Target detection method, device and related equipment
By detecting and converting multiple images, combined with world coordinates and the maximum matching algorithm, the problem of low pedestrian detection efficiency in the existing technology is solved, and more efficient pedestrian deduplication processing is achieved.
Patent Information
- Application Number
- CN202410240135.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-04
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2044-03-04
AI Technical Summary
Pedestrian detection efficiency in the existing technology is low, mainly due to the limited monitoring range of a single camera, and the low accuracy of deduplication processing based on pedestrian distance when merging data from multiple cameras.
By inputting multiple images into the detection model for detection, multiple detection results and image feature vectors are generated, combined with world coordinates for deduplication processing, and the maximum matching algorithm and similarity calculation are used to reduce errors and achieve deduplication and merging.
It improves the efficiency and accuracy of pedestrian detection, can effectively remove duplicates and reduce the impact of errors in complex environments such as dense crowds and light changes.
Smart Images

Figure CN118135484B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer vision technology, and in particular, to a target detection method, apparatus, and related equipment. Background Art
[0002] The demand for pedestrian perception in public places is increasing. For example, there is a need to monitor the number of people in transportation hubs, there is a need to profile customer behavior in shopping malls, and there is a need for staff management in parks. Surveillance cameras are the most common pedestrian perception devices, but the monitoring range of a single camera is limited. With the emergence of low-cost, high-quality, and high-frame-rate cameras, the deployment of multi-camera networks in various applications has increased significantly. For example, to obtain a complete distribution or location of pedestrians, it is necessary to fuse the data of multiple cameras. When fusing data from multiple cameras, deduplication processing is required to remove duplicate data. In the existing technology, deduplication is generally performed based on pedestrian distance, but the deduplication accuracy of this method is low, resulting in low pedestrian detection efficiency. Summary of the invention
[0003] The embodiments of the present application provide a target detection method, device and related equipment to solve the problem of low pedestrian detection efficiency in the prior art.
[0004] To solve the above problems, this application is implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a target detection method, the method comprising:
[0006] Inputting the captured multiple first images into the detection model for detection, and obtaining multiple first detection results and multiple second detection results, wherein the multiple first images include the captured multiple objects to be detected, the first detection result includes a first detection frame of a head image of the object to be detected, and the second detection result includes a second detection frame of an image of the object to be detected;
[0007] Performing vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors, wherein the multiple image feature vectors correspond one-to-one to the multiple objects to be detected;
[0008] Determine a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, wherein the world coordinates correspond one-to-one to the plurality of objects to be detected;
[0009] The multiple objects to be detected are deduplicated based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object.
[0010] Optionally, performing vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors includes:
[0011] Traversing the multiple first detection results to generate multiple target matching pairs, the generation process of the i-th target matching pair included in the multiple target matching pairs includes: respectively calculating the intersection ratio of the first target detection result and the multiple second detection results to obtain multiple first calculation results, the first target detection result is any one of the multiple first detection results; determining a first target calculation result among the multiple first calculation results, the first target calculation result is the largest calculation result of the multiple first calculation results; determining a target matching pair according to the first target calculation result, the target matching pair includes the first target detection result and the second target detection result, the second target detection result is the second detection result corresponding to the first target calculation result;
[0012] Perform vector conversion on the multiple target matching pairs to obtain multiple image feature vectors.
[0013] Optionally, determining a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results includes:
[0014] Acquire parameter information, where the parameter information includes camera parameters for shooting the plurality of first images;
[0015] Calculating pixel coordinates corresponding to the plurality of target matching pairs respectively to obtain a plurality of pixel coordinates;
[0016] The plurality of pixel coordinates are converted according to the parameter information to obtain the plurality of world coordinates.
[0017] Optionally, the world coordinates include a length coordinate, a width coordinate, and a height coordinate, and converting the multiple pixel coordinates according to the parameter information to obtain the multiple world coordinates includes:
[0018] Predicting heights of second detection frames corresponding to the multiple target matching pairs to obtain multiple height coordinates, where the multiple height coordinates correspond one-to-one to the multiple target matching pairs;
[0019] Calculate a plurality of length coordinates and a plurality of width coordinates of the second detection frames corresponding to the plurality of target matching pairs respectively according to the parameter information;
[0020] The plurality of world coordinates are generated according to the plurality of length coordinates, the plurality of width coordinates, and the plurality of height coordinates.
[0021] Optionally, the performing deduplication processing on the multiple objects to be detected based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object includes:
[0022] Classifying the plurality of first images to obtain a plurality of classification sets, wherein the objects to be detected included in the same classification set are images taken by the same camera;
[0023] Performing similarity calculation on the multiple classification sets to obtain a second calculation result, wherein the second calculation result includes: the similarity between any two classification sets in the multiple classification sets;
[0024] The multiple classification sets are de-duplicated and merged according to the maximum matching algorithm and the multiple second calculation results to obtain a target classification set, where the target classification set includes the at least one target object.
[0025] Optionally, performing similarity calculation on the multiple classification sets to obtain a second calculation result includes:
[0026] Performing Euclidean distance calculation on a first classification set and a second classification set to obtain a target Euclidean distance, wherein the first classification set and the second classification set are any two classification sets among the multiple classification sets;
[0027] Performing cosine calculation on the first classification set and the second classification set to obtain a target cosine value;
[0028] The target Euclidean distance and the target cosine value are weightedly calculated according to a preset weight coefficient to obtain the multiple second calculation results, the preset weight coefficient includes a first weight value and a second weight value, the first weight value is the weight value of the target Euclidean distance, and the second weight value is the weight value of the target cosine value.
[0029] In a second aspect, an embodiment of the present application further provides a target detection device, the device comprising:
[0030] A detection module, used for inputting a plurality of first images captured into a detection model for detection, and obtaining a plurality of first detection results and a plurality of second detection results, wherein the plurality of first images include a plurality of objects to be detected captured, the first detection result includes a first detection frame of a head image of the object to be detected, and the second detection result includes a second detection frame of an image of the object to be detected;
[0031] A conversion module, used for performing vector conversion on the plurality of first detection results and the plurality of second detection results to obtain a plurality of image feature vectors, wherein the plurality of image feature vectors correspond one-to-one to the plurality of objects to be detected;
[0032] A determination module, configured to determine a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, wherein the world coordinates correspond one-to-one to the plurality of objects to be detected;
[0033] A processing module is used to perform deduplication processing on the multiple objects to be detected based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object.
[0034] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a transceiver, a memory, a processor, and a program stored in the memory and executable on the processor; the processor is used to read the program in the memory to implement the steps of the method described in the first aspect above.
[0035] In a fourth aspect, an embodiment of the present application further provides a readable storage medium for storing a program, which, when executed by a processor, implements the steps in the method described in the first aspect above.
[0036] In a fifth aspect, an embodiment of the present application further provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps in the method described in the first aspect.
[0037] The present application provides a target detection method, device and related equipment, the method comprising: inputting a plurality of first images captured into a detection model for detection, obtaining a plurality of first detection results and a plurality of second detection results, the plurality of first images comprising a plurality of objects to be detected captured, the first detection result comprising a first detection frame of a head image of an object to be detected, and the second detection result comprising a second detection frame of an image of an object to be detected; performing vector conversion on the plurality of first detection results and the plurality of second detection results to obtain a plurality of image feature vectors, the plurality of image feature vectors corresponding one-to-one to the plurality of objects to be detected; determining a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, the world coordinates corresponding one-to-one to the plurality of objects to be detected; performing deduplication processing on the plurality of objects to be detected based on the plurality of image feature vectors and the plurality of world coordinates to obtain at least one target object. The present application detects a plurality of first images to obtain a plurality of first detection frames and a second detection frame of the objects to be detected, thereby performing vector conversion and determining a plurality of world coordinates, thereby performing deduplication processing on the plurality of objects to be detected, obtaining at least one target object after deduplication processing, thereby improving the efficiency of pedestrian detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application 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 paying any creative labor.
[0039] Figure 1 It is a flowchart of the target detection method provided in the embodiment of the present application;
[0040] Figure 2 It is a conversion schematic diagram provided in an embodiment of the present application;
[0041] Figure 3 is a schematic diagram of the structure of a target detection device provided in an embodiment of the present application;
[0042] Figure 4 It is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0043] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0044] The terms "first", "second" etc. in the embodiments of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. In addition, the terms "include" and "have" and any variation thereof are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. In addition, "and / or" is used in the present application to represent at least one of connected objects, such as A and / or B and / or C, representing the inclusion of separate A, separate B, separate C, and A and B all exist, B and C all exist, A and C all exist, and 7 situations that A, B and C all exist.
[0045] See also Figure 1 , Figure 1 is a flow chart of the target detection method provided in the embodiment of the present application, such as Figure 1 As shown, the following steps may be included:
[0046] Step 101: input the multiple captured first images into the detection model for detection to obtain multiple first detection results and multiple second detection results, wherein the multiple first images include multiple captured objects to be detected, the first detection result includes a first detection frame of a head image of the object to be detected, and the second detection result includes a second detection frame of an image of the object to be detected.
[0047] In this embodiment, multiple first images can be captured by multiple cameras or video cameras, wherein the multiple first images can be captured by one camera or multiple cameras, which is not specifically limited in this embodiment. The first detection result is a head image of the object to be detected. For example, in this application, the object to be detected is explained by taking a pedestrian as an example, and the head image of the object to be detected is the head image of the pedestrian. The second detection result is the entire image of the detection object, that is, the full-body image of the pedestrian.
[0048] It should also be noted that the plurality of first images include a plurality of objects to be detected captured, wherein each first image includes at least one object to be detected, and thus, the plurality of objects to be detected can be identified through the plurality of first images. The detection model can be a trained detection network model obtained by training with a large number of data sets.
[0049] Step 102: Perform vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors, where the multiple image feature vectors correspond one-to-one to the multiple objects to be detected.
[0050] In this embodiment, after performing vector conversion on the multiple first detection results and the multiple second detection results, the multiple first detection results and the multiple second detection results are matched one by one, wherein the corresponding matching refers to matching the first detection frame of the head image with the second detection frame belonging to the same person. After the matching is completed, the multiple second detection frame vectors are converted to obtain multiple image feature vectors.
[0051] Step 103 : determining a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, wherein the world coordinates correspond one-to-one to the plurality of objects to be detected.
[0052] In this embodiment, multiple world coordinates are determined through multiple first detection results and multiple second detection results, where the world coordinates refer to coordinate values in the real world, such as longitude and latitude values, and also include altitude values. For example, if the two-dimensional pixel coordinates are known to be (u, v), the world coordinates (Xw, Yw, Zw) are calculated. Assuming that the value of Zw in the three-dimensional coordinates is determined, Xw and Yw can be inferred in reverse. Therefore, after predicting the value of Zw, Xw and Yw can be calculated. Thus, the world coordinates corresponding to each second detection frame are obtained.
[0053] Step 104: De-duplicate the multiple objects to be detected based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object.
[0054] In this embodiment, calibration will bring certain errors in the estimation of pedestrian positions, especially in crowded situations, where the impact of such errors will be greater. At the same time, factors such as light and occlusion will cause the image features of the same pedestrian under different cameras to differ greatly, and different pedestrians with similar clothing will also have similar image features. Therefore, both position features and image features have certain errors. The present invention uses a maximum matching algorithm to reduce the impact of errors on the deduplication results, and obtains the best deduplication results from a global optimal perspective.
[0055] The present application provides a target detection method, the method comprising: inputting a plurality of first images captured into a detection model for detection, obtaining a plurality of first detection results and a plurality of second detection results, the plurality of first images comprising a plurality of objects to be detected captured, the first detection result comprising a first detection frame of a head image of an object to be detected, and the second detection result comprising a second detection frame of an image of an object to be detected; performing vector conversion on the plurality of first detection results and the plurality of second detection results to obtain a plurality of image feature vectors, the plurality of image feature vectors corresponding one-to-one to the plurality of objects to be detected; determining a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, the plurality of world coordinates corresponding one-to-one to the plurality of objects to be detected; performing deduplication processing on the plurality of objects to be detected based on the plurality of image feature vectors and the plurality of world coordinates to obtain at least one target object. The present application detects a plurality of first images to obtain a plurality of first detection frames and a second detection frame of the objects to be detected, thereby performing vector conversion and determining a plurality of world coordinates, thereby performing deduplication processing on the plurality of objects to be detected, obtaining at least one target object after deduplication processing, thereby improving the efficiency of pedestrian detection.
[0056] In some feasible implementations, optionally, performing vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors includes:
[0057] Traversing the multiple first detection results to generate multiple target matching pairs, the generation process of the i-th target matching pair included in the multiple target matching pairs includes: respectively calculating the intersection ratio of the first target detection result and the multiple second detection results to obtain multiple first calculation results, the first target detection result is any one of the multiple first detection results; determining a first target calculation result among the multiple first calculation results, the first target calculation result is the largest calculation result of the multiple first calculation results; determining a target matching pair according to the first target calculation result, the target matching pair includes the first target detection result and the second target detection result, the second target detection result is the second detection result corresponding to the first target calculation result;
[0058] Perform vector conversion on the multiple target matching pairs to obtain multiple image feature vectors.
[0059] In this embodiment, Figure 2 is a conversion diagram in this embodiment, as shown in Figure 2 As shown in the figure, using the pedestrian head and shoulder dataset and the pedestrian human dataset, the head detection model and the human body detection model are trained respectively by adopting the deep learning structure of yolo v5. Then, according to the overlap of the detection frame, the correspondence between the head and the human body is calculated to generate the pixel coordinates of the head and the corresponding human body image feature vector.
[0060] Specifically, the matching process of the head and the body is as follows: First, calculate the intersection ratio IoH between all head detection frames H_i and all body detection frames B_j in the same row of images = the intersection area of H_i and B_j / H_i area. Then for each head detection frame H_i, find the body detection frame B_ki with the largest IoH value. If the maximum IoH value is less than the threshold, skip it, that is, the body corresponding to the head cannot be found (for example, if there is an occlusion), otherwise continue with the following steps. Finally, the human body picture is captured through the obtained human body detection frame, and the human body image feature vector is obtained using the pre-trained image encoder.
[0061] Optionally, determining a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results includes:
[0062] Acquire parameter information, where the parameter information includes camera parameters for shooting the plurality of first images;
[0063] Calculating pixel coordinates corresponding to the plurality of target matching pairs respectively to obtain a plurality of pixel coordinates;
[0064] The plurality of pixel coordinates are converted according to the parameter information to obtain the plurality of world coordinates.
[0065] In this embodiment, since there may be multiple cameras shooting the first image and the parameters of each camera may be different, the error caused by the camera parameters needs to be considered when calculating the world coordinates, that is, in this embodiment, the camera parameters need to be obtained first.
[0066] Among them, it includes obtaining the internal and external parameters of the camera, including focal length fx, fy, coordinates (Xc, Yc, Zc), elevation pitch, heading yaw, and calculating the world coordinates (Xw, Yw, Zw) from the pixel coordinates (u, v), where Zw is known. It should be noted that in order to adapt to head detection, it is necessary to determine the height of the pedestrian, that is, to predict Zw, in order to reversely infer the world coordinates of the pedestrian. In actual scenarios, it is impossible to accurately estimate the height of each pedestrian, but it can be replaced by an average height based on statistics. In order to improve the accuracy of height estimation, the present invention uses the existing pedestrian attribute recognition model based on the characteristics of pedestrian images to calculate pedestrian attributes including gender, age group, etc. Then, according to the average height statistics of different genders and age groups, pedestrians are given height information. For example, the average height of men and women aged 18-44 in China is 169.7cm for men and 158cm for women.
[0067] Optionally, the world coordinates include a length coordinate, a width coordinate, and a height coordinate, and converting the multiple pixel coordinates according to the parameter information to obtain the multiple world coordinates includes:
[0068] Predicting heights of second detection frames corresponding to the multiple target matching pairs to obtain multiple height coordinates, where the multiple height coordinates correspond one-to-one to the multiple target matching pairs;
[0069] Calculate a plurality of length coordinates and a plurality of width coordinates of the second detection frames corresponding to the plurality of target matching pairs respectively according to the parameter information;
[0070] The plurality of world coordinates are generated according to the plurality of length coordinates, the plurality of width coordinates, and the plurality of height coordinates.
[0071] In this embodiment, it should be noted that the world coordinates include length coordinates, width coordinates and height coordinates, that is, corresponding to X-axis coordinates, Y-axis coordinates and Z-axis coordinates. The multiple pixel coordinates are converted by parameter information to obtain the multiple world coordinates, including the following formula:
[0072] Yw'=(Zc-Zw)×tan(β+γ), where β=atan((I h / 2-v) / f y ),γ is the pitch angle Pitch, IwIh are the pixel width and height of the image respectively.
[0073]
[0074] Xw=Xw'×cosθ+Yw'×sinθ+Xc
[0075] Yw=Yw'×cosθ-Xw'×sinθ+Yc, where θ is the heading angle yaw.
[0076] Therefore, the world coordinates can be calculated by the above formula.
[0077] Optionally, the performing deduplication processing on the multiple objects to be detected based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object includes:
[0078] Classifying the plurality of first images to obtain a plurality of classification sets, wherein the objects to be detected included in the same classification set are images taken by the same camera;
[0079] Performing similarity calculation on the multiple classification sets to obtain a second calculation result, wherein the second calculation result includes: the similarity between any two classification sets in the multiple classification sets;
[0080] The multiple classification sets are de-duplicated and merged according to the maximum matching algorithm and the multiple second calculation results to obtain a target classification set, where the target classification set includes the at least one target object.
[0081] In this embodiment, pedestrian deduplication is performed based on the distance between pedestrians and the similarity of pedestrian image features. It should be noted that calibration will cause certain errors in pedestrian position estimation, especially in crowded situations, the impact of such errors will be greater. At the same time, factors such as light and occlusion will cause the image features of the same pedestrian under different cameras to differ greatly, and different pedestrians with similar clothing will also have similar image features. Therefore, there are certain errors in both position features and image features. The present invention uses a maximum matching algorithm to reduce the impact of errors on deduplication results, and obtains the best deduplication results from a global optimal perspective.
[0082] Optionally, performing similarity calculation on the multiple classification sets to obtain a second calculation result includes:
[0083] Performing Euclidean distance calculation on a first classification set and a second classification set to obtain a target Euclidean distance, wherein the first classification set and the second classification set are any two classification sets among the multiple classification sets;
[0084] Performing cosine calculation on the first classification set and the second classification set to obtain a target cosine value;
[0085] The target Euclidean distance and the target cosine value are weightedly calculated according to a preset weight coefficient to obtain the multiple second calculation results, the preset weight coefficient includes a first weight value and a second weight value, the first weight value is the weight value of the target Euclidean distance, and the second weight value is the weight value of the target cosine value.
[0086] In this embodiment, each pedestrian detected by the camera is represented as a set, such as A = {(x, y, F)i, i = 1, 2, ..., m}, where xi, yi represent the world coordinates of pedestrian i, and F i =(f1 i ,f2 i ,…,f k i ) represents the image feature vector of pedestrian i.
[0087] For the set A = {(x, y, F)i, i = 1, 2, ..., m} and the set B = {(x, y, F)j, j = 1, 2, ..., n}, the similarity between each pedestrian in A and each pedestrian in B is calculated as follows:
[0088] s ij =α·1 / d+(1-α)·cosθ
[0089] Where α is the weight coefficient, d is the Euclidean distance between (xi,yi) and (xj,yj) cosθ is the cosine value of vectors Fi and Fj
[0090] Using the maximum matching algorithm, find all pairs of pedestrians in A and B that belong to the same pedestrian. The specific calculation process is as follows: construct a bipartite graph G = (V, E), where the vertex set V of G consists of all pedestrians in A and B, that is, V = AUB, and the edge set E = {(a, b, s), where a∈A, b∈B, s>s min}, where s min is the similarity threshold, s represents the weight of edge (a, b), and the bipartite graph KM algorithm (a general algorithm, not described in detail in the present invention) is used to obtain the maximum matching M = {(a, b), where a∈A, b∈B} of G.
[0091] According to the maximum matching result in the above maximum matching algorithm, set A and set B are merged to obtain a new set C to replace A and B. For the same pedestrian that appears in A and B, only one of them is retained. Continue to merge other sets through the above method until only one set is left.
[0092] This application adopts a staged approach for pedestrian detection and pedestrian deduplication, and uses both image features and pedestrian positions in the pedestrian deduplication stage. On the one hand, the dataset annotation cost for pedestrian detection under single camera is relatively low, and there are many public datasets to choose from, which makes this method have a wider range of applications; on the other hand, when deduplicating pedestrians, not only the position information is used, but also the image features are used to improve the accuracy of pedestrian deduplication.
[0093] The present application detects multiple first images to obtain first detection frames and second detection frames of multiple objects to be detected, thereby performing vector conversion and determining multiple world coordinates, thereby deduplicating the multiple objects to be detected and obtaining at least one target object after deduplication, thereby improving the efficiency of pedestrian detection.
[0094] See also Figure 3 , Figure 3 is a structural diagram of a target detection device provided in an embodiment of the present application. Figure 3 As shown, the target detection device 300 includes:
[0095] A detection module 310 is used to input the captured multiple first images into the detection model for detection, and obtain multiple first detection results and multiple second detection results, wherein the multiple first images include the captured multiple objects to be detected, the first detection result includes a first detection frame of a head image of the object to be detected, and the second detection result includes a second detection frame of an image of the object to be detected;
[0096] A conversion module 320, configured to perform vector conversion on the plurality of first detection results and the plurality of second detection results to obtain a plurality of image feature vectors, wherein the plurality of image feature vectors correspond one-to-one to the plurality of objects to be detected;
[0097] A determination module 330, configured to determine a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, wherein the world coordinates correspond one-to-one to the plurality of objects to be detected;
[0098] The processing module 340 is used to perform deduplication processing on the multiple objects to be detected based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object.
[0099] Optionally, the conversion module 320 includes:
[0100] A traversal submodule, used to traverse the multiple first detection results to generate multiple target matching pairs, wherein the generation process of the i-th target matching pair included in the multiple target matching pairs includes: respectively calculating the intersection ratio of the first target detection result and the multiple second detection results to obtain multiple first calculation results, wherein the first target detection result is any one of the multiple first detection results; determining a first target calculation result among the multiple first calculation results, wherein the first target calculation result is the largest calculation result of the multiple first calculation results; determining a target matching pair according to the first target calculation result, wherein the target matching pair includes the first target detection result and the second target detection result, wherein the second target detection result is a second detection result corresponding to the first target calculation result;
[0101] The first conversion submodule is used to perform vector conversion on the multiple target matching pairs to obtain multiple image feature vectors.
[0102] Optionally, the determination module 330 includes:
[0103] An acquisition submodule, used to acquire parameter information, wherein the parameter information includes camera parameters for shooting the plurality of first images;
[0104] A first calculation submodule is used to calculate the pixel coordinates corresponding to the plurality of target matching pairs respectively to obtain a plurality of pixel coordinates;
[0105] The second conversion submodule is used to convert the multiple pixel coordinates according to the parameter information to obtain the multiple world coordinates.
[0106] Optionally, the world coordinates include length coordinates, width coordinates and height coordinates, and the second conversion submodule includes:
[0107] A prediction unit, configured to predict heights of second detection frames corresponding to the plurality of target matching pairs to obtain a plurality of height coordinates, wherein the plurality of height coordinates correspond one-to-one to the plurality of target matching pairs;
[0108] A first calculation unit, configured to respectively calculate a plurality of length coordinates and a plurality of width coordinates of second detection frames corresponding to the plurality of target matching pairs according to the parameter information;
[0109] A generating unit is used to generate the multiple world coordinates according to the multiple length coordinates, the multiple width coordinates and the multiple height coordinates.
[0110] Optionally, the processing module 340 includes:
[0111] A classification submodule, used for classifying the plurality of first images to obtain a plurality of classification sets, wherein the objects to be detected included in the same classification set are images taken by the same camera;
[0112] A second calculation submodule is configured to perform similarity calculation on the multiple classification sets to obtain a second calculation result, wherein the second calculation result includes: the similarity between any two classification sets in the multiple classification sets;
[0113] The deduplication submodule is used to perform deduplication and merging processing on the multiple classification sets according to the maximum matching algorithm and the multiple second calculation results to obtain a target classification set, and the target classification set includes the at least one target object.
[0114] Optionally, the second computing submodule includes:
[0115] A second calculation unit is used to perform Euclidean distance calculation on a first classification set and a second classification set to obtain a target Euclidean distance, wherein the first classification set and the second classification set are any two classification sets among the multiple classification sets;
[0116] A third calculation unit is used to perform cosine calculation on the first classification set and the second classification set to obtain a target cosine value;
[0117] The fourth calculation unit is used to perform weighted calculation on the target Euclidean distance and the target cosine value according to a preset weight coefficient to obtain the multiple second calculation results. The preset weight coefficient includes a first weight value and a second weight value. The first weight value is the weight value of the target Euclidean distance, and the second weight value is the weight value of the target cosine value.
[0118] The present application detects multiple first images to obtain first detection frames and second detection frames of multiple objects to be detected, thereby performing vector conversion and determining multiple world coordinates, thereby deduplicating the multiple objects to be detected and obtaining at least one target object after deduplication, thereby improving the efficiency of pedestrian detection.
[0119] The present application also provides an electronic device. Figure 4 , the electronic device may include a processor 401, a memory 402, and a program 4021 stored in the memory 402 and executable on the processor 401.
[0120] When the program 4021 is executed by the processor 401, it can achieve Figure 1 Any step in the corresponding method embodiment:
[0121] Inputting the captured multiple first images into the detection model for detection, and obtaining multiple first detection results and multiple second detection results, wherein the multiple first images include the captured multiple objects to be detected, the first detection result includes a first detection frame of a head image of the object to be detected, and the second detection result includes a second detection frame of an image of the object to be detected;
[0122] Performing vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors, wherein the multiple image feature vectors correspond one-to-one to the multiple objects to be detected;
[0123] Determine a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, wherein the world coordinates correspond one-to-one to the plurality of objects to be detected;
[0124] The multiple objects to be detected are deduplicated based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object.
[0125] Optionally, performing vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors includes:
[0126] Traversing the multiple first detection results to generate multiple target matching pairs, the generation process of the i-th target matching pair included in the multiple target matching pairs includes: respectively calculating the intersection ratio of the first target detection result and the multiple second detection results to obtain multiple first calculation results, the first target detection result is any one of the multiple first detection results; determining a first target calculation result among the multiple first calculation results, the first target calculation result is the largest calculation result of the multiple first calculation results; determining a target matching pair according to the first target calculation result, the target matching pair includes the first target detection result and the second target detection result, the second target detection result is the second detection result corresponding to the first target calculation result;
[0127] Perform vector conversion on the multiple target matching pairs to obtain multiple image feature vectors.
[0128] Optionally, determining a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results includes:
[0129] Acquire parameter information, where the parameter information includes camera parameters for shooting the plurality of first images;
[0130] Calculating pixel coordinates corresponding to the plurality of target matching pairs respectively to obtain a plurality of pixel coordinates;
[0131] The plurality of pixel coordinates are converted according to the parameter information to obtain the plurality of world coordinates.
[0132] Optionally, the world coordinates include a length coordinate, a width coordinate, and a height coordinate, and converting the multiple pixel coordinates according to the parameter information to obtain the multiple world coordinates includes:
[0133] Predicting heights of second detection frames corresponding to the multiple target matching pairs to obtain multiple height coordinates, where the multiple height coordinates correspond one-to-one to the multiple target matching pairs;
[0134] Calculate a plurality of length coordinates and a plurality of width coordinates of the second detection frames corresponding to the plurality of target matching pairs respectively according to the parameter information;
[0135] The plurality of world coordinates are generated according to the plurality of length coordinates, the plurality of width coordinates, and the plurality of height coordinates.
[0136] Optionally, the performing deduplication processing on the multiple objects to be detected based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object includes:
[0137] Classifying the plurality of first images to obtain a plurality of classification sets, wherein the objects to be detected included in the same classification set are images taken by the same camera;
[0138] Performing similarity calculation on the multiple classification sets to obtain a second calculation result, wherein the second calculation result includes: the similarity between any two classification sets in the multiple classification sets;
[0139] The multiple classification sets are de-duplicated and merged according to the maximum matching algorithm and the multiple second calculation results to obtain a target classification set, where the target classification set includes the at least one target object.
[0140] Optionally, performing similarity calculation on the multiple classification sets to obtain a second calculation result includes:
[0141] Performing Euclidean distance calculation on a first classification set and a second classification set to obtain a target Euclidean distance, wherein the first classification set and the second classification set are any two classification sets among the multiple classification sets;
[0142] Performing cosine calculation on the first classification set and the second classification set to obtain a target cosine value;
[0143] The target Euclidean distance and the target cosine value are weightedly calculated according to a preset weight coefficient to obtain the multiple second calculation results, the preset weight coefficient includes a first weight value and a second weight value, the first weight value is the weight value of the target Euclidean distance, and the second weight value is the weight value of the target cosine value.
[0144] The present application detects multiple first images to obtain first detection frames and second detection frames of multiple objects to be detected, thereby performing vector conversion and determining multiple world coordinates, thereby deduplicating the multiple objects to be detected and obtaining at least one target object after deduplication, thereby improving the efficiency of pedestrian detection.
[0145] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the above-mentioned target detection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0146] An embodiment of the present application further provides a computer program product, which is stored in a storage medium. The computer program product is executed by at least one processor to implement the various processes of the above-mentioned target detection method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0147] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0148] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0149] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A target detection method, characterized in that: The method comprises: Inputting the captured multiple first images into the detection model for detection, and obtaining multiple first detection results and multiple second detection results, wherein the multiple first images include the captured multiple objects to be detected, the first detection result includes a first detection frame of a head image of the object to be detected, and the second detection result includes a second detection frame of a full body image of the object to be detected; Performing vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors, wherein the multiple image feature vectors correspond one-to-one to the multiple objects to be detected, and performing vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors, including: traversing the multiple first detection results to generate multiple target matching pairs, wherein the generation process of the i-th target matching pair included in the multiple target matching pairs includes: respectively calculating the intersection ratio of the first target detection result and the multiple second detection results to obtain multiple first calculation results, wherein the first target detection result is any one of the multiple first detection results; determining a first target calculation result among the multiple first calculation results, wherein the first target calculation result is the largest calculation result of the multiple first calculation results; determining a target matching pair according to the first target calculation result, wherein the target matching pair includes the first target detection result and the second target detection result, wherein the second target detection result is the second detection result corresponding to the first target calculation result; performing vector conversion on the multiple target matching pairs to obtain multiple image feature vectors; Determine a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, wherein the world coordinates correspond one-to-one to the plurality of objects to be detected; The multiple objects to be detected are deduplicated based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object.
2. The method according to claim 1, characterized in that The determining a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results comprises: Acquire parameter information, where the parameter information includes camera parameters for shooting the plurality of first images; Calculating pixel coordinates corresponding to the plurality of target matching pairs respectively to obtain a plurality of pixel coordinates; The plurality of pixel coordinates are converted according to the parameter information to obtain the plurality of world coordinates.
3. The method according to claim 2, characterized in that The world coordinates include a length coordinate, a width coordinate, and a height coordinate, and the converting of the plurality of pixel coordinates according to the parameter information to obtain the plurality of world coordinates includes: Predicting heights of second detection frames corresponding to the multiple target matching pairs to obtain multiple height coordinates, where the multiple height coordinates correspond one-to-one to the multiple target matching pairs; Calculate a plurality of length coordinates and a plurality of width coordinates of the second detection frames corresponding to the plurality of target matching pairs respectively according to the parameter information; The plurality of world coordinates are generated according to the plurality of length coordinates, the plurality of width coordinates, and the plurality of height coordinates.
4. The method according to claim 1, characterized in that: The performing deduplication processing on the multiple objects to be detected based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object includes: Classifying the plurality of first images to obtain a plurality of classification sets, wherein the objects to be detected included in the same classification set are images taken by the same camera; Performing similarity calculation on the multiple classification sets to obtain a second calculation result, wherein the second calculation result includes: the similarity between any two classification sets in the multiple classification sets; The multiple classification sets are de-duplicated and merged according to the maximum matching algorithm and the second calculation result to obtain a target classification set, wherein the target classification set includes the at least one target object, and the maximum matching algorithm is used to determine a set C according to the set A and the set B, wherein the set C is all pairs of pedestrians belonging to the same pedestrian in the set A and the set B, the set A={(x, y, F)i, i = 1,2,...,m}, the set B={(x, y, F)j, j =1,2,...,n}, wherein xi,yi represent the world coordinates of pedestrian i, represents the image feature vector of pedestrian i. The calculation process of the set C includes: constructing a bipartite graph G=(V, E), where the vertex set V of G is composed of all pedestrians in A and B, that is, V=AUB, and the edge set , where s min is the similarity threshold, s represents the weight of edge (a, b), and the bipartite graph KM algorithm is used to obtain the maximum matching of G. .
5. The method according to claim 4, characterized in that The performing similarity calculation on the multiple classification sets to obtain a second calculation result includes: Performing Euclidean distance calculation on a first classification set and a second classification set to obtain a target Euclidean distance, wherein the first classification set and the second classification set are any two classification sets among the multiple classification sets; Performing cosine calculation on the first classification set and the second classification set to obtain a target cosine value; The target Euclidean distance and the target cosine value are weightedly calculated according to a preset weight coefficient to obtain the second calculation result, wherein the preset weight coefficient includes a first weight value and a second weight value, the first weight value is the weight value of the target Euclidean distance, and the second weight value is the weight value of the target cosine value.
6. A target detection device, characterized in that: The device comprises: A detection module, used for inputting a plurality of first images captured into a detection model for detection, and obtaining a plurality of first detection results and a plurality of second detection results, wherein the plurality of first images include a plurality of objects to be detected captured, the first detection result includes a first detection frame of a head image of the object to be detected, and the second detection result includes a second detection frame of a full body image of the object to be detected; A conversion module, used for performing vector conversion on the multiple first detection results and the multiple second detection results to obtain multiple image feature vectors, wherein the multiple image feature vectors correspond one-to-one to the multiple objects to be detected, and the conversion module includes: a traversal submodule, used for traversing the multiple first detection results to generate multiple target matching pairs, wherein the generation process of the i-th target matching pair included in the multiple target matching pairs includes: respectively calculating the intersection ratio of the first target detection result and the multiple second detection results to obtain multiple first calculation results, wherein the first target detection result is any one of the multiple first detection results; determining a first target calculation result from the multiple first calculation results, wherein the first target calculation result is the maximum calculation result of the multiple first calculation results; determining a target matching pair according to the first target calculation result, wherein the target matching pair includes the first target detection result and the second target detection result, wherein the second target detection result is the second detection result corresponding to the first target calculation result; a first conversion submodule, used for performing vector conversion on the multiple target matching pairs to obtain multiple image feature vectors; A determination module, configured to determine a plurality of world coordinates according to the plurality of first detection results and the plurality of second detection results, wherein the world coordinates correspond one-to-one to the plurality of objects to be detected; A processing module is used to perform deduplication processing on the multiple objects to be detected based on the multiple image feature vectors and the multiple world coordinates to obtain at least one target object.
7. An electronic device comprising: A memory, a processor, and a program stored in the memory and executable on the processor; wherein the processor is used to read the program in the memory to implement the steps in the target detection method as described in any one of claims 1 to 5.
8. A readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps in the target detection method according to any one of claims 1 to 5 are implemented.
9. A computer program product, characterized in that The computer program product is stored in a storage medium, and the computer program product is executed by at least one processor to implement the steps in the target detection method according to any one of claims 1 to 5.
