Prof. Dr. Stefan Bosse
University of Siegen - Dept. Maschinenbau
University of Koblenz - Dept. Computer Science
PD Stefan Bosse - AFEML - Module C: Image Feature Extraction and Marking -
In this module we learn the basic workflow of image processing consisting of:
Image feature marking: Image → Image
Image feature clustering (Point list → List of point lists)
Geometric processing of point clouds (Point list → Point list)
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing -
How can we apply algorithms to image data?
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing -
How can we apply algorithms to image data?
Relation between Images and Cellular Automata - local versa global state processing
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing -
How can we apply algorithms to image data?
Relation between Images and Cellular Automata - local versa global state processing
From local to global state using Point Clustering and Polygon Hulls
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing -
How can we apply algorithms to image data?
Relation between Images and Cellular Automata - local versa global state processing
From local to global state using Point Clustering and Polygon Hulls
Kernel-based Transformations and Convolutional Neural Networks!
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
A cellular automaton (CA) is basically an active (functional) matrix
Applications:
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
Complex phenomena are the result of the collective dynamics of a very large number of parts obeying simple rules
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
We want to define the simplest nontrivial model of a cellular system. We base our model on the following concepts:
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Space
Floreano et al.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
A cellular automaton (CA) consists of a set of state-based cells CA={c1,c2,..,cn}.
Each cell i has a number of cell variables {x1,..,xk}i
The variables define the data state S: S(zi)=Si={x1,..,xk}
The next state of the cells is calculated via an activity function Act.
The state transition of a cell usually takes place in the activity function, optionally prepared by before (pre) or after (post) functions.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
A CA is a parallel computational architecture. All cell state transitions can be computed in parallel at the same time.
But CA processing by generic computers requires a (semi-) sequential algorithm to perform cell state transitions ⇒ CA simulation with a scheduler
In a parallel system the following formula is valid for each cell (①right hand side, ②left hand side):
Si(t+1)=Act(Si(t),{Sj(t)|j≠iand|j∣≤R})
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
A scheduler processes the individual calculation functions of all cells sequentially in three phases:
pre(S):Si→Si,0Act(S):Si,0×Σ→Sipost(S):Si→Si
Σ(R)i={Sj|j≠iand|j∣≤R}
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
Cellular automaton as a network of simple communicating computational units
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
There is a
Typically, the data state can be compsoed of:
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
Floreano et al. Comparison of Moore and Neumann neighbourhood in different space dimensions
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
The value of the state of each cell belong to a finite set, whose elements are commonly numbers.
The value of the state is often represented by cell colors. A color function maps cell states on colors (from a palette)
There can be a special quiescent state s0.
The transition rule is the fundamental element of the CA.
It must specify the new state corresponding to each possible configuration of states of the cells in the neighborhood.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
Floreano et al. A transition rule maps states of neighbouring cells on new cell states. Cell states are visualized by colors.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Cellular Automaton
Cell updates by transition rules modify the cell states over (discrete) time. In order to start with the updating of the cells of the CA we must specify the initial state of the cells (initial conditions or seed)
Floreano et al.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Image processing with CA
An input image is mapped 1:1 on a cell matrix. The CA activation (iteratively) modifies the state of the cells, finally mapped 1:1 on an output (feature) image.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Kernel-based Transformations
I⋆(x,y)=∑i∑jI(x−i+a,y−j+b)k(i,j)
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Kernel-based Transformations
Effect | Kernel |
---|---|
Average | 19⎛⎜⎝111111111⎞⎟⎠ |
Sharpening | ⎛⎜⎝0−10−15−10−10⎞⎟⎠ |
Relief | ⎛⎜⎝−2−10−111012⎞⎟⎠ |
Effect | Kernel |
---|---|
Edge, Laplace | ⎛⎜⎝010141010⎞⎟⎠ |
Edge, Sobel | ⎛⎜⎝10−120−210−1⎞⎟⎠ |
Noise?, Bosse | ⎛⎜⎝−1−10001100⎞⎟⎠ |
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Kernel-based Transformations
Most kernel-based edge and gradient computations are sensitive in a specific direction (axis).
Sx=⎛⎜⎝10−120−210−1⎞⎟⎠Sy=SxT=⎛⎜⎝−12−1000121⎞⎟⎠zx,y= ⎷(3∑k=1Sxk,lzx+k−1,y+l−1)2+(3∑l=1Syk,lzx+k−1,y+l−1)2
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Iterative Transformations
Kernel-based transformations usually terminates after one step, except if the input is the output of the previous update phase!
In iterative transformations, the input of the next update phase is the output from the last (or the initial seed image data)
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Edge Detection with CA
For edge detection of intensity images, some approaches first convert the intensity images into binary ones, and then evolve two-state cellular automata using specific state transition rules to determine edge pixels, while the others directly update pixel states based on the relationship of the central pixel with its neighbourhood, mostly a 1-ring von Neumann or Moore neighbourhood.
Popovici et al. proposed an edge detection approach based on the state differences between the central pixel and the pixels in its von Neumann neighbourhood. If all the absolute state differences are less than a threshold ε, then the state of the central pixel becomes 0, otherwise it remains unaltered.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Edge Detection with CA
s+i={0∣∣sj−si∣∣<δ,∀j∈Nisiotherwise
where s and s+ are the current and the updated states of the central cell i, Ni is the von Neumann neighbourhood of the cell c, and sj is the current state value of the cell j in Ni.
In the case of feature marking, the conditional expression || < δ can be applied to other input variables (input image), and the state s represents a marked feature count only. But in this case it is a one-step update.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Edge Detection with CA
Wongthanavasu and Sadananda proposed a conditional rule to update the cellular state as:
s+i={sisi<(smax−smin)smax−sminotherwisesmax=max{sj∣j∈Ni},smin=min{sj∣j∈Ni}
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Agent-based Image Processing: Feature Marking
Lui proposed a similar approach of neighbourhood exploration for feature marking in mages using mobile agents.
In contrast to Ca cells, the state of an agent is not fixed to a specific position.
There are explorations agents with the following behaviour:
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Agent-based Image Processing: Feature Marking
s+i=si+{1(∑∣∣vj−vi∣∣<δ,∀j∈Ni)∈[ϵ1,ϵ2]0otherwise
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Agent-based Image Processing: Feature Marking
state : { input:0, output:0, weight:1, deltaweight:0 },activity : function (x,y) { // neighbors: ordering [NW,N,NW,W,E,SW,S,SE] var countdn = this.ask(this.neighbors, 'absdiffcount', 'input',this.delta,'<='), mark = countdn>=this.eps1 && countdn <= this.eps2; if (mark) { this.output += this.weight; // simulate new agent replications on heighbor nodes by increasing weight for (var i=0;i<this.replicate*this.weight;i++) { var delta = [0,0]; while (delta[0]==0 && delta[1]==0) delta=[Math.random.select([-1,0,1]),Math.random.select([-1,0,1])]; this.set(delta,'deltaweight',this.get(delta,'deltaweight')+1); } } else if (this.weight>0) { this.deltaweight--; // simulate aagent diffusion to heighbor node by increasing weight var delta = [0,0]; while (delta[0]==0 && delta[1]==0) delta=[Math.random.select([-1,0,1]),Math.random.select([-1,0,1])]; this.set(delta,'deltaweight',this.get(delta,'deltaweight')+1); }},after : function (x,y) { this.weight += this.deltaweight; this.deltaweight=0; },
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Learning CA
Which transition rules leads to a specific (global) emergent behaviour, e.g., edge detection?
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Learning CA
Which transition rules leads to a specific (global) emergent behaviour, e.g., edge detection?
Besides classical folding kernels, the answer is unknown.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Learning CA
Which transition rules leads to a specific (global) emergent behaviour, e.g., edge detection?
Besides classical folding kernels, the answer is unknown.
Solution: Learn the rules, i.e., the kernel matrix! E.g., by using evolutinary and genetic algorithms.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Density-based Pointcloud Clustering DBSCAN
The output of the CA is an image with pixels representing point-wise features
But point clouds are still high-dimensioal
Dimensionality reduction by finding groups of points close together ⇒ Clustering
Density-based spatial clustering of applications with noise (DBSCAN) is a well-known data clustering algorithm that is commonly used in data mining and machine learning.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Density-based Pointcloud Clustering DBSCAN
Based on a set of points (let’s think in a bidimensional space as exemplified in the figure), DBSCAN groups together points that are close to each other based on a distance measurement (usually Euclidean distance) and a minimum number of points.
It also marks as outliers the points that are in low-density regions.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Density-based Pointcloud Clustering DBSCAN
https://www.kdnuggets.com/2020/04/dbscan-clustering-algorithm-machine-learning.html Points: Core - This is a point that has at least m points within distance n from itself. Border - This is a point that has at least one core point at a distance n. Noise - This is a point that is neither a Core nor a Border. And it has less than m points within distance n from itself.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Density-based Pointcloud Clustering DBSCAN
The algorithm proceeds by arbitrarily picking up a point in the dataset (until all points have been visited).
If there are at least ‘minPoint’ points within a radius of ‘ε’ to the point then we consider all these points to be part of the same cluster.
The clusters are then expanded by recursively repeating the neighborhood calculation for each neighboring point
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Density-based Pointcloud Clustering DBSCAN
The DBSCAN algorithm basically requires 2 parameters:
https://towardsdatascience.com/how-dbscan-works-and-why-should-i-use-it-443b4a191c80
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Density-based Pointcloud Clustering DBSCAN
The parameter estimation is a problem for every data mining task. To choose good parameters we need to understand how they are used and have at least a basic previous knowledge about the data set that will be used.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Density-based Pointcloud Clustering DBSCAN
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Density-based Pointcloud Clustering DBSCAN
More information:
Ester, M., Kriegel, H. P., Sander, J., & Xu, X. (1996, August). A density-based algorithm for discovering clusters in large spatial databases with noise. In Kdd (Vol. 96, №34, pp. 226–231).
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Polygon Hulls
Up to here, we have still point clouds, although clustered.
For, e.g., area or perimeter computation of a cluster, a (concave) polygon hull approximation is needed (simplifying, averaging, and denoising point cloud)
Well known algorithms and software:
The hull may not be limited to monotonic hulls without holes and caves (mixing of convex and concave hull segments)!
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Polygon Hulls
A hull can be described by a list of ordered boundary points
A hull can be described by a list of pice-wise linear lines (between boundary points)
https://gis.stackexchange.com/questions/143821/how-to-find-the-concave-hull-for-a-cloud-of-points-in-3d-space The outline of a point cloud as a concave hull
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Polygon Hulls
Further readings:
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Convolutional Neural Networks
CNN are suitable for classifying different structural features in the data regardless of location and orientation
A CNN is based on matrix algebra with convolution operations
For further reading: https://towardsdatascience.com/covolutional-neural-network-cb0883dd6529?gi=521747216671; G. Paaß, Artificial Intelligence, What is behind the technology of the future?, Jumper
Well-known software framework for the browser: convnet.js https://cs.stanford.edu/people/karpathy/convnetjs
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Folding Operation
20 First calculation step (left) and second calculation step (right) in the convolution layer for a shifted small area of the input matrix. The kernel is "pushed" successively over the entire input matrix and the result matrix is filled
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Convolutional Neural Networks
20 A convolution layer contains k kernels and k result matrices, which are each combined into tensors
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Convolutional Neural Networks
https://towardsdatascience.com General construction of a CNN with alternating layers of convolutions, merging, and finally binary classification
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Convolutional Neural Networks
https://towardsdatascience.com Depending on the number of structural features, there may be a large number of the following folding and merging layers
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - CNN Point Classifier
As with the CA approach, a CNN can be used to predict feature output images ⇒ CNN Image Feature Marking
The idea: A CNN is used to predict the feature class (e.g., marking of pixel belonging to a crack shape) with a small moving segment window.
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - CNN Point Classifier
Iterative image pixel feature marking by a moving segment window
Training is supervised with labelled input data.
Training and prediction poses high computational complexity.
The CNN can be simple, e.g.: two convoultional layers with 8 and 16 filter, respectively, one soft-max layer. But even such a simple CNN has about 10000 parameters!
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - CNN Point Classifier
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - CNN Point Classifier
Feature marking with a trained CNN pixel classifier of pores in X-ray images (Aluminum diecasted plates, here synthetic X-ray images simulated with gVXR)
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Summary
In this module we learnrd the basic workflow of feature extraction with image processing consisting of:
Image feature marking: Image → Image
Image feature clustering (Point list → List of point lists)
Geometric processing of point clouds (Point list → Point list)
Finally we can compute aggregate paramters (from hull):
PD Stefan Bosse - AFEML - Module C: Cellular Automata and Image Processing - Further Reading