WO2021073267A1 - 基于图像识别的行人闯红灯检测方法、装置及相关设备 - Google Patents
基于图像识别的行人闯红灯检测方法、装置及相关设备 Download PDFInfo
- Publication number
- WO2021073267A1 WO2021073267A1 PCT/CN2020/111884 CN2020111884W WO2021073267A1 WO 2021073267 A1 WO2021073267 A1 WO 2021073267A1 CN 2020111884 W CN2020111884 W CN 2020111884W WO 2021073267 A1 WO2021073267 A1 WO 2021073267A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- pedestrian
- images
- image
- red light
- zebra crossing
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06V—IMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
- G06V40/00—Recognition of biometric, human-related or animal-related patterns in image or video data
- G06V40/20—Movements or behaviour, e.g. gesture recognition
Definitions
- This application relates to the field of smart city and intelligent transportation technology, and in particular to a method, device and related equipment for detecting pedestrians running red lights based on image recognition.
- the first aspect of the present application provides a method for detecting pedestrian running through a red light based on image recognition.
- the method includes:
- a second aspect of the present application provides a terminal, the terminal includes a memory and a processor, the memory is configured to store at least one computer-readable instruction, and the processor is configured to execute the at least one computer-readable instruction to implement the following step:
- a third aspect of the present application provides a computer-readable storage medium that stores at least one computer-readable instruction, and when the at least one computer-readable instruction is executed by a processor, the following steps are implemented:
- a fourth aspect of the present application provides a pedestrian red light detection device based on image recognition, the device including:
- An acquiring module configured to acquire at least two first images containing pedestrians in the zebra crossing area when the indicator light corresponding to the zebra crossing is displayed as a red light;
- the recognition module is used to recognize whether the pedestrians in the at least two first images are the same pedestrian
- a first determining module configured to determine the behavior trajectory of the pedestrian based on the position of the pedestrian in the at least two first images based on the pedestrian in the at least two first images;
- the detection module is configured to use the YOLO target detection algorithm to detect whether there is a preset target object in each of the first images when the behavior trajectory of the pedestrian is perpendicular to the direction indicated by the zebra crossing;
- the second determining module is configured to determine that the pedestrian has not run a red light when the preset target object is present in each of the first images.
- the image recognition-based pedestrian red light detection method, device, and related equipment described in this application can promote the construction of smart cities and be applied to smart transportation, smart logistics, smart communities, smart urban management and other fields.
- This application acquires at least two first images containing pedestrians in the zebra crossing area when the indicator light corresponding to the zebra crossing is displayed as a red light; identifying whether the pedestrians in the at least two first images are the same pedestrian Based on the pedestrians in the at least two first images as the same pedestrian, determine the behavior trajectory of the pedestrian according to the position of the pedestrian in the at least two first images; when the behavior trajectory of the pedestrian is the same as that of the pedestrian When the indication direction of the zebra crossing is vertical, the YOLO target detection algorithm is used to detect whether there is a preset target object in each of the first images; when each of the first images has the preset target object, it is determined The pedestrian did not run the red light.
- the present application determines whether the pedestrian is in the positional relationship between the direction of the pedestrian’s trajectory and the direction indicated by the zebra crossing when the indicator light corresponding to the zebra crossing is displayed as a red light. Running a red light avoids the misjudgment of pedestrians who are going to the right direction as running a red light, reduces the misjudgment rate and improves the detection accuracy.
- FIG. 1 is a flowchart of a method for detecting pedestrian running through a red light based on image recognition provided in Embodiment 1 of the present application.
- Figure 2 is a schematic diagram of a pedestrian's behavior trajectory perpendicular to the direction indicated by the zebra crossing.
- Fig. 3 is a schematic diagram of a pedestrian's behavior trajectory parallel to the direction indicated by the zebra crossing.
- Fig. 4 is a structural diagram of a pedestrian red light detection device based on image recognition provided in the second embodiment of the present application.
- FIG. 5 is a schematic structural diagram of a terminal provided in Embodiment 3 of the present application.
- FIG. 1 is a flowchart of a method for detecting pedestrian running through a red light based on image recognition provided in Embodiment 1 of the present application.
- the method for detecting pedestrian red light running through image recognition can be applied to a terminal.
- the image-based method provided by the method of this application can be directly integrated on the terminal.
- the method for detecting pedestrian running through a red light based on image recognition specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some of the steps can be omitted.
- multiple traffic lights, multiple cameras, and multiple sets of zebra crossings are provided at the intersections.
- This application is described by taking one of the indicator lights, the camera corresponding to the indicator light, and the zebra crossing indicated by the indicator light as an example.
- the camera corresponding to the direction indicated by the indicator light captures an image in the area where the zebra crossing is located, and acquires at least two first images containing pedestrians.
- the acquiring at least two first images containing pedestrians in the zebra crossing area includes:
- At least two first images are filtered from the target image, where the at least two first images are continuous frame images.
- multiple target images containing pedestrians in the zebra crossing area continuously captured by the camera are acquired, wherein the target images are at least two first images that are consecutive frames.
- a face detection algorithm to detect whether there is a pedestrian in each of the monitored images includes:
- an image is taken through the camera corresponding to the indicator light as a background image; or an image is taken from the video.
- the frame when the indicator light corresponding to the zebra crossing is displayed as a red light and there are no pedestrians in the zebra crossing area is used as a background image.
- the background image only contains background information, such as sky information, road information, etc., and does not contain any personal information of pedestrians.
- the background image is an image in which the indicator light is displayed as a red light and there is no pedestrian
- the monitoring image is based on the background image with a pedestrian foreground image added to the zebra crossing area.
- the shooting position of the camera is fixed, that is, the size of the background image and the monitoring image are the same. Therefore, each pixel in the monitoring image and the corresponding pixel in the background image can be directly subjected to differential processing to remove the monitoring image.
- the obtained differential monitoring image basically only includes the foreground of pedestrians, which is beneficial to face detection.
- the features in each of the at least two first images are extracted, and the difference between the features in any two first images is compared whether the difference is less than the preset difference threshold, when any two first images
- the difference between the features in an image is less than the preset difference threshold, determine that the pedestrians in at least two first images are the same pedestrian, and when the difference between the features in any two first images is greater than the preset difference Value threshold to determine that the pedestrians in at least two first images are not the same pedestrian.
- identifying whether the pedestrians in the at least two first images are the same pedestrian is identifying whether the pedestrians in the at least two first differential monitoring images are the same pedestrian. Extract the features in each first differential monitoring image in at least two first differential monitoring images, and determine whether the difference between the features in any two first differential monitoring images is less than the preset difference threshold, and determine according to the comparison result Whether the pedestrians in the at least two first differential monitoring images are the same pedestrian, and then determine whether the pedestrians in the at least two first images are the same pedestrian.
- S13 Determine the behavior trajectory of the pedestrian based on the position of the pedestrian in the at least two first images based on the pedestrian in the at least two first images.
- multiple locations in multiple first images of the same pedestrian are extracted to determine the pedestrian trajectory of the pedestrian.
- the determining the behavior trajectory of the pedestrian based on the pedestrian in the at least two first images is the same pedestrian based on the position of the pedestrian in the at least two first images includes:
- center point position coordinates of the pedestrian in each of the first images Acquiring the center point position coordinates of the pedestrian in each of the first images, where the center point position coordinates include a center point abscissa and a center point ordinate;
- the behavior trajectory of the pedestrian is determined according to the lateral displacement and the longitudinal displacement of the pedestrian.
- the upper left corner of the first image with the smallest time is determined as the coordinate origin and the upper edge Determined as the horizontal axis coordinates and the left side as the vertical axis coordinates, wherein the horizontal axis coordinates and the vertical axis coordinates are used as a reference for the direction of the pedestrian movement trajectory, based on the reference and the reference in each of the first images
- the horizontal coordinate and the vertical coordinate of the center point in the center point position coordinates of the pedestrian determine the lateral displacement and the longitudinal displacement of the pedestrian.
- the display corresponding to crossing indicator when red, two first image of the camera in the continuous shooting with a pedestrian with F1, T 1 the first time the first captured image A, time T 2 of the second imaging a first image B, where, T1 ⁇ T2, the first upper left corner of the first image a captured at time T 1 is determined as the coordinate origin, then the first image a by The center position coordinates of the pedestrian F1 are (X 1 , Y 1 ), and the center position coordinates of the pedestrian F1 in the second first image B taken at time T 2 are (X 2 , Y 2 ), based on the The horizontal coordinates X 1 and X 2 of the center point of the pedestrian F1 determine that the lateral displacement of the pedestrian is equal to X 2 -X 1 , and the longitudinal displacement of the pedestrian is determined based on the vertical coordinates Y 1 and Y 2 of the center point of the pedestrian F1 It is equal to Y 2 -Y 1 , and the direction of the behavior track of the pedestrian is determined according to the lateral displacement of the pedestrian
- the determining the behavior trajectory of the pedestrian according to the lateral displacement and the longitudinal displacement of the pedestrian includes:
- the absolute value of the lateral displacement is less than the first threshold and the absolute value of the longitudinal displacement is greater than the second threshold, it is determined that the pedestrian's behavior trajectory is parallel to the direction indicated by the zebra crossing.
- the first threshold corresponding to the horizontal axis coordinate and the second threshold corresponding to the vertical axis coordinate can be preset. Determine the direction of the pedestrian’s behavior trajectory based on comparing the absolute value of the pedestrian's lateral displacement with the first threshold, and comparing the absolute value of the pedestrian's longitudinal displacement with the second threshold at the same time The relationship with the direction of the zebra crossing.
- the coordinates of the center position of the pedestrian F1 at time T 1 are (X 1 , Y 1 ), and the coordinates of the center position at time T 2 are (X 2 , Y 2 ), where T 1 ⁇ T 2 , the absolute value of the pedestrian's lateral displacement is equal to
- the second threshold value is N, when the
- the direction of passage of the pedestrian can be quickly determined, and whether the pedestrian is determined according to the direction of passage of the pedestrian Running a red light reduces the misjudgment rate of pedestrians running a red light.
- the preset target object refers to a motor vehicle, such as a motorcycle, a tricycle, or a bicycle
- the YOLO target detection algorithm is used to detect whether there is a preset target object in the first image.
- the YOLO target detection algorithm is a prior art, which is not described in detail in this application.
- the method further includes:
- the colors displayed by the indicator lights include red, green, and yellow. If the pedestrian's behavior trajectory is parallel to the direction of the zebra crossing, when the indicator light corresponding to the zebra crossing switches to green, the At least one second image in the zebra crossing area containing a pedestrian, the pedestrian in the second image is identified with the pedestrian in the first image, and if the pedestrian in the second image is identical to any one of the pedestrians in the first image The pedestrian in the first image is the same pedestrian, and it is determined that the pedestrian did not run a red light.
- the pedestrian runs a red light based on the pedestrian's behavior trajectory, it is possible to exclude pedestrians who fail to cross the zebra crossing during the period when the indicator is green and stay on the zebra crossing during the period when the indicator is red.
- the misjudgment is the case of running a red light, which reduces the misjudgment rate of pedestrians running a red light, and reduces labor costs to a certain extent.
- the method further includes:
- the coordinates of the center position of the pedestrian F1 in the first image at time T 3 are (X 3 , Y 3 ), and the coordinates of the center position in the second image at time T 4 are (X 4 , Y 4 ), where T 3 ⁇ T 4 , it is determined that the pedestrian F1 and the direction indicated by the zebra crossing are parallel, and before time T 3 , when the indicator light is green, the at least one piece containing the pedestrian is acquired
- the second image of F2 when the pedestrian F1 and the pedestrian F2 are not the same pedestrian, it means that the pedestrian F1 does not start to pass during the green light period, but starts to pass during the red light period, and the pedestrian F1 is determined Run the red light.
- the method further includes:
- feature recognition is performed on pedestrians who run red lights.
- the feature recognition includes appearance features but not limited to gender, clothes, height, etc.
- the feature recognition results are broadcast through voice, for example: "Handsome guys in red clothes do not run red lights ".
- targeted broadcasts are made to pedestrians who run red lights to increase the psychological pressure of the offenders, while reducing invalid and repetitive broadcasts and reducing noise.
- the pedestrian is warned of running the red light by voice broadcasting the pedestrian running the red light, and at the same time, the face image of the pedestrian whose number of red light running exceeds the preset threshold is projected on the electronic display screen, which increases the pedestrian's psychology of running the red light. The burden reduces the illegal behavior of pedestrians running red lights and ensures the safety of pedestrians.
- the method for detecting pedestrian running through a red light based on image recognition described in this application acquires at least two first images containing pedestrians in the zebra crossing area when the indicator light corresponding to the zebra crossing is displayed as a red light; Identify whether the pedestrians in the at least two first images are the same pedestrian; based on the pedestrians in the at least two first images are the same pedestrian, according to the positions of the pedestrians in the at least two first images Determine the behavior trajectory of the pedestrian; when the behavior trajectory of the pedestrian is perpendicular to the direction indicated by the zebra crossing, use the YOLO target detection algorithm to detect whether there is a preset target object in each of the first images; When there is the preset target object in the first image, it is determined that the pedestrian has not run a red light.
- the present application determines whether the pedestrian is in the positional relationship between the direction of the pedestrian’s trajectory and the direction indicated by the zebra crossing when the indicator light corresponding to the zebra crossing is displayed as a red light. Running a red light avoids the misjudgment of pedestrians who are going to the right direction as running a red light, reduces the misjudgment rate and improves the detection accuracy.
- Fig. 4 is a structural diagram of a pedestrian red light detection device based on image recognition provided in the second embodiment of the present application.
- the device 40 for detecting pedestrians crossing a red light based on image recognition may include multiple functional modules composed of program code segments.
- the program code of each program segment in the device 40 for detecting pedestrian red light running based on image recognition can be stored in the memory of the terminal and executed by the at least one processor to execute (see Figure 1 for details). Detection of pedestrians running red lights.
- the pedestrian red light running detection device 40 based on image recognition can be divided into multiple functional modules according to the functions it performs.
- the functional modules may include: an acquisition module 401, an identification module 402, a first determination module 403, a detection module 404, a second determination module 405, an extraction module 406, and a broadcasting module 407.
- the module referred to in this application refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, and are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.
- the acquiring module 401 is configured to acquire at least two first images containing pedestrians in the zebra crossing area when the indicator light corresponding to the zebra crossing is displayed as a red light.
- multiple traffic lights, multiple cameras, and multiple sets of zebra crossings are provided at the intersections.
- This application is described by taking one of the indicator lights, the camera corresponding to the indicator light, and the zebra crossing indicated by the indicator light as an example.
- the camera corresponding to the direction indicated by the indicator light captures an image in the area where the zebra crossing is located, and acquires at least two first images containing pedestrians.
- the acquiring at least two first images containing pedestrians in the zebra crossing area includes:
- At least two first images are filtered from the target image, where the at least two first images are continuous frame images.
- multiple target images containing pedestrians in the zebra crossing area continuously captured by the camera are acquired, wherein the target images are at least two first images that are consecutive frames.
- a face detection algorithm to detect whether there is a pedestrian in each of the monitored images includes:
- an image is taken through the camera corresponding to the indicator light as a background image; or an image is taken from the video.
- the frame when the indicator light corresponding to the zebra crossing is displayed as a red light and there are no pedestrians in the zebra crossing area is used as a background image.
- the background image only contains background information, such as sky information, road information, etc., and does not contain any personal information of pedestrians.
- the background image is an image in which the indicator light is displayed as a red light and there is no pedestrian
- the monitoring image is based on the background image with a pedestrian foreground image added to the zebra crossing area.
- the shooting position of the camera is fixed, that is, the size of the background image and the monitoring image are the same. Therefore, each pixel in the monitoring image and the corresponding pixel in the background image can be directly subjected to differential processing to remove the monitoring image.
- the obtained differential monitoring image basically only includes the foreground of pedestrians, which is beneficial to face detection.
- the recognition module 402 is used to recognize whether the pedestrians in the at least two first images are the same pedestrian.
- the features in each of the at least two first images are extracted, and the difference between the features in any two first images is compared whether the difference is less than the preset difference threshold, when any two first images
- the difference between the features in an image is less than the preset difference threshold, determine that the pedestrians in at least two first images are the same pedestrian, and when the difference between the features in any two first images is greater than the preset difference Value threshold to determine that the pedestrians in at least two first images are not the same pedestrian.
- identifying whether the pedestrians in the at least two first images are the same pedestrian is identifying whether the pedestrians in the at least two first differential monitoring images are the same pedestrian. Extract the features in each first differential monitoring image in at least two first differential monitoring images, and determine whether the difference between the features in any two first differential monitoring images is less than the preset difference threshold, and determine according to the comparison result Whether the pedestrians in the at least two first differential monitoring images are the same pedestrian, and then determine whether the pedestrians in the at least two first images are the same pedestrian.
- the first determination module 403 used for the recognition module 402 to recognize that the pedestrian in the at least two first images is the same pedestrian, and determine the pedestrian based on the position of the pedestrian in the at least two first images The trajectory of behavior.
- multiple locations in multiple first images of the same pedestrian are extracted to determine the pedestrian trajectory of the pedestrian.
- the determining the behavior trajectory of the pedestrian based on the pedestrian in the at least two first images as the same pedestrian according to the position of the pedestrian in the at least two first images includes:
- center point position coordinates of the pedestrian in each of the first images Acquiring the center point position coordinates of the pedestrian in each of the first images, where the center point position coordinates include a center point abscissa and a center point ordinate;
- the behavior trajectory of the pedestrian is determined according to the lateral displacement and the longitudinal displacement of the pedestrian.
- the upper left corner of the first image with the smallest time is determined as the coordinate origin and the upper edge Determined as the horizontal axis coordinates and the left side as the vertical axis coordinates, wherein the horizontal axis coordinates and the vertical axis coordinates are used as a reference for the direction of the pedestrian movement trajectory, based on the reference and the reference in each of the first images
- the horizontal coordinate and the vertical coordinate of the center point in the center point position coordinates of the pedestrian determine the lateral displacement and the longitudinal displacement of the pedestrian.
- the display corresponding to crossing indicator when red, two first image of the camera in the continuous shooting with a pedestrian with F1, T 1 the first time the first captured image A, time T 2 of the second imaging a first image B, where, T 1 ⁇ T 2, the time T 1 the upper left corner of the captured first image a is determined as the first coordinate origin, then the first image a
- the coordinates of the center position of the pedestrian F1 are (X 1 , Y 1 ), and the coordinates of the center position of the pedestrian F1 in the second first image B taken at time T 2 are (X 2 , Y 2 ), based on The horizontal coordinates X 1 and X 2 of the center point of the pedestrian F1 determine that the lateral displacement of the pedestrian is equal to X 2 -X 1 , and the vertical coordinates Y 1 and Y 2 of the center point of the pedestrian F1 determine the pedestrian’s
- the longitudinal displacement is equal to Y 2 -Y 1 , and the behavior track direction of the pedestrian is determined according to the lateral displacement of the pedestrian
- the determining the behavior trajectory of the pedestrian according to the lateral displacement and the longitudinal displacement of the pedestrian includes:
- the absolute value of the lateral displacement is less than the first threshold and the absolute value of the longitudinal displacement is greater than the second threshold, it is determined that the pedestrian's behavior trajectory is parallel to the direction indicated by the zebra crossing.
- the first threshold corresponding to the horizontal axis coordinate and the second threshold corresponding to the vertical axis coordinate can be preset. Determine the direction of the pedestrian’s behavior trajectory based on comparing the absolute value of the pedestrian's lateral displacement with the first threshold, and comparing the absolute value of the pedestrian's longitudinal displacement with the second threshold at the same time The relationship with the direction of the zebra crossing.
- the coordinates of the center position of the pedestrian F1 at time T 1 are (X 1 , Y 1 ), and the coordinates of the center position at time T 2 are (X 2 , Y 2 ), where T 1 ⁇ T 2 , the absolute value of the pedestrian's lateral displacement is equal to
- the second threshold value is N, when the
- the direction of passage of the pedestrian can be quickly determined, and whether the pedestrian is determined according to the direction of passage of the pedestrian Running a red light reduces the misjudgment rate of pedestrians running a red light.
- the detection module 404 is configured to use the YOLO target detection algorithm to detect whether there is a preset target object in each of the first images when the behavior trajectory of the pedestrian is perpendicular to the direction indicated by the zebra crossing.
- the preset target object refers to a motor vehicle, such as a motorcycle, a tricycle, or a bicycle
- the YOLO target detection algorithm is used to detect whether there is a preset target object in the first image.
- the YOLO target detection algorithm is a prior art, which is not described in detail in this application.
- the second determination module 405 is configured to determine that the pedestrian has not run a red light when the detection module 404 detects that there is the preset target object in each of the first images.
- the acquisition module 401 when the behavior track of the pedestrian is parallel to the indication direction of the zebra crossing, acquire at least one of the zebra crossing areas before the indicator light is displayed as a red light. Second image of pedestrians;
- the recognition module 402 is also used to recognize whether the pedestrian in the at least two first images and the pedestrian in the at least one second image are the same pedestrian;
- the second determining module 405 is further configured to determine that the pedestrian in the at least two first images and the pedestrian in the at least one second image are the same pedestrian, determining that the pedestrian has not run a red light.
- the colors displayed by the indicator lights include red, green, and yellow. If the pedestrian's behavior trajectory is parallel to the direction of the zebra crossing, when the indicator light corresponding to the zebra crossing switches to green, the At least one second image in the zebra crossing area containing a pedestrian, the pedestrian in the second image is identified with the pedestrian in the first image, and if the pedestrian in the second image is identical to any one of the pedestrians in the first image The pedestrian in the first image is the same pedestrian, and it is determined that the pedestrian did not run a red light.
- the pedestrian runs a red light based on the pedestrian's behavior trajectory, it is possible to exclude pedestrians who fail to cross the zebra crossing during the period when the indicator is green and stay on the zebra crossing during the period when the indicator is red.
- the misjudgment is the case of running a red light, which reduces the misjudgment rate of pedestrians running a red light, and reduces labor costs to a certain extent.
- the second determining module 405 is further configured to determine that the pedestrian runs a red light when the detection module 404 detects that there is no predetermined target object in the at least two first images; or
- the second determining module 405 is further configured to determine that when the recognition module 402 recognizes that the pedestrian in the at least two first images and the pedestrian in the at least one second image are not the same pedestrian, The pedestrian ran through the red light.
- the coordinates of the center position of the pedestrian F1 in the first image at time T 3 are (X 3 , Y 3 ), and the coordinates of the center position in the second image at time T 4 are (X 4 , Y 4 ), where T 3 ⁇ T 4 , it is determined that the pedestrian F1 and the direction indicated by the zebra crossing are parallel, and before time T 3 , when the indicator light is green, the at least one piece containing the pedestrian is acquired
- the second image of F2 when the pedestrian F1 and the pedestrian F2 are not the same pedestrian, it means that the pedestrian F1 does not start to pass during the green light period, but starts to pass during the red light period, and the pedestrian F1 is determined Run the red light.
- the recognition module 402 is further configured to perform feature recognition on the pedestrian;
- Extraction module 406 used to extract the recognition result of the feature recognition
- Broadcast module 407 used to perform voice broadcast according to the recognition result.
- feature recognition is performed on pedestrians who run red lights.
- the feature recognition includes appearance features but not limited to gender, clothes, height, etc.
- the feature recognition results are broadcast through voice, for example: "Handsome guys in red clothes do not run red lights ".
- targeted broadcasts are made to pedestrians who run red lights to increase the psychological pressure of the offenders, while reducing invalid and repetitive broadcasts and reducing noise.
- the pedestrian is warned of running the red light by voice broadcasting the pedestrian running the red light, and at the same time, the face image of the pedestrian whose number of red light running exceeds the preset threshold is projected on the electronic display screen, which increases the pedestrian's psychology of running the red light. The burden reduces the illegal behavior of pedestrians running red lights and ensures the safety of pedestrians.
- the image recognition-based pedestrian red light detection device described in this application acquires at least two first images containing pedestrians in the zebra crossing area when the indicator light corresponding to the zebra crossing is displayed as a red light; Identify whether the pedestrians in the at least two first images are the same pedestrian; based on the pedestrians in the at least two first images are the same pedestrian, according to the positions of the pedestrians in the at least two first images Determine the behavior trajectory of the pedestrian; when the behavior trajectory of the pedestrian is perpendicular to the direction indicated by the zebra crossing, use the YOLO target detection algorithm to detect whether there is a preset target object in each of the first images; When there is the preset target object in the first image, it is determined that the pedestrian has not run a red light.
- the present application determines whether the pedestrian is in the positional relationship between the direction of the pedestrian’s trajectory and the direction indicated by the zebra crossing when the indicator light corresponding to the zebra crossing is displayed as a red light. Running a red light avoids the misjudgment of pedestrians who are going to the right direction as running a red light, reduces the misjudgment rate and improves the detection accuracy.
- the terminal 5 includes a memory 51, at least one processor 52, at least one communication bus 53 and a transceiver 54.
- the structure of the terminal shown in FIG. 5 does not constitute a limitation of the embodiment of the present application. It may be a bus-type structure or a star structure.
- the terminal 5 may also include more than that shown in the figure. More or less other hardware or software, or different component arrangements.
- the terminal 5 is a terminal that can automatically perform numerical calculation and/or information processing in accordance with pre-set or stored instructions.
- Its hardware includes, but is not limited to, a microprocessor, an application specific integrated circuit, and Programming gate arrays, digital processors and embedded devices, etc.
- the terminal 5 may also include client equipment.
- the client equipment includes, but is not limited to, any electronic product that can interact with the client through a keyboard, a mouse, a remote control, a touch panel, or a voice control device, for example, a personal computer. Computers, tablets, smart phones, digital cameras, etc.
- terminal 5 is only an example. If other existing or future electronic products can be adapted to this application, they should also be included in the protection scope of this application and included here by reference.
- the memory 51 is used to store program codes and various data, such as a pedestrian red light detection device 40 based on image recognition installed in the terminal 5, and realizes high-speed, high-speed, and high-speed operation during the operation of the terminal 5. Automatically complete the access of programs or data.
- the memory 51 includes read-only memory (Read-Only Memory, ROM), random access memory, programmable read-only memory (Programmable Read-Only Memory, PROM), and erasable programmable read-only memory (Erasable Programmable Read-Only Memory).
- EPROM One-time Programmable Read-Only Memory
- OTPROM One-time Programmable Read-Only Memory
- EEPROM Electronically-Erasable Programmable Read-Only Memory
- CD-ROM Compact Disc Read-Only Memory
- CD-ROM Compact Disc Read-Only Memory
- the computer-readable storage medium may be non-volatile or volatile.
- the at least one processor 52 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same function or different functions, including one Or a combination of multiple central processing units (CPU), microprocessors, digital processing chips, graphics processors, and various control chips.
- the at least one processor 52 is the control core (Control Unit) of the terminal 5.
- Various interfaces and lines are used to connect the various components of the entire terminal 5, and by running or executing programs or modules stored in the memory 51, And call the data stored in the memory 51 to execute various functions of the terminal 5 and process data.
- the at least one communication bus 53 is configured to implement connection and communication between the memory 51 and the at least one processor 52 and the like.
- the terminal 5 may also include a power source (such as a battery) for supplying power to various components.
- the power source may be logically connected to the at least one processor 52 through a power management device, so as to realize management through the power management device. Functions such as charging, discharging, and power management.
- the power supply may also include any components such as one or more DC or AC power supplies, recharging devices, power failure detection circuits, power converters or inverters, and power status indicators.
- the terminal 5 may also include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
- the above-mentioned integrated unit implemented in the form of a software function module may be stored in a computer readable storage medium.
- the above-mentioned software function module is stored in a storage medium and includes several instructions to make a computer device (which may be a personal computer, a terminal, or a network device, etc.) or a processor execute the method described in each embodiment of the present application. section.
- the at least one processor 52 can execute the operating device of the terminal 5 and various installed applications (such as the image recognition-based pedestrian red light detection device 40), Program code, etc., for example, the above-mentioned modules.
- the memory 51 stores program code
- the program code can be divided into one or more modules/units
- the at least one processor 52 can call the program code stored in the memory 51 to perform related functions .
- the various modules described in FIG. 4 are program codes stored in the memory 51 and executed by the at least one processor 52, so as to realize the functions of the various modules to achieve a pedestrian running a red light based on image recognition.
- the one or more modules may be a series of computer-readable instruction segments capable of completing specific functions, and the computer-readable instruction segments are used to describe the execution process of the program code in the terminal 5.
- the memory 51 stores a plurality of computer-readable instructions, and the plurality of computer-readable instructions are executed by the at least one processor 52 to realize the detection of pedestrians running red lights based on image recognition.
- the disclosed device and method can be implemented in other ways.
- the device embodiments described above are only illustrative.
- the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
- modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
- the functional modules in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
- the above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional modules.
Landscapes
- Engineering & Computer Science (AREA)
- Human Computer Interaction (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Health & Medical Sciences (AREA)
- Psychiatry (AREA)
- Social Psychology (AREA)
- Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Traffic Control Systems (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
本申请涉及智慧城市及智慧交通技术领域,提供一种基于图像识别的行人闯红灯检测方法,包括:在斑马线对应的指示灯显示为红灯时,连续获取斑马线区域内的至少两张包含了行人的第一图像;当第一图像中的行人为同一个行人,根据行人的位置确定行人的行为轨迹,当行人的行为轨迹与斑马线的指示方向垂直时,采用YOLO目标检测算法检测到每张第一图像中均有预设目标对象时,确定行人未闯红灯。本申请还提供一种基于图像识别的行人闯红灯检测装置及相关设备。本申请能够根据行人的行为轨迹确定行人的通行方向,避免将通行方向正确的行人误判为闯红灯,降低了误判率,提高了检测精度。
Description
本申请要求于2019年10月18日提交中国专利局,申请号为201910995454.X申请名称为“基于图像识别的行人闯红灯检测方法、装置及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及智慧城市及智能交通技术领域,具体涉及一种基于图像识别的行人闯红灯检测方法、装置及相关设备。
随着我国经济的快速发展,申请人发现私家车拥有数量的日益增多,道路拥挤、堵塞现象已越来越严重,其中行人与行车矛盾最为突出。现阶段行人与行车抢占道路资源而导致的交通事故频发,已然成为城市道路交通的一大隐患。
目前在城市中有很多由红绿灯控制交通的交叉路口,在这些交叉路口安装有摄像头,通过摄像头检测斑马线上是否有行人,一旦摄像头在红灯时检测到斑马线上出现了行人,即判定该行人有闯红灯的行为。然而,发明人意识到,上述情形的判定并未将行人的行为轨迹与实际情形相结合来考虑,将正常通行的行人误判为闯红灯,导致检测结果不准。
由此有必要提供一种新的基于图像识别的行人闯红灯检测方案,以解决现有技术中未考虑行人的行为轨迹,导致检测结果精度不高的技术问题。
发明内容
鉴于以上内容,有必要提出一种基于图像识别的行人闯红灯检测方法、装置及相关设备,能够根据行人的行为轨迹确定行人的通行方向,避免将通行方向正确的行人误判为闯红灯,降低了误判率,提高了检测精度。
本申请的第一方面提供一种基于图像识别的行人闯红灯检测方法,所述方法包括:
在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;
识别所述至少两张第一图像中的行人是否为同一个行人;
基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;
当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;
当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
本申请的第二方面提供一种终端,所述终端包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:
在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;
识别所述至少两张第一图像中的行人是否为同一个行人;
基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;
当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;
当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
本申请的第三方面提供一种计算机可读存储介质,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:
在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;
识别所述至少两张第一图像中的行人是否为同一个行人;
基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;
当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;
当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
本申请的第四方面提供一种基于图像识别的行人闯红灯检测装置,所述装置包括:
获取模块,用于在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;
识别模块,用于识别所述至少两张第一图像中的行人是否为同一个行人;
第一确定模块,用于基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;
检测模块,用于当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;
第二确定模块,用于当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
综上所述,本申请所述的基于图像识别的行人闯红灯检测方法、装置及相关设备,能够推动智慧城市的建设,应用于智慧交通、智慧物流、智慧社区、智慧城管等领域。本申请通过在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;识别所述至少两张第一图像中的行人是否为同一个行人;基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。本申请通过当斑马线对应的指示灯显示为红灯时,所述摄像头连续拍摄的多张第一图像中的行人的行为轨迹方向与所述斑马线指示方向之间的位置关系,确定所述行人是否闯红灯,避免了通行向正确的行人误判为闯红灯,降低了误判率,提高了检测精度。
图1是本申请实施例一提供的基于图像识别的行人闯红灯检测方法的流程图。
图2是行人的行为轨迹与斑马线指示方向垂直的示意图。
图3是行人的行为轨迹与斑马线指示方向平行的示意图。
图4是本申请实施例二提供的基于图像识别的行人闯红灯检测装置的结构图。
图5是本申请实施例三提供的终端的结构示意图。
为了能够更清楚地理解本申请的上述目的、特征和优点,下面结合附图和具体实施例对本申请进行详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技 术人员通常理解的含义相同。本文中在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。
实施例一
图1是本申请实施例一提供的基于图像识别的行人闯红灯检测方法的流程图。
在本实施例中,所述基于图像识别的行人闯红灯检测方法可以应用于终端中,对于需要进行基于图像识别的行人闯红灯检测的终端,可以直接在终端上集成本申请的方法所提供的基于图像识别的行人闯红灯检测的功能,或者以软件开发工具包(Software Development Kit,SKD)的形式运行在终端中。
如图1所示,所述基于图像识别的行人闯红灯检测方法具体包括以下步骤,根据不同的需求,该流程图中步骤的顺序可以改变,某些可以省略。
S11:在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像。
本实施例中,在十字路口处均设置有多个交通指示灯、多个摄像头及多组斑马线。本申请以其中的一个指示灯及所述指示灯对应的摄像头和所述指示灯指示的斑马线为例进行说明。当所述指示灯显示为红灯时,所述指示灯指示方向所对应的摄像头拍摄所述斑马线所在区域内的图像,获取至少两张包含有行人的第一图像。
优选的,所述获取所述斑马线区域内的至少两张包含了行人的第一图像包括:
连续获取所述斑马线区域内的多张监测图像;
采用人脸检测算法检测每张所述监测图像中是否有行人;
从所述多张监测图像中筛选出有行人的目标图像;
从所述目标图像中筛选出至少两张第一图像,其中,所述至少两张第一图像为连续帧图像。
本实施例中,通过获取所述摄像头连续拍摄的所述斑马线区域内的多张包含有行人的目标图像,其中,所述目标图像为至少两张为连续帧的第一图像。
进一步的,所述采用人脸检测算法检测每张所述监测图像中是否有行人包括:
111)获取所述斑马线区域内的背景图像;
本实施例中,在斑马线对应的指示灯显示为红灯且所述斑马线区域内没有行人时,通过所述指示灯对应的所述摄像头拍摄一张图像,作为背景图像;或者从视频中截取一帧所述斑马线对应的指示灯显示为红灯且所述斑马线区域内没有行人时的图像,作为背景图像。
应当理解的是,所述背景图像中只包含背景信息,例如,天空信息,马路信息等,而不包含任何行人的个人信息。
112)将每张所述监测图像与所述背景图像进行差分处理得到差分监测图像;
本实施例中,由于背景图像为所述指示灯显示为红灯且无行人的图像,监测图像是在背景图像的基础上在所述斑马线区域上增加了行人这一前景的图像,由于所述摄像头的拍摄位置固定,即背景图像与所述监测图像的大小是相同的,因而可以直接将监测图像中的每个像素与所述背景图像中的相对应的像素进行差分处理,去掉监测图像中属于背景的区域,得到的差分监测图像基本上仅包括了行人这一前景,从而有利于人脸检测。
113)采用所述人脸检测算法检测每张差分监测图像中是否有行人。
本实施例中,通过对每张差分监测图像采用人脸检测算法进行人脸检测,确定每张所述差分监测图像中是否有行人,其中,所述人脸检测算法为现有技术,本申请在此不做详细阐述。
S12:识别所述至少两张第一图像中的行人是否为同一个行人。
本实施例中,提取至少两张第一图像中每张第一图像中的特征,通过比较任意两张第一图像中的特征的差值是否均小于预设差值阈值,当任意两张第一图像中的特征的差值均小于预设差值阈值时,确定至少两张第一图像中的行人为同一个行人,当任意两张第一图像中的 特征的差值均大于预设差值阈值,确定至少两张第一图像中的行人不为同一个行人。关于特征提取为现有技术,本申请不做详细介绍。
优选的,识别所述至少两张第一图像中的行人是否为同一个行人为识别至少两张第一差分监测图像中的行人是否为同一个行人。提取至少两张第一差分监测图像中每张第一差分监测图像中的特征,通过比较任意两张第一差分监测图像中的特征的差值是否均小于预设差值阈值,根据比较结果确定至少两张第一差分监测图像中的行人是否为同一个行人,进而确定至少两张第一图像中的行人是否为同一个行人。
S13:基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹。
本实施例中,提取出同一行人的多张第一图像中的多个位置确定所述行人的行人轨迹。
优选的,所述基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹包括:
将所述第一图像的左上角确定为坐标原点,所述第一图像的上边确定为横坐标轴,所述第一图像的左边确定为纵坐标轴;
获取每张所述第一图像中所述行人的中心点位置坐标,其中,所述中心点位置坐标包括中心点横坐标和中心点纵坐标;
基于每张所述第一图像中的所述中心点横坐标确定所述行人的横向位移;
基于每张所述第一图像中的所述中心点纵坐标确定所述行人的纵向位移;
根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹。
本实施例中,当所述摄像头拍摄到同一个行人的多张第一图像时,根据所述第一图像中携带的时间帧,将时间最小的第一图像的左上角确定为坐标原点、上边确定为横轴坐标和左边确定为纵轴坐标,其中,所述横轴坐标和所述纵轴坐标作为行人移动轨迹方向的基准,基于所述基准及每张所述第一图像中的所述行人的中心点位置坐标中的中心点横坐标和中心点纵坐标确定所述行人的横向位移和纵向位移。如图2所示,在斑马线对应的指示灯显示为红灯时,所述摄像头连续拍摄的两张第一图像中包含有同一个行人F1,T
1时刻拍摄的第一张第一图像A,T
2时刻拍摄的第二张第一图像B,其中,T1<T2,将T
1时刻拍摄的第一张第一图像A的左上角确定为坐标原点,则所述第一图像A中的所述行人F1的中心位置坐标为(X
1,Y
1),T
2时刻拍摄的第二张第一图像B中的所述行人F1的中心位置坐标为(X
2,Y
2),基于所述行人F1的中心点的横坐标X
1和X
2确定所述行人的横向位移等于X
2-X
1,基于所述行人F1的中心点的纵坐标Y
1和Y
2确定所述行人的纵向位移等于Y
2-Y
1,根据所述行人的横向位移和所述行人的纵向位移确定所述行人的行为轨迹方向。
进一步的,所述根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹包括:
判断所述横向位移的绝对值是否大于第一阈值及所述纵向位移的绝对值是否大于第二阈值;
当所述横向位移的绝对值大于所述第一阈值,且所述纵向位移的绝对值小于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向垂直;
当所述横向位移的绝对值小于所述第一阈值,且所述纵向位移的绝对值大于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向平行。
本实施例中,可以预先设置横轴坐标对应的第一阈值,和纵轴坐标对应的第二阈值。根据比对所述行人的横向位移的绝对值与所述第一阈值的大小,同时比对所述行人的纵向位移的绝对值与所述第二阈值的大小来确定所述行人的行为轨迹方向与所述斑马线的指示方向之间的关系。
参阅图2所示,假设所述行人F1在T
1时刻的中心位置坐标为(X
1,Y
1),T
2时刻的中心位置坐标为(X
2,Y
2),其中,T
1<T
2,则所述行人横向位移的绝对值等于||X
2-X
1||,所述行人的纵向位移的绝对值等于||Y
2-Y
1||,预先设置的第一阈值为M,所述第二阈值为N,当 所述||X
2-X
1||≥M且所述||Y
2-Y
1||≤N时,认为所述行人横穿斑马线,即所述行人的行为轨迹与所述斑马线的指示方向垂直;当所述||X
2-X
1||≤M且所述||Y
2-Y
1||≥N时,认为所述行人过斑马线,即所述行人的行为轨迹与所述斑马线的指示方向平行,M或者N可以为0。
本实施例中,通过所述行人的行为轨迹方向与所述斑马线的指示方向之间的关系,可以快速的确定出所述行人的通行方向,并根据所述行人的通行方向确定所述行人是否闯红灯,减少了行人闯红灯的误判率。
S14:当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象。
本实施例中,所述预设目标对象是指机动车,比如摩托车,三轮车或者自行车等,采用YOLO目标检测算法检测所述第一图像中是否有预设目标对象。
本实施例中,所述YOLO目标检测算法为现有技术,本申请在此不作详细阐述。
S15:当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
本实施例中,当采用YOLO目标检测算法检测的每张所述第一图像中均有预设目标对象时,确定所述行人未闯红灯。
再次参阅图2所示,假设所述行人F1在T
1时刻的第一图像中的中心位置坐标为(X
1,Y
1),T
2时刻的第一图像中的中心位置坐标为(X
2,Y
2),其中,T
1<T
2,所述行人F1的行为轨迹与所述斑马线的指示方向垂直,如果在T
1时刻和T
2时刻拍摄的所述第一图像中都检测到既有行人,又有预设目标对象,如电动车,说明所述行人在正常骑电动车过马路,确定所述行人未闯红灯,可以避免行人骑着摩托车或者电动车沿着绿灯指示方向在机动车轨道上低速行驶穿过指示灯显示为红灯的斑马线时被摄像头抓拍到行人图像误判为闯红灯的现象,在一定的程度上减小了行人闯红灯的误判率。
进一步的,所述方法还包括:
当所述行人的行为轨迹与所述斑马线的指示方向平行时,获取所述指示灯显示为红灯之前的所述斑马线区域内的至少一张包含了行人的第二图像;
识别所述至少两张第一图像中的行人与所述至少一张第二图像中的行人是否为同一个行人;
当所述至少两张第一图像中的行人与所述至少一张第二图像中的行人为同一个行人时,确定所述行人未闯红灯。
本实施例中,指示灯显示的颜色包括红色、绿色和黄色三种,如果所述行人的行为轨迹与所述斑马线的指示方向平行时,在斑马线对应的指示灯切换为绿灯时,获取所述斑马线区域内的至少一张包含了行人的第二图像,将所述第二图像中的行人与所述第一图像中的行人进行识别,若所述第二图像中的行人与所述任意一张第一图像中的行人为同一个行人,确定所述行人未闯红灯。
示例性的,假设所述行人F1在T
3时刻的第一图像中的中心位置坐标为(X
3,Y
3),T
4时刻的第一图像中的中心位置坐标为(X
4,Y
4),其中,T
3<T
4,确定所述行人的行为轨迹与所述斑马线指示方向平行,如图3所示。在指示灯切换为红灯之前,获取所述指示灯为绿灯时的斑马线区域内的至少一张包含了所述行人F1的第二图像,确定所述行人F1在绿灯期间未通过所述斑马线区域,为滞留在斑马线上,不属于闯红灯。
本实施例中,通过所述行人的行为轨迹判断所述行人是否闯红灯,可以排除在所述指示灯显示为绿灯期间未通过斑马线且在所述指示灯为红灯期间滞留在斑马线上的行人被误判为闯红灯的情况,减小了行人闯红灯的误判率,在一定的程度上降低了人工成本。
更进一步的,所述方法还包括:
当检测到所述至少两张第一图像中没有所述预设目标对象时,确定所述行人闯红灯;或者
当所述至少两张第一图像中的行人与所述至少一张第二图像中的行人不为同一个行人时, 确定所述行人闯红灯。
参阅图3所示,假设所述行人F1在T
3时刻的第一图像中的中心位置坐标为(X
3,Y
3),T
4时刻的第一图像中的中心位置坐标为(X
4,Y
4),其中,T
3<T
4,确定所述行人F1和所述斑马线指示的方向平行,在T
3时刻和T
4时刻拍摄到的所述第一图像中有一张没有检测到预设目标对象,说明所述行人的行为轨迹与所述斑马线指示的方向平行,确定所述行人闯红灯。
再次参阅图3所示,假设所述行人F1在T
3时刻的第一图像中的中心位置坐标为(X
3,Y
3),T
4时刻的第二图像中的中心位置坐标为(X
4,Y
4),其中,T
3<T
4,确定所述行人F1和所述斑马线指示的方向平行,在T
3时刻之前,当所述指示灯为绿灯时获取所述至少一张包含了行人F2的第二图像,当所述行人F1和所述行人F2不为同一个行人时,说明所述行人F1不是在绿灯期间就开始通行,而是在红灯期间开始通行,确定所述行人F1闯红灯。
本实施例中,当确定所述行人和所述斑马线指示的方向平行时,通过判断所述第一图像中是否有预设目标对象或者所述第二图像中的行人是否与所述第一图像中的行人是否为同一行人,确定所述行人是否闯红灯,避免了因行人正常过马路而被误判为闯红灯的现象,在一定的程度上降低了闯红灯检测的误判率。
更进一步的,当在确定所述行人闯红灯之后,所述方法还包括:
对所述行人进行特征识别;
提取所述特征识别的识别结果;
根据所述识别结果进行语音播报。
本实施例中,对闯红灯的行人进行特征识别,所述特征识别包括外观特征但不限于性别、衣服、身高等,通过语音播报所述特征识别结果,例如:“穿红衣服的帅哥请勿闯红灯”。
本实施例中,通过对闯红灯的行人进行有针对性的播报,增加违法者心理压力,同时减少无效重复的播报,降低噪声。本实施例中,通过对所述行人闯红灯进行语音播报,告警所述行人闯红灯,同时将闯红灯次数超过预设的次数阈值的行人的人脸图像投影到电子显示屏上,增加了行人闯红灯的心理负担,减少了行人闯红灯的违法行为,保证了行人的出行安全。
综上所述,本申请所述的基于图像识别的行人闯红灯检测方法,通过在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;识别所述至少两张第一图像中的行人是否为同一个行人;基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。本申请通过当斑马线对应的指示灯显示为红灯时,所述摄像头连续拍摄的多张第一图像中的行人的行为轨迹方向与所述斑马线指示方向之间的位置关系,确定所述行人是否闯红灯,避免了通行向正确的行人误判为闯红灯,降低了误判率,提高了检测精度。
实施例二
图4是本申请实施例二提供的基于图像识别的行人闯红灯检测装置的结构图。
在一些实施例中,所述基于图像识别的行人闯红灯检测装置40可以包括多个由程序代码段所组成的功能模块。所述基于图像识别的行人闯红灯检测装置40中的各个程序段的程序代码可以存储于终端的存储器中,并由所述至少一个处理器所执行,以执行(详见图1描述)基于图像识别的行人闯红灯的检测。
本实施例中,所述基于图像识别的行人闯红灯检测装置40根据其所执行的功能,可以被划分为多个功能模块。所述功能模块可以包括:获取模块401、识别模块402、第一确定模块403、检测模块404、第二确定模块405、提取模块406及播报模块407。本申请所称的模块是指一种能够被至少一个处理器所执行并且能够完成固定功能的一系列计算机程序段,其存储在存储器中。在本实施例中,关于各模块的功能将在后续的实施例中详述。
获取模块401:用于在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至 少两张包含了行人的第一图像。
本实施例中,在十字路口处均设置有多个交通指示灯、多个摄像头及多组斑马线。本申请以其中的一个指示灯及所述指示灯对应的摄像头和所述指示灯指示的斑马线为例进行说明。当所述指示灯显示为红灯时,所述指示灯指示方向所对应的摄像头拍摄所述斑马线所在区域内的图像,获取至少两张包含有行人的第一图像。
优选的,所述获取所述斑马线区域内的至少两张包含了行人的第一图像包括:
连续获取所述斑马线区域内的多张监测图像;
采用人脸检测算法检测每张所述监测图像中是否有行人;
从所述多张监测图像中筛选出有行人的目标图像;
从所述目标图像中筛选出至少两张第一图像,其中,所述至少两张第一图像为连续帧图像。
本实施例中,通过获取所述摄像头连续拍摄的所述斑马线区域内的多张包含有行人的目标图像,其中,所述目标图像为至少两张为连续帧的第一图像。
进一步的,所述采用人脸检测算法检测每张所述监测图像中是否有行人包括:
111)获取所述斑马线区域内的背景图像;
本实施例中,在斑马线对应的指示灯显示为红灯且所述斑马线区域内没有行人时,通过所述指示灯对应的所述摄像头拍摄一张图像,作为背景图像;或者从视频中截取一帧所述斑马线对应的指示灯显示为红灯且所述斑马线区域内没有行人时的图像,作为背景图像。
应当理解的是,所述背景图像中只包含背景信息,例如,天空信息,马路信息等,而不包含任何行人的个人信息。
112)将每张所述监测图像与所述背景图像进行差分处理得到差分监测图像;
本实施例中,由于背景图像为所述指示灯显示为红灯且无行人的图像,监测图像是在背景图像的基础上在所述斑马线区域上增加了行人这一前景的图像,由于所述摄像头的拍摄位置固定,即背景图像与所述监测图像的大小是相同的,因而可以直接将监测图像中的每个像素与所述背景图像中的相对应的像素进行差分处理,去掉监测图像中属于背景的区域,得到的差分监测图像基本上仅包括了行人这一前景,从而有利于人脸检测。
113)采用所述人脸检测算法检测每张差分监测图像中是否有行人。
本实施例中,通过对每张差分监测图像采用人脸检测算法进行人脸检测,确定每张所述差分监测图像中是否有行人,其中,所述人脸检测算法为现有技术,本申请在此不做详细阐述。
识别模块402:用于识别所述至少两张第一图像中的行人是否为同一个行人。
本实施例中,提取至少两张第一图像中每张第一图像中的特征,通过比较任意两张第一图像中的特征的差值是否均小于预设差值阈值,当任意两张第一图像中的特征的差值均小于预设差值阈值时,确定至少两张第一图像中的行人为同一个行人,当任意两张第一图像中的特征的差值均大于预设差值阈值,确定至少两张第一图像中的行人不为同一个行人。关于特征提取为现有技术,本申请不做详细介绍。
优选的,识别所述至少两张第一图像中的行人是否为同一个行人为识别至少两张第一差分监测图像中的行人是否为同一个行人。提取至少两张第一差分监测图像中每张第一差分监测图像中的特征,通过比较任意两张第一差分监测图像中的特征的差值是否均小于预设差值阈值,根据比较结果确定至少两张第一差分监测图像中的行人是否为同一个行人,进而确定至少两张第一图像中的行人是否为同一个行人。
第一确定模块403:用于所述识别模块402识别基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹。
本实施例中,提取出同一行人的多张第一图像中的多个位置确定所述行人的行人轨迹。
优选的,所述基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第 一图像中所述行人的位置确定所述行人的行为轨迹包括:
将所述第一图像的左上角确定为坐标原点,所述第一图像的上边确定为横坐标轴,所述第一图像的左边确定为纵坐标轴;
获取每张所述第一图像中所述行人的中心点位置坐标,其中,所述中心点位置坐标包括中心点横坐标和中心点纵坐标;
基于每张所述第一图像中的所述中心点横坐标确定所述行人的横向位移;
基于每张所述第一图像中的所述中心点纵坐标确定所述行人的纵向位移;
根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹。
本实施例中,当所述摄像头拍摄到同一个行人的多张第一图像时,根据所述第一图像中携带的时间帧,将时间最小的第一图像的左上角确定为坐标原点、上边确定为横轴坐标和左边确定为纵轴坐标,其中,所述横轴坐标和所述纵轴坐标作为行人移动轨迹方向的基准,基于所述基准及每张所述第一图像中的所述行人的中心点位置坐标中的中心点横坐标和中心点纵坐标确定所述行人的横向位移和纵向位移。如图2所示,在斑马线对应的指示灯显示为红灯时,所述摄像头连续拍摄的两张第一图像中包含有同一个行人F1,T
1时刻拍摄的第一张第一图像A,T
2时刻拍摄的第二张第一图像B,其中,T
1<T
2,将T
1时刻拍摄的第一张第一图像A的左上角确定为坐标原点,则所述第一图像A中的所述行人F1的中心位置坐标为(X
1,Y
1),T
2时刻拍摄的第二张第一图像B中的所述行人F1的中心位置坐标为(X
2,Y
2),基于所述行人F1的中心点的横坐标X
1和X
2确定所述行人的横向位移等于X
2-X
1,基于所述行人F1的中心点的纵坐标Y
1和Y
2确定所述行人的纵向位移等于Y
2-Y
1,根据所述行人的横向位移和所述行人的纵向位移确定所述行人的行为轨迹方向。
进一步的,所述根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹包括:
判断所述横向位移的绝对值是否大于第一阈值及所述纵向位移的绝对值是否大于第二阈值;
当所述横向位移的绝对值大于所述第一阈值,且所述纵向位移的绝对值小于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向垂直;
当所述横向位移的绝对值小于所述第一阈值,且所述纵向位移的绝对值大于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向平行。
本实施例中,可以预先设置横轴坐标对应的第一阈值,和纵轴坐标对应的第二阈值。根据比对所述行人的横向位移的绝对值与所述第一阈值的大小,同时比对所述行人的纵向位移的绝对值与所述第二阈值的大小来确定所述行人的行为轨迹方向与所述斑马线的指示方向之间的关系。
参阅图2所示,假设所述行人F1在T
1时刻的中心位置坐标为(X
1,Y
1),T
2时刻的中心位置坐标为(X
2,Y
2),其中,T
1<T
2,则所述行人横向位移的绝对值等于||X
2-X
1||,所述行人的纵向位移的绝对值等于||Y
2-Y
1||,预先设置的第一阈值为M,所述第二阈值为N,当所述||X
2-X
1||≥M且所述||Y
2-Y
1||≤N时,认为所述行人横穿斑马线,即所述行人的行为轨迹与所述斑马线的指示方向垂直;当所述||X
2-X
1||≤M且所述||Y
2-Y
1||≥N时,认为所述行人过斑马线,即所述行人的行为轨迹与所述斑马线的指示方向平行,M或者N可以为0。
本实施例中,通过所述行人的行为轨迹方向与所述斑马线的指示方向之间的关系,可以快速的确定出所述行人的通行方向,并根据所述行人的通行方向确定所述行人是否闯红灯,减少了行人闯红灯的误判率。
检测模块404:用于当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象。
本实施例中,所述预设目标对象是指机动车,比如摩托车,三轮车或者自行车等,采用YOLO目标检测算法检测所述第一图像中是否有预设目标对象。
本实施例中,所述YOLO目标检测算法为现有技术,本申请在此不作详细阐述。
第二确定模块405:用于当所述检测模块404检测到每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
本实施例中,当采用YOLO目标检测算法检测的每张所述第一图像中均有预设目标对象时,确定所述行人未闯红灯。
再次参阅图2所示,假设所述行人F1在T
1时刻的第一图像中的中心位置坐标为(X
1,Y
1),T
2时刻的第一图像中的中心位置坐标为(X
2,Y
2),其中,T
1<T
2,所述行人F1的行为轨迹与所述斑马线的指示方向垂直,如果在T
1时刻和T
2时刻拍摄的所述第一图像中都检测到既有行人,又有预设目标对象,如电动车,说明所述行人在正常骑电动车过马路,确定所述行人未闯红灯,可以避免行人骑着摩托车或者电动车沿着绿灯指示方向在机动车轨道上低速行驶穿过指示灯显示为红灯的斑马线时被摄像头抓拍到行人图像误判为闯红灯的现象,在一定的程度上减小了行人闯红灯的误判率。
进一步的,所述获取模块401:还用于当所述行人的行为轨迹与所述斑马线的指示方向平行时,获取所述指示灯显示为红灯之前的所述斑马线区域内的至少一张包含了行人的第二图像;
所述识别模块402:还用于识别所述至少两张第一图像中的行人与所述至少一张第二图像中的行人是否为同一个行人;
所述第二确定模块405:还用于当所述至少两张第一图像中的行人与所述至少一张第二图像中的行人为同一个行人时,确定所述行人未闯红灯。
本实施例中,指示灯显示的颜色包括红色、绿色和黄色三种,如果所述行人的行为轨迹与所述斑马线的指示方向平行时,在斑马线对应的指示灯切换为绿灯时,获取所述斑马线区域内的至少一张包含了行人的第二图像,将所述第二图像中的行人与所述第一图像中的行人进行识别,若所述第二图像中的行人与所述任意一张第一图像中的行人为同一个行人,确定所述行人未闯红灯。
示例性的,假设所述行人F1在T
3时刻的第一图像中的中心位置坐标为(X
3,Y
3),T
4时刻的第一图像中的中心位置坐标为(X
4,Y
4),其中,T
3<T
4,确定所述行人的行为轨迹与所述斑马线指示方向平行,如图3所示。在指示灯切换为红灯之前,获取所述指示灯为绿灯时的斑马线区域内的至少一张包含了所述行人F1的第二图像,确定所述行人F1在绿灯期间未通过所述斑马线区域,为滞留在斑马线上,不属于闯红灯。
本实施例中,通过所述行人的行为轨迹判断所述行人是否闯红灯,可以排除在所述指示灯显示为绿灯期间未通过斑马线且在所述指示灯为红灯期间滞留在斑马线上的行人被误判为闯红灯的情况,减小了行人闯红灯的误判率,在一定的程度上降低了人工成本。
更进一步的,所述第二确定模块405:还用于当所述检测模块404检测到所述至少两张第一图像中没有所述预设目标对象时,确定所述行人闯红灯;或者
所述第二确定模块405:还用于当所述识别模块402识别所述至少两张第一图像中的行人与所述至少一张第二图像中的行人不为同一个行人时,确定所述行人闯红灯。
参阅图3所示,假设所述行人F1在T
3时刻的第一图像中的中心位置坐标为(X
3,Y
3),T
4时刻的第一图像中的中心位置坐标为(X
4,Y
4),其中,T
3<T
4,确定所述行人F1和所述斑马线指示的方向平行,在T
3时刻和T
4时刻拍摄到的所述第一图像中有一张没有检测到预设目标对象,说明所述行人的行为轨迹与所述斑马线指示的方向平行,确定所述行人闯红灯。
再次参阅图3所示,假设所述行人F1在T
3时刻的第一图像中的中心位置坐标为(X
3,Y
3),T
4时刻的第二图像中的中心位置坐标为(X
4,Y
4),其中,T
3<T
4,确定所述行人F1和所述斑马线指示的方向平行,在T
3时刻之前,当所述指示灯为绿灯时获取所述至少一张包含了行人F2的第二图像,当所述行人F1和所述行人F2不为同一个行人时,说明所述行人F1不是在绿灯期间就开始通行,而是在红灯期间开始通行,确定所述行人F1闯红灯。
本实施例中,当确定所述行人和所述斑马线指示的方向平行时,通过判断所述第一图像 中是否有预设目标对象或者所述第二图像中的行人是否与所述第一图像中的行人是否为同一行人,确定所述行人是否闯红灯,避免了因行人正常过马路而被误判为闯红灯的现象,在一定的程度上降低了闯红灯检测的误判率。
更进一步的,当在确定所述行人闯红灯之后,所述识别模块402:还用于对所述行人进行特征识别;
提取模块406:用于提取所述特征识别的识别结果;
播报模块407:用于根据所述识别结果进行语音播报。
本实施例中,对闯红灯的行人进行特征识别,所述特征识别包括外观特征但不限于性别、衣服、身高等,通过语音播报所述特征识别结果,例如:“穿红衣服的帅哥请勿闯红灯”。
本实施例中,通过对闯红灯的行人进行有针对性的播报,增加违法者心理压力,同时减少无效重复的播报,降低噪声。本实施例中,通过对所述行人闯红灯进行语音播报,告警所述行人闯红灯,同时将闯红灯次数超过预设的次数阈值的行人的人脸图像投影到电子显示屏上,增加了行人闯红灯的心理负担,减少了行人闯红灯的违法行为,保证了行人的出行安全。
综上所述,本申请所述的基于图像识别的行人闯红灯检测装置,通过在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;识别所述至少两张第一图像中的行人是否为同一个行人;基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。本申请通过当斑马线对应的指示灯显示为红灯时,所述摄像头连续拍摄的多张第一图像中的行人的行为轨迹方向与所述斑马线指示方向之间的位置关系,确定所述行人是否闯红灯,避免了通行向正确的行人误判为闯红灯,降低了误判率,提高了检测精度。
实施例三
参阅图5所示,为本申请实施例三提供的终端的结构示意图。在本申请较佳实施例中,所述终端5包括存储器51、至少一个处理器52、至少一条通信总线53及收发器54。
本领域技术人员应该了解,图5示出的终端的结构并不构成本申请实施例的限定,既可以是总线型结构,也可以是星形结构,所述终端5还可以包括比图示更多或更少的其他硬件或者软件,或者不同的部件布置。
在一些实施例中,所述终端5是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的终端,其硬件包括但不限于微处理器、专用集成电路、可编程门阵列、数字处理器及嵌入式设备等。所述终端5还可包括客户设备,所述客户设备包括但不限于任何一种可与客户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互的电子产品,例如,个人计算机、平板电脑、智能手机、数码相机等。
需要说明的是,所述终端5仅为举例,其他现有的或今后可能出现的电子产品如可适应于本申请,也应包含在本申请的保护范围以内,并以引用方式包含于此。
在一些实施例中,所述存储器51用于存储程序代码和各种数据,例如安装在所述终端5中的基于图像识别的行人闯红灯检测装置40,并在终端5的运行过程中实现高速、自动地完成程序或数据的存取。所述存储器51包括只读存储器(Read-Only Memory,ROM)、随机存取存储器、可编程只读存储器(Programmable Read-Only Memory,PROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、一次可编程只读存储器(One-time Programmable Read-Only Memory,OTPROM)、电子擦除式可复写只读存储器(Electrically-Erasable Programmable Read-Only Memory,EEPROM)、只读光盘(Compact Disc Read-Only Memory,CD-ROM)或其他光盘存储器、磁盘存储器、磁带存储器、或者能够用于携带或存储数据的计算机可读的任何其他介质。
本发明中,所述计算机可读存储介质可以是非易失性,也可以是易失性的。
在一些实施例中,所述至少一个处理器52可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述至少一个处理器52是所述终端5的控制核心(Control Unit),利用各种接口和线路连接整个终端5的各个部件,通过运行或执行存储在所述存储器51内的程序或者模块,以及调用存储在所述存储器51内的数据,以执行终端5的各种功能和处理数据。
在一些实施例中,所述至少一条通信总线53被设置为实现所述存储器51以及所述至少一个处理器52等之间的连接通信。
尽管未示出,所述终端5还可以包括给各个部件供电的电源(比如电池),优选的,电源可以通过电源管理装置与所述至少一个处理器52逻辑相连,从而通过电源管理装置实现管理充电、放电、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述终端5还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
上述以软件功能模块的形式实现的集成的单元,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,终端,或者网络设备等)或处理器(processor)执行本申请各个实施例所述方法的部分。
在进一步的实施例中,结合图4,所述至少一个处理器52可执行所述终端5的操作装置以及安装的各类应用程序(如所述的基于图像识别的行人闯红灯检测装置40)、程序代码等,例如,上述的各个模块。
所述存储器51中存储有程序代码,所述程序代码可以被分割成一个或多个模块/单元,且所述至少一个处理器52可调用所述存储器51中存储的程序代码以执行相关的功能。例如,图4中所述的各个模块是存储在所述存储器51中的程序代码,并由所述至少一个处理器52所执行,从而实现所述各个模块的功能以达到基于图像识别的行人闯红灯检测的目的。所述一个或多个模块可以是能够完成特定功能的一系列计算机可读指令段,该计算机可读指令段用于描述所述程序代码在所述终端5中的执行过程。
在本申请的一个实施例中,所述存储器51存储多个计算机可读指令,所述多个计算机可读指令被所述至少一个处理器52所执行以实现基于图像识别的行人闯红灯的检测。
具体地,所述至少一个处理器52对上述指令的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,既可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括 在本申请内。不应将权利要求中的任何附图标记视为限制所涉及的权利要求。此外,显然“包括”一词不排除其他单元或,单数不排除复数。装置权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第一,第二等词语用来表示名称,而并不表示任何特定的顺序。
Claims (20)
- 一种基于图像识别的行人闯红灯检测方法,其中,所述基于图像识别的行人闯红灯检测方法包括:在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;识别所述至少两张第一图像中的行人是否为同一个行人;基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
- 如权利要求1所述的基于图像识别的行人闯红灯检测方法,其中,所述根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹包括:将所述第一图像的左上角确定为坐标原点,所述第一图像的上边确定为横坐标轴,所述第一图像的左边确定为纵坐标轴;获取每张所述第一图像中所述行人的中心点位置坐标,其中,所述中心点位置坐标包括中心点横坐标和中心点纵坐标;基于每张所述第一图像中的所述中心点横坐标确定所述行人的横向位移;基于每张所述第一图像中的所述中心点纵坐标确定所述行人的纵向位移;根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹。
- 如权利要求2所述的基于图像识别的行人闯红灯检测方法,其中,所述根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹包括:判断所述横向位移的绝对值是否大于第一阈值及所述纵向位移的绝对值是否大于第二阈值;当所述横向位移的绝对值大于所述第一阈值,且所述纵向位移的绝对值小于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向垂直;当所述横向位移的绝对值小于所述第一阈值,且所述纵向位移的绝对值大于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向平行。
- 如权利要求1所述的基于图像识别的行人闯红灯检测方法,其中,所述方法还包括:当所述行人的行为轨迹与所述斑马线的指示方向平行时,获取所述指示灯显示为红灯之前的所述斑马线区域内的至少一张包含了行人的第二图像;识别所述至少两张第一图像中的行人与所述至少一张第二图像中的行人是否为同一个行人;当所述至少两张第一图像中的行人与所述至少一张第二图像中的行人为同一个行人时,确定所述行人未闯红灯。
- 如权利要求1所述的基于图像识别的行人闯红灯检测方法,其中,所述获取所述斑马线区域内的至少两张包含了行人的第一图像包括:连续获取所述斑马线区域内的多张监测图像;采用人脸检测算法检测每张所述监测图像中是否有行人;从所述多张监测图像中筛选出有行人的目标图像;从所述目标图像中筛选出至少两张第一图像,其中,所述至少两张第一图像为连续帧图像。
- 如权利要求5所述的基于图像识别的行人闯红灯检测方法,其中,所述采用人脸检测 算法检测每张所述监测图像中是否有行人包括:获取所述斑马线区域内的背景图像;将每张所述监测图像与所述背景图像进行差分处理得到差分监测图像;采用所述人脸检测算法检测每张差分监测图像中是否有行人。
- 如权利要求1所述的基于图像识别的行人闯红灯检测方法,其中,在确定所述行人闯红灯之后,所述方法还包括:对所述行人进行特征识别;提取所述特征识别的识别结果;根据所述识别结果进行语音播报。
- 一种终端,其中,所述终端包括存储器及处理器,所述存储器用于存储至少一个计算机可读指令,所述处理器用于执行所述至少一个计算机可读指令以实现以下步骤:在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;识别所述至少两张第一图像中的行人是否为同一个行人;基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
- 如权利要求8所述的终端,其中,所述处理器执行所述至少一个计算机可读指令以实现所述根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹时,具体包括:将所述第一图像的左上角确定为坐标原点,所述第一图像的上边确定为横坐标轴,所述第一图像的左边确定为纵坐标轴;获取每张所述第一图像中所述行人的中心点位置坐标,其中,所述中心点位置坐标包括中心点横坐标和中心点纵坐标;基于每张所述第一图像中的所述中心点横坐标确定所述行人的横向位移;基于每张所述第一图像中的所述中心点纵坐标确定所述行人的纵向位移;根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹。
- 如权利要求9所述的终端,其中,所述处理器执行所述至少一个计算机可读指令以实现所述根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹时,具体包括:判断所述横向位移的绝对值是否大于第一阈值及所述纵向位移的绝对值是否大于第二阈值;当所述横向位移的绝对值大于所述第一阈值,且所述纵向位移的绝对值小于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向垂直;当所述横向位移的绝对值小于所述第一阈值,且所述纵向位移的绝对值大于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向平行。
- 如权利要求8所述的终端,其中,所述处理器执行所述至少一个计算机可读指令还用以实现以下步骤:当所述行人的行为轨迹与所述斑马线的指示方向平行时,获取所述指示灯显示为红灯之前的所述斑马线区域内的至少一张包含了行人的第二图像;识别所述至少两张第一图像中的行人与所述至少一张第二图像中的行人是否为同一个行人;当所述至少两张第一图像中的行人与所述至少一张第二图像中的行人为同一个行人 时,确定所述行人未闯红灯。
- 如权利要求8所述的终端,其中,所述处理器执行所述至少一个计算机可读指令以实现所述获取所述斑马线区域内的至少两张包含了行人的第一图像时,具体包括:连续获取所述斑马线区域内的多张监测图像;采用人脸检测算法检测每张所述监测图像中是否有行人;从所述多张监测图像中筛选出有行人的目标图像;从所述目标图像中筛选出至少两张第一图像,其中,所述至少两张第一图像为连续帧图像。
- 如权利要求12所述的终端,其中,所述处理器执行所述至少一个计算机可读指令以实现所述采用人脸检测算法检测每张所述监测图像中是否有行人时,具体包括:获取所述斑马线区域内的背景图像;将每张所述监测图像与所述背景图像进行差分处理得到差分监测图像;采用所述人脸检测算法检测每张差分监测图像中是否有行人。
- 一种计算机可读存储介质,其中,所述计算机可读存储介质存储有至少一个计算机可读指令,所述至少一个计算机可读指令被处理器执行时实现以下步骤:在斑马线对应的指示灯显示为红灯时,获取所述斑马线区域内的至少两张包含了行人的第一图像;识别所述至少两张第一图像中的行人是否为同一个行人;基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
- 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹时,具体包括:将所述第一图像的左上角确定为坐标原点,所述第一图像的上边确定为横坐标轴,所述第一图像的左边确定为纵坐标轴;获取每张所述第一图像中所述行人的中心点位置坐标,其中,所述中心点位置坐标包括中心点横坐标和中心点纵坐标;基于每张所述第一图像中的所述中心点横坐标确定所述行人的横向位移;基于每张所述第一图像中的所述中心点纵坐标确定所述行人的纵向位移;根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹。
- 如权利要求15所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述根据所述行人的横向位移和所述纵向位移确定所述行人的行为轨迹时,具体包括:判断所述横向位移的绝对值是否大于第一阈值及所述纵向位移的绝对值是否大于第二阈值;当所述横向位移的绝对值大于所述第一阈值,且所述纵向位移的绝对值小于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向垂直;当所述横向位移的绝对值小于所述第一阈值,且所述纵向位移的绝对值大于所述第二阈值时,确定所述行人的行为轨迹与所述斑马线的指示方向平行。
- 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被处理器执行时还用以实现以下步骤:当所述行人的行为轨迹与所述斑马线的指示方向平行时,获取所述指示灯显示为红 灯之前的所述斑马线区域内的至少一张包含了行人的第二图像;识别所述至少两张第一图像中的行人与所述至少一张第二图像中的行人是否为同一个行人;当所述至少两张第一图像中的行人与所述至少一张第二图像中的行人为同一个行人时,确定所述行人未闯红灯。
- 如权利要求14所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述获取所述斑马线区域内的至少两张包含了行人的第一图像时,具体包括:连续获取所述斑马线区域内的多张监测图像;采用人脸检测算法检测每张所述监测图像中是否有行人;从所述多张监测图像中筛选出有行人的目标图像;从所述目标图像中筛选出至少两张第一图像,其中,所述至少两张第一图像为连续帧图像。
- 如权利要求18所述的存储介质,其中,所述至少一个计算机可读指令被所述处理器执行以实现所述采用人脸检测算法检测每张所述监测图像中是否有行人时,具体包括:获取所述斑马线区域内的背景图像;将每张所述监测图像与所述背景图像进行差分处理得到差分监测图像;采用所述人脸检测算法检测每张差分监测图像中是否有行人。
- 一种基于图像识别的行人闯红灯检测装置,其中,所述基于图像识别的行人闯红灯检测装置包括:获取模块,用于在斑马线对应的指示灯显示为红灯时,连续获取所述斑马线区域内的至少两张包含了行人的第一图像;识别模块,用于识别所述至少两张第一图像中的行人是否为同一个行人;第一确定模块,用于基于所述至少两张第一图像中的行人为同一个行人,根据所述至少两张第一图像中所述行人的位置确定所述行人的行为轨迹;检测模块,用于当所述行人的行为轨迹与所述斑马线的指示方向垂直时,采用YOLO目标检测算法检测每张所述第一图像中是否有预设目标对象;第二确定模块,用于当每张所述第一图像中均有所述预设目标对象时,确定所述行人未闯红灯。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910995454.XA CN110991224B (zh) | 2019-10-18 | 2019-10-18 | 基于图像识别的行人闯红灯检测方法、装置及相关设备 |
CN201910995454.X | 2019-10-18 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021073267A1 true WO2021073267A1 (zh) | 2021-04-22 |
Family
ID=70082175
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/111884 WO2021073267A1 (zh) | 2019-10-18 | 2020-08-27 | 基于图像识别的行人闯红灯检测方法、装置及相关设备 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110991224B (zh) |
WO (1) | WO2021073267A1 (zh) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113645415A (zh) * | 2021-08-13 | 2021-11-12 | 京东科技信息技术有限公司 | 用于生成视频的方法、装置、电子设备和介质 |
WO2023098081A1 (zh) * | 2021-11-30 | 2023-06-08 | 上海商汤智能科技有限公司 | 获取客流数据的方法、装置、电子设备以及存储介质 |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110991224B (zh) * | 2019-10-18 | 2024-05-28 | 平安科技(深圳)有限公司 | 基于图像识别的行人闯红灯检测方法、装置及相关设备 |
CN111582171B (zh) * | 2020-05-08 | 2024-04-09 | 济南博观智能科技有限公司 | 一种行人闯红灯监测方法、装置、***及可读存储介质 |
CN111582239A (zh) * | 2020-05-28 | 2020-08-25 | 中国联合网络通信集团有限公司 | 一种违章监控方法和装置 |
CN112950931B (zh) * | 2021-01-26 | 2023-01-10 | 佛山市恩卓信息科技有限公司 | 一种大数据行人闯红灯提醒方法及*** |
CN114093172A (zh) * | 2021-11-03 | 2022-02-25 | 中科智城(广州)信息科技有限公司 | 一种基于图像识别的行人通行方法、终端和存储介质 |
CN115797849B (zh) * | 2023-02-03 | 2023-04-28 | 以萨技术股份有限公司 | 一种基于图像确定异常行为的数据处理*** |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104091446A (zh) * | 2014-07-11 | 2014-10-08 | 厦门磐道电子有限公司 | 行人过斑马线的智能化视频分析方法 |
CN104332052A (zh) * | 2014-11-11 | 2015-02-04 | 杭州新迪数字工程***有限公司 | 一种行人闯红灯自动抓拍***与识别方法 |
CN106846792A (zh) * | 2017-04-05 | 2017-06-13 | 滁州学院 | 城市交通违章智能预警***及其方法 |
CN107662867A (zh) * | 2016-07-29 | 2018-02-06 | 奥的斯电梯公司 | 乘客运输机的梯级滚轮监测和维修操作人员监测 |
CN108877205A (zh) * | 2018-07-12 | 2018-11-23 | 苏州旭安交通科技有限公司 | 行人闯红灯检测方法及*** |
US10255805B1 (en) * | 2018-01-29 | 2019-04-09 | Volkswagen Ag | Traffic signal emulation using genetic algorithm |
CN110287855A (zh) * | 2019-06-21 | 2019-09-27 | 上海闪马智能科技有限公司 | 一种行人轨迹获取方法以及*** |
CN110991224A (zh) * | 2019-10-18 | 2020-04-10 | 平安科技(深圳)有限公司 | 基于图像识别的行人闯红灯检测方法、装置及相关设备 |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20180096595A1 (en) * | 2016-10-04 | 2018-04-05 | Street Simplified, LLC | Traffic Control Systems and Methods |
-
2019
- 2019-10-18 CN CN201910995454.XA patent/CN110991224B/zh active Active
-
2020
- 2020-08-27 WO PCT/CN2020/111884 patent/WO2021073267A1/zh active Application Filing
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104091446A (zh) * | 2014-07-11 | 2014-10-08 | 厦门磐道电子有限公司 | 行人过斑马线的智能化视频分析方法 |
CN104332052A (zh) * | 2014-11-11 | 2015-02-04 | 杭州新迪数字工程***有限公司 | 一种行人闯红灯自动抓拍***与识别方法 |
CN107662867A (zh) * | 2016-07-29 | 2018-02-06 | 奥的斯电梯公司 | 乘客运输机的梯级滚轮监测和维修操作人员监测 |
CN106846792A (zh) * | 2017-04-05 | 2017-06-13 | 滁州学院 | 城市交通违章智能预警***及其方法 |
US10255805B1 (en) * | 2018-01-29 | 2019-04-09 | Volkswagen Ag | Traffic signal emulation using genetic algorithm |
CN108877205A (zh) * | 2018-07-12 | 2018-11-23 | 苏州旭安交通科技有限公司 | 行人闯红灯检测方法及*** |
CN110287855A (zh) * | 2019-06-21 | 2019-09-27 | 上海闪马智能科技有限公司 | 一种行人轨迹获取方法以及*** |
CN110991224A (zh) * | 2019-10-18 | 2020-04-10 | 平安科技(深圳)有限公司 | 基于图像识别的行人闯红灯检测方法、装置及相关设备 |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113645415A (zh) * | 2021-08-13 | 2021-11-12 | 京东科技信息技术有限公司 | 用于生成视频的方法、装置、电子设备和介质 |
WO2023098081A1 (zh) * | 2021-11-30 | 2023-06-08 | 上海商汤智能科技有限公司 | 获取客流数据的方法、装置、电子设备以及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
CN110991224B (zh) | 2024-05-28 |
CN110991224A (zh) | 2020-04-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021073267A1 (zh) | 基于图像识别的行人闯红灯检测方法、装置及相关设备 | |
EP3806064A1 (en) | Method and apparatus for detecting parking space usage condition, electronic device, and storage medium | |
CN109740420B (zh) | 车辆违法识别方法及相关产品 | |
CN110782681B (zh) | 交通指示灯自适应控制方法、装置、终端及存储介质 | |
CN110032947B (zh) | 一种监控事件发生的方法及装置 | |
CN111738212B (zh) | 基于人工智能的交通信号灯识别方法、装置、设备及介质 | |
JP6595375B2 (ja) | 交通状況解析装置、交通状況解析方法、及び、交通状況解析プログラム | |
CN112509325B (zh) | 一种基于视频深度学习的非现场违法自动甄别方法 | |
CN111369801B (zh) | 车辆识别方法、装置、设备和存储介质 | |
CN112270244A (zh) | 目标物违规监控方法、装置、电子设备及存储介质 | |
CN112381014A (zh) | 一种基于城市道路的违停车辆检测及管理方法及*** | |
AU2020286290A1 (en) | Systems and methods for identifying vehicles using wireless device identifiers | |
CN112528924A (zh) | 一种车辆掉头检测方法、装置、设备及存储介质 | |
CN109800684B (zh) | 一种视频中对象的确定方法及装置 | |
CN110660225A (zh) | 闯红灯行为检测方法、装置和设备 | |
CN116543189B (zh) | 一种目标检测方法、装置、设备及存储介质 | |
CN114092902A (zh) | 电动自行车违规行为的检测方法及装置 | |
CN111931650A (zh) | 目标检测模型构建及闯红灯追责方法、***、终端及介质 | |
CN111724607A (zh) | 转向灯使用检测方法、装置、计算机设备和存储介质 | |
CN112270258A (zh) | 一种非机动车的违规信息获取方法及装置 | |
CN114693722B (zh) | 一种车辆行驶行为检测方法、检测装置及检测设备 | |
CN114022848B (zh) | 一种隧道自动照明的控制方法及*** | |
CN114882709B (zh) | 车辆拥堵检测方法、装置及计算机存储介质 | |
US20150178577A1 (en) | Image processing apparatus, and image processing method | |
CN115880632A (zh) | 超时停留检测方法、监控设备、计算机可读存储介质和芯片 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20876912 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20876912 Country of ref document: EP Kind code of ref document: A1 |