Target area determination method and device, equipment and storage medium
By generating a target detection frame that is more in line with the vehicle width direction and reducing irrelevant areas, it solves the problem of manual dependence in vehicle operation qualification investigation, improves the accuracy and efficiency of passenger behavior detection, and achieves long-distance and all-round detection.
Patent Information
- Application Number
- CN202310376036.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-31
- Publication Date
- 2024-10-01
AI Technical Summary
The existing technology relies on manual labor in vehicle operation qualification investigation, resulting in huge consumption of manpower, material and financial resources and ineffective results. In addition, the target detection frame may contain irrelevant passers-by, which affects the accuracy of passenger behavior detection.
By obtaining the image of the vehicle to be detected, a target detection frame is generated that is more consistent with the vehicle width direction, reducing irrelevant areas, and improving the accuracy of passenger behavior detection.
It improves the accuracy of detecting the passenger behavior of the vehicle to be detected, saves manpower, material and financial resources, and achieves long-distance and all-round detection.
Smart Images

Figure CN118736501A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of security, and in particular to a method, device, equipment and storage medium for determining a target area. Background Art
[0002] At present, the investigation and handling of vehicle operating qualification issues mainly remains at the stage of manual on-site investigation and handling, which greatly consumes manpower, material and financial resources, and the effect is not obvious.
[0003] In order to save manpower, material resources and financial resources, it is proposed that a camera can be used to obtain an image of the vehicle to be detected, and the image can be recognized, a rectangular detection frame of the vehicle to be detected is identified as the target area of the vehicle to be detected, and personnel detection is performed on the target area to detect whether the vehicle to be detected is carrying passengers. Summary of the invention
[0004] Based on the above technical problems, the present application provides a method, device, equipment and storage medium for determining a target area, which can further generate a target detection frame that further enlarges the area in the vehicle width direction according to the rectangular detection frame of the vehicle to be detected, which is more in line with the actual detection needs of detecting passenger-carrying behavior, thereby improving the accuracy of detecting the passenger-carrying behavior of the vehicle to be detected.
[0005] In a first aspect, the present application provides a method for determining a target area, the method comprising: acquiring an image including a vehicle to be detected; a rectangular detection frame including the vehicle to be detected in the image; the area framed by the rectangular detection frame includes the vehicle to be detected; determining the target direction according to the driving direction of the vehicle to be detected in the image and the rectangular detection frame; the target direction is used to indicate the direction of the horizontal direction and the vertical direction of the plane where the image is located that converges to the width direction of the vehicle to be detected; generating a target detection frame of the vehicle to be detected according to the center of the rectangular detection frame and the target direction; wherein, if the target detection frame is a target rectangular frame, the target rectangular frame includes a long side in the target direction, and the long side is longer than a side in the rectangular detection frame parallel to the target direction; if the target detection frame is an elliptical detection frame, the elliptical detection frame includes a long axis in the target direction, and the long axis is longer than a side in the rectangular detection frame parallel to the target direction; according to the target detection frame, determining the target area of the vehicle to be detected.
[0006] The method for determining the target area provided in the present application can determine the target direction converging to the vehicle width direction according to the driving direction of the vehicle to be detected in the image and the rectangular detection frame, and generate a target detection frame according to the center of the rectangular detection frame and the target direction. The target detection frame has a longer major axis or long side in the target direction, that is, a longer major axis or long side in the direction converging to the vehicle width direction. The area in the vehicle width direction is also the area on both sides of the vehicle body. Generating a target detection frame with a longer major axis or long side can stretch and enlarge the areas on both sides of the vehicle body, and the areas on both sides of the vehicle body are the key areas for passenger-carrying behavior detection. Therefore, the target detection frame after stretching and enlarging the areas on both sides of the vehicle body in the present application is more in line with the actual detection needs of detecting passenger-carrying behavior, thereby improving the accuracy of detecting passenger-carrying behavior of the vehicle to be detected.
[0007] In one possible implementation, the rectangular detection frame includes a first side parallel to the horizontal direction of the plane where the image is located, and a second side perpendicular to the first side; the target direction is determined according to the driving direction of the vehicle to be detected in the image and the rectangular detection frame, including: if the angle between the driving direction and the horizontal direction of the plane where the image is located is within a preset vertical angle range, then the direction parallel to the first side is used as the target direction; if the angle between the driving direction and the horizontal direction of the plane where the image is located is outside the preset vertical angle range, then the direction parallel to the second side is used as the target direction.
[0008] In one possible implementation, before determining the target area of the vehicle to be detected based on the target detection frame, the method also includes: rotating the target detection frame according to the driving direction so that the short axis or short side of the target detection frame is parallel to the driving direction; wherein the short side is the side opposite to the long side in the target rectangular frame.
[0009] The method for determining the target area provided in the present application can also rotate the generated target detection frame so that the short axis or short side of the target detection frame is parallel to the driving direction, which is more in line with actual detection needs, thereby improving the accuracy of detecting the passenger behavior of the vehicle to be detected.
[0010] In a possible implementation, the short axis or short side of the target detection frame is shorter than or equal to a side of the rectangular detection frame that is parallel to the short axis or short side.
[0011] It should be understood that the rectangular detection frame of the vehicle to be detected is usually large, and the larger rectangular detection frame may frame irrelevant pedestrians around the vehicle to be detected into the area where the surrounding personnel aggregation and inductive analysis are required, thereby analyzing irrelevant pedestrians around the vehicle to be detected as passengers getting on or off the vehicle, affecting the accuracy of detecting the passenger-carrying behavior of the vehicle to be detected. The short axis or short side of the target detection frame generated by the target area determination method provided in the present application is shorter than or equal to the side of the rectangular detection frame parallel to the short axis or short side. Therefore, compared with the rectangular detection frame, the target detection frame removes the four right angles of the rectangular detection frame (or the four corners of the vehicle body) that are not strongly correlated with the passenger boarding and disembarking behavior, which is more in line with the actual detection needs of detecting passenger-carrying behavior, thereby improving the accuracy of detecting the passenger-carrying behavior of the vehicle to be detected.
[0012] In one possible implementation, a target area of the vehicle to be detected is determined based on a target detection frame, including: dividing the target detection frame into a driver side area and a non-driver side area; and using the non-driver side area as the target area of the vehicle to be detected.
[0013] It should be understood that after the vehicle pulls over, other vehicles may pass by on the left side of the vehicle body. For safety reasons, passengers usually get on and off the vehicle on the right side of the vehicle body (i.e., the non-driver side). After determining the target detection frame of the area to be detected, the target area determination method provided in the present application can also divide the target detection frame according to the driving direction, into the driver side and the non-driver side, and use the non-driver side as the target area, focusing on the non-driver side where passengers may get on and off the vehicle. Passenger-carrying behavior detection is performed, and at the same time, the driver's behavior of getting off the vehicle on the driver's side to pick up the luggage and then returning to the vehicle is prevented from being misjudged as passenger-carrying behavior, which is more in line with the actual detection needs of detecting passenger-carrying behavior, thereby improving the accuracy of detecting passenger-carrying behavior of the vehicle to be detected.
[0014] In one possible implementation, the target detection frame is segmented into a driver side area and a non-driver side area, including: drawing a segmentation line along a direction parallel to the driving direction and passing through the center of the target detection frame; and segmenting the target detection frame into a driver side area and a non-driver side area according to the driving direction and the segmentation line.
[0015] In a second aspect, the present application provides a device for determining a target area, the device comprising various functional modules used in the method described in the first aspect above.
[0016] In a third aspect, the present application provides an electronic device, which includes a processor and a memory; the memory stores instructions executable by the processor; when the processor is configured to execute the instructions, the electronic device implements the method described in the first aspect above.
[0017] In a fourth aspect, the present application provides a computer program product. When the computer program product is executed in an electronic device, the electronic device executes the related method described in the first aspect to implement the method described in the first aspect.
[0018] In a fifth aspect, the present application provides a readable storage medium, which includes: software instructions; when the software instructions are executed in an electronic device, the electronic device implements the method described in the first aspect above.
[0019] The beneficial effects of the second to fifth aspects mentioned above can be referred to the first aspect and will not be elaborated on again. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0021] Figure 1 A schematic diagram of the composition of a target area determination system is provided for an embodiment of the present application;
[0022] Figure 2 A schematic diagram of the composition of an electronic device provided in an embodiment of the present application;
[0023] Figure 3 A schematic diagram of a flow chart of a method for determining a target area provided in an embodiment of the present application;
[0024] Figure 4 A schematic diagram of the vertical angle range provided in the embodiment of the present application;
[0025] Figure 5 A schematic diagram of the target direction provided in an embodiment of the present application;
[0026] Figure 6 Another target direction schematic diagram provided for an embodiment of the present application;
[0027] Figure 7 A schematic diagram of the configuration of the preset direction provided in the embodiment of the present application;
[0028] Figure 8 A schematic diagram of an ellipse detection frame provided in an embodiment of the present application;
[0029] Fig. 9 A schematic diagram of another flow chart of a method for determining a target area provided in an embodiment of the present application;
[0030] Fig.10A schematic diagram of dividing an ellipse detection frame provided in an embodiment of the present application;
[0031] Fig.11 A flow chart of a method for detecting passenger-carrying behavior provided in an embodiment of the present application;
[0032] Fig.12 Another schematic diagram of a flow chart of a method for detecting passenger-carrying behavior provided in an embodiment of the present application;
[0033] Fig.13 A schematic diagram of another flow chart of a method for detecting passenger-carrying behavior provided in an embodiment of the present application;
[0034] Fig.14 A schematic diagram of the composition of a target area determination device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] In the following, the terms "first", "second", "third", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", or "third", etc. may explicitly or implicitly include one or more of the features.
[0036] At present, the investigation and handling of vehicle operating qualification issues mainly remains at the stage of manual on-site investigation and handling, which greatly consumes manpower, material and financial resources, and the effect is not obvious.
[0037] For example, a driver who does not have operating qualifications and is carrying passengers may flee the scene or stop carrying passengers once he sees the personnel conducting the investigation or his vehicle, making it impossible for the personnel conducting the investigation to collect evidence and conduct the investigation.
[0038] In order to save manpower, material resources, and financial resources, a solution has recently been proposed to use a camera to obtain an image of a vehicle to be detected, recognize the image, identify a target detection frame of the vehicle to be detected as the target area of the vehicle to be detected, and perform personnel detection on the target area to detect whether the vehicle to be detected is carrying passengers.
[0039] However, there may be irrelevant pedestrians around the vehicle in the target detection frame, thereby affecting the accuracy of detecting the passenger-carrying behavior of the detected vehicle.
[0040] On this basis, the embodiments of the present application provide a method, device, equipment and storage medium for determining a target area, which can further generate a smaller elliptical frame to obtain the target area based on the target detection frame of the vehicle to be detected. The elliptical frame is shorter and more in line with the actual detection needs of detecting passenger-carrying behavior, thereby improving the accuracy of detecting the passenger-carrying behavior of the vehicle to be detected.
[0041] The following is an introduction with reference to the accompanying drawings.
[0042] Figure 1 A schematic diagram of the composition of a target area determination system is provided for an embodiment of the present application. Figure 1 As shown, the system includes: an image acquisition device 100 and a target area determination device 200. The image acquisition device 100 and the target area determination device 200 may be connected via a wired network or a wireless network.
[0043] The image acquisition device 100 can be used to acquire images of a vehicle to be detected.
[0044] The image acquisition device 100 may be a camera or an internet protocol camera (IPC) installed on both sides of the road.
[0045] In some embodiments, the image acquisition device 100 may also be used to send the acquired image to the target area determination device 200 .
[0046] As described above, the image acquisition device 100 and the target area determination device 200 may be connected via a wired network or a wireless network which may include one or more media or devices capable of transmitting image data from the image acquisition device 100 to the target area determination device 200.
[0047] In some embodiments, the wired or wireless network may include one or more communication media that enable the image acquisition device 100 to send image data directly to the target area determination device 200 in real time. In this embodiment, the image acquisition device 100 can modulate the image data according to a communication standard (e.g., a wireless communication protocol) and send the modulated image data to the target area determination device 200. The one or more communication media may include wireless, and / or, wired communication media, such as a radio frequency (RF) spectrum or one or more physical transmission lines. Optionally, the one or more communication media may form part of a packet-based network, which may be, for example, a local area network, a wide area network, or a global network (e.g., the Internet). Optionally, the one or more communication media may also include routers, switches, base stations, or other devices that facilitate communication from the image acquisition device 100 to the target area determination device 200.
[0048] The target area determination device 200 can be used to determine the target area of the vehicle to be detected based on the image of the vehicle to be detected collected by the image acquisition device 100. The specific determination process can refer to the target area determination method described in the following embodiment, which will not be repeated here.
[0049] The target area determination device 200 may be an electronic device with a computing and processing function, such as a computer or a server.
[0050] Among them, the server can be a single server, or it can be a server cluster consisting of multiple servers. In some implementations, the server cluster can also be a distributed cluster. Optionally, the server can also be implemented on a cloud platform, for example, the cloud platform can include a private cloud, a public cloud, a hybrid cloud, a community cloud, a distributed cloud, an inter-cloud, and a multi-cloud, etc., or any combination thereof. The embodiments of the present application are not limited to this.
[0051] It should be noted that the above Figure 1 In the description, the image acquisition device 100 and the target area determination device 200 are described as independent devices. Optionally, the image acquisition device 100 and the target area determination device 200 can also be combined into one device. For example, the image acquisition device 100 or its corresponding function, and the target area determination device 200 or its corresponding function can be integrated into one device. The embodiments of the present application are not limited to this.
[0052] The execution subject of the target area determination method provided in the embodiment of the present application may be the above-mentioned target area determination device 200. As described above, the target area determination device 200 may be an electronic device with computing and processing functions such as a computer or a server. Optionally, the target area determination device 200 may also be a processor (such as a central processing unit (CPU)) in the aforementioned electronic device; or, the target area determination device 200 may also be an application (application, APP) with a target area determination function installed in the aforementioned electronic device; or, the target area determination device 200 may also be a functional module with a target area determination function in the aforementioned electronic device, etc. The embodiment of the present application does not limit this.
[0053] For simplicity of description, the following description will be made by taking the target area determination device 200 as an electronic device as an example.
[0054] Figure 2 The following is a schematic diagram of the composition of the electronic device provided in the embodiment of the present application. Figure 2 As shown, the electronic device may include: a processor 10 , a memory 20 , a communication line 30 , a communication interface 40 , and an input / output interface 50 .
[0055] The processor 10 , the memory 20 , the communication interface 40 and the input / output interface 50 may be connected via a communication line 30 .
[0056] The processor 10 is used to execute the instructions stored in the memory 20 to implement the method for determining the target area provided in the following embodiments of the present application. The processor 10 can be a CPU, a general-purpose processor network processor (NP), a digital signal processor (DSP), a microprocessor, a microcontroller (MCU) / single chip microcomputer / single chip microcomputer, a programmable logic device (PLD) or any combination thereof. The processor 10 can also be any other device with processing functions, such as a circuit, a device or a software module, which is not limited in the embodiments of the present application. In one example, the processor 10 may include one or more CPUs, such as Figure 2 As an optional implementation, the electronic device may include multiple processors, for example, in addition to the processor 10, it may also include a processor 60 ( Figure 2 The dashed line is used as an example.
[0057] The memory 20 is used to store instructions. For example, the instructions may be computer programs. Optionally, the memory 20 may be a read-only memory (ROM) or other types of static storage devices that can store static information and / or instructions, or a random access memory (RAM) or other types of dynamic storage devices that can store information and / or instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage devices, etc., and the embodiments of the present application are not limited to this.
[0058] It should be noted that the memory 20 may exist independently of the processor 10, or may be integrated with the processor 10. The memory 20 may be located inside the electronic device, or may be located outside the electronic device, which is not limited in the embodiment of the present application.
[0059] The communication line 30 is used to transmit information between various components included in the electronic device.
[0060] The communication interface 40 is used to communicate with other devices (such as the above-mentioned image acquisition device 100) or other communication networks. The other communication networks can be Ethernet, radio access network (RAN), wireless local area network (WLAN), etc. The communication interface 40 can be a module, a circuit, a transceiver or any device capable of achieving communication.
[0061] The input / output interface 50 is used to implement human-computer interaction between a user and an electronic device, for example, to implement action interaction or information interaction between a user and an electronic device.
[0062] Exemplarily, the input / output interface 50 may be a mouse, a keyboard, a display screen, or a touch display screen, etc. Action interaction or information interaction between a user and an electronic device may be achieved through a mouse, a keyboard, a display screen, or a touch display screen, etc.
[0063] It should be noted that Figure 2 The structure shown in the figure does not constitute a limitation on the electronic device, except Figure 2 In addition to the components shown, the electronic device may include more or fewer components than shown, or a combination of certain components, or a different arrangement of components.
[0064] The following is an introduction to the method for determining the target area provided in the embodiments of the present application.
[0065] Figure 3 Schematic diagram of a method for determining a target area provided in an embodiment of the present application. Optionally, the method may be performed by the above Figure 2 The electronic device of the hardware structure shown is executed, such as Figure 3 As shown, the method includes S101 to S105.
[0066] S101: An electronic device acquires an image including a vehicle to be detected.
[0067] For example, as described above, the electronic device (target area determination device 200) can be connected to the image acquisition device 100 via a wired network or a wireless network, and the electronic device can receive the image including the vehicle to be detected sent by the image acquisition device 100 via the wired network or the wireless network.
[0068] S102: The electronic device generates a rectangular detection frame of the vehicle to be detected in the image.
[0069] The area defined by the rectangular detection frame may include the vehicle to be detected. The area defined by the rectangular detection frame may include the vehicle to be detected.
[0070] For example, a target detection model for recognizing an image and generating a rectangular detection frame of a vehicle in the image may be preset in the electronic device.
[0071] Optionally, before S102, the electronic device may also acquire the target detection model.
[0072] In one possible implementation, the electronic device may receive a trained target detection model sent by other devices or obtained through an intermediate storage medium.
[0073] In another possible implementation, the electronic device may also obtain labeled training samples, and use the labeled training samples to train a preset machine learning model to obtain a target detection model. The training sample may be an image including one or more vehicles. The label of the training sample may be a rectangular detection box of one or more vehicles in the aforementioned image.
[0074] For example, as described above, the electronic device may include an input / output interface, which may include a mouse, a keyboard, or a touch screen, etc. The electronic device may receive the rectangular detection frame input by the operator through the mouse, the keyboard, or the touch screen, etc.
[0075] It is understandable that the electronic device can also directly obtain the image with the rectangular detection frame. That is, the step of generating the rectangular detection frame can also be performed by other devices, and the electronic device can receive the image with the rectangular detection frame generated by the other device. The embodiment of the present application does not limit this.
[0076] S103: The electronic device determines the target direction according to the driving direction of the vehicle to be detected in the image and the rectangular detection frame.
[0077] The target direction is used to indicate the direction, in the horizontal direction and the vertical direction of the plane where the image is located, which is close to the width direction of the vehicle to be detected.
[0078] For example, assuming that the horizontal direction converges to the vehicle width direction, the angle between the horizontal direction and the vehicle width direction is smaller than the angle between the vertical direction and the vehicle width direction; assuming that the vertical direction converges to the vehicle width direction, the angle between the vertical direction and the vehicle width direction is smaller than the angle between the horizontal direction and the vehicle width direction.
[0079] In a possible implementation, the rectangular detection frame includes a first side parallel to the horizontal direction of the plane where the image is located, and a second side perpendicular to the first side. In this case, the above S103 may specifically include: if the angle between the driving direction and the horizontal direction of the plane where the image is located is within a preset vertical angle range, the direction parallel to the first side is used as the target direction; if the angle between the driving direction and the horizontal direction of the plane where the image is located is outside the preset vertical angle range, the direction parallel to the second side is used as the target direction.
[0080] The preset vertical angle range is preset in the electronic device by the administrator. For example, the preset vertical angle range may be 45° to 135° and 225° to 315°.
[0081] For example, Figure 4 Schematic diagram of vertical angle range provided in the embodiment of the present application. Figure 4 As shown, Figure 4 Taking the horizontal direction of the plane including the image of the vehicle to be detected as horizontal to the left (thin solid arrow) as an example, it is shown that the preset vertical angle range can be 45° to 135° and 225° to 315° with the horizontal direction, that is, when the angle between the driving direction of the vehicle to be detected and the horizontal direction is 45° to 135° and 225° to 315°, it can be considered that the driving direction of the vehicle to be detected in the image is vertical.
[0082] For example, Figure 5 This is a schematic diagram of the target direction provided by the embodiment of the present application. Figure 5 As shown, taking the above-mentioned preset vertical angle ranges of 45° to 135° and 225° to 315° as an example, assuming that the angle between the driving direction of the current vehicle to be detected and the horizontal direction of the plane where the image is located is 50°, within the preset vertical angle range, it can be considered that the driving direction of the vehicle in the image is roughly vertical, and the horizontal direction is more similar to the vehicle width direction (the angle between the vehicle width direction and the horizontal direction is 40°, which is smaller than the angle between the vehicle width direction and the vertical direction of 50°), so the direction of the first side parallel to the horizontal direction can be used as the target direction.
[0083] For example, Figure 6 Another target direction schematic diagram provided in the embodiment of the present application. Figure 6As shown, taking the above-mentioned preset vertical angle ranges of 45° to 135° and 225° to 315° as an example, assuming that the angle between the driving direction of the current vehicle to be detected and the horizontal direction of the plane where the image is located is 40°, outside the preset vertical angle range, it can be considered that the driving direction of the vehicle in the image is roughly horizontal. At this time, the vertical direction is more similar to the vehicle width direction (the angle between the vehicle width direction and the vertical direction is 40°, which is smaller than the angle between the vehicle width direction and the horizontal direction of 50°). Therefore, the direction of the second side parallel to the vertical direction can be used as the target direction.
[0084] Optionally, before S103, the electronic device may also obtain the driving direction of the vehicle to be detected.
[0085] Optionally, as described above, the image including the vehicle to be detected may be acquired by the image acquisition device 100, and the image acquisition device 100 may be understood as a camera (e.g., a first camera), and the electronic device may obtain a preset direction configured for the first camera as the driving direction of the vehicle to be detected. In this case, the electronic device may specifically obtain the driving direction by the following steps:
[0086] Step 1: The electronic device obtains a preset direction of a first camera.
[0087] The first camera is a camera that captures an image including the vehicle to be detected. For example, the first camera may be a camera disposed on both sides of a road. The preset direction is used to indicate the driving direction of the vehicle flow in the field of view of the first camera.
[0088] Optionally, the field of view of the first camera may include two areas with opposite driving directions. In this case, the preset direction in step 1 can also be understood as the driving direction of the traffic in the area where the vehicle to be detected is located in the field of view of the first camera.
[0089] In one possible implementation, as described above, the electronic device may include an input / output interface, which may be a mouse, keyboard, or touch screen, etc. The electronic device may receive the preset direction configured by the administrator for the first camera through the mouse, keyboard, or touch screen.
[0090] In another possible implementation, as described above, the first camera may be a camera disposed on both sides of the road, and the road or the vicinity of the road may include a marker indicating the direction of traffic flow (e.g., an arrow in the lane or an arrow in a lane sign on the right side of the road). In this case, the electronic device may identify these markers to obtain the above-mentioned preset direction. The specific identification process may refer to the description in the related art and will not be repeated here.
[0091] Step 2: The electronic device obtains the driving direction of the vehicle to be detected according to a preset direction.
[0092] Wherein, the driving direction of the vehicle to be detected is the same as the preset direction.
[0093] For example, the electronic device may use a preset direction as the driving direction of the vehicle to be detected.
[0094] For example, Figure 7 This is a schematic diagram of the configuration of the preset direction provided in the embodiment of the present application. Figure 7 As shown, the electronic device can be configured with preset directions of multiple cameras ( Figure 7 In the figure, camera01, camera02, and camera03 are used as examples. Assume that camera01 is the first camera and the right area of the image acquired by camera01 is the area where the vehicle to be detected is located. The preset direction of camera01 can be as follows: Figure 7 The direction indicated by the thick black solid arrow at the middle lane line in the middle right area.
[0095] S104: The electronic device generates a target detection frame for the vehicle to be detected according to the center of the rectangular detection frame and the target direction.
[0096] The target detection frame may include a target rectangular frame or an elliptical detection frame and other specific implementation forms. If the target detection frame is a target rectangular frame, the target rectangular frame includes a long side in the target direction, and the long side is longer than the side of the rectangular detection frame parallel to the target direction; if the target detection frame is an elliptical detection frame, the elliptical detection frame includes a long axis in the target direction, and the long axis is longer than the side of the rectangular detection frame parallel to the target direction.
[0097] For example, taking the elliptical detection frame as an example, assuming that the target direction is the horizontal direction of the image, the side of the rectangular detection frame parallel to the horizontal direction is called the length, and the side perpendicular to the top is called the width. The electronic device can multiply the length of the rectangular detection frame by the first coefficient to obtain the major axis of the elliptical detection frame, and multiply the width of the rectangular detection frame by the second coefficient to obtain the minor axis of the elliptical detection frame. According to the center of the elliptical detection frame, the major axis of the elliptical detection frame, and the minor axis of the elliptical detection frame, the elliptical detection frame is generated.
[0098] The first coefficient may be greater than 1, and the first coefficient may be preset in the electronic device by a manager, and the embodiment of the present application does not limit the specific value of the first coefficient. The second coefficient is greater than 0 and less than or equal to 1. The second coefficient may also be preset in the electronic device by a manager, and the embodiment of the present application does not limit the specific value of the second coefficient.
[0099] For example, Figure 8 Schematic diagram of the ellipse detection frame provided in the embodiment of the present application. Figure 8 As shown, when the driving direction of the vehicle in the image is roughly vertical, taking the target detection frame as an elliptical detection frame as an example, the major axis of the elliptical detection frame generated by the embodiment of the present application can be longer than the length of the target detection frame, thereby stretching the area in the vehicle width direction (or on both sides of the vehicle body) and expanding the target area on both sides of the vehicle body.
[0100] S105: The electronic device determines a target area of the vehicle to be detected according to the target detection frame.
[0101] Among them, in order to know whether the vehicle to be detected is carrying passengers, it is necessary to aggregate and summarize the people around the vehicle. Before the analysis, it is necessary to determine a clear area related to the vehicle to be detected. The target area of the vehicle to be detected can also be understood as an area used to indicate that the vehicle to be detected needs to conduct aggregate and summarize analysis of the people around it.
[0102] S105 can refer to the description in the following embodiments and will not be described in detail here.
[0103] In the method for determining the target area provided in the embodiment of the present application, the electronic device can determine the target direction converging to the vehicle width direction based on the driving direction of the vehicle to be detected in the image and the rectangular detection frame, and generate a target detection frame based on the center of the rectangular detection frame and the target direction. The target detection frame has a longer major axis or long side in the target direction, that is, a longer major axis or long side in the direction converging to the vehicle width direction. The area in the vehicle width direction is also the area on both sides of the vehicle body. Generating a target detection frame with a longer major axis or long side can stretch and enlarge the areas on both sides of the vehicle body, and the areas on both sides of the vehicle body are the key areas for passenger-carrying behavior detection. Therefore, the target detection frame after stretching and enlarging the areas on both sides of the vehicle body in the present application is more in line with the actual detection needs of detecting passenger-carrying behavior, thereby improving the accuracy of detecting passenger-carrying behavior of the vehicle to be detected.
[0104] In some possible embodiments, before determining the target area of the vehicle to be detected based on the target detection frame, the electronic device may also rotate the target detection frame according to the driving direction so that the short axis or short side of the target detection frame is parallel to the driving direction.
[0105] The short side is the side of the target rectangular frame opposite to the long side.
[0106] In the target area determination method provided in the embodiment of the present application, the electronic device can also rotate the generated target detection frame so that the short axis or short side of the target detection frame is parallel to the driving direction, which is more in line with actual detection needs, thereby improving the accuracy of detecting the passenger behavior of the vehicle to be detected.
[0107] In some possible embodiments, the short axis or short side of the target detection box is shorter than or equal to the side of the rectangular detection box that is parallel to the short axis or short side.
[0108] It should be understood that the rectangular detection frame of the vehicle to be detected is usually large, and the larger rectangular detection frame may frame irrelevant passers-by around the vehicle to be detected into the area where the surrounding personnel aggregation and inductive analysis are required, thereby analyzing irrelevant passers-by around the vehicle to be detected as passengers getting on or off the vehicle, affecting the accuracy of detecting the passenger-carrying behavior of the vehicle to be detected. In the method for determining the target area provided in the embodiment of the present application, the short axis or short side of the target detection frame generated by the electronic device is shorter than or equal to the side of the rectangular detection frame parallel to the short axis or short side. Therefore, compared with the rectangular detection frame, the target detection frame removes the four right angles of the rectangular detection frame (or the four corners of the vehicle body) that are not strongly correlated with the passenger boarding and disembarking behavior, which is more in line with the actual detection needs of detecting passenger-carrying behavior, thereby improving the accuracy of detecting the passenger-carrying behavior of the vehicle to be detected.
[0109] The specific process of S105 is introduced below.
[0110] In some possible embodiments, the electronic device may directly use the area within the target detection frame as the target area.
[0111] In some other possible embodiments, in order to prevent the driver of the detected vehicle from getting off the vehicle to pick up luggage and then returning to the vehicle from being misjudged as a passenger-carrying behavior, the electronic device may also divide the target detection frame into a driver side area and a non-driver side area, and use the non-driver side area as the target area. Fig. 9 This is another flow chart of a method for determining a target area provided in an embodiment of the present application. Fig. 9 As shown, the above S105 may specifically include S1051 and S1052.
[0112] S1051: The electronic device divides the target detection frame into a driver side area and a non-driver side area.
[0113] Optionally, S1051 may specifically include the following steps:
[0114] X1. Draw a dividing line along the direction parallel to the driving direction and through the center of the target detection frame.
[0115] X2. According to the driving direction and the dividing line, the target detection frame is divided into a driver side area and a non-driver side area.
[0116] In some embodiments, the electronic device may indicate the driver side area or the non-driver side area using a filled mask.
[0117] In this case, the above S1051 may further specifically include the following steps:
[0118] Step 1: The electronic device determines a first vector according to the driving direction.
[0119] The first vector is used to divide the target detection frame into a driver side area and a non-driver side area. The first vector passes through the center of the target detection frame, and the starting point and the end point of the first vector are both located on the boundary of the target detection frame.
[0120] Step 2: The electronic device selects a seed point in the target detection frame from (any) side of the first vector.
[0121] Step 3: The electronic device uses a preset algorithm to fill the mask on the side where the seed point is located.
[0122] The area filled with the mask in the target detection frame is used to indicate the driver side area or the non-driver side area. The preset algorithm may be a filling algorithm, such as a flooding algorithm or other filling algorithms that fill an area based on a seed point. The present application embodiment does not limit this.
[0123] Specifically, step 2 in the above S1051 may further include the following steps:
[0124] Step 2.1: The electronic device selects candidate points from the target detection frame.
[0125] Step 2.2: The electronic device determines a candidate vector based on the candidate point.
[0126] Among them, the starting point of the candidate vector is the center of the target detection box, and the end point of the candidate vector is the candidate point.
[0127] Step 2.3. When the area filled with the mask is used to indicate the driver's side area, if the right-hand screw rule of vector cross multiplication is used, when the first vector cross multiplication of the candidate vector is calculated, the candidate vector is in the counterclockwise direction of the first vector; or when the candidate vector cross multiplication of the first vector is calculated, the first vector is in the clockwise direction of the candidate vector, then the end point of the candidate vector (candidate point) is used as the seed point.
[0128] Step 2.4, when the area filled with the mask is used to indicate the non-driver side area, if the right-hand screw rule of vector cross multiplication is used, when the first vector cross multiplication of the candidate vector is calculated, the candidate vector is in the clockwise direction of the first vector; or when the candidate vector cross multiplication of the first vector is calculated, the first vector is in the counterclockwise direction of the candidate vector, then the end point of the candidate vector (candidate point) is used as the seed point.
[0129] S1052: The electronic device uses the non-driver side area as the target area of the vehicle to be detected.
[0130] For example, Fig.10 This is a schematic diagram of dividing the ellipse detection frame provided in the embodiment of the present application. Fig.10 As shown, the target detection frame is an ellipse detection frame, the area filled with a mask in the ellipse detection frame is used to indicate the non-driver side area, and the area not filled with a mask in the ellipse detection frame is used to indicate the driver side area. Fig.10 FIG. 4 shows the identification of target areas of multiple vehicles to be detected.
[0131] It should be understood that after the vehicle pulls over, other vehicles may pass by on the left side of the vehicle body. For safety reasons, passengers of the vehicle usually get on and off on the right side of the vehicle body (i.e., the non-driver side). In the method for determining the target area provided in the embodiment of the present application, after the electronic device determines the target detection frame of the area to be detected, it can also divide the target detection frame according to the driving direction, into the driver's side and the non-driver's side, and use the non-driver's side as the target area, focusing on the non-driver's side where passengers may get on and off the vehicle. Passenger-carrying behavior detection is performed, and at the same time, the driver's behavior of getting off the vehicle on the driver's side to get the luggage and then returning to the vehicle is prevented from being misjudged as passenger-carrying behavior, which is more in line with the actual detection needs of detecting passenger-carrying behavior, thereby improving the accuracy of detecting the passenger-carrying behavior of the vehicle to be detected.
[0132] The above is an introduction to the process of determining the target area in a certain frame of image. In the actual process of detecting passenger-carrying behavior, it is possible to detect and judge multiple frames of images. In this case, Fig.11 Schematic diagram of the process of detecting the passenger-carrying behavior provided in the embodiment of the present application. Optionally, the method can be performed by the above Figure 2 The electronic device of the hardware structure shown is executed, such as Fig.11 As shown, the method may include S201 to S203.
[0133] S201: The electronic device obtains multiple frames of images including a vehicle to be detected.
[0134] The specific process of S201 can be referred to the description in the following embodiment and will not be repeated here.
[0135] S202: The electronic device determines, in each frame of the multiple frames of images, a target area of the vehicle to be detected, a door status of the vehicle to be detected, and the number of people in the target area.
[0136] The target area is the area where passenger behavior detection is performed. The door status includes open or closed.
[0137] The specific process of determining the target area of the vehicle to be inspected in S202 can refer to the description in the above-mentioned target area determination method, which will not be repeated here. The process of determining the door status of the vehicle to be inspected and the number of people in the target area in S202 can refer to the description in the following embodiments, which will not be repeated here.
[0138] S203, the electronic device determines whether the vehicle to be detected is carrying passengers based on changes in the door status of the vehicle to be detected and changes in the number of people in the target area in the multiple frames of images.
[0139] The specific process of S203 can be referred to the description in the following embodiment, which will not be repeated here.
[0140] In the passenger-carrying behavior detection method provided in the embodiment of the present application, the electronic device can identify multiple frames of images including the vehicle to be detected, obtain the target area of the vehicle to be detected, the door status of the vehicle to be detected, and the number of people in the target area, and determine whether the vehicle to be detected has passenger-carrying behavior based on the changes in the door status of the vehicle to be detected in the multiple frames of images and the changes in the number of people in the target area. Compared with the current manual investigation and handling scheme, the detection method provided in the embodiment of the present application can directly use remotely acquired images for detection, and can perform long-distance and all-round detection, saving manpower, physical, and financial resources.
[0141] In addition, the passenger-carrying behavior detection method provided in the embodiment of the present application does not require the cooperation of an advanced zoom camera, and is theoretically suitable for images captured by all cameras. Moreover, the method can simultaneously detect multiple passenger-carrying behaviors in the picture, thereby improving the detection capability of passenger-carrying behaviors.
[0142] The specific process of the above S201 is introduced below.
[0143] In some possible embodiments, the electronic device may first determine the vehicle to be detected, then determine the historical vehicle frame sequence corresponding to the vehicle to be detected, and use the multiple frame images in the historical vehicle frame sequence corresponding to the vehicle to be detected as the multiple frame images including the vehicle to be detected in S201. Fig.12 Another flow chart of the method for detecting passenger-carrying behavior provided in the embodiment of the present application. Fig.12 As shown, the above S201 may specifically include S2011 to S2014.
[0144] S2011. The electronic device obtains multiple frames of vehicle images.
[0145] Each frame of vehicle image includes one or more vehicles.
[0146] For example, as described above, the electronic device (target area determination device 200) can be connected to the image acquisition device 100 via a wired network or a wireless network, and the electronic device can receive the vehicle image sent by the image acquisition device 100 via the wired network or the wireless network.
[0147] S2012: The electronic device determines a vehicle with an open door in the multiple frames of vehicle images as a vehicle to be detected.
[0148] For example, a door state detection model for detecting the door state may be preset in the electronic device. The electronic device may use the door state detection model to detect a vehicle image and determine a vehicle with an open door state in the vehicle image as a vehicle to be detected.
[0149] Optionally, before using the door state detection model to detect the vehicle image, the electronic device may also obtain the door state detection model.
[0150] In a possible implementation, the electronic device may directly receive the trained door state detection model sent by other devices or obtain the trained door state detection model through an intermediate storage medium.
[0151] In another possible implementation, the electronic device may train a preset initial machine learning model using a first training sample with a first label to obtain a door state detection model, wherein the first training sample may be a vehicle image, and the first label may be a pre-labeled door state.
[0152] Optionally, the first training sample may include a positive sample and a negative sample. The positive sample is a training sample with a marked door state of open, and the negative sample is a training sample with a marked door state of closed.
[0153] S2013: The electronic device determines an intersection-over-union ratio between the position to be detected and the historical positions.
[0154] The position to be detected is the position of the vehicle to be detected in the vehicle image. The historical position is the position of the historical vehicle in any frame image included in the corresponding historical vehicle frame sequence.
[0155] S2014: If the IoU between the position to be detected and the historical position is greater than a preset IoU threshold, the electronic device obtains a plurality of frames of images including the vehicle to be detected in S201 according to a historical vehicle frame sequence corresponding to the historical position.
[0156] The preset intersection-and-intersection ratio threshold value may be preset in the electronic device by the administrator. For example, the preset intersection-and-intersection ratio threshold value may be 70% or 80%, etc. The embodiment of the present application does not limit the specific value of the preset intersection-and-intersection ratio threshold value.
[0157] Optionally, if the IoU between the position to be detected and the historical position is greater than a preset IoU threshold, the electronic device may use the historical vehicle frame sequence corresponding to the historical position as the multi-frame image including the vehicle to be detected in S201.
[0158] For example, a historical vehicle frame sequence set includes a historical vehicle frame sequence A corresponding to a historical vehicle A, and a historical vehicle frame sequence B corresponding to a historical vehicle B. Assuming that the historical vehicle frame sequence A includes three frames of images a1, a2, and a3, and the historical vehicle frame sequence B includes three frames of images b1, b2, and b3, the electronic device can calculate the intersection-and-union ratio of the position of the vehicle to be detected in the vehicle image and any one of the position of the historical vehicle A in image a1, the position of the historical vehicle A in image a2, the position of the historical vehicle A in image a3, the position of the historical vehicle B in image b1, the position of the historical vehicle B in image b2, and the position of the historical vehicle B in image b3. Assuming that the intersection-and-union ratio between the position of the vehicle to be detected in the vehicle image and the position of the historical vehicle A in image a1 is greater than a preset intersection-and-union ratio threshold, the electronic device can use the three frames of images in the historical vehicle frame sequence A as the multiple frames of images including the vehicle to be detected in S201.
[0159] Optionally, if the intersection-and-union ratio of the vehicle to be detected compared with any historical vehicle frame sequence of the historical vehicle is less than a preset threshold, the electronic device can create a new historical vehicle frame sequence for the vehicle to be detected and supplement the newly created historical vehicle frame sequence by comparing the intersection-and-union ratio according to the above steps based on the subsequently acquired images.
[0160] It should be noted that if the intersection-and-joint ratio of the vehicle to be detected compared with any historical vehicle frame sequence of the historical vehicle is equal to a preset threshold, the electronic device can obtain multiple frames of images including the vehicle to be detected based on the historical vehicle frame sequence of the any historical vehicle; or, a new historical vehicle frame sequence can be created for the vehicle to be detected. The embodiments of the present application are not limited to this.
[0161] In some other possible embodiments, the electronic device may also first determine the historical vehicle frame sequence corresponding to each vehicle in the multiple frames of vehicle images, and then determine the vehicle to be detected from the multiple vehicles included in the multiple frames of vehicle images, thereby determining the historical vehicle frame sequence corresponding to the vehicle to be detected.
[0162] Among them, the specific process of the electronic device determining the historical vehicle frame sequence corresponding to each vehicle in the multiple frames of vehicle images, and determining the vehicle to be detected from the multiple vehicles included in the multiple frames of vehicle images can be referred to as described in the previous embodiment, and will not be repeated here.
[0163] The following describes the process of determining the door status of the vehicle to be detected and the number of people in the target area in S202.
[0164] In some possible embodiments, with respect to the door status of the vehicle to be detected in S202 above, as described above, a door status detection model for detecting the door status may be preset in the electronic device. In this case, the electronic device may use the door status detection model to detect the door status of the door to be detected.
[0165] In some other possible embodiments, with respect to the number of people in the target area in S202 above, a person detection model (or pedestrian detector) for detecting people may be preset in the electronic device. The electronic device may use the person detection model to detect people in the image where the vehicle to be detected is located, and generate a rectangular detection frame for each person detected. The electronic device may calculate the center point of the rectangular detection frame for each person. For any rectangular detection frame, if the center point of the rectangular detection frame falls within the target area, the electronic device may determine the person corresponding to the rectangular detection frame as a person within the target area, and further calculate the number of center points of the rectangular detection frames falling within the target area to determine the number of people within the target area.
[0166] Among them, the personnel detection model can refer to the description in the relevant technology and will not be repeated here.
[0167] The specific process of the above S203 is introduced below.
[0168] In some possible embodiments, the passenger-carrying behavior in S203 may include passenger boarding behavior and passenger alighting behavior. Fig.13 Another flow chart of the method for detecting passenger-carrying behavior provided in the embodiment of the present application is shown in FIG. Fig.13 As shown, the above S203 may specifically include S2031 to S2033.
[0169] S2031. The electronic device determines (in sequence) a door opening frame and a door closing frame according to changes in the door status of the vehicle to be detected in the multiple frames of images.
[0170] For example, as described above, if the intersection-and-joint ratio between the position to be detected and the historical position is greater than a preset intersection-and-joint ratio threshold, the electronic device can use the historical vehicle frame sequence corresponding to the historical position as a multi-frame image including the vehicle to be detected in S201. In this case, the electronic device can use the door state sequence corresponding to the historical vehicle frame sequence to record the changes in the door state of the vehicle to be detected in the historical vehicle frame sequence.
[0171] Among them, the door status sequence may include multiple indicator symbols, and the multiple indicator symbols correspond one-to-one to multiple frame images in the historical vehicle frame sequence, and each indicator symbol is used to indicate the door status of the vehicle to be detected in the corresponding image in the historical vehicle frame sequence.
[0172] For example, taking the indicator symbols including 1 and 0, 1 indicates that the door state is open, and 0 indicates that the door state is closed, the change of the door state and the corresponding door state sequence can be specifically expressed as follows:
[0173] 1) The car door was once opened and is now closed: 111111010101011111100000.
[0174] 2) The car door is opening: 11010111111111111111011111111111.
[0175] Optionally, the electronic device may determine the first indicator symbol and the second indicator symbol according to the door state sequence, and use the image corresponding to the first indicator symbol as the door open frame, and use the image corresponding to the second indicator symbol as the door closed frame.
[0176] The first indicator is the indicator that appears for the first time in the door state sequence and is used to indicate that the door state is open. The second indicator is the indicator that appears for the last time in the door state sequence and is used to indicate that the door state is open.
[0177] For example, taking the door state sequence in the above example where the door was once opened and is currently closed as an example, assuming that A represents the historical vehicle frame sequence (the frame number), and B represents the door state sequence, the corresponding relationship between the historical vehicle frame sequence (the frame number) and the door state sequence can be shown in the following Table 1:
[0178] Table 1
[0179]
[0180] As shown in Table 1, the first indicator symbol of the indicator symbol 1 for indicating that the door state is open that appears for the first time in the door state sequence B is the indicator symbol corresponding to the 11th frame in the historical vehicle frame sequence, and the electronic device can use the 11th frame in the historical vehicle frame sequence as the door open frame. The second indicator symbol of the indicator symbol 1 for indicating that the door state is open that appears last in the door state sequence B (or the indicator symbol before the cluster of M indicator symbols 0 for indicating that the door state is closed that appear consecutively in the door state sequence B, M is a positive integer and can be preset in the electronic device by the management personnel) is the indicator symbol corresponding to the 27th frame in the historical vehicle frame sequence, and the electronic device can use the 27th frame in the historical vehicle frame sequence as the door closed frame.
[0181] S2032. The electronic device determines the first number of people and the second number of people based on the image frame before the door opening frame and the image frame after the door closing frame.
[0182] The first number of people is the number of people in the target area before the door opening frame, and the second number is the number of people in the target area after the door closing frame.
[0183] Optionally, as described above, the electronic device can detect people in the target area using a people detection model, and further calculate the number of center points of a rectangular detection frame falling into the target area to determine the number of people in the target area. In this case, the electronic device can use a people number sequence to record changes in the number of people in the target area.
[0184] The personnel quantity sequence may include multiple personnel quantities, and the multiple personnel quantities correspond one-to-one to multiple frame images in the historical vehicle frame sequence.
[0185] Optionally, since pedestrians may be blocked when the car door is opened, in order to improve the stability of detection, the electronic device can use the mode of the number of people in the target area in multiple frames (or several frames) of image frames before the car door opening frame as the first number of people, or can use the mode of the number of people in the target area in multiple frames (or several frames) of image frames after the car door closing frame as the second number of people.
[0186] S2033. The electronic device determines whether the vehicle to be detected is carrying passengers based on the first number of people and the second number of people.
[0187] Optionally, if the first number of people (the number of people in the target area before the door opening frame) is greater than the second number of people (the number of people in the target area after the door closing frame), the electronic device can determine that there is a passenger boarding the vehicle to be detected.
[0188] For example, taking the door opening frame and the door closing frame shown in Table 1 as an example, it is assumed that the corresponding relationship between the number of people sequence C and the door state sequence B is as follows:
[0189] B: 0000000000 1 11110101011111 1 000000000000000.
[0190] C: 5554455545************************2212122322.
[0191] Then the electronic device can determine in the sequence of the number of people that the mode of the number of people in the several frames of images before the number of people corresponding to the door opening frame (the image corresponding to the first bold and underlined 1 in sequence B) is 5 (5554455545), thereby determining that the first number of people (the number of people before the door opening frame) is 5. Then the electronic device can determine in the sequence of the number of people that the mode of the number of people in the several frames of images after the number of people corresponding to the door closing frame (the image corresponding to the second bold and underlined 1 in sequence B) is 2 (2212122322), thereby determining that the second number of people (the number of people after the door closing frame) is 2, thereby determining that the first number of people 5 is greater than the second number of people 2, and determining that there is a passenger boarding behavior in the vehicle to be detected.
[0192] Optionally, if the first number of people (the number of people in the target area before the door opening frame) is less than the second number of people (the number of people in the target area after the door closing frame), the electronic device can determine that there is passenger getting off the vehicle to be detected.
[0193] For example, taking the door opening frame and the door closing frame shown in Table 1 as an example, it is assumed that the corresponding relationship between the number of people sequence C and the door state sequence B is as follows:
[0194] B: 0000000000 1 11110101011111 1 000000000000000.
[0195] C: 2212122322************************5554455545.
[0196] Then the electronic device can determine in the sequence of the number of people that the mode of the number of people in the several frames of images before the number of people corresponding to the door opening frame (the image corresponding to the first bold and underlined 1 in sequence B) is 2 (2212122322), thereby determining that the first number of people (the number of people before the door opening frame) is 2. Then the electronic device can determine in the sequence of the number of people that the mode of the number of people in the several frames of images after the number of people corresponding to the door closing frame (the image corresponding to the second bold and underlined 1 in sequence B) is 5 (5554455545), thereby determining that the second number of people (the number of people after the door closing frame) is 5, thereby determining that the first number of people 2 is less than the second number of people 5, that there is a passenger getting off the vehicle to be detected.
[0197] Optionally, if the first number of people (the number of people in the target area before the door opening frame) is equal to the second number of people (the number of people in the target area after the door closing frame), the electronic device can determine that the vehicle to be detected does not carry passengers.
[0198] For example, taking the door opening frame and the door closing frame shown in Table 1 as an example, it is assumed that the corresponding relationship between the number of people sequence C and the door state sequence B is as follows:
[0199] B: 0000000000 1 11110101011111 1 000000000000000.
[0200] C: 5554455545************************5554455545.
[0201] Then the electronic device can determine in the sequence of the number of people that the mode of the number of people in the several frames of images before the number of people corresponding to the door opening frame (the image corresponding to the first bold and underlined 1 in sequence B) is 5 (5554455545), thereby determining that the first number of people (the number of people before the door opening frame) is 5. Then the electronic device can determine in the sequence of the number of people that the mode of the number of people in the several frames of images after the number of people corresponding to the door closing frame (the image corresponding to the second bold and underlined 1 in sequence B) is 5 (5554455545), thereby determining that the second number of people (the number of people after the door closing frame) is 5, thereby determining that the vehicle to be detected does not carry passengers.
[0202] In some possible embodiments, after determining that the vehicle to be detected is carrying passengers, the electronic device may also obtain the license plate number of the vehicle to be detected, and compare the license plate number of the vehicle to be detected with a preset license plate library with operating qualifications. If the license plate number of the vehicle to be detected is within the preset license plate library with operating qualifications, the electronic device may not process it; if the license plate number of the vehicle to be detected is outside the preset license plate library with operating qualifications, the electronic device may mark the vehicle to be detected for further detection.
[0203] For example, the electronic device can count the frequency of passenger-carrying behavior of the marked vehicle to be detected. If the frequency of passenger-carrying behavior exceeds a preset frequency threshold, it can be determined that the vehicle to be detected is operating in violation of regulations.
[0204] For another example, the electronic device can record the characteristics of the passengers getting on and off the marked vehicle each time it carries passengers. If the characteristics of the passengers getting on and off are different, it can be determined that the vehicle to be inspected is operating in violation of regulations.
[0205] The above mainly introduces the solution provided by the embodiment of the present application from the perspective of the method. In order to achieve the above functions, it includes hardware structures and / or software modules corresponding to the execution of each function. It should be easy to realize that the technical goals in this field are combined with the units and algorithm steps of each example described in the embodiments disclosed in this article, and the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical goals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0206] In an exemplary embodiment, the present application also provides a device for determining a target area. Fig.14 Schematic diagram of the composition of the target area determination device provided in the embodiment of the present application. Fig.14 As shown, the device includes: an acquisition module 1401 and a processing module 1402.
[0207] The acquisition module 1401 is used to acquire an image including a vehicle to be detected; the image includes a rectangular detection frame of the vehicle to be detected; and the area framed by the rectangular detection frame includes the vehicle to be detected.
[0208] The processing module 1402 is used to determine the target direction according to the driving direction of the vehicle to be detected in the image and the rectangular detection frame; the target direction is used to indicate the direction of the horizontal direction and the vertical direction of the plane where the image is located that converges to the width direction of the vehicle to be detected; according to the center of the rectangular detection frame and the target direction, a target detection frame of the vehicle to be detected is generated; wherein, if the target detection frame is a target rectangular frame, the target rectangular frame includes the long side of the target direction, and the long side is longer than the side of the rectangular detection frame parallel to the target direction; if the target detection frame is an elliptical detection frame, the elliptical detection frame includes the long axis of the target direction, and the long axis is longer than the side of the rectangular detection frame parallel to the target direction; according to the target detection frame, the target area of the vehicle to be detected is determined.
[0209] In some possible embodiments, the rectangular detection frame includes a first side parallel to the horizontal direction of the plane where the image is located, and a second side perpendicular to the first side; the processing module 1402 is specifically used to take the direction parallel to the first side as the target direction if the angle between the driving direction and the horizontal direction of the plane where the image is located is within a preset vertical angle range; if the angle between the driving direction and the horizontal direction of the plane where the image is located is outside the preset vertical angle range, then take the direction parallel to the second side as the target direction.
[0210] In some other possible embodiments, the processing module 1402 is also used to rotate the target detection frame according to the driving direction before determining the target area of the vehicle to be detected based on the target detection frame, so that the short axis or short side of the target detection frame is parallel to the driving direction; wherein the short side is the side opposite to the long side in the target rectangular frame.
[0211] In some other possible embodiments, the short axis or short side of the target detection box is shorter than or equal to the side of the rectangular detection box parallel to the short axis or short side.
[0212] In some other possible embodiments, the processing module 1402 is specifically used to divide the target detection frame into a driver side area and a non-driver side area; and the non-driver side area is used as the target area of the vehicle to be detected.
[0213] In some other possible embodiments, the processing module 1402 is specifically used to make a dividing line along a direction parallel to the driving direction and passing through the center of the target detection frame; and divide the target detection frame into a driver side area and a non-driver side area according to the driving direction and the dividing line.
[0214] It should be noted that Fig.14 The division of modules in the example is schematic and is only a logical function division. There may be other division methods in actual implementation. For example, two or more functions may be integrated into one processing module. The above integrated modules may be implemented in the form of hardware or in the form of software functional units.
[0215] In an exemplary embodiment, the embodiment of the present application further provides a readable storage medium, including software instructions, which, when executed on an electronic device, enables the electronic device to execute any one of the methods provided in the above embodiments.
[0216] In an exemplary embodiment, the embodiment of the present application further provides a computer program product including computer-executable instructions, which, when executed on an electronic device, enables the electronic device to execute any one of the methods provided in the above embodiments.
[0217] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using a software program, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer-executable instructions. When the computer-executable instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer-executable instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer-executable instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (digital subscriber line, DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more servers that can be integrated with the medium. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium (eg, a solid state disk (SSD)).
[0218] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art may understand and implement other changes to the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit can implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.
[0219] Although the present application has been described in conjunction with specific features and embodiments thereof, it is obvious that various modifications and combinations may be made thereto without departing from the spirit and scope of the present application. Accordingly, this specification and the drawings are merely exemplary illustrations of the present application as defined by the appended claims, and are deemed to have covered any and all modifications, variations, combinations or equivalents within the scope of the present application. Obviously, those skilled in the art may make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
[0220] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A method for determining a target area, characterized in that: The method comprises: Acquire an image including a vehicle to be detected; the image includes a rectangular detection frame of the vehicle to be detected; the area framed by the rectangular detection frame includes the vehicle to be detected; Determine a target direction according to the driving direction of the vehicle to be detected in the image and the rectangular detection frame; the target direction is used to indicate a direction that converges to the width direction of the vehicle to be detected in both the horizontal direction and the vertical direction of the plane where the image is located; Generate a target detection frame of the vehicle to be detected according to the center of the rectangular detection frame and the target direction; wherein, if the target detection frame is a target rectangular frame, the target rectangular frame includes a long side in the target direction, and the long side is longer than a side in the rectangular detection frame parallel to the target direction; if the target detection frame is an elliptical detection frame, the elliptical detection frame includes a long axis in the target direction, and the long axis is longer than a side in the rectangular detection frame parallel to the target direction; A target area of the vehicle to be detected is determined according to the target detection frame.
2. The method according to claim 1, characterized in that The rectangular detection frame includes a first side parallel to the horizontal direction of the plane where the image is located, and a second side perpendicular to the first side; and determining the target direction according to the driving direction of the vehicle to be detected in the image and the rectangular detection frame, including: If the angle between the driving direction and the horizontal direction of the plane where the image is located is within a preset vertical angle range, the direction parallel to the first side is taken as the target direction; If the angle between the driving direction and the horizontal direction of the plane where the image is located is outside a preset vertical angle range, the direction parallel to the second side is used as the target direction.
3. The method according to claim 1, characterized in that Before determining the target area of the vehicle to be detected according to the target detection frame, the method further includes: According to the driving direction, the target detection frame is rotated so that the short axis or short side of the target detection frame is parallel to the driving direction; wherein the short side is the side of the target rectangular frame opposite to the long side.
4. The method according to claim 1, characterized in that The short axis or short side of the target detection frame is shorter than or equal to the side of the rectangular detection frame parallel to the short axis or the short side.
5. The method according to any one of claims 1 to 4, characterized in that The step of determining the target area of the vehicle to be detected according to the target detection frame includes: Segmenting the target detection frame into a driver side area and a non-driver side area; The non-driver side area is used as the target area of the vehicle to be detected.
6. The method according to claim 5, characterized in that The segmenting of the target detection frame into a driver side area and a non-driver side area includes: Draw a dividing line along a direction parallel to the driving direction and passing through the center of the target detection frame; The object detection frame is divided into a driver side area and a non-driver side area according to the driving direction and the dividing line.
7. A device for determining a target area, characterized in that: The device comprises: an acquisition module and a processing module; The acquisition module is used to acquire an image including a vehicle to be detected; the image includes a rectangular detection frame of the vehicle to be detected; the area framed by the rectangular detection frame includes the vehicle to be detected; The processing module is used to determine the target direction according to the driving direction of the vehicle to be detected in the image and the rectangular detection frame; the target direction is used to indicate the direction of the horizontal direction and the vertical direction of the plane where the image is located that converges to the width direction of the vehicle to be detected; according to the center of the rectangular detection frame and the target direction, the target detection frame of the vehicle to be detected is generated; wherein, if the target detection frame is a target rectangular frame, the target rectangular frame includes the long side of the target direction, and the long side is longer than the side of the rectangular detection frame parallel to the target direction; if the target detection frame is an elliptical detection frame, the elliptical detection frame includes the long axis of the target direction, and the long axis is longer than the side of the rectangular detection frame parallel to the target direction; according to the target detection frame, the target area of the vehicle to be detected is determined.
8. The device according to claim 7, characterized in that The rectangular detection frame includes a first side parallel to the horizontal direction of the plane where the image is located, and a second side perpendicular to the first side; the processing module is specifically used to use the direction parallel to the first side as the target direction if the angle between the driving direction and the horizontal direction of the plane where the image is located is within a preset vertical angle range; if the angle between the driving direction and the horizontal direction of the plane where the image is located is outside the preset vertical angle range, use the direction parallel to the second side as the target direction; and / or, The processing module is further configured to rotate the target detection frame according to the driving direction before determining the target area of the vehicle to be detected according to the target detection frame, so that the short axis or short side of the target detection frame is parallel to the driving direction; wherein the short side is the side of the target rectangular frame opposite to the long side; and / or, The short axis or short side of the target detection frame is shorter than or equal to the side of the rectangular detection frame parallel to the short axis or the short side; and / or, The processing module is specifically used to divide the target detection frame into a driver side area and a non-driver side area; and use the non-driver side area as the target area of the vehicle to be detected; and / or, The processing module is specifically used to make a dividing line along a direction parallel to the driving direction and passing through the center of the target detection frame; and divide the target detection frame into a driver side area and a non-driver side area according to the driving direction and the dividing line.
9. An electronic device, characterized in that: include: Processor and memory; The memory stores instructions executable by the processor; When the processor is configured to execute the instructions, the electronic device implements the method according to any one of claims 1 to 6.
10. A readable storage medium, characterized in that: The readable storage medium includes: software instructions; When the software instructions are executed in an electronic device, the electronic device implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Vehicle course angle detection method and device, equipment and storage medium
CN114091521A
Video-based motor vehicle illegal manned detection method
CN114120250A
Occupancy detection for managed lane enforcement based on localization and classification of windshield images
US20130336538A1
