CN115984821A - Traffic light identification method and device, electronic equipment and computer readable storage medium - Google Patents

Traffic light identification method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN115984821A
CN115984821A CN202310104374.7A CN202310104374A CN115984821A CN 115984821 A CN115984821 A CN 115984821A CN 202310104374 A CN202310104374 A CN 202310104374A CN 115984821 A CN115984821 A CN 115984821A
Authority
CN
China
Prior art keywords
image
traffic light
identified
feature extraction
module
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202310104374.7A
Other languages
Chinese (zh)
Inventor
李宁
贾双成
朱磊
郭杏荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhidao Network Technology Beijing Co Ltd
Original Assignee
Zhidao Network Technology Beijing Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhidao Network Technology Beijing Co Ltd filed Critical Zhidao Network Technology Beijing Co Ltd
Priority to CN202310104374.7A priority Critical patent/CN115984821A/en
Publication of CN115984821A publication Critical patent/CN115984821A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Traffic Control Systems (AREA)

Abstract

The application relates to a traffic light identification method and device, electronic equipment and a computer readable storage medium. The method comprises the steps of obtaining a traffic light image to be identified, wherein the traffic light image to be identified is an image containing traffic lights to be identified; inputting the traffic light image to be identified into a preset traffic light identification model to obtain a target image of the traffic light image to be identified, wherein the preset traffic light identification model is a pre-trained unet network model combined with a plurality of attention mechanism modules; and carrying out external rectangle operation on the target graph to obtain an external rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the external rectangle. According to the embodiment of the application, the plurality of attention mechanism modules are added in the unet network, so that when the traffic light image to be identified is transmitted in the unet network, the key points in the feature extraction image and the upper sampling image are connected, the obtained traffic light image is clearer, and the identification of the traffic light state category is improved.

Description

Traffic light identification method and device, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a traffic light identification method and apparatus, an electronic device, and a computer-readable storage medium.
Background
With the increasing maturity of automatic driving technology and navigation technology, and the complexity of urban roads, it has become the driving habit of drivers to use navigation tools for navigation while driving vehicles.
Whether automatic driving or driver adopts a navigation tool to carry out path navigation driving, the real-time passing condition of the road in front needs to be known, so that the navigation path is convenient to plan, and therefore, the traffic light state on the road needs to be identified, and whether the current road can pass or not is determined, or how long the current road can pass is required. In a related technical scheme, road traffic light images are collected through a vehicle-mounted device, the traffic light images are identified, the traffic light images collected by the vehicle-mounted device are deformed to a certain degree, the lighting states of the traffic lights may include various states such as red lights, green lights, yellow lights and extinguishment, and the category identification of the lighting states of the traffic lights in the prior art is inaccurate.
Disclosure of Invention
In order to solve or partially solve the problems in the related art, the present application provides a traffic light identification method, apparatus, electronic device, and computer-readable storage medium, which can accurately identify the lighting category of a traffic light.
A first aspect of the present application provides a traffic light identification method, including:
acquiring a traffic light image to be identified, wherein the traffic light image to be identified is an image containing traffic lights to be identified;
inputting the traffic light image to be identified into a preset traffic light identification model to obtain a target image of the traffic light image to be identified, wherein the preset traffic light identification model is a pre-trained unet network model combined with a plurality of attention mechanism modules;
and carrying out external rectangle operation on the target graph to obtain an external rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the external rectangle.
As a possible embodiment of the present application, in this embodiment, after the traffic light image to be identified, the method further includes:
and carrying out image segmentation processing on the traffic light image to be identified, and labeling the outline of the traffic light to be identified in the traffic light image to be identified after image segmentation to obtain a target input image.
As a possible implementation manner of the present application, in this implementation manner, the inputting the traffic light image to be identified into a preset traffic light identification model to obtain a binary image of the traffic light image to be identified includes:
performing feature extraction on the target input image for multiple times by adopting an encoder of the unet network model to obtain a feature extraction image of the traffic light image to be identified;
a decoder of the unet network combined with a plurality of attention mechanism modules is adopted to perform up-sampling on the feature extraction image for a plurality of times to obtain an up-sampled image of the traffic light image to be identified;
and connecting the feature extraction image with the up-sampling image to obtain a binary image of the traffic light image to be identified.
As a possible embodiment of the present application, in this embodiment, the performing, by an encoder using the unet network model, feature extraction on the target input image multiple times to obtain a feature extraction map of the traffic light image to be identified includes:
performing first-time feature extraction on the traffic light image to be identified by adopting a preset feature extraction module to obtain a first feature extraction image, wherein the feature extraction module comprises a convolution module and a pooling module;
performing secondary feature extraction on the first feature extraction image by using the feature extraction module to obtain a second feature extraction image;
and performing third-time feature extraction on the second feature extraction image by adopting the feature extraction module to obtain a third feature extraction image.
As a possible embodiment of the present application, in this embodiment, the performing, by a decoder of the unet network that combines a plurality of attention mechanism modules, multiple times of upsampling on the feature extraction map to obtain an upsampled image of the traffic light image to be identified includes:
performing first upsampling on the third feature extraction image by using an upsampling module to obtain a first upsampled intermediate image, and connecting the second feature extraction image with the first upsampled intermediate image after the second feature extraction image is convolved by a convolution module to obtain a first upsampled image, wherein the upsampling module comprises an attention mechanism module;
and performing second upsampling on the first upsampled image by adopting the upsampling module to obtain a second upsampled intermediate image, and connecting the second feature extraction image with the second upsampled intermediate image after the convolution of the second feature extraction image by the convolution module to obtain a second upsampled image.
As a possible implementation manner of the present application, in this implementation manner, the connecting the feature extraction image and the up-sampling image to obtain a binary image of the traffic light image to be identified includes:
performing third upsampling on the second upsampled image to obtain a third upsampled image;
and after the target input image is convolved by a convolution module, connecting the target input image with the third up-sampling image to obtain a binary image of the traffic light to be identified.
As a possible implementation manner of the present application, in this implementation manner, the performing a circumscribed rectangle operation on the binary image to obtain a circumscribed rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the circumscribed rectangle includes:
recognizing a plurality of corner points in the binary image by adopting a preset corner point recognition model;
and performing external rectangle operation based on the plurality of corner points to obtain the external rectangle of the traffic light to be identified.
The second aspect of the present application provides a traffic light recognition apparatus, including:
the traffic light identification device comprises an image acquisition module, a recognition module and a recognition module, wherein the image acquisition module is used for acquiring traffic light images to be identified, and the traffic light images to be identified comprise traffic lights to be identified;
the binary image determining module is used for inputting the traffic light image to be identified into a preset traffic light identification model to obtain a target image of the traffic light image to be identified, wherein the preset traffic light identification model is a pre-trained unet network model combined with a plurality of attention mechanism modules;
and the identification module is used for carrying out external rectangle operation on the target graph to obtain an external rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the external rectangle.
A third aspect of the present application provides an electronic device, comprising:
a processor; and
a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method as described above.
A fourth aspect of the present application provides a computer-readable storage medium having stored thereon executable code, which, when executed by a processor of an electronic device, causes the processor to perform the method as described above.
According to the traffic light identification method and device, the traffic light image to be identified is identified through the unet network model combined with the plurality of attention mechanism modules, the model identification result is obtained, then external rectangle operation is conducted on the model identification result, the external rectangle of the traffic light to be identified is obtained, and the lighting state of the traffic light to be identified is determined based on the external rectangle. By adding the plurality of attention mechanism modules in the unet network, the important points in the feature extraction diagram and the upper sampling diagram are connected when the traffic light image to be identified is transmitted in the unet network, the obtained traffic light image is clearer, and the identification of the bright light state category of the traffic light is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The foregoing and other objects, features and advantages of the application will be apparent from the following more particular descriptions of exemplary embodiments of the application as illustrated in the accompanying drawings wherein like reference numbers generally represent like parts throughout the exemplary embodiments of the application.
Fig. 1 is a schematic flowchart illustrating a traffic light identification method according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of a traffic light identification model according to an embodiment of the present application;
FIG. 3 is a flow chart illustrating a method for determining a binary image according to an embodiment of the present disclosure;
fig. 4 is a schematic flow chart of a feature extraction method according to an embodiment of the present application;
fig. 5 is a schematic flow chart of an upsampling method shown in the embodiment of the present application;
FIG. 6 is a flow chart illustrating a method for graph connection according to an embodiment of the present disclosure;
FIG. 7 is a flowchart illustrating a method for circumscribing a rectangle according to an embodiment of the present application;
fig. 8 is a diagram illustrating a traffic light recognition effect according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a traffic light identification device according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale.
Detailed Description
Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While embodiments of the present application are illustrated in the accompanying drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms "first," "second," "third," etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
With the increasing maturity of automatic driving technology and navigation technology, and the complexity of urban roads, it has become the driving habit of drivers to adopt navigation tools to navigate when driving vehicles. Whether the automatic driving or the driver adopts the navigation tool to carry out the route navigation driving, the real-time passing condition of the road in front needs to be known, so that the navigation route is convenient to plan, and therefore, the traffic light state on the road needs to be identified, and whether the current road can pass or not is determined, or how long the current road can pass is required. In a related technical scheme, road traffic light images are collected through a vehicle-mounted device, the traffic light images are identified, the traffic light images collected by the vehicle-mounted device are deformed to a certain degree, the lighting states of the traffic lights may include various states such as red lights, green lights, yellow lights and extinguishment, and the category identification of the lighting states of the traffic lights in the prior art is inaccurate.
In view of the above problems, an embodiment of the present application provides a traffic light identification method, which can accurately identify a lighting state of a traffic light at a distance.
The technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Fig. 1 is a schematic flowchart of a traffic light identification method according to an embodiment of the present application.
Referring to fig. 1, a traffic light identification method provided in the embodiment of the present application includes:
step S101, obtaining a traffic light image to be identified, wherein the traffic light image to be identified is an image containing a traffic light to be identified.
In the embodiment of the application, the traffic light image to be identified refers to an image including a traffic light to be identified, wherein the traffic light to be identified is an image of a traffic light in front of a vehicle running road, and the image can be acquired by a vehicle-mounted image acquisition device, such as a vehicle-mounted camera, a vehicle-mounted camera and the like.
As a possible implementation manner of the present application, when constructing a high-precision map, road information needs to be perfected, where the lighting state of a traffic light needs to be labeled, where the lighting state of the traffic light includes a red light, a green light, a yellow light, and an off state. In the embodiment of the application, the road surface image is used as the traffic light image to be identified for identification by acquiring the image of the traffic light to be identified in front of the driving road, wherein the road surface image should contain the traffic light to be identified.
As a possible implementation manner of the present application, in this implementation manner, after the acquiring the traffic light image to be identified, the method further includes:
and carrying out image segmentation processing on the traffic light image to be identified, and labeling the outline of the traffic light to be identified in the traffic light image to be identified after image segmentation to obtain a target input image.
In the embodiment of the application, before the traffic light image to be identified is input into the traffic light identification model, the traffic light image to be identified needs to be preprocessed, and the preprocessing process comprises the steps of carrying out binarization processing on the traffic light image to be identified, labeling the outline of the traffic light to be identified in the traffic light image to be identified after the binarization processing, and obtaining a target input image.
As a possible implementation manner of the present application, after the image is binarized, the binarized image may be combined with json data, and the binarized image is labeled by the json data to obtain the contour of the traffic light to be identified, where when the labeling effect is not good or the labeling fails, the image may be labeled again to determine to obtain the target input image.
Step S102, inputting the traffic light image to be identified into a preset traffic light identification model to obtain a binary image of the traffic light image to be identified, wherein the preset traffic light identification model is a pre-trained unet network model combined with a plurality of attention mechanism modules.
In the embodiment of the present application, after the target input image is obtained, the target input image is input to a preset traffic light identification model to obtain a binary image of the traffic light image to be identified, the traffic light identification model is a pre-trained unet network model combining a plurality of residual error modules, and the structure of the traffic light identification model can refer to fig. 2.
As a possible embodiment of the present application, in this embodiment, as shown in fig. 3, the inputting the traffic light image to be recognized into a preset traffic light recognition model to obtain a binary image of the traffic light image to be recognized includes:
and S301, performing feature extraction on the target input image for multiple times by adopting an encoder of the unet network model to obtain a feature extraction image of the traffic light image to be identified.
In the embodiment of the present application, before inputting the target into the traffic light recognition model, the size of the target input image needs to be adjusted, and in the embodiment of the present application, a matrix of 1920 × 1080 × 3 may be selected. Of course, the size of the specific matrix may be determined according to actual conditions, and the application is not limited thereto.
In this embodiment of the application, the feature extraction performed on the target input image may be performed multiple times, so as to obtain multiple feature extraction images, wherein when performing the feature extraction, the feature extraction may be performed on matrix data through a feature extraction module, specifically, as shown in fig. 4, the obtaining of the feature extraction map of the traffic light image to be identified includes:
step S401, a preset feature extraction module is adopted to perform first feature extraction on the traffic light image to be identified to obtain a first feature extraction image, wherein the feature extraction module comprises a convolution module and a pooling module.
In the embodiment of the present application, referring to fig. 2, a left box in fig. 2 is a step of feature extraction, and feature extraction is performed a total of three times, where the step of feature extraction includes convolution and pooling, where a convolution module may be convolution of 3 × 3, and pooling may adopt max-pooling, for example, based on RGB values in a target input image, a maximum value in a local acceptance domain is selected as a feature value of the domain to perform extraction, so as to obtain a first feature extraction graph.
And step S402, performing secondary feature extraction on the first feature extraction image by using the feature extraction module to obtain a second feature extraction image.
And S403, performing third-time feature extraction on the second feature extraction image by using the feature extraction module to obtain a third feature extraction image.
In steps S402 and S403, feature extraction is performed on the first feature extraction map based on the same scheme in step S401 to obtain a second feature extraction map, and feature extraction is performed on the second feature extraction map to obtain a third feature extraction map.
Step S302, a decoder of the unet network combined with a plurality of attention mechanism modules is adopted to perform up-sampling on the feature extraction image for a plurality of times, and an up-sampling image of the traffic light image to be identified is obtained.
In the embodiment of the present application, referring to fig. 2, a right-side block in fig. 2 is an upsampling step, and upsampling is performed a total of three times, where when performing upsampling, as shown in fig. 5, specifically includes:
step S501, an up-sampling module is adopted to perform first up-sampling on the third feature extraction image to obtain a first up-sampling intermediate image, and the second feature extraction image is convolved by a convolution module and then is connected with the first up-sampling intermediate image to obtain a first up-sampling image, wherein the up-sampling module comprises an attention mechanism module;
step S502, the up-sampling module is adopted to perform the second up-sampling on the first up-sampled image to obtain a second up-sampled intermediate image, and the second feature extraction image is convolved by the convolution module and then is connected with the second up-sampled intermediate image to obtain a second up-sampled image.
In this embodiment of the present application, the operation in step S501 and step S502 is similar, and the specific process of upsampling includes that the upsampling module is adopted to perform upsampling on the third feature extraction image for the first time, so as to obtain a first upsampled intermediate image, and the second feature extraction image is connected to the first upsampled intermediate image after being convolved by the convolution module, so as to obtain a first upsampled image, wherein the upsampling module includes an attention mechanism module, and is adopted to perform upsampling on the first upsampled image for the second time, so as to obtain a second upsampled intermediate image, and the second feature extraction image is connected to the second upsampled intermediate image after being convolved by the convolution module, so as to obtain a second upsampled image, wherein the attention mechanism module is used to extract important regions in the feature extraction image and the upsampled image, and connect the extracted images, so as to obtain a more accurate identification result.
And step S303, connecting the feature extraction image with the up-sampling image to obtain a binary image of the traffic light image to be identified.
In the embodiment of the present application, the feature extraction map obtained in the foregoing embodiment is connected to the up-sampled image, so as to obtain an output of the model, that is, a binary map of the traffic light to be identified, specifically, as shown in fig. 6, the method includes:
step S601, performing third upsampling on the second upsampled image to obtain a third upsampled image.
In this embodiment, after obtaining the second up-sampled image, the third up-sampling is performed on the second up-sampled image to obtain a third up-sampled image.
And step S602, after the target input image is convolved by the convolution module, connecting the target input image with the third up-sampling image to obtain a binary image of the traffic light to be identified.
In the embodiment of the application, after the third up-sampled image is obtained, the target input image is convolved by the convolution module and then is connected with the third up-sampled image to obtain the binary image of the traffic light to be identified.
Step S103, carrying out external rectangle operation on the binary image to obtain an external rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the external rectangle.
In the embodiment of the application, after the binary image of the traffic light to be identified is obtained, the binary image needs to be subjected to circumscribed rectangle operation, and the circumscribed rectangle operation is implemented by circumscribing a rectangle used for representing the shape of the traffic light to be identified in the binary image, so that the category of the traffic light to be identified is identified. Specifically, as shown in fig. 7, the method includes:
step S701, a plurality of corner points in the binary image are identified by adopting a preset corner point identification model.
In this embodiment, the corner point refers to an extreme point in the binary image, and the RGB value at the corner point is the largest or the smallest compared to the surrounding, and optionally, a Moravec corner point detection algorithm may be used to determine the corner point in the binary image.
And S702, performing external rectangle operation based on the plurality of corner points to obtain an external rectangle of the traffic light to be identified.
In the embodiment of the application, after the corner points of the traffic light to be identified in the binary image are obtained, an external rectangle operation is performed based on the corner points, specifically, the corner points can be connected without repetition to form an external rectangle, and the category of the traffic light to be identified is determined based on the shape of the external rectangle.
As a possible implementation manner of the present application, for convenience of description, a specific embodiment is taken as an example, when a preset traffic light identification model is generated, traffic light image data collected in advance needs to be processed, the traffic light image collected in advance may be a traffic light image collected when a test vehicle runs on a road, wherein the traffic light image collected in advance should at least include a traffic light to be identified, the traffic light image collected in advance is combined with json (json Object Notation) data to generate required sample data, and the sample data is preprocessed after the sample data is reached, wherein the preprocessing process includes removing data which does not meet a specification requirement from the sample data, for example, when the traffic light image is combined with the json data, the traffic light image is labeled through the json data to obtain a contour of the traffic light to be identified, wherein, when the labeling effect is poor or the labeling is failed, images with failed labeling can be selected to be removed to obtain data meeting the specification, the obtained data meeting the specification are randomly divided into test data and training data, the test data and the training data are stored in a preset mdb database, training is carried out on a unet network model combined with a plurality of attention mechanism modules by adopting the training data, during the training, the data in the mdb database can be analyzed into a 1080 1920 matrix for inputting, the unet network model combined with the attention mechanism modules is trained, when the unet network model carries out recognition prediction on the traffic light images, a prediction recognition record is obtained, an external rectangle operation is carried out on the basis of the prediction recognition result to obtain a final recognition result and a real picture label used for indicating the traffic light category, and then the trained unet network model is tested by adopting the test data, when the test result meets the preset requirement, a trained unet network model combined with a residual error module is obtained, and the network model can be adopted to identify the traffic light image acquired by the vehicle. As shown in fig. 8, it can be known from fig. 8 that the scheme provided by the embodiment of the present application can accurately identify the traffic light categories at near and far in a color background, wherein white and gray frames at the lower middle left side in fig. 8 are used for displaying the traffic light categories, and the white and gray frames have limited picture display effects, so that the traffic light categories can be identified in the actual identification process.
According to the traffic light identification method and device, the traffic light image to be identified is identified through the unet network model combined with the plurality of attention mechanism modules, the model identification result is obtained, then external rectangle operation is conducted on the model identification result, the external rectangle of the traffic light to be identified is obtained, and the lighting state of the traffic light to be identified is determined based on the external rectangle. By adding the plurality of attention mechanism modules in the unet network, the key points in the feature extraction image and the upper sampling image are connected when the traffic light image to be identified is transmitted in the unet network, the obtained traffic light image is clearer, and the identification of the bright state category of the traffic light is promoted.
Corresponding to the embodiment of the application function implementation method, the application also provides a traffic light identification device, electronic equipment and a corresponding embodiment.
Fig. 9 is a schematic structural diagram of a traffic light identification device according to an embodiment of the present application.
Referring to fig. 9, the traffic light identification apparatus 90 provided in the embodiment of the present application includes an image obtaining module 910, a binary map determining module 920, and an identification module 930, where:
the image acquisition module 910 is configured to acquire a traffic light image to be identified, where the traffic light image to be identified is an image including a traffic light to be identified;
the target map determining module 920 is configured to input the traffic light image to be identified to a preset traffic light identification model to obtain a target map of the traffic light image to be identified, where the preset traffic light identification model is a pre-trained unet network model combining multiple attention mechanism modules;
the identification module 930 is configured to perform an external rectangle operation on the target map to obtain an external rectangle of the traffic light to be identified, and determine the category of the traffic light to be identified based on the external rectangle.
As a possible embodiment of the present application, in this embodiment, after the traffic light image to be recognized, the method further includes:
and carrying out binarization processing on the traffic light image to be identified, and labeling the contour of the traffic light to be identified in the traffic light image to be identified after binarization processing to obtain a target input image.
As a possible implementation manner of the present application, in this implementation manner, the inputting the traffic light image to be identified into a preset traffic light identification model to obtain a binary image of the traffic light image to be identified includes:
performing feature extraction on the target input image for multiple times by adopting an encoder of the unet network model to obtain a feature extraction image of the traffic light image to be identified;
a decoder of the unet network combined with a plurality of attention mechanism modules is adopted to perform up-sampling on the feature extraction image for a plurality of times to obtain an up-sampled image of the traffic light image to be identified;
and connecting the feature extraction image with the up-sampling image to obtain a binary image of the traffic light image to be identified.
As a possible implementation manner of the present application, in this implementation manner, the performing, by an encoder using the unet network model, feature extraction on the target input image multiple times to obtain a feature extraction map of the traffic light image to be identified includes:
performing first-time feature extraction on the traffic light image to be identified by adopting a preset feature extraction module to obtain a first feature extraction image, wherein the feature extraction module comprises a convolution module and a pooling module;
performing secondary feature extraction on the first feature extraction image by using the feature extraction module to obtain a second feature extraction image;
and performing third-time feature extraction on the second feature extraction image by adopting the feature extraction module to obtain a third feature extraction image.
As a possible embodiment of the present application, in this embodiment, the performing, by a decoder of the unet network that combines a plurality of attention mechanism modules, multiple times of upsampling on the feature extraction map to obtain an upsampled image of the traffic light image to be identified includes:
performing first upsampling on the third feature extraction image by using an upsampling module to obtain a first upsampled intermediate image, and connecting the second feature extraction image with the first upsampled intermediate image after the convolution of the second feature extraction image by using a convolution module to obtain a first upsampled image, wherein the upsampling module comprises an attention mechanism module;
and performing second upsampling on the first upsampled image by adopting the upsampling module to obtain a second upsampled intermediate image, and connecting the second feature extraction image with the second upsampled intermediate image after the convolution of the second feature extraction image by the convolution module to obtain a second upsampled image.
As a possible implementation manner of the present application, in this implementation manner, the connecting the feature extraction image and the up-sampling image to obtain a binary image of the traffic light image to be identified includes:
performing third upsampling on the second upsampled image to obtain a third upsampled image;
and after the target input image is convolved by a convolution module, connecting the target input image with the third up-sampling image to obtain a binary image of the traffic light to be identified.
As a possible implementation manner of the present application, in this implementation manner, the performing a circumscribed rectangle operation on the binary image to obtain a circumscribed rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the circumscribed rectangle includes:
recognizing a plurality of corner points in the binary image by adopting a preset corner point recognition model;
and performing external rectangle operation based on the angular points to obtain the external rectangle of the traffic light to be identified.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
According to the traffic light identification method and device, the traffic light image to be identified is identified through the unet network model combined with the plurality of attention mechanism modules, the model identification result is obtained, then external rectangle operation is conducted on the model identification result, the external rectangle of the traffic light to be identified is obtained, and the lighting state of the traffic light to be identified is determined based on the external rectangle. By adding the plurality of attention mechanism modules in the unet network, the key points in the feature extraction image and the upper sampling image are connected when the traffic light image to be identified is transmitted in the unet network, the obtained traffic light image is clearer, and the identification of the bright state category of the traffic light is promoted.
Referring now to FIG. 10, a block diagram of an electronic device 1000 suitable for use in implementing embodiments of the present disclosure is shown. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
The electronic device includes: a memory and a processor, wherein the processor may be referred to as a processing device 1001 described below, and the memory may include at least one of a Read Only Memory (ROM) 1002, a Random Access Memory (RAM) 1003, and a storage device 1008, which are described below:
as shown in fig. 10, the electronic device 1000 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 1001 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 1002 or a program loaded from a storage means 1008 into a Random Access Memory (RAM) 1003. In the RAM 1003, various programs and data necessary for the operation of the electronic apparatus 1000 are also stored. The processing device 1001, ROM 1002, and RAM 1003 are connected to each other by a bus 1004. An input/output (I/O) interface 1005 is also connected to bus 1004.
Generally, the following devices may be connected to the I/O interface 1005: input devices 1006 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 1007 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 1008 including, for example, magnetic tape, hard disk, and the like; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. While fig. 10 illustrates an electronic device 1000 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 1009, or installed from the storage means 1008, or installed from the ROM 1002. The computer program, when executed by the processing device 1001, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network Protocol, such as HTTP (HyperText Transfer Protocol), and may interconnect with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring a traffic light image to be identified, wherein the traffic light image to be identified is an image containing a traffic light to be identified; inputting the traffic light image to be identified into a preset traffic light identification model to obtain a binary image of the traffic light image to be identified, wherein the preset traffic light identification model is a pre-trained unet network model combined with a plurality of attention mechanism modules; and carrying out external rectangle operation on the binary image to obtain an external rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the external rectangle.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the designation of a module or unit does not in some cases constitute a limitation on the unit itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems on a chip (SOCs), complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and the technical features disclosed in the present disclosure (but not limited to) having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A traffic light identification method is characterized by comprising the following steps:
acquiring a traffic light image to be identified, wherein the traffic light image to be identified is an image containing a traffic light to be identified;
inputting the traffic light image to be recognized into a preset traffic light recognition model to obtain a target image of the traffic light image to be recognized, wherein the preset traffic light recognition model is a pre-trained unet network model combined with a plurality of attention mechanism modules;
and carrying out external rectangle operation on the target graph to obtain an external rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the external rectangle.
2. The traffic light identification method according to claim 1, wherein after the traffic light image to be identified, the method further comprises:
and carrying out image segmentation processing on the traffic light image to be identified, and labeling the outline of the traffic light to be identified in the traffic light image to be identified after image segmentation to obtain a target input image.
3. The traffic light identification method according to claim 2, wherein the step of inputting the traffic light image to be identified into a preset traffic light identification model to obtain a binary image of the traffic light image to be identified comprises:
performing feature extraction on the target input image for multiple times by adopting an encoder of the unet network model to obtain a feature extraction image of the traffic light image to be identified;
a decoder of the unet network combined with a plurality of attention mechanism modules is adopted to perform up-sampling on the feature extraction image for a plurality of times to obtain an up-sampled image of the traffic light image to be identified;
and connecting the feature extraction image with the up-sampling image to obtain a binary image of the traffic light image to be identified.
4. The traffic light identification method according to claim 3, wherein the performing a plurality of feature extractions on the target input image by using the encoder of the unet network model to obtain the feature extraction map of the traffic light image to be identified comprises:
performing first-time feature extraction on the traffic light image to be identified by adopting a preset feature extraction module to obtain a first feature extraction image, wherein the feature extraction module comprises a convolution module and a pooling module;
performing secondary feature extraction on the first feature extraction image by using the feature extraction module to obtain a second feature extraction image;
and performing third-time feature extraction on the second feature extraction image by adopting the feature extraction module to obtain a third feature extraction image.
5. The traffic light identification method according to claim 4, wherein the up-sampling the feature extraction map for a plurality of times by using a decoder of the unet network combined with a plurality of attention mechanism modules to obtain an up-sampled image of the traffic light image to be identified comprises:
performing first upsampling on the third feature extraction image by using an upsampling module to obtain a first upsampled intermediate image, and connecting the second feature extraction image with the first upsampled intermediate image after the convolution of the second feature extraction image by using a convolution module to obtain a first upsampled image, wherein the upsampling module comprises an attention mechanism module;
and performing second upsampling on the first upsampled image by adopting the upsampling module to obtain a second upsampled intermediate image, and connecting the second feature extraction image with the second upsampled intermediate image after the convolution of the second feature extraction image by the convolution module to obtain a second upsampled image.
6. The traffic light identification method according to claim 5, wherein the connecting the feature extraction image with the up-sampling image to obtain a binary image of the traffic light image to be identified comprises:
performing third upsampling on the second upsampled image to obtain a third upsampled image;
and after the target input image is convolved by a convolution module, connecting the target input image with the third up-sampling image to obtain a binary image of the traffic light to be identified.
7. The traffic light identification method according to claim 6, wherein the operation of circumscribing rectangles on the binary image to obtain circumscribing rectangles of the traffic light to be identified, and the determination of the category of the traffic light to be identified based on the circumscribing rectangles comprises:
recognizing a plurality of corner points in the binary image by adopting a preset corner point recognition model;
and performing external rectangle operation based on the plurality of corner points to obtain the external rectangle of the traffic light to be identified.
8. A traffic light identification device, comprising:
the traffic light identification device comprises an image acquisition module, a recognition module and a recognition module, wherein the image acquisition module is used for acquiring traffic light images to be identified, and the traffic light images to be identified comprise traffic lights to be identified;
the target map determining module is used for inputting the traffic light image to be identified into a preset traffic light identification model to obtain a target map of the traffic light image to be identified, wherein the preset traffic light identification model is a pre-trained unet network model combined with a plurality of attention mechanism modules;
and the identification module is used for carrying out external rectangle operation on the target graph to obtain an external rectangle of the traffic light to be identified, and determining the category of the traffic light to be identified based on the external rectangle.
9. An electronic device, comprising:
a processor; and
a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method of any one of claims 1-7.
10. A computer-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the method of any one of claims 1-7.
CN202310104374.7A 2023-01-30 2023-01-30 Traffic light identification method and device, electronic equipment and computer readable storage medium Withdrawn CN115984821A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310104374.7A CN115984821A (en) 2023-01-30 2023-01-30 Traffic light identification method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310104374.7A CN115984821A (en) 2023-01-30 2023-01-30 Traffic light identification method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN115984821A true CN115984821A (en) 2023-04-18

