Traffic Light Recognition Method, Device, Computer Equipment and Storage Medium
By combining the historical status data of traffic lights and real-time status data, and using preset thresholds to determine the properties of traffic lights, the problem of slow identification in traditional methods is solved, and faster and more accurate traffic light status recognition is achieved.
Patent Information
- Application Number
- CN202210545859.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-18
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2042-05-18
AI Technical Summary
When the traffic light signal is in an abnormal state, the recognition speed cannot meet the actual driving needs, especially when the traffic light is not working or blocked for a long time, it takes a long time.
By combining the historical status data of the current traffic light and real-time status data, attribute information is obtained and the current working status is identified, including non-working attributes, long-term flashing yellow light attributes, etc., the preset threshold value is used to determine the status of the current traffic light.
The speed and accuracy of traffic light recognition are improved, especially when real-time image data acquisition is difficult, the working status of traffic lights can be identified in time.
Smart Images

Figure CN114973192B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data processing, and particularly to a traffic light recognition method, apparatus, computer device, and storage medium. Background Art
[0002] The recognition of traffic light signals is an important part of driverless driving. In recent years, with the rise of driverless research, the technology for vehicles to accurately recognize objects has become a focus, especially the recognition of traffic lights is crucial; accurately recognizing traffic lights is of great significance for autonomous driving and path planning.
[0003] In traditional traffic light recognition solutions, only the signal results of traffic lights can be recognized from the images collected by the camera in real time. However, when the traffic light signal is in an abnormal state (the normal state means: switching according to the pattern of green, yellow, red, green...), such as all bulbs are not lit, or the signal is always in the state of flashing yellow, the solution based entirely on real-time image recognition may not meet the actual driving requirements in terms of recognition speed. For example, for a traffic light that has not worked for a long time and is blocked by trees in front, the solution based entirely on real-time image recognition needs to pause in front of the traffic light for the same long time each time to recognize that the traffic light is in a non-working state, which takes a long time. Summary of the Invention
[0004] Based on this, it is necessary to provide a traffic light recognition method, apparatus, computer device, and storage medium for the above technical problems.
[0005] A traffic light recognition method, the method includes:
[0006] Obtain the current image data of the current traffic light;
[0007] According to the current image data, obtain the real-time state data of the current traffic light;
[0008] Obtain the attribute information of the current traffic light, where the attribute information is obtained according to the historical state data of the current traffic light;
[0009] According to the attribute information and the real-time state data, recognize the current working state of the current traffic light.
[0010] In one of the embodiments, the above method further includes:
[0011] Obtain the historical state data of the current traffic light within a preset time period, where the historical state data includes each data record, and each data record includes the signal color of the current traffic light and the data indicating whether it is lit;
[0012] Determine a first ratio according to the historical state data, where the first ratio is the ratio of the number of data records where the current traffic light is not lit to the total number of data records;
[0013] If the first ratio exceeds the first preset threshold, add the non-operating attribute to the attribute information of the current traffic light;
[0014] Determine a second ratio according to historical status data, where the second ratio is the ratio of the total number of data records of the current traffic light being off and on yellow to the total number of data records;
[0015] If the second ratio exceeds the second preset threshold, add the long-term flashing yellow light attribute to the attribute information of the current traffic light.
[0016] In one embodiment, the above-mentioned identifying the current working state of the current traffic light according to the attribute information and real-time status data includes:
[0017] If there is a non-operating attribute in the attribute information of the current traffic light, determine the number of consecutive frames that the current traffic light is off according to the real-time status data;
[0018] If the number of consecutive frames that the current traffic light is off exceeds the third preset threshold, determine that the current working state is the non-operating state;
[0019] If the number of consecutive frames that the current traffic light is off does not exceed the third preset threshold, determine the current working state according to the real-time status data.
[0020] In one embodiment, the above-mentioned method further includes:
[0021] If there is no non-operating attribute in the attribute information of the current traffic light, and the number of consecutive frames that the current traffic light is off exceeds the fourth preset threshold, determine that the current working state is the non-operating state.
[0022] In one embodiment, the above-mentioned method further includes:
[0023] If there is no non-operating attribute in the attribute information of the current traffic light, the number of consecutive frames that the current traffic light is off does not exceed the fourth preset threshold, and there is a long-term flashing yellow light attribute in the attribute information of the current traffic light, determine the number of consecutive frames that the current traffic light is continuously red and continuously green according to the real-time status data;
[0024] If the number of consecutive frames that the current traffic light is continuously red and the number of consecutive frames that the current traffic light is continuously green do not exceed the fifth preset threshold, determine that the current working state of the current traffic light is flashing yellow.
[0025] In one embodiment, the above-mentioned method further includes:
[0026] When there is no non - working attribute in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not on does not exceed the fourth preset threshold, and there is no long - term flashing yellow light attribute in the attribute information of the current traffic light, determine the number of times of switching between consecutive non - lighting and consecutive yellow - light flashing of the current traffic light according to the real - time status data;
[0027] If the number of switching times exceeds the sixth preset threshold, and the number of consecutive frames of non - lighting and yellow - light flashing are both less than the seventh preset threshold, then determine that the current working state of the current traffic light is flashing yellow.
[0028] In one embodiment, the above - mentioned method further includes:
[0029] Update the current working state of the current traffic light to the historical status data;
[0030] Update the attribute information of the current traffic light according to the updated historical status data.
[0031] A traffic - light recognition device, the device includes:
[0032] A first acquisition module, configured to acquire the current image data of the current traffic light;
[0033] A processing module, configured to obtain the real - time status data of the current traffic light according to the current image data;
[0034] A second acquisition module, configured to acquire the attribute information of the current traffic light, where the attribute information is obtained according to the historical status data of the current traffic light;
[0035] A recognition module, configured to recognize the current working state of the current traffic light according to the attribute information and the real - time status data.
[0036] A computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0037] Acquire the current image data of the current traffic light;
[0038] Obtain the real - time status data of the current traffic light according to the current image data;
[0039] Acquire the attribute information of the current traffic light, where the attribute information is obtained according to the historical status data of the current traffic light;
[0040] Recognize the current working state of the current traffic light according to the attribute information and the real - time status data.
[0041] A computer - readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented:
[0042] Obtain the current image data of the current traffic light;
[0043] Based on the current image data, obtain the real-time status data of the current traffic light;
[0044] Obtain the attribute information of the current traffic light, where the attribute information is obtained based on the historical status data of the current traffic light;
[0045] Based on the attribute information and the real-time status data, identify the current working status of the current traffic light.
[0046] The above traffic light recognition method, device, computer device, and storage medium obtain the current image data of the current traffic light; based on the current image data, obtain the real-time status data of the current traffic light; obtain the attribute information of the current traffic light, where the attribute information is obtained based on the historical status data of the current traffic light; based on the attribute information and the real-time status data, identify the current working status of the current traffic light. This application can identify the working status of the traffic light by combining the attribute information and the real-time status data of the current traffic light. The attribute information is obtained from the historical status data of the current traffic light. Therefore, this application combines the historical status data and the real-time status data to identify the working status of the traffic light. Compared with the traditional technology that completely relies on real-time image recognition and requires the same length of pause in front of the traffic light each time to identify that the traffic light is in a non-working state, the recognition speed is accelerated. Brief Description of the Drawings
[0047] Figure 1 It is a schematic flowchart of the traffic light recognition method in an embodiment;
[0048] Figure 2 It is a schematic flowchart of the determination of the attribute information of the current traffic light in an embodiment;
[0049] Figure 3 It is a schematic flowchart of the step of identifying the current working status of the current traffic light based on the attribute information and the real-time status data in an embodiment;
[0050] Figure 4 It is a schematic flowchart of the process of determining the current working status when there is no non-working attribute in the attribute information of the current traffic light in another embodiment;
[0051] Figure 5 It is a schematic flowchart of the process of determining the current working status when there is no non-working attribute in the attribute information of the current traffic light in another embodiment;
[0052] Figure 6 It is a structural block diagram of the traffic light recognition device in an embodiment;
[0053] Figure 7Internal structure diagram of a computer device in an embodiment. Detailed implementation manners
[0054] To make the objectives, technical solutions and advantages of this application clearer, the following further elaborates on this application in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for explaining this application and are not used to limit this application.
[0055] In one embodiment, as Figure 1 shown, a traffic light recognition method is provided. Taking the application of this method to a server as an example, the method includes the following steps:
[0056] S11. Obtain the current image data of the current traffic light.
[0057] In this application, the above-mentioned current image data may be the image data collected by a camera at the current moment or during the current time period. It may be the current frame image or multiple frames of images within a preset time period, such as multiple frames of images within the current 5 seconds.
[0058] S12. Obtain the real-time status data of the current traffic light according to the current image data.
[0059] In this application, the above-mentioned real-time status data may be the data used to describe the real-time working status of the current traffic light. For example, the real-time status data may include the color of the signal light of the current traffic light at the current moment, the lighting time and duration, whether it is working properly, the on / off status of each bulb, and the number of abnormalities, etc.
[0060] In this application, the current image data may be processed by a pre-trained neural network model to obtain the real-time status data. This application may also process the current image data through a preset image processing algorithm to obtain the real-time status data.
[0061] S13. Obtain the attribute information of the current traffic light, where the attribute information is obtained according to the historical status data of the current traffic light.
[0062] In this application, the above-mentioned attribute information may be the data used to describe the working status, geographical location status, appearance status, material status, time characteristics, etc. of the current traffic light. For example, the attribute information may include whether the current traffic light is working properly, the type of abnormal work (such as whether it is constantly flashing a yellow light or not lighting up), geographical location information, appearance and material information, etc.
[0063] The attribute information in this application is information obtained through data mining and analysis based on the historical status data of the current traffic light. Specifically, an attribute database can be pre-created in this application. The attribute database includes the historical status data of each traffic light in each time period. The historical status data can be data such as the signal color, the duration of each color light, the on / off state of each light bulb, the number of anomalies, the geographical location status, the appearance status, and the material status in each historical time period of each traffic light.
[0064] Furthermore, the server integrates based on this historical status data, such as data statistics, to obtain the attribute information of each traffic light, and stores each piece of attribute information in the attribute database correspondingly. Among them, each traffic light can correspond to multiple attributes. For example, not working can be an attribute, geographical location can be an attribute, and material can also be an attribute, etc.
[0065] For example, if it is obtained that the current traffic light has been in a non-working state for a long historical period, the non-working attribute can be marked as one of the attributes of the current traffic light. And so on, data analysis can be performed based on the historical status data of each traffic light to obtain multiple attributes of each traffic light, and these multiple attributes can be used for subsequent identification of traffic lights.
[0066] S14. Identify the current working state of the current traffic light according to the attribute information and the real-time status data.
[0067] In this application, the above-mentioned current working state data is data used to describe the operating state of the current traffic light at the current moment. For example, data such as whether it is working properly, whether it is flashing a yellow light, and the color of the signal light. The attribute information in this application is obtained based on historical status data and can be considered as offline data. The above-mentioned real-time status data is real-time data. This application combines offline data and real-time data to identify the current working state of the current traffic light. In some cases where real-time data cannot be obtained or is difficult to obtain (such as when the traffic light is blocked by trees), the current working state of the current traffic light can be obtained in a timely manner by combining offline data.
[0068] In one embodiment, as Figure 2 shown, the above method may further include:
[0069] S21. Obtain the historical status data of the current traffic light within a preset time period. The historical status data includes each data record, and each data record includes the signal color of the current traffic light and the data of whether it is lit;
[0070] S22. Determine a first ratio according to the historical status data. The first ratio is the ratio of the number of data records in which the current traffic light is not lit to the total number of data records;
[0071] S23. If the first ratio exceeds the first preset threshold, add the non - working attribute to the attribute information of the current traffic light;
[0072] S24. Determine the second ratio according to the historical status data. The second ratio is the ratio of the total number of data records where the current traffic light is off and the yellow light is on to the total number of data records;
[0073] S25. If the second ratio exceeds the second preset threshold, add the long - term flashing yellow light attribute to the attribute information of the current traffic light.
[0074] In this application, each of the above - mentioned data records records data such as the signal color of each traffic light in each historical time period, the duration of each color light, the on - off state of each light bulb, the number of anomalies, the geographical location state, the appearance state, and the material state. If each moment's recorded data corresponds to one data record, then there will be multiple data records for each traffic light.
[0075] In this application, when the first ratio exceeds the first preset threshold, adding the non - working attribute to the attribute information of the current traffic light means marking the non - working attribute for the current traffic light in the attribute database. Similarly, when the second ratio exceeds the second preset threshold, mark the long - term flashing yellow light attribute for the current traffic light in the attribute database. The first preset threshold and the second preset threshold in this application can be set according to actual needs and are not specifically limited here.
[0076] Through this implementation method, this application can mine and analyze the historical status data of each traffic light obtained, and obtain the attribute information of each traffic light. The attribute information of each traffic light can include multiple items. Subsequently, based on the attribute information of each traffic light and the real - time status data of each traffic light, the current working state of each traffic light can be identified.
[0077] In one embodiment, as Figure 3 shown, identifying the current working state of the current traffic light according to the attribute information and the real - time status data may include:
[0078] S31. If there is a non - working attribute in the attribute information of the current traffic light, determine the number of consecutive frames in which the current traffic light is off according to the real - time status data;
[0079] S32. If the number of consecutive frames in which the current traffic light is off exceeds the third preset threshold, then determine that the current working state is the non - working state;
[0080] S33. If the number of consecutive frames in which the current traffic light is off does not exceed the third preset threshold, then determine the current working state according to the real - time status data.
[0081] In this application, the server queries the pre-created attribute database, queries the attribute information corresponding to the current traffic light from the attribute database, and determines whether there is a non-operating attribute in its attribute information. If there is, the number of consecutive frames in which the current traffic light is not lit is determined according to the real-time status data.
[0082] The above determination of the number of consecutive frames in which the current traffic light is not lit according to the real-time status data may include:
[0083] Data statistics are performed on data such as the color of the signal light corresponding to each frame in the real-time status data, the lighting time and duration, whether it is working properly, the on / off status of each bulb, and the number of anomalies, to determine the number of consecutive frames in which the current traffic light is not lit.
[0084] The above determination of the current working status according to the real-time status data may include:
[0085] Based on data such as the color of the signal light corresponding to each frame in the real-time status data, the lighting time and duration, whether it is working properly, the on / off status of each bulb, and the number of anomalies, the current working status is determined.
[0086] For example, if the current traffic light in the real-time status data is a red light, the output current working status is that the red light is on. If the current traffic light in the real-time status data is not lit for a continuous preset number of frames, the output current working status is non-operating.
[0087] In the field of autonomous driving, compared with the traditional method of identifying traffic lights only based on real-time image data, the solution of this application can save time in some cases. For example, for a traffic light that has not been working for a long time and is blocked by trees in front, a solution that completely relies on real-time image data needs to pause for the same length of time in front of the traffic light every time to identify that the traffic light is in a non-operating state, which is time-consuming.
[0088] In one embodiment, the above method may further include:
[0089] If there is no non-operating attribute in the attribute information of the current traffic light, and the number of consecutive frames in which the current traffic light is not lit exceeds the fourth preset threshold, then the current working status is determined to be a non-operating state.
[0090] In this application, the above third preset threshold and fourth preset threshold can be set according to actual needs. However, the fourth preset threshold is much larger than the above third preset threshold. The specific setting method is not specifically limited herein.
[0091] In one embodiment, as Figure 4 shown, the above method may further include:
[0092] S41. If the non - working attribute does not exist in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not on does not exceed the fourth preset threshold, and the long - term flashing yellow light attribute exists in the attribute information of the current traffic light, determine the number of consecutive frames in which the current traffic light is red and the number of consecutive frames in which the current traffic light is green according to the real - time status data;
[0093] S42. If the number of consecutive frames in which the current traffic light is red and the number of consecutive frames in which the current traffic light is green both do not exceed the fifth preset threshold, then determine that the current working state of the current traffic light is flashing yellow.
[0094] In this application, the above - mentioned determining the number of consecutive frames in which the current traffic light is red and the number of consecutive frames in which the current traffic light is green according to the real - time status data may include:
[0095] Perform data statistics based on data such as the color of the signal light corresponding to each frame, the lighting time and duration, whether it works properly, the on - off state of each bulb, and the number of anomalies in the real - time status data, and determine the number of consecutive frames in which the current traffic light is red and the number of consecutive frames in which the current traffic light is green.
[0096] In this application, first check whether the non - working attribute exists in the attribute information of the current traffic light. When it is determined that the non - working attribute information does not exist and the number of consecutive frames in which the current traffic light is not on does not exceed the fourth preset threshold, then query whether the long - term flashing yellow light attribute exists in the attribute information of the current traffic light. When the long - term flashing yellow light attribute exists, count the number of consecutive frames in which the current traffic light is red and the number of consecutive frames in which the current traffic light is green. When the number of consecutive frames in which the current traffic light is red and the number of consecutive frames in which the current traffic light is green both do not exceed the fifth preset threshold, then determine that the current working state of the current traffic light is flashing yellow.
[0097] Further, if the number of consecutive frames in which the current traffic light is red or the number of consecutive frames in which the current traffic light is green exceeds the fifth preset threshold, then obtain the current working state of the current traffic light according to the above - mentioned real - time status data.
[0098] This application combines the pre - obtained attribute information of the current traffic light with the current real - time status data to identify the current traffic state of the current traffic light, making the identification more timely and accurate.
[0099] In one of the embodiments, as Figure 5 shown, the above - mentioned method may further include:
[0100] S51. If the non - working attribute does not exist in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not on does not exceed the fourth preset threshold, and the long - term flashing yellow light attribute does not exist in the attribute information of the current traffic light, determine the number of times of switching between the current traffic light being continuously off and continuously on with a yellow light according to the real - time status data;
[0101] S52. If the number of switches exceeds the sixth preset threshold, and the continuous frame numbers of non - illumination and yellow - light illumination are both less than the seventh preset threshold, then determine that the current working state of the current traffic light is flashing yellow light.
[0102] In this application, the above - mentioned determination of the switching times of continuous non - illumination and continuous yellow - light illumination of the current traffic light based on real - time status data may include:
[0103] Perform data statistics according to data such as the color of the signal lamp corresponding to each frame in the real - time status data, the lighting time and duration, whether it works normally, the on - off state of each bulb, and the number of anomalies, etc., to determine the switching times of continuous non - illumination and continuous yellow - light illumination of the current traffic light.
[0104] Among them, the above - mentioned switching times of continuous non - illumination and continuous yellow - light illumination of the current traffic light refer to the situation where it switches from continuous non - illumination to continuous yellow - light illumination, and then from continuous yellow - light illumination to continuous non - illumination, and so on, and count the number of its switches.
[0105] The above - mentioned continuous frame numbers of non - illumination and yellow - light illumination refer to the number of frames of each non - illumination and each yellow - light illumination during the switching period of continuous non - illumination and continuous yellow - light illumination. For example, it switches from continuous 5 - frame non - illumination to continuous 5 - frame yellow - light illumination, and then to continuous 6 - frame non - illumination and other modes. The server counts the continuous frame numbers during this switching period. If the number of switches exceeds the sixth preset threshold, and the continuous frame numbers of non - illumination and yellow - light illumination are both less than the seventh preset threshold, then determine that the current working state of the current traffic light is flashing yellow light.
[0106] Further, when the number of switches does not exceed the sixth preset threshold, or one of the continuous frame numbers of non - illumination and yellow - light illumination is not less than the seventh preset threshold, then determine the current working state of the current traffic light according to the above - mentioned real - time status data.
[0107] In this application, the current working state of the current traffic light can be identified more efficiently and accurately based on the pre - obtained non - working attribute or long - term flashing yellow - light attribute, combined with the real - time status data.
[0108] In one embodiment, the above - mentioned method may further include:
[0109] Update the current working state of the current traffic light to the historical status data;
[0110] Update the attribute information of the current traffic light according to the updated historical status data.
[0111] In this application, the current working state of the obtained current traffic light is updated to the historical status data in real time. And update the attribute information of each traffic light in the above - mentioned attribute database at preset time intervals to ensure that the attribute information of each traffic light is the latest.
[0112] For example, in the present application, for each traffic light in each preset time period, the data records of its historical status data within the past week can be summarized, and the ratio of the number of data records corresponding to the traffic light being off to the total number of records can be calculated. If it exceeds the first preset threshold, the non-working attribute is updated to the attribute information of the corresponding traffic light. The ratio of the total number of data records corresponding to the traffic light being off and showing a yellow light to the total number of data records is calculated. If it exceeds the second preset threshold, the long-term flashing yellow light attribute is updated to the attribute information of the corresponding traffic light.
[0113] In the present application, the server can form a traffic light attribute database with the attribute information of each traffic light on the map, and download the latest attribute database to the storage medium of the vehicle before each self-driving vehicle goes out. The present application can also add new attributes to each traffic light and corresponding determination logics for the newly added attributes to expand the solution.
[0114] In one embodiment, as Figure 6 shown, a traffic light recognition device is provided, including: a first acquisition module 11, a processing module 12, a second acquisition module 13, and a recognition module 14, where:
[0115] The first acquisition module 11 is configured to acquire the current image data of the current traffic light;
[0116] The processing module 12 is configured to obtain the real-time status data of the current traffic light according to the current image data;
[0117] The second acquisition module 13 is configured to acquire the attribute information of the current traffic light, and the attribute information is obtained according to the historical status data of the current traffic light;
[0118] The recognition module 14 is configured to recognize the current working status of the current traffic light according to the attribute information and the real-time status data.
[0119] In one embodiment, the above traffic light recognition device further includes an attribute determination module (not shown in the figure). The attribute determination module can obtain the historical status data of the current traffic light within a preset time period. The historical status data includes each data record, and each data record includes the signal light color of the current traffic light and the data indicating whether it is lit. The first ratio is determined according to the historical status data. The first ratio is the ratio of the number of data records in which the current traffic light is not lit to the total number of data records. When the first ratio exceeds the first preset threshold, the non-operating attribute is added to the attribute information of the current traffic light. The second ratio is determined according to the historical status data. The second ratio is the ratio of the total number of data records in which the current traffic light is not lit and lit yellow to the total number of data records. When the second ratio exceeds the second preset threshold, the long-term flashing yellow light attribute is added to the attribute information of the current traffic light.
[0120] In one embodiment, the above recognition module 14 can, when there is a non-operating attribute in the attribute information of the current traffic light, determine the number of consecutive frames in which the current traffic light is not lit according to the real-time status data. When the number of consecutive frames in which the current traffic light is not lit exceeds the third preset threshold, it is determined that the current working state is the non-operating state. When the number of consecutive frames in which the current traffic light is not lit does not exceed the third preset threshold, the current working state is determined according to the real-time status data.
[0121] In one embodiment, the above recognition module 14 can also determine that the current working state is the non-operating state when there is no non-operating attribute in the attribute information of the current traffic light and the number of consecutive frames in which the current traffic light is not lit exceeds the fourth preset threshold.
[0122] In one embodiment, the above recognition module 14 can also, when there is no non-operating attribute in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not lit does not exceed the fourth preset threshold, and there is a long-term flashing yellow light attribute in the attribute information of the current traffic light, determine the number of consecutive frames in which the current traffic light is continuously red and continuously green according to the real-time status data. When the number of consecutive frames in which the current traffic light is continuously red and the number of consecutive frames in which the current traffic light is continuously green both do not exceed the fifth preset threshold, it is determined that the current working state of the current traffic light is flashing yellow.
[0123] In one embodiment, the above recognition module 14 can also, when there is no non-operating attribute in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not lit does not exceed the fourth preset threshold, and there is no long-term flashing yellow light attribute in the attribute information of the current traffic light, determine the number of times of switching between continuous non-lighting and continuous lighting of the yellow light of the current traffic light according to the real-time status data. When the number of switching times exceeds the sixth preset threshold and the continuous frame numbers of non-lighting and lighting of the yellow light are both less than the seventh preset threshold, it is determined that the current working state of the current traffic light is flashing yellow.
[0124] In one embodiment, the above traffic light recognition device further includes an update module (not shown in the figure), which can update the current working state of the current traffic light to the historical state data, and update the attribute information of the current traffic light according to the updated historical state data.
[0125] In one embodiment, a computer device is provided. The computer device can be a server, and its internal structure diagram can be as Figure 7 shown. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as the operation data of smart home devices. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it realizes the resource allocation method of the compilation virtual machine.
[0126] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: obtaining current image data of a current traffic light; obtaining real-time state data of the current traffic light according to the current image data; obtaining attribute information of the current traffic light, where the attribute information is obtained according to the historical state data of the current traffic light; and identifying the current working state of the current traffic light according to the attribute information and the real-time state data.
[0127] In one embodiment, when the processor executes the computer program, the following steps are specifically further implemented:
[0128] Obtaining historical state data of the current traffic light within a preset time period, where the historical state data includes each data record, and each data record includes the signal light color of the current traffic light and data on whether it is lit;
[0129] Determining a first ratio according to the historical state data, where the first ratio is the ratio of the number of data records in which the current traffic light is not lit to the total number of data records;
[0130] If the first ratio exceeds a first preset threshold, add a non-working attribute to the attribute information of the current traffic light;
[0131] Determining a second ratio according to the historical state data, where the second ratio is the ratio of the total number of data records in which the current traffic light is not lit and lit yellow to the total number of data records;
[0132] When the second ratio exceeds the second preset threshold, add the long-term yellow flashing light attribute to the attribute information of the current traffic light.
[0133] In one embodiment, when the processor executes the computer program to implement the above step of identifying the current working state of the current traffic light according to the attribute information and the real-time status data, the following steps are specifically implemented:
[0134] If there is a non-working attribute in the attribute information of the current traffic light, determine the number of consecutive frames in which the current traffic light is not on according to the real-time status data;
[0135] If the number of consecutive frames in which the current traffic light is not on exceeds the third preset threshold, then determine that the current working state is the non-working state;
[0136] If the number of consecutive frames in which the current traffic light is not on does not exceed the third preset threshold, then determine the current working state according to the real-time status data.
[0137] In one embodiment, when the processor executes the computer program, the following steps are specifically further implemented:
[0138] If there is no non-working attribute in the attribute information of the current traffic light, and the number of consecutive frames in which the current traffic light is not on exceeds the fourth preset threshold, then determine that the current working state is the non-working state.
[0139] In one embodiment, when the processor executes the computer program, the following steps are specifically further implemented:
[0140] If there is no non-working attribute in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not on does not exceed the fourth preset threshold, and there is a long-term yellow flashing light attribute in the attribute information of the current traffic light, determine the number of consecutive frames in which the current traffic light is continuously red and the number of consecutive frames in which it is continuously green according to the real-time status data;
[0141] If both the number of consecutive frames in which the current traffic light is continuously red and the number of consecutive frames in which it is continuously green do not exceed the fifth preset threshold, then determine that the current working state of the current traffic light is yellow flashing.
[0142] In one embodiment, when the processor executes the computer program, the following steps are specifically further implemented:
[0143] If there is no non-working attribute in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not on does not exceed the fourth preset threshold, and there is no long-term yellow flashing light attribute in the attribute information of the current traffic light, determine the number of times of switching between continuous non-lighting and continuous yellow flashing of the current traffic light according to the real-time status data;
[0144] If the number of switching times exceeds the sixth preset threshold, and the continuous frame numbers of non-lighting and yellow flashing are both less than the seventh preset threshold, then determine that the current working state of the current traffic light is yellow flashing.
[0145] In one embodiment, when the processor executes the computer program, the following steps are further specifically implemented:
[0146] Update the current working state of the current traffic light to the historical state data;
[0147] Update the attribute information of the current traffic light according to the updated historical state data.
[0148] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: Obtain the current image data of the current traffic light; According to the current image data, obtain the real-time state data of the current traffic light; Obtain the attribute information of the current traffic light, where the attribute information is obtained according to the historical state data of the current traffic light; Identify the current working state of the current traffic light according to the attribute information and the real-time state data.
[0149] In one embodiment, when the computer program is executed by the processor, the following steps are further specifically implemented:
[0150] Obtain the historical state data of the current traffic light within a preset time period. The historical state data includes each data record, and each data record includes the signal light color of the current traffic light and the data on whether it is lit;
[0151] Determine a first ratio according to the historical state data. The first ratio is the ratio of the number of data records where the current traffic light is not lit to the total number of data records;
[0152] If the first ratio exceeds a first preset threshold, add a non-working attribute to the attribute information of the current traffic light;
[0153] Determine a second ratio according to the historical state data. The second ratio is the ratio of the total number of data records where the current traffic light is not lit and lit yellow to the total number of data records;
[0154] If the second ratio exceeds a second preset threshold, add a long-term flashing yellow light attribute to the attribute information of the current traffic light.
[0155] In one embodiment, when the computer program is executed by the processor to implement the above step of identifying the current working state of the current traffic light according to the attribute information and the real-time state data, the following steps are specifically implemented:
[0156] If there is a non-working attribute in the attribute information of the current traffic light, determine the number of consecutive frames where the current traffic light is not lit according to the real-time state data;
[0157] If the number of consecutive frames where the current traffic light is not lit exceeds a third preset threshold, then determine that the current working state is a non-working state;
[0158] If the number of consecutive frames in which the current traffic light is not on does not exceed the third preset threshold, then determine the current working state according to the real-time status data.
[0159] In one embodiment, when the computer program is executed by a processor, the following steps are further specifically implemented:
[0160] If the non-working attribute does not exist in the attribute information of the current traffic light and the number of consecutive frames in which the current traffic light is not on exceeds the fourth preset threshold, then determine that the current working state is the non-working state.
[0161] In one embodiment, when the computer program is executed by a processor, the following steps are further specifically implemented:
[0162] If the non-working attribute does not exist in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not on does not exceed the fourth preset threshold, and the long-term flashing yellow light attribute exists in the attribute information of the current traffic light, determine the number of consecutive frames in which the current traffic light is continuously red and the number of consecutive frames in which it is continuously green according to the real-time status data;
[0163] If the number of consecutive frames in which the current traffic light is continuously red and the number of consecutive frames in which it is continuously green both do not exceed the fifth preset threshold, then determine that the current working state of the current traffic light is flashing yellow.
[0164] In one embodiment, when the computer program is executed by a processor, the following steps are further specifically implemented:
[0165] If the non-working attribute does not exist in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not on does not exceed the fourth preset threshold, and the long-term flashing yellow light attribute does not exist in the attribute information of the current traffic light, determine the number of times of switching between continuous non-lighting and continuous lighting of the yellow light of the current traffic light according to the real-time status data;
[0166] If the number of switching times exceeds the sixth preset threshold and the continuous frame numbers of non-lighting and lighting of the yellow light are both less than the seventh preset threshold, then determine that the current working state of the current traffic light is flashing yellow.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are further specifically implemented:
[0168] Update the current working state of the current traffic light to the historical status data;
[0169] Update the attribute information of the current traffic light according to the updated historical status data.
[0170] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0171] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope described in this specification.
[0172] The above embodiments only represent several implementation manners of the present application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.
Claims
1. A traffic light recognition method, characterized in that, The method includes: Obtaining current image data of the current traffic light; Obtaining real-time status data of the current traffic light according to the current image data; Obtaining attribute information of the current traffic light, where the attribute information is obtained according to historical status data of the current traffic light; Identifying the current working status of the current traffic light according to the attribute information and the real-time status data; Obtaining historical status data of the current traffic light within a preset time period, where the historical status data includes each data record, and each data record includes data on the signal light color of the current traffic light and whether it is lit; Determining a first ratio according to the historical status data, where the first ratio is the ratio of the number of data records in which the current traffic light is not lit to the total number of data records; If the first ratio exceeds a first preset threshold, adding a non-working attribute to the attribute information of the current traffic light; Determining a second ratio according to the historical status data, where the second ratio is the ratio of the total number of data records in which the current traffic light is not lit and lit yellow to the total number of data records; If the second ratio exceeds a second preset threshold, adding a long-term flashing yellow light attribute to the attribute information of the current traffic light.
2. The method according to claim 1, characterized in that, The identifying the current working status of the current traffic light according to the attribute information and the real-time status data includes: If the non-working attribute exists in the attribute information of the current traffic light, determining the number of consecutive frames in which the current traffic light is not lit according to the real-time status data; If the number of consecutive frames in which the current traffic light is not lit exceeds a third preset threshold, determining that the current working status is a non-working status; If the number of consecutive frames in which the current traffic light is not lit does not exceed the third preset threshold, determining the current working status according to the real-time status data.
3. The method according to claim 2, characterized in that, The method further includes: If the non-working attribute does not exist in the attribute information of the current traffic light and the number of consecutive frames in which the current traffic light is not lit exceeds a fourth preset threshold, determining that the current working status is a non-working status.
4. The method according to claim 3, characterized in that, The method further includes: If the non-working attribute does not exist in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not lit does not exceed the fourth preset threshold, and the long-term flashing yellow light attribute exists in the attribute information of the current traffic light, determining the number of consecutive frames in which the current traffic light is continuously red and continuously green according to the real-time status data; If the number of consecutive frames in which the current traffic light is continuously red and the number of consecutive frames in which the current traffic light is continuously green both do not exceed a fifth preset threshold, determining that the current working status of the current traffic light is flashing yellow.
5. The method according to claim 4, wherein The method further includes: If the non-working attribute does not exist in the attribute information of the current traffic light, the number of consecutive frames in which the current traffic light is not lit does not exceed the fourth preset threshold, and the long-term flashing yellow light attribute does not exist in the attribute information of the current traffic light, determining the number of times of switching between continuous non-lighting and continuous lighting of the yellow light of the current traffic light according to the real-time status data; If the number of switches exceeds the sixth preset threshold, and the continuous frame numbers of the non - illuminated and the illuminated yellow lights are both less than the seventh preset threshold, then determine that the current working state of the current traffic light is flashing yellow.
6. The method according to claim 1, characterized in that, The method further includes: Updating the current working state of the current traffic light to the historical state data; Updating the attribute information of the current traffic light according to the updated historical state data.
7. A traffic light recognition device, characterized in that, The device includes: A first acquisition module, configured to acquire the current image data of the current traffic light; A processing module, configured to obtain the real - time state data of the current traffic light according to the current image data; A second acquisition module, configured to acquire the attribute information of the current traffic light, where the attribute information is obtained according to the historical state data of the current traffic light; An identification module, configured to identify the current working state of the current traffic light according to the attribute information and the real - time state data. Obtain the historical state data of the current traffic light within a preset time period. The historical state data includes each data record, and each data record includes the signal light color of the current traffic light and the data of whether it is illuminated. Determine a first ratio according to the historical state data. The first ratio is the ratio of the number of data records where the current traffic light is not illuminated to the total number of data records. If the first ratio exceeds the first preset threshold, add the non - working attribute to the attribute information of the current traffic light. Determine a second ratio according to the historical state data. The second ratio is the ratio of the sum of the number of data records where the current traffic light is not illuminated and illuminated yellow to the total number of data records. If the second ratio exceeds the second preset threshold, add the long - term flashing yellow light attribute to the attribute information of the current traffic light.
8. A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Signal lamp detection method and device and computer readable storage medium
CN113723229A