Method, device and electronic equipment for processing image of target object
By using pre-trained neural network models and global local matching modules to automatically match target object images from different angles or lenses in the video surveillance system, the problem of low target matching accuracy in the existing technology is solved, and efficiency and accuracy are improved. .
Patent Information
- Application Number
- CN202110166218.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-04
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-02-04
AI Technical Summary
Existing video surveillance systems have low target object matching accuracy at different shooting angles or across lenses, resulting in low efficiency and the need to rely on manual observation for target retrieval.
Use pre-trained neural network models, especially capsule networks, to perform target detection and feature extraction on target images, and automatically match the target object image with images from different angles or lenses through the global and local matching modules, and update the weight of the matching module , improve matching accuracy.
It achieves accurate matching of target objects at different shooting angles or across lenses, improves matching efficiency and accuracy, and reduces manual intervention.
Smart Images

Figure CN113011435B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of machine learning, and in particular to a method, device and electronic equipment for processing an image of a target object. Background Art
[0002] With the development of society, public safety has become a common topic in the whole society, and video surveillance systems have also become popular. Video surveillance systems can intuitively reproduce scenes and can serve as strong factual evidence. However, when the shooting angles of the target object in multiple images captured by the camera change greatly, or when tracking the target object in a cross-border head-over scene, since the video surveillance system includes multiple image sensors, each image sensor may have different shooting angles or image resolutions. It is difficult to match the image of the same target object from images of different shooting angles of the target object or images taken by different cameras, resulting in low target matching accuracy. In order to ensure the accuracy of target matching at different shooting angles or under cross-border heads, the existing cross-border head-over-cross-scene target matching mainly relies on manual observation of surveillance videos for target retrieval, resulting in low target matching efficiency. Summary of the invention
[0003] In view of this, an object of the present invention is to provide an image processing method, device and electronic device of a target object, which can automatically match the target object image with the target images at different shooting angles or across lenses, thereby improving the accuracy and efficiency of target matching.
[0004] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0005] In a first aspect, an embodiment of the present invention provides an image processing method for a target object, comprising: acquiring a target image captured by an image sensor, performing target detection on the target image based on a pre-trained neural network model, and obtaining a target detection result of the target image; matching features of the target object image with features of the target detection result, and obtaining a similarity between the target object image and the target detection result.
[0006] Further, an embodiment of the present invention provides a first possible implementation of the first aspect, wherein the target detection result includes a target frame; the step of matching the features of the target object image with the features of the target detection result to obtain the similarity between the target object image and the target detection result includes: taking the images in each target frame in the target detection result as images to be matched respectively; performing global matching and local matching on the features of the target object image and the features of each of the images to be matched to obtain the similarity between the target object image and each of the images to be matched.
[0007] Furthermore, an embodiment of the present invention provides a second possible implementation of the first aspect, wherein the step of globally matching and locally matching the features of the target object image and the features of each of the images to be matched to obtain the similarity between the target object image and each of the images to be matched comprises: step a, globally matching and locally matching the features of the target object image and the features of each of the images to be matched based on a preset matching module to obtain a similarity score corresponding to each of the images to be matched; step b, updating the weight of the preset matching module based on the similarity score corresponding to each of the images to be matched; and step c, repeating steps a to b above until a preset number of matches is reached to obtain a final similarity corresponding to each of the images to be matched.
[0008] Further, an embodiment of the present invention provides a third possible implementation of the first aspect, wherein the step of globally and locally matching the features of the target object image with the features of each of the images to be matched based on a preset matching module to obtain a similarity score corresponding to each of the images to be matched includes: calculating the global similarity between the target object image and each of the images to be matched based on the global features of the target object image and each of the images to be matched; determining the local similarity between the target object image and each of the images to be matched based on the local features of the target object image and each of the images to be matched; wherein the local features are obtained by dividing the global features; and determining the similarity scores corresponding to each of the images to be matched based on the global similarity and the local similarity.
[0009] Furthermore, an embodiment of the present invention provides a fourth possible implementation of the first aspect, wherein the neural network model includes a capsule network; the step of performing target detection on the target image based on the pre-trained neural network model to obtain the target detection result of the target image includes: performing feature extraction on the target image based on the capsule network obtained by preset training to obtain a feature extraction result; performing first-order target detection and second-order target detection on the feature extraction result in sequence to obtain the target detection result of the target image.
[0010] Further, an embodiment of the present invention provides a fifth possible implementation of the first aspect, wherein the step of performing first-order target detection and second-order target detection on the feature extraction result in sequence to obtain the target detection result of the target image includes: obtaining feature maps of multiple scales corresponding to the feature extraction result based on a preset target detection algorithm, and using each of the feature maps as a prediction layer; performing second-order target detection on each of the prediction layers to obtain the target detection result of the target image.
[0011] Furthermore, an embodiment of the present invention provides a sixth possible implementation of the first aspect, wherein the step of performing second-order target detection on each of the prediction layers to obtain the target detection result of the target image includes: generating a candidate box based on a regional candidate network on each of the prediction layers; obtaining image features of the prediction layer and image features of the candidate box on the prediction layer, performing feature fusion on the image features of the prediction layer and the image features of the candidate box on the prediction layer, and determining each target category and target box position in the target image based on the fused features.
[0012] Further, an embodiment of the present invention provides a seventh possible implementation of the first aspect, wherein the image sensor includes multiple cameras; the method also includes: determining the target camera that photographed the target object and the position change information of the target object in the target camera based on the similarity between the target object image and the target detection result; determining the motion trajectory of the target object based on the position change information of the target object in the target camera and the position of each of the target cameras.
[0013] In the second aspect, an embodiment of the present invention also provides a target object tracking device, including: a target detection module, used to obtain target images collected by each image sensor, and perform target recognition on each of the target images based on a pre-trained neural network model to obtain a target detection result for each of the target images; a target re-identification module, used to match the features of the target object image with the features of the target detection result to obtain the similarity between the target object image and the target detection result.
[0014] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a processor and a storage device; the storage device stores a computer program, and when the computer program is executed by the processor, it executes the method as described in any one of the first aspects.
[0015] The embodiment of the present invention provides an image processing method, device and electronic device for a target object, the method comprising: obtaining a target image captured by an image sensor, performing target detection on the target image based on a pre-trained neural network model, and obtaining a target detection result of the target image; matching the features of the target object image with the features of the target detection result, and obtaining the similarity between the target object image and the target detection result. The above-mentioned target object tracking method can accurately match the target object in the target image captured by the image sensor by performing image recognition on the target image captured by the image sensor and matching the target image with the target detection result, thereby improving the accuracy of target matching, and automatically matching the target object image with the target detection result of the target image at different shooting angles or across lenses, thereby improving the target matching efficiency.
[0016] Other features and advantages of the embodiments of the present invention will be described in the following description, or some features and advantages can be inferred or determined without doubt from the description, or can be learned by implementing the above-mentioned techniques of the embodiments of the present invention.
[0017] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0019] Figure 1 A flow chart of a method for tracking a target object provided by an embodiment of the present invention is shown;
[0020] Figure 2 A schematic diagram of a multi-level matching process provided by an embodiment of the present invention is shown;
[0021] Figure 3 A schematic diagram of a target recognition process provided by an embodiment of the present invention is shown;
[0022] Figure 4 A schematic diagram of the structure of a target object tracking device provided by an embodiment of the present invention is shown;
[0023] Figure 5 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be described below in conjunction with the drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.
[0025] At present, the video surveillance system can intuitively reproduce the target scene. Due to hardware defects such as the resolution of the camera, it is difficult to obtain a clear image of the human body, making it difficult for existing face recognition technology to solve the matching and retrieval of pedestrians under multiple shooting angles or across cameras and scenes. To improve this problem, an embodiment of the present invention provides an image processing method, device and electronic device for a target object. The technology can be used to improve the target tracking efficiency and tracking accuracy under cross-border cameras. The following is a detailed introduction to the embodiment of the present invention.
[0026] This embodiment provides a method for tracking a target object, which can be applied to electronic devices such as computers connected to image sensors. Figure 1 The target object tracking method flow chart shown in FIG. 1 mainly includes the following steps S102 to S104:
[0027] Step S102, acquiring the target images captured by each image sensor, performing target detection on each target image based on a pre-trained neural network model, and obtaining target detection results for each target image.
[0028] The above-mentioned image sensor can be one or more cameras set up in the area where target object retrieval is required. The image captured by the camera within a preset time is used as the target image, and the target image is input into a preset trained neural network model for target recognition to obtain a target detection result corresponding to the target image. The target detection result may include the target type and target frame coordinates of each target in each target image.
[0029] Step S104: Match the features of the target object image with the features of the target detection result to obtain the similarity between the target object image and the target detection result.
[0030] The target object may be a pedestrian or an object that needs to be matched, and a target object image (i.e., an image of the target object) is obtained. The target object image may be obtained from a pre-established database, or may be an image of any object that needs to be matched from a target image captured by an image sensor. The features of the target object image pre-stored in the database or cut from the target image are matched with the features of the target detection result to obtain the similarity between the target object and each target in the target detection result. For example, when the image sensor is located in a work park, the pre-established database may be established by obtaining the facial information of enterprise staff and pedestrian image information. By matching the features of any target object image that needs to be matched in the database with each target in the target image captured by the camera, it can be determined whether the target image captured by the camera includes the target object to be searched, and it can also be determined whether the targets in surveillance videos of different cameras are the same target.
[0031] The target object tracking method provided in the present embodiment can accurately match the target object in the target image captured by the image sensor by performing image recognition on the target image captured by the image sensor and matching the features of the target object image with the features of the target detection result, thereby improving the accuracy of target matching. The target object image is automatically matched with target images at different shooting angles or across lenses, thereby improving the target matching efficiency.
[0032] In order to improve the accuracy of target matching, this embodiment provides an implementation method for matching the features of the target object image with the features of the target detection result to obtain the similarity between the target object image and the target detection result. The specific implementation method can refer to the following steps (1) to (2):
[0033] Step (1): The images in each target box in the target detection result are respectively used as images to be matched.
[0034] The above target detection results include a target frame (the coordinates of each vertex of the target frame) and the target category within the target frame. In order to find the target that is the same as the target object from the target images captured by each image sensor, each target detection result in the target image obtained above is used as a target to be matched, that is, the image within the target frame in the target detection result is used as the image to be matched, so as to determine whether the image within the target frame is the same target as the target object.
[0035] Step (2): Perform global matching and local matching on the features of the target object image and the features of each image to be matched, and obtain the similarity between the target object image and each image to be matched.
[0036] By globally and locally matching the features of the target object image with the features of each image to be matched, the similarity between the target object and each image to be matched can be obtained. Based on the similarity, it can be determined whether each image to be matched includes the image of the target object. For details, refer to the following steps a to c:
[0037] Step a: Based on a preset matching module, the features of the target object image are globally and locally matched with the features of each image to be matched, and the similarity scores corresponding to each image to be matched are obtained.
[0038] Based on the preset matching module, image features are extracted from the target object image and each image to be matched respectively, and global features of the target object image and each image to be matched are obtained (the global features include all features extracted from the images), and the global similarity between the target object image and each image to be matched is calculated based on the global features of the target object image and each image to be matched. The preset matching module may include a convolutional neural network, and the target object image and any image to be matched are input into the preset matching module, and image features are extracted from the target object image and the image to be matched respectively based on the convolutional neural network to obtain global features corresponding to each image, see FIG. Figure 2 The multi-level matching process diagram shown in the figure performs feature matching on the global features of the target object image and the global features of the image to be matched, and obtains the global similarity Similarity between the target object image and each image to be matched global .
[0039] The global features of the above-mentioned image can be divided into two or more parts of local features, and the local similarity between the target object image and each image to be matched is determined based on the local features of the target object image and each image to be matched. The global features of the target object image and the global features of the object to be matched are simultaneously divided into the same number (two or more parts) of local features, and feature matching is performed on each local feature respectively, and the weighted summation of the matching results of each local feature is performed to obtain the local similarity between the target object image and the image to be matched.
[0040] Such as Figure 2 As shown in the figure, the global features of the target object image can be divided into two parts, denoted as A1 and A2, and the global features of the image to be matched can be divided into two parts, denoted as B1 and B2. Calculate the similarity between the local features A1 and B1 2-part1 , calculate the similarity between local feature A2 and local feature B2 2-part2 , the sum of the two parts of local features is used as the local similarity Similarity between the target object image and the image to be matched local =Similary 2-part =Similary 2-part1 +Similary 2-part2 .
[0041] In another embodiment, the feature division method of the above-mentioned global image feature can include multiple methods at the same time, such as dividing the global image feature of the target object image and the global image feature of the image to be matched into m parts and n parts respectively, and calculating the local similarity Similarity between the target object image and the image to be matched when the global image feature is divided into m parts. m-part , calculate the local similarity Similarityy between the target object image and the image to be matched when the global image features are divided into n parts n-part The sum of the local similarities obtained under various division methods is used as the local similarity between the target object image and the image to be matched. local =Similary m-part +Similary n-part In another embodiment, Similary local =a*Similarity m-part +b*Similary n-part , where a and b are weight values respectively, a+b=1, and the a and b values can be set according to the preset matching module.
[0042] Determine the similarity score corresponding to each image to be matched based on the global similarity and local similarity. Perform weighted summation on the global similarity and local similarity between the target object image and the image to be matched to obtain the similarity score between the target object image and the image to be matched, i.e., the similarity score corresponding to the image to be matched. Traverse the above images to be matched to calculate the global similarity and local similarity between each image to be matched and the target object image, and then obtain the similarity score between the target object image and each image to be matched, i.e., the similarity score corresponding to each image to be matched.
[0043] In one embodiment, the similarity score between the target object image and the image to be matched is calculated as follows:
[0044] Similary score =Similary global +Similary local
[0045] In another embodiment, weights may be set for the global similarity and local similarity between the image to be matched and the target object image respectively:
[0046] Similary score =x*Similary global +y*Similary local
[0047] Wherein, x and y are constants respectively, x+y=1, and the values of x and y can be set according to a preset matching module.
[0048] Step b: updating the weight of the preset matching module based on the similarity scores corresponding to the images to be matched.
[0049] The above-mentioned preset matching module includes multiple convolution layers. The function of the convolution layer is to extract features from the input image data. It contains multiple convolution kernels. Each element of the convolution kernel corresponds to a weight coefficient. By updating the weight coefficient in the convolution layer based on the similarity scores corresponding to each image to be matched, the updated convolution layer can improve the similarity scores corresponding to the images to be matched that truly match the target object, and suppress the similarity scores corresponding to the images to be matched that do not match the target object.
[0050] Step c: Repeat the above steps a to b until a preset number of matches is reached to obtain the final similarity corresponding to each image to be matched.
[0051] Repeat the above steps a to b, that is, calculate the similarity scores corresponding to the to-be-matched images multiple times based on the convolution layer after updating the weight coefficients, and update the weight coefficients of the convolution layer based on the similarity scores corresponding to the to-be-matched images calculated each time, until the number of similarity scores corresponding to each to-be-matched image calculated reaches the preset number of matches, and use the similarity scores corresponding to each to-be-matched image calculated last time as the final similarity corresponding to each to-be-matched image. The above preset number of matches can be set according to the calculation accuracy of the preset matching module, such as any value between 20 and 100 times.
[0052] In order to improve the target recognition accuracy of the target image, this embodiment provides an implementation method for performing target recognition on each target image based on a pre-trained neural network model to obtain a target detection result for each target image. Specifically, the following steps 1 to 2 can be referred to for execution:
[0053] Step 1: Extract features of each target image based on the capsule network obtained through preset training to obtain feature extraction results.
[0054] The capsule network is used as the backbone network for target recognition. The image samples in the pre-established database are marked as targets. The marked image samples are input into the capsule network for network training to obtain the trained capsule network. A capsule is a group of neurons that can learn to detect specific targets in a given area (such as a rectangle) of an image and output a vector (such as an eight-dimensional vector). The length of the vector represents the probability estimate of the existence of the target and can encode the pose parameters (such as precise position, rotation, etc.) in a directional manner (such as 8D space). If the target object has a slight change (such as displacement, rotation, resizing, etc.), the capsule will output a vector of the same length but slightly different direction. Therefore, the capsule is isovariant.
[0055] Since the same target presents different angles and postures under different cameras, the traditional CNN algorithm is not robust to such deformation of the target. When the angle of the picture changes, it will not be recognized; when CNN performs operations such as flipping and rotating the picture through data enhancement, the amount of data will become very large, reducing the training speed. This embodiment uses the pre-trained capsule network to extract target features from the target images collected by each image sensor. Compared with the CNN network, the capsule network is more robust to the deformation of the object, which improves the accuracy of target recognition.
[0056] Step 2: Perform first-order target detection and second-order target detection on the feature extraction results in turn to obtain the target detection results of each target image.
[0057] Based on the preset target detection algorithm, feature maps of multiple scales corresponding to the feature extraction results are obtained, and each feature map is used as a prediction layer. The preset target detection algorithm includes a first-order target detection algorithm such as the SSD (Single Shot MultiBox Detector) algorithm or the YOLO (You Only Look Once) algorithm.
[0058] See Figure 3 As shown in the target recognition process diagram, the target images collected by each image sensor are input into the pre-trained capsule network for feature extraction to obtain feature extraction results. Based on the SSD algorithm or the YOLO algorithm, feature maps of different scales are generated on the features extracted by the capsule network as the prediction layer for target detection. The existing target detection technology sets a priori boxes of different sizes and aspect ratios on the feature maps of different scales obtained by the SSD algorithm, and calculates the intersection and union ratio of the priori boxes and the manually labeled rectangular boxes to determine the positive and negative samples. Since most of the priori boxes are negative samples, it is easy to cause an imbalance between positive and negative samples. Therefore, Figure 3 As shown, the method provided in this embodiment discards the mechanism of the prior frame and adopts the idea of a second-order target detector on each prediction feature layer.
[0059] Perform second-order target detection on each prediction layer to obtain the target categories and target frame positions in the target image. Generate candidate frames based on the Region Proposal Network (RPN) on each prediction layer; obtain the image features of the prediction layer and the image features of the candidate frames on the prediction layer, and perform feature fusion on the image features of the prediction layer and the image features of the candidate frames on the prediction layer, that is, feature splicing of global features and local features, and determine the target categories and target frame positions (including the coordinates of each vertex) in the target image based on the fused features.
[0060] like Figure 3 As shown, the RPN network is used to generate candidate boxes on each prediction layer, and the candidate boxes and the corresponding prediction layers are normalized. Since the image features of the candidate boxes generated on the prediction layer are local features, and the image features of each prediction layer are global features, the image features of the prediction layer and the image features of the candidate boxes on the prediction layer are fused to achieve feature fusion of global features and local features. The target image is recognized based on the fused features corresponding to each prediction layer to predict the target category and target position.
[0061] In a specific implementation, the image sensor includes a plurality of cameras; the method provided in this embodiment further includes the following steps:
[0062] First, based on the similarity between the target object image and the target detection result, the target camera that captured the target object and the position change information of the target object in the target camera are determined. The similarity between the target object image and the target detection result is the final similarity corresponding to each image to be matched, and each image to be matched whose final similarity is greater than the preset similarity is used as the target image to be matched, wherein the target image to be matched includes the image of the target object.
[0063] According to the final similarity value corresponding to each image to be matched, the image to be matched including the target object is screened out from the images to be matched. When the final similarity corresponding to the image to be matched is greater than the preset similarity, it is determined that the image to be matched includes the target object (that is, the target object image and the target in the image to be matched are the same pedestrian or object), and the image to be matched including the target object is used as the target image to be matched. Since each image to be matched is obtained from each target image, the camera that captures the target image to which the target image to be matched belongs is used as the target camera, that is, the camera that captures the target object is used as the target camera. The above-mentioned preset similarity can be determined according to the value range of the final similarity. For example, when the value range of the final similarity is [0, 1], the above-mentioned preset similarity can be any value between 0.75 and 1.
[0064] In practical applications, in order to facilitate tracing the target camera corresponding to the target object, the target images captured by each camera can be numbered, such as numbering the k target images captured by camera 1 as 1-1, 1-2, ... 1-k, and the j target images captured by camera 2 as 2-1, 2-2, ... 2-j, and so on. The images to be matched in each target frame on each target image are numbered, such as numbering the images to be matched in t target frames on target image 1-1 as: 1-1-1, 1-1-2, ... 1-1-t, and so on. When the above-mentioned image to be matched 1-1-2 is a target image to be matched whose final similarity is greater than the preset similarity, it can be determined according to the target image to be matched 1-1-2 that the target image sensor corresponding to the target object includes camera 1, that is, camera 1 has photographed the target object.
[0065] Since the above-mentioned target camera can capture continuous frame images of the target object, the position change information of the target object in the target camera can be determined based on the position change information of the target object in the continuous frame images captured by the target camera. For example, the position change information may be that the target object moves from a first position to a second position in the target camera (the first position and the second position may be actual position information, such as the positions of reference objects such as street lights or intersections, and may also be pixel coordinate positions in the image captured by the target camera).
[0066] Secondly, the motion trajectory of the target object is determined based on the position change information of the target object in the target camera and the position of each target camera. The trajectory of the target object under the target camera can be obtained based on the position change information of the target object in the target camera, and the trajectories of the target object under all the target cameras that captured the target object are linked according to the time sequence to obtain the complete running trajectory of the target object.
[0067] The image processing method for the target object provided in this embodiment uses the capsule network as the backbone network for image feature extraction and fuses global features and local features during target detection, thereby improving the accuracy of target recognition and positioning. By using multi-level matching from coarse to fine in the matching stage, the accuracy of the matching results is improved, and the running trajectory of the same target between different image sensors can be accurately obtained.
[0068] Based on the above embodiment, this embodiment provides an example of obtaining a pedestrian motion trajectory by applying the above target object image processing method, which can be specifically performed with reference to the following steps 1) to 3):
[0069] Step 1): Perform target detection on the images captured by each camera based on a preset target detection model, and extract pedestrians from the images captured by each camera.
[0070] The above-mentioned preset target detection model includes a capsule network. The capsule network obtained based on the preset training performs feature extraction on the images captured by each camera to obtain pedestrian feature extraction results. The pedestrian feature extraction results are sequentially subjected to first-order target detection and second-order target detection to obtain multiple pedestrian recognition results in the images captured by each camera (i.e., each pedestrian in the image is framed with a target frame).
[0071] Step 2): Calculate the similarity between any two pedestrians under different cameras based on the target re-identification module, and determine whether they are the same pedestrian based on the similarity.
[0072] Multi-level feature matching is performed on any two pedestrian recognition results in images captured by different cameras to obtain the similarity of any two pedestrian recognition results. When the similarity is greater than the preset similarity, it is determined that the pedestrians in the images captured by the two cameras are the same pedestrian.
[0073] Step 3): Determine the movement trajectory of the same pedestrian between different cameras based on the target tracking module.
[0074] The positions of each camera are obtained, and the cameras that have captured the same pedestrian image are connected in series according to the order of acquisition time to obtain the pedestrian's movement trajectory.
[0075] The pedestrian tracking method provided in this embodiment detects the target in the camera to extract the target's features, then matches (and re-identifies) the target's features with the features of the object in the database to obtain the corresponding matching results, and finally uses the cross-camera target tracking technology to obtain the movement trajectory of the same pedestrian between different cameras.
[0076] Corresponding to the target object tracking method provided in the above embodiment, the embodiment of the present invention provides a target object tracking device, see Figure 4 The schematic diagram of the structure of a tracking device for a target object is shown, and the device includes the following modules:
[0077] The target detection module 41 is used to obtain the target images collected by each image sensor, perform target recognition on each target image based on a pre-trained neural network model, and obtain target detection results for each target image.
[0078] The target re-identification module 42 is used to match the features of the target object image with the features of the target detection result to obtain a matching result; wherein the matching result includes a target detection result that belongs to the same target as the target object.
[0079] The target object tracking device provided in the present embodiment can accurately match the target object in the target image captured by the image sensor by performing image recognition on the target image captured by the image sensor and matching the features of the target object image with the features of the target detection result, thereby improving the accuracy of target matching. The target object image is automatically matched with target images at different shooting angles or across lenses, thereby improving the target matching efficiency.
[0080] In one embodiment, the image sensor includes a plurality of cameras; the device further includes:
[0081] The target tracking module is used to determine the target camera that photographed the target object and the position change information of the target object in the target camera based on the similarity between the target object image and the target detection result; and determine the movement trajectory of the target object based on the position change information of the target object in the target camera and the position of each target camera.
[0082] In one embodiment, the target detection result includes a target frame; the target re-identification module 42 is further used to use the images in each target frame in the target detection result as images to be matched; perform global matching and local matching on the features of the target object image and the features of each image to be matched to obtain the similarity between the target object image and each image to be matched.
[0083] In one embodiment, the target re-identification module 42 is further used to perform the following steps: step a, based on a preset matching module, globally and locally match the features of the target object image with the features of each image to be matched, and obtain a similarity score corresponding to each image to be matched; step b, based on the similarity score corresponding to each image to be matched, update the weight of the preset matching module; step c, repeatedly perform steps a to b above until a preset number of matches is reached, and obtain a final similarity corresponding to each image to be matched.
[0084] In one embodiment, the target re-identification module 42 further calculates the global similarity between the target object image and each image to be matched based on the global features of the target object image and each image to be matched; determines the local similarity between the target object image and each image to be matched based on the local features of the target object image and each image to be matched; wherein the local features are obtained by dividing the global features; and determines the similarity score corresponding to each image to be matched based on the global similarity and the local similarity.
[0085] In one embodiment, the above-mentioned neural network model includes a capsule network; the above-mentioned target detection module 41 is further used to perform feature extraction on the target image based on the capsule network obtained by preset training to obtain feature extraction results; the feature extraction results are sequentially subjected to first-order target detection and second-order target detection to obtain target detection results of the target image.
[0086] In one embodiment, the target detection module 41 is further used to obtain feature maps of multiple scales corresponding to the feature extraction results based on a preset target detection algorithm, and use each feature map as a prediction layer; perform second-order target detection on each prediction layer to obtain the target detection result of the target image.
[0087] In one embodiment, the target detection module 41 is further used to generate candidate boxes based on the regional candidate network on each prediction layer; obtain image features of the prediction layer and image features of the candidate boxes on the prediction layer, perform feature fusion on the image features of the prediction layer and the image features of the candidate boxes on the prediction layer, and determine each target category and target box in the target image based on the fused features.
[0088] The target object tracking device provided in this embodiment uses a capsule network as the backbone network for image feature extraction and fuses global features and local features during target detection, thereby improving the accuracy of target recognition and positioning. By using multi-level matching from coarse to fine in the matching stage, the accuracy of the matching results is improved, and the running trajectory of the same target between different image sensors can be accurately obtained.
[0089] The implementation principle and technical effects of the device provided in this embodiment are the same as those of the aforementioned embodiments. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0090] An embodiment of the present invention provides an electronic device, such as Figure 5 As shown in the structural diagram of the electronic device, the electronic device includes a processor 51 and a memory 52, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the computer program, the steps of the method provided in the above embodiment are implemented.
[0091] See also Figure 5 The electronic device further includes: a bus 54 and a communication interface 53, and the processor 51, the communication interface 53 and the memory 52 are connected via the bus 54. The processor 51 is used to execute executable modules stored in the memory 52, such as computer programs.
[0092] The memory 52 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 53 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0093] The bus 54 may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0094] Among them, the memory 52 is used to store programs, and the processor 51 executes the program after receiving the execution instruction. The method executed by the device for flow process definition disclosed in any embodiment of the above-mentioned embodiment of the present invention can be applied to the processor 51, or implemented by the processor 51.
[0095] The processor 51 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit in the processor 51 or the instruction in the form of software. The above processor 51 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc. It can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiment of the present invention can be directly embodied as a hardware decoding processor to execute, or a combination of hardware and software modules in the decoding processor to execute. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 52, and the processor 51 reads the information in the memory 52 and completes the steps of the above method in combination with its hardware.
[0096] An embodiment of the present invention provides a computer-readable medium, wherein the computer-readable medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described in the above embodiment.
[0097] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned embodiment, and will not be repeated here.
[0098] The computer program product of the target object image processing method, device and electronic device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the method described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0099] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0100] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0101] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0102] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for processing an image of a target object, It is characterized in that include: Acquire a target image captured by an image sensor, perform target detection on the target image based on a pre-trained neural network model, and obtain a target detection result of the target image; Matching the features of the target object image with the features of the target detection result to obtain the similarity between the target object image and the target detection result; The neural network model includes a capsule network; the step of performing target detection on the target image based on the pre-trained neural network model to obtain the target detection result of the target image includes: performing feature extraction on the target image based on the capsule network obtained by preset training to obtain a feature extraction result; performing first-order target detection and second-order target detection on the feature extraction result in sequence to obtain the target detection result of the target image; The step of performing first-order target detection and second-order target detection on the feature extraction result in sequence to obtain the target detection result of the target image includes: acquiring feature maps of multiple scales corresponding to the feature extraction result based on a preset target detection algorithm, and using each of the feature maps as a prediction layer; performing second-order target detection on each of the prediction layers to obtain the target detection result of the target image.
2. The method according to claim 1, It is characterized in that The target detection result includes a target frame; the step of matching the features of the target object image with the features of the target detection result to obtain the similarity between the target object image and the target detection result includes: The images in each target frame in the target detection result are respectively used as images to be matched; The features of the target object image and the features of each of the images to be matched are globally matched and locally matched to obtain the similarity between the target object image and each of the images to be matched.
3. The method according to claim 2, It is characterized in that The step of performing global matching and local matching on the features of the target object image and the features of each of the images to be matched to obtain the similarity between the target object image and each of the images to be matched comprises: Step a, based on a preset matching module, globally and locally matching the features of the target object image with the features of each of the images to be matched, to obtain a similarity score corresponding to each of the images to be matched; Step b, updating the weight of the preset matching module based on the similarity scores corresponding to the images to be matched; Step c, repeatedly executing the above steps a to b until a preset number of matches is reached, and obtaining a final similarity corresponding to each of the images to be matched.
4. The method according to claim 3, It is characterized in that The step of globally and locally matching the features of the target object image with the features of each of the images to be matched based on a preset matching module to obtain a similarity score corresponding to each of the images to be matched includes: Calculating the global similarity between the target object image and each of the images to be matched based on the global features of the target object image and each of the images to be matched; Determining the local similarity between the target object image and each of the images to be matched based on the local features of the target object image and each of the images to be matched; wherein the local features are obtained by dividing the global features; A similarity score corresponding to each of the to-be-matched images is determined based on the global similarity and the local similarity.
5. The method according to claim 1, It is characterized in that The step of performing second-order target detection on each of the prediction layers to obtain the target detection result of the target image comprises: Generating candidate boxes based on a region candidate network on each of the prediction layers; The image features of the prediction layer and the image features of the candidate frame on the prediction layer are obtained, the image features of the prediction layer and the image features of the candidate frame on the prediction layer are fused, and each target category and target frame in the target image is determined based on the fused features.
6. The method according to claim 1, It is characterized in that The image sensor includes a plurality of cameras; the method further includes: Based on the similarity between the target object image and the target detection result, determining the target camera that photographed the target object and the position change information of the target object in the target camera; The motion trajectory of the target object is determined based on the position change information of the target object in the target camera and the position of each of the target cameras.
7. A tracking device for a target object, It is characterized in that include: A target detection module is used to obtain target images collected by each image sensor, perform target recognition on each target image based on a pre-trained neural network model, and obtain target detection results for each target image; A target re-identification module is used to match the features of the target object image with the features of the target detection result to obtain the similarity between the target object image and the target detection result; The neural network model includes a capsule network; the target detection module includes: extracting features of the target image based on the capsule network obtained through preset training to obtain a feature extraction result; performing first-order target detection and second-order target detection on the feature extraction result in sequence to obtain a target detection result of the target image; The first-order target detection and the second-order target detection are performed on the feature extraction results in sequence to obtain the target detection result of the target image, including: acquiring feature maps of multiple scales corresponding to the feature extraction results based on a preset target detection algorithm, and using each of the feature maps as a prediction layer; and performing second-order target detection on each of the prediction layers to obtain the target detection result of the target image.
8. An electronic device, It is characterized in that include: processor and storage device; The storage device stores a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 6 is executed.