Family

ID=85974319

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310104374.7A Withdrawn CN115984821A (en) 2023-01-30 2023-01-30 Traffic light identification method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN115984821A (en)

Similar Documents

Publication Publication Date Title
CN111626208B (en) Method and device for detecting small objects
US20230394671A1 (en) Image segmentation method and apparatus, and device, and storage medium
CN110119725B (en) Method and device for detecting signal lamp
CN111401255B (en) Method and device for identifying bifurcation junctions
CN110852258A (en) Object detection method, device, equipment and storage medium
CN112712036A (en) Traffic sign recognition method and device, electronic equipment and computer storage medium
CN114612872A (en) Target detection method, target detection device, electronic equipment and computer-readable storage medium
CN111209856B (en) Invoice information identification method and device, electronic equipment and storage medium
CN113592033B (en) Oil tank image recognition model training method, oil tank image recognition method and device
CN111382695A (en) Method and apparatus for detecting boundary points of object
CN116704473B (en) Obstacle information detection method, obstacle information detection device, electronic device, and computer-readable medium
CN111311609B (en) Image segmentation method and device, electronic equipment and storage medium
CN115546769B (en) Road image recognition method, device, equipment and computer readable medium
CN113409393B (en) Method and device for identifying traffic sign
CN112418054A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN115565158B (en) Parking space detection method, device, electronic equipment and computer readable medium
CN116012814A (en) Signal lamp identification method, signal lamp identification device, electronic equipment and computer readable storage medium
CN115512336B (en) Vehicle positioning method and device based on street lamp light source and electronic equipment
CN110633598B (en) Method and device for determining a driving area in an environment image
CN115984821A (en) Traffic light identification method and device, electronic equipment and computer readable storage medium
CN111383337B (en) Method and device for identifying objects
CN111340813B (en) Image instance segmentation method and device, electronic equipment and storage medium
CN114511744A (en) Image classification method and device, readable medium and electronic equipment
CN116012816A (en) Traffic light identification method and device, electronic equipment and computer readable storage medium
CN112528970A (en) Guideboard detection method, device, equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WW01 Invention patent application withdrawn after publication

Application publication date: 20230418

WW01 Invention patent application withdrawn after publication