Method for recognizing illumination state of traffic lights, electronic device, and storage medium
Abstract
A vehicle-borne method for recognizing the illumination state of traffic lights even against a backlighting of strong sunlight or other light source obtains a first image of a set of traffic lights in a road traffic environment. A segmentation map is acquired by dividing a first region from the first image, and an illumination region in the segmentation map is extracted by marking RGB pixels in the region which are of a preset threshold in brightness according to a training model. A lit color of the set of traffic lights is recognized according to a position of the illumination region in the segmentation map. By utilizing the method, accuracy of recognition of illumination state of traffic lights is improved.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1. A method for recognizing traffic lights, comprising:
acquiring a first image that comprises a set of traffic lights;
recognizing a lit color of the set of traffic lights in the first image;
in response that no lit color of the traffic lights is recognized, confirming that the first image is in a backlight scene;
when confirming that the first image is in the backlight scene, obtaining a segmentation map by dividing a first region from the first image, in which the first region is an image region of the set of traffic lights;
extracting an illumination region from the segmentation map, comprising: dividing the segmentation map into three regions equally, wherein each of the three regions corresponds to a signal light in the set of traffic lights; determining a brightness of each region of the three regions, and determining a region with the highest brightness among the three regions as the illumination region;
recognizing a lit color of the set of traffic lights according to a position of the illumination region in the segmentation map, comprising: acquiring a location of the illumination region and a location of each of the three regions; determining a region where the illumination region is located from the three regions as a target region, according to the location of the illumination region and the location of each of the three regions; outputting a lit color corresponding to the target region.
2. The method of claim 1 , wherein extracting an illumination region from the segmentation map comprises:
converting a red green blue (RGB) color gamut of pixels in the segmentation map to a hue, saturation, value (HSV) color gamut, and obtaining a converted segmentation map;
extracting the illumination region from the converted segmentation map using a preset threshold.
3. The method of claim 2 , wherein extracting the illumination region from the converted segmentation map using a preset threshold comprises:
acquiring a value of a V channel of each pixel in each of the three regions in the converted segmentation map;
determining pixels whose values of the V channel in each of the three regions are greater than the preset threshold as first pixels of the corresponding region;
determining a brightness of each of the three regions according to first pixels of each of the three regions, and determining the region with a highest brightness as the illumination region.
4. The method of claim 3 , further comprising:
acquiring values of the V channel of all pixels in the converted segmentation map;
obtaining the preset threshold by averaging the values.
5. The method of claim 1 , wherein obtaining a segmentation map by dividing a first region from the first image comprises:
obtaining the segmentation map by using a segmentation network to divide the first region from the first image.
6. An electronic device comprising:
a processor; and
a storage device storing a plurality of instructions, which when executed by the processor, cause the processor to:
acquire a first image that comprises a set of traffic lights;
recognize a lit color of the set of traffic lights in the first image:
in response that no lit color of the traffic lights is recognized, confirm that the first image is in a backlight scene;
when confirming that the first image is in the backlight scene, obtain a segmentation map by dividing a first region from the first image, in which the first region is an image region of the set of traffic lights;
extract an illumination region from the segmentation map, comprising: dividing the segmentation map into three regions equally, wherein each of the three regions corresponds to a signal light in the set of traffic lights: determining a brightness of each region of the three regions, and determining a region with the highest brightness among the three regions as the illumination region;
recognize a lit color of the set of traffic lights according to a position of the illumination region in the segmentation map, comprising: acquiring a location of the illumination region and a location of each of the three regions; determining a region where the illumination region is located from the three regions as a target region, according to the location of the illumination region and the location of each of the three regions: outputting a lit color corresponding to the target region.
7. The electronic device of claim 6 , wherein the processor is further caused to:
convert a red green blue (RGB) color gamut of pixels in the segmentation map to a hue, saturation, value (HSV) color gamut, and obtain a converted segmentation map;
extract the illumination region from the converted segmentation map using a preset threshold.
8. The electronic device of claim 7 , wherein the processor is further caused to:
acquire a value of a V channel of each pixel in each of the three regions in the converted segmentation map;
determine pixels whose values of the V channel in each of the three regions are greater than the preset threshold as the first pixels of the corresponding region;
determine a brightness of each of the three regions according to first pixels of each of the three regions, and determining the region with a highest brightness as the illumination region.
9. The electronic device of claim 8 , wherein the processor is further caused to:
acquire values of the V channel of all pixels in the converted segmentation map;
obtain the preset threshold by averaging the values.
10. The electronic device of claim 6 , wherein the processor is further caused to:
obtain the segmentation map by using a segmentation network to divide the first region from the first image.
11. A non-transitory storage medium having stored thereon at least one computer-readable instructions that, when executed by a processor of an electronic device, causes the processor to perform a method for recognizing traffic lights, the method comprising:
acquiring a first image that comprises a set of traffic lights;
recognizing a lit color of the set of traffic lights in the first image;
in response that no lit color of the traffic lights is recognized, confirming that the first image is in a backlight scene;
when confirming that the first image is in the backlight scene, obtaining a segmentation map by dividing a first region from the first image, in which the first region is an image region of the set of traffic lights;
extracting an illumination region from the segmentation map, comprising: dividing the segmentation map into three regions equally, wherein each of the three regions corresponds to a signal light in the set of traffic lights; determining a brightness of each region of the three regions, and determining a region with the highest brightness among the three regions as the illumination region;
recognizing a lit color of the set of traffic lights according to a position of the illumination region in the segmentation map, comprising: acquiring a location of the illumination region and a location of each of the three regions; determining a region where the illumination region is located from the three regions as a target region, according to the location of the illumination region and the location of each of the three regions; outputting a lit color corresponding to the target region.
12. The non-transitory storage medium of claim 11 , wherein extracting an illumination region from the segmentation map comprises:
converting a red green blue (RGB) color gamut of pixels in the segmentation map to a hue, saturation, value (HSV) color gamut, and obtaining a converted segmentation map;
extracting the illumination region from the converted segmentation map using a preset threshold.
13. The non-transitory storage medium of claim 12 , wherein extracting the illumination region from the converted segmentation map using a preset threshold comprises:
acquiring a value of a V channel of each pixel in each of the three regions in the converted segmentation map;
determining pixels whose values of the V channel in each of the three regions are greater than the preset threshold as the first pixels of the corresponding region;
determining a brightness of each of the three regions according to first pixels of each of the three regions, and determining the region with a highest brightness as the illumination region.
14. The non-transitory storage medium of claim 13 , further comprising:
acquiring values of the V channel of all pixels in the converted segmentation map;
obtaining the preset threshold by averaging the values.
15. The non-transitory storage medium of claim 11 , wherein obtaining a segmentation map by dividing a first region from the first image comprises:
obtaining the segmentation map by using a segmentation network to divide the first region from the first image.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.