2. Hierarchical Classification of Traffic Sign Images
One of the main problems in the classification of traffic signs is the large number of their standard types. The total number of standard types for traffic signs is more than one hundred. Classifier efficiency is improved by reducing the number of object classes. The classification of traffic signs can be carried out by the method of sequential approximation. The classifier sequentially clarifies the information about a traffic sign by its image. The number of classes at each stage must be small. The shape and color of a traffic sign is specified in the first two stages. The details of the internal image are specified in the third step. The number of stages and their content differ for different types of traffic signs. The hierarchical system of traffic sign recognition methods corresponds to such a task. There is a hierarchy of traffic signs according to their effect on road traffic. This hierarchy cannot be used in a traffic sign recognition system. There is no complete correlation between the shape and color of a traffic sign and its value.
A zero-level classification is related to the geometric shape of the signs. The first class at this level includes traffic signs that can be inscribed in a square (square, round, triangular, octagonal, rhombic). These traffic signs perform prescriptive and prohibitive functions. The second grade at level zero includes rectangular-shaped traffic signs. These signs inform drivers. Our classifier only works with zero-level first-class signs. Traffic signs in this class are critical to traffic management. Our classifier can easily be extended to work with second-class signs. This task requires the development of additional templates.
A hierarchical road sign recognition system requires the development of classifiers for each level of the hierarchical tree. The classifiers may be the same for the type of algorithms used. However, each classifier requires its own training set.
A first-level classifier recognizes the shape of a traffic sign. We denote the first-level classifier as
. Classifier
distributes traffic signs into six classes as follows:
—rhombus,
—octagon,
—inverted triangle,
—circle,
—square, and
—triangle. The first level for the hierarchical classifier tree is shown in
Figure 1.
Some second-level classes do not contain the next-level classifiers. Classes
and
include one traffic sign each (
Figure 2). These nodes are the leaves in a hierarchical tree. If the classifier Z assigns a traffic sign to one of these classes, then the recognition problem is solved.
The class
contains only two traffic signs (
Figure 3). The identification of class z1 traffic signs requires one additional step. Recognition in this class can also be performed based on character outline highlighting.
The class
includes five subclasses (
Figure 4). Subclasses
and
can be separated from the others with red along the contour. Subclass
differs from subclass
in the number of pixels in red. Node
is a leaf. If a road sign is assigned to this class, then the recognition problem is solved. Class
includes 32 traffic signs. These signs have a different image of black on a white background. Classes
and
are highlighted by the presence of an area of blue. Class z44 is separated from class
by a red stripe. Class
includes nine traffic signs. Seven traffic signs in this class contain images of numbers. Class
includes 18 traffic signs. These traffic signs contain a white image on a blue background.
An additional hierarchy level in class
simplifies the classification task. We introduce three additional classes (
Figure 5). The
class combines subclasses
and
. The
class includes only subclass
. The
class combines subclasses
and
.
An edge segment is a segment of a traffic sign image that includes its outer boundary. Traffic signs in class have a red edge segment. Traffic signs in class have a white edge segment. Traffic signs of class have a blue edge segment.
Splitting the class into two classes, and is easy. The area of the edge segment in class is more than twice the area of the edge segment in class . Class is a leaf.
The inner segment of traffic signs in class is highlighted by removing the edge segment and the entire image outside the sign from the image. The inside of the sign is a black and white image without grayscale. A binarization operation is applied to the inner segment of the traffic sign. The binary shape of the image is easily compared to the pattern.
Class
includes three subclasses (
Figure 6). The main difference between these classes is the colors used. The subclass
includes six traffic signs. These signs define the direction of the main road. The inner segment of these classes consists of black lines. Subclass
contains 33 traffic signs. Subclass
contains seven traffic signs.
The edge segment type requires an additional hierarchy level for class
. The first subclass
contains traffic signs with a white edge segment. The second subclass of
includes traffic signs with a blue edge segment (
Figure 7). The RGB model makes it easy to distinguish between these classes.
All traffic signs in class
have the same shape and edge segment (
Figure 8). Class
includes 42 traffic signs.
The color of the edge segment in class z61 does not affect the recognition of the traffic sign. The algorithm shall determine the shape of the traffic sign. The edge segment and the entire exterior environment are removed from the image. The inner segment of the road sign is a black and white image without grayscale. The contents of an internal segment can be defined based on a comparison with a template.
An analysis of the image hierarchy for traffic signs shows that the recognition of traffic signs based on their segmentation includes five algorithms:
1. Algorithm for obtaining an edge segment and determining its color (red, blue, white);
2. Algorithm for determining the area of the edge segment;
3. Algorithm for determining the shape of a traffic sign by its edge segment;
4. Algorithm for obtaining an inner segment of a traffic sign and its binarization;
5. Algorithm for identifying the internal image of a traffic sign.
3. Segmentation Algorithm
The edge segment is searched for a localized traffic sign. We do not solve the problem of localizing the traffic sign on the road scene. Various algorithms can be used to localize a traffic sign in a square window. There are localization algorithms for similar tasks [
18,
19]. These algorithms can be adapted for traffic signs. The task of finding traffic signs in an image requires separate research. A square window including a traffic sign is a window for localizing a traffic sign.
We use the segmentation algorithm developed earlier to highlight the road contour [
20,
21,
22]. This segmentation algorithm highlights segments that have both a uniform color fill and a gradient color fill. This factor is important in the processing of real traffic signs. The illumination of the sign is never uniform. This results in color gradients in images of real traffic signs. Our algorithm has a quadratic complexity. The segmentation algorithm is based on the method of growing areas. The method of growing areas has a quadratic labor intensity. Each iteration of the algorithm performs a number of operations not exceeding the number of image points. The total number of iterations does not exceed the number of image points. The speed of the algorithm is large enough for use in the designed system. The size of the input images of the algorithm does not exceed
pixels. The segmentation target in this case is the edge segment of the traffic sign. An edge segment is a segment of a traffic sign image having an outer boundary coinciding with the boundary of a traffic sign. All points of this segment have the same color in the ideal image of the traffic sign. Real images distort the color of individual pixels due to lighting features. Foreign objects and shadows change the outer boundary of the edge segment. These factors complicate the segmentation task. We enter the symbol
for the set of edge segment points.
The segmentation algorithm is based on the method of growing areas. The grain of the algorithm is one pixel. The dimensions of the traffic sign localization window are pixels. We select the starting pixel of the segment at . The coordinates of this point are determined from the upper-left corner. The value of the first coordinate for point is based on the symmetry of all traffic signs with respect to the vertical axis through their center. The traffic sign localization algorithm determines the second coordinate . The value of this coordinate depends on the accuracy of finding the signs’ boundaries. This coordinate should not have a large value, otherwise the selection of a narrow red strip of prohibitory traffic signs is impossible. must be taken for the GTSRB collection.
An undirected weighted graph can be mapped to each image. The nodes of this graph are the pixels of the image.
is the set of the graph nodes. The edges of the graph connect the nodes. We consider a fully connected graph at the beginning of the algorithm’s construction. The edge weight determines the color difference of the image pixels corresponding to the graph nodes. The RGB model is used for representing the color of the pixels. Each pixel has five coordinates. Two coordinates
determine its position in the image. Three coordinates
determine its color characteristics.
is the intensity of red.
is the intensity of green.
is the intensity of blue. We define the distance in terms of the five-dimensional space
between the pixels
and
.
The five-dimensional distance between the pixels increases if the distance between the pixels in the image grows or the difference in color increases.
The image segmentation problem is equivalent to partitioning a graph into communities [
23]. A community must include the nodes of the graph whose pixels are located a short distance from each other and have a similar color. Having a small distance is a necessary requirement for segment connectivity. The similar colors ensure the edge segment is highlighted. The edge segment of the traffic sign has one color. The edge weight of the graph should decrease when moving away from the pixel and when the color changes sharply. The edge weight is calculated based on the distance between pixels
and
. If node
corresponds to pixel
and node
corresponds to pixel
, then the weight of the arc between nodes
and
is calculated using the following formula:
This function for the edge weight is 1 if the neighboring pixels and their pixel colors match. If the neighboring pixels have different colors, then . The function rapidly decreases as the distance between pixels increases. Accounting for the edges between nodes for pixels very far from each other is not necessary. We enter the correlation radius . This value indicates the largest geometric distance between pixels whose nodes are connected by an edge. The edges between nodes that are located in the image more than are removed from the graph. The correlation radius determines the number of neighbors for a node.
A community search is required to highlight a segment. We use the method of growing regions on a graph. Community
with strongly connected nodes is the result of the algorithm. Community
includes one node
at the zero step of the algorithm. This node
corresponds to pixel
. The algorithm at each stage calculates the average edge weight in community
.
is the number of nodes in community .
The algorithm step is to enumerate all nodes connected by an edge to at least one community
node. If node
is a candidate for inclusion in community
, then the total association of this node with nodes of community
is as follows:
If the
does not exceed the threshold
, then node
is included in community
. The threshold value
is calculated based on the average weight of the community edges.
The parameter is determined in a computer experiment. This parameter depends on the type of images. The algorithm achieves the best results for traffic signs at .
The algorithm stops if no node satisfies the condition of inclusion in community . The complexity of the algorithm depends on the number of pixels in the image according to the quadratic law. If the traffic sign localization window has a size of pixels, then the complexity of the algorithm grows according to the law . The edge segment consists of pixels corresponding to nodes in community .
The outer boundary of the edge segment is the boundary of the traffic sign. The edge segment boundary algorithm is reduced to determine the number of neighbors for each pixel in segment
. If a pixel in segment
has less than eight neighbors from that segment, then it is boundary. The outer edge of the edge segment is separated from the inner edge by the geometric coordinates of the points. The sign boundary in this algorithm has a thickness of one pixel. Examples of edge segments and boundary definition for traffic signs are shown in
Figure 9.
The color of the edge segment is determined by comparing the average value of the color coordinates for its pixels. There are three colors of the edge segment (red, blue, white). We calculate the average value of the red and blue components for pixels in the edge segment.
is the number of pixels in the edge segment
.
is the intensity of red for pixel
.
is the intensity of blue for pixel
. The mean difference determines the color of the edge segment.
We compare the difference in average values with the depth of palette . If , the edge segment is red. If , the edge segment is blue. If , the edge segment is white. In this case, the intensities of red and blue are approximately equal. The green component of the pixels is not considered, since there are no green road signs.
4. Recognition of the Traffic Sign Shape
We use templates to recognize the shape of a traffic sign. There are six different templates: rhombus (t1), octagon (t2), inverted triangle (t3), circle (t4), square (t5), and triangle (t6). The traffic sign outline is mapped to all the templates. The decision on the shape of the sign is made as closely as possible to one of the templates. There are three main problems when comparing the outline of a traffic sign with templates. The first problem is the variability in the dimensions of the sign in the image. The solution to this problem is templates scaling. The second problem is the distortion of the traffic sign when shooting at an angle. The solution to this problem is to use deformable templates. The two main characteristics of the template are the number of angles and the location on the plane. The third problem is the distortion of straight lines when obtaining the contour of a traffic sign. The features of real images prevent smooth lines and curves.
The first step in determining the shape of a traffic sign is to calculate its center. All geometric figures of traffic signs have central symmetry. For all traffic sign shapes, the center of symmetry coincides with the center of mass. We enter the designation
for the set of points for the traffic sign outline obtained using the segmentation algorithm. Formulas for the center of mass
for the set of points with the same mass are used when finding the center of the traffic sign image.
is the number of points in set .
Each template
is described by an equation.
The points of set
do not satisfy any template equation. The deviation
of the coordinate for the points of set
from the template equation
determines the proximity of the shape to the template
.
is the deviation at the location of point from the curve for the template . The minimum defines the template to which the sign belongs.
Next, we consider the features of creating adaptable templates for various shapes.