Object re-identification method and device
By constructing an undirected graph and neural network model to calculate the spatiotemporal transition probability and similarity, the problem of insufficient continuity of spatiotemporal probability distribution in pedestrian re-identification is solved, and the recognition accuracy is significantly improved.
Patent Information
- Application Number
- CN202010896120.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-31
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2040-08-31
AI Technical Summary
In the existing technology, the spatio-temporal probability distribution of pedestrian re-identification has poor continuity, resulting in an insignificant improvement in recognition accuracy.
By constructing an undirected graph, based on the spatiotemporal information of the object sample image and the neural network model, the spatiotemporal transition probability and similarity between image nodes are calculated, and the parameters of the neural network model are adjusted to improve the recognition accuracy.
It effectively improves the accuracy of object re-identification, improves the continuity of spatio-temporal probability distribution, and improves the accuracy of recognition results.
Smart Images

Figure CN112052771B
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence, and in particular to an object re-identification method and device. Background Art
[0002] Person re-identification is a recognition technology in the field of computer vision of artificial intelligence. Person re-identification technology can identify a set of images and determine several target images containing target pedestrians from the image set. Pedestrian re-identification technology can be widely used in security, transportation, buildings and other fields. The image set contains several pedestrian images, each of which carries the time information and camera information when it was taken. In a specific area, the time difference between the appearance of pedestrian images of different pedestrians between specific cameras can be counted to obtain the spatiotemporal probability distribution of pedestrian movement between the specific cameras. In the existing technology, the recognition results of pedestrian re-identification can be adjusted based on the spatiotemporal transfer probability.
[0003] In the process of research and practice of the prior art, the inventors of the present application found that due to the poor continuity of the spatiotemporal probability distribution obtained through statistics, the method of adjusting the recognition results by spatiotemporal transfer probability does not have a significant effect on improving the recognition accuracy. Summary of the invention
[0004] The embodiments of the present application provide an object re-identification method and device, which can effectively improve the accuracy of object re-identification.
[0005] The present application provides an object re-identification method, including:
[0006] Acquire multiple object sample images in the target area, as well as sample labels and spatiotemporal information of each object sample image;
[0007] constructing an undirected graph according to the plurality of object sample images, the undirected graph comprising interconnected image nodes, the image nodes representing the object sample images, and the image nodes comprising image features of the object sample images;
[0008] Determining the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the plurality of object sample images;
[0009] Calculating the image similarity between adjacent image nodes in the undirected graph based on the image features of each image node;
[0010] Based on the neural network model, the spatiotemporal transition probability, the image similarity, and the sample labels of the multiple object sample images, object recognition is performed on the image features of the target object sample image to obtain a prediction result of the target object sample image;
[0011] Based on the image features and sample labels of the multiple object sample images and the prediction results, the network parameters of the neural network model are adjusted to perform object re-identification on the multiple object images to be identified through the trained neural network model.
[0012] Accordingly, the present application provides an object re-identification device, comprising:
[0013] An acquisition module, used to acquire multiple object sample images in the target area, as well as a sample label and spatiotemporal information of each object sample image;
[0014] A construction module, configured to construct an undirected graph according to the plurality of object sample images, wherein the undirected graph comprises interconnected image nodes, the image nodes represent object sample images, and the image nodes comprise image features of the object sample images;
[0015] A determination module, configured to determine the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the plurality of object sample images;
[0016] A calculation module, used for calculating the image similarity between adjacent image nodes in the undirected graph through the image features of each image node;
[0017] an identification module, configured to perform object identification on the image features of the target object sample image based on the neural network model, the spatiotemporal transition probability, the image similarity, and the sample labels of the plurality of object sample images, to obtain a prediction result of the target object sample image;
[0018] An adjustment module is used to adjust the network parameters of the neural network model based on the image features and sample labels of the multiple object sample images and the prediction results, so as to re-identify the multiple object images to be identified through the trained neural network model.
[0019] In some embodiments, the object re-identification apparatus further includes:
[0020] The extraction module is used to extract features from the multiple object sample images through the first sub-model of the neural network model to obtain image features of each object sample image.
[0021] In some embodiments, the recognition module may include an extraction submodule and a recognition submodule, wherein:
[0022] an extraction submodule, configured to extract image features of the target object sample image based on the second submodel of the neural network model, the spatiotemporal transition probability, the image similarity, and the sample labels of the plurality of object sample images, so as to obtain target image features of the target object sample image;
[0023] The recognition submodule is used to perform object recognition on the target object sample image according to the target image feature to obtain a prediction result of the target object sample image.
[0024] In some embodiments, the identification submodule may include a determination unit and an extraction unit, wherein:
[0025] a determining unit, configured to determine that adjacent image nodes are candidate adjacent image nodes when the sample labels of the object sample images of adjacent image nodes are the same;
[0026] The extraction unit is used to extract the image features of the target object sample image based on the second sub-model of the neural network model, the spatiotemporal transfer probability of the candidate adjacent image nodes in the undirected graph, and the image similarity, so as to obtain the target image features of the target object sample image.
[0027] In some embodiments, the extraction unit may be specifically configured to:
[0028] Determine at least one target adjacent image node associated with the target object sample image from the candidate adjacent image nodes of the undirected graph, wherein the target adjacent image node represents the target object sample image and an adjacent object sample image;
[0029] Determine the feature weight of each adjacent object sample image based on the spatiotemporal transition probability and image similarity of all target adjacent image nodes;
[0030] The image features and feature weights of each adjacent object sample image and the image features of the target object sample image are fused to obtain the target image features of the target object sample image.
[0031] In some embodiments, the adjustment module may include an adjustment submodule and a re-identification submodule, wherein:
[0032] An adjustment submodule, configured to adjust network parameters of the neural network model based on the image features and sample labels of the plurality of object sample images and the prediction results;
[0033] The re-identification submodule is used to perform object re-identification on multiple images of objects to be identified through the trained neural network model.
[0034] In some embodiments, the re-identification submodule includes an acquisition unit, an extraction unit, a calculation unit, and a re-identification unit, wherein:
[0035] An acquisition unit, used for acquiring a plurality of images of objects to be identified;
[0036] An extraction unit, used for extracting features from the plurality of to-be-identified object images through a trained neural network model to obtain target image features of each to-be-identified object image;
[0037] A calculation unit, used for calculating the target similarity between the images of the objects to be identified based on the spatiotemporal information of each image of the object to be identified and the target image features;
[0038] The re-identification unit is used to perform object re-identification based on the target similarity between the images of the objects to be identified to obtain a recognition result.
[0039] In some embodiments, the computing unit may be specifically configured to:
[0040] Calculating the feature similarity between the images of the objects to be identified based on the target image features of each image of the object to be identified;
[0041] Determine the spatiotemporal transfer probability between the images of the objects to be identified based on the spatiotemporal transfer probability distribution and the spatiotemporal information of the images of the objects to be identified;
[0042] The target similarity between the images of the objects to be identified is obtained by fusing the feature similarity and spatiotemporal transition probability between the images of the objects to be identified.
[0043] In some embodiments, the spatiotemporal information includes time information and space information, and the determination module is specifically used to:
[0044] Calculating time difference information and spatial transfer information between adjacent image nodes according to time information and spatial information of object sample images of adjacent image nodes in the undirected graph;
[0045] Determine a target spatiotemporal probability distribution from the spatiotemporal probability distribution of object transfers in the target area according to the spatial transfer information, wherein the target spatiotemporal probability distribution includes a mapping relationship between time information and probability information;
[0046] The spatiotemporal transfer probability between adjacent image nodes in the undirected graph is determined according to the time difference information and the target spatiotemporal probability distribution.
[0047] In some embodiments, the adjustment submodule is specifically used to:
[0048] Calculating a first loss of the neural network model based on image features and sample labels of the plurality of object sample images;
[0049] Calculating a second loss of the neural network model based on the prediction result and the sample label of the target object sample image;
[0050] The first loss and the second loss are combined to adjust the network parameters of the neural network model.
[0051] Correspondingly, an embodiment of the present application further provides a storage medium, which stores a computer program, and the computer program is suitable for loading by a processor to execute any object re-identification method provided in the embodiment of the present application.
[0052] Correspondingly, an embodiment of the present application also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any object re-identification method provided in the embodiment of the present application is implemented.
[0053] The present application can obtain multiple object sample images in a target area, as well as sample labels and spatiotemporal information of each object sample image; construct an undirected graph based on the multiple object sample images, the undirected graph includes interconnected image nodes, the image nodes represent object sample images, and the image nodes include image features of the object sample images; determine the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the multiple object sample images; calculate the image similarity between adjacent image nodes in the undirected graph through the image features of each image node; based on the neural network model, the spatiotemporal transfer probability, the image similarity and the sample labels of the multiple object sample images, perform object recognition on the image features of the target object sample images to obtain the prediction results of the target object sample images; based on the image features and sample labels of the multiple object sample images, and the prediction results, adjust the network parameters of the neural network model to perform object re-recognition on multiple object images to be recognized through the trained neural network model.
[0054] The present application can integrate the spatiotemporal transfer probability into the training process and application process of the neural network model. In the training process, feature extraction and neural network model training can be performed based on sample labels, spatiotemporal transfer probability and image similarity, thereby improving the continuity of the statistically obtained spatiotemporal probability distribution. In the application process, the spatiotemporal transfer probability and image similarity can be fused based on the trained neural network model, and object re-identification can be performed through the fused target similarity, thereby effectively improving the accuracy of object re-identification. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0056] Figure 1 is a schematic diagram of a scene of an object re-identification system provided in an embodiment of the present application;
[0057] Figure 2 is a flowchart of an object re-identification method provided in an embodiment of the present application;
[0058] Figure 3 is another flowchart of the object re-identification method provided in an embodiment of the present application;
[0059] Figure 4 is an implementation example diagram of the object re-identification method provided in the embodiment of the present application;
[0060] Figure 5 is another implementation example diagram of the object re-identification method provided in an embodiment of the present application;
[0061] Figure 6 is a schematic diagram of the structure of an object re-identification device provided in an embodiment of the present application;
[0062] Figure 7 is another structural schematic diagram of the object re-identification device provided in an embodiment of the present application;
[0063] Figure 8 It is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0064] 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 embodiments described in this application are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0065] Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0066] Computer Vision (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to the use of cameras and computers to replace human eyes to identify, track and measure targets, and further perform graphics processing so that the computer processes the images into images that are more suitable for human observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multi-dimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and mapping, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0067] The object recognition, network parameter adjustment and object re-identification in the embodiments of the present application involve the computer vision field of artificial intelligence, for example, object re-identification of multiple images of objects to be identified is performed through a trained neural network model, which will be explained in detail through the following embodiments.
[0068] The embodiments of the present application provide a method and device for object re-identification. Specifically, the embodiments of the present application can be integrated into an object re-identification device.
[0069] The object re-identification device can be integrated in a computer device, which can include a terminal or a server, etc. The server can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. The terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application does not limit this.
[0070] See also Figure 1The object re-identification device can be integrated in a computer device such as a terminal and a server, wherein the computer device can obtain multiple object sample images in a target area, as well as a sample label and spatiotemporal information of each object sample image; construct an undirected graph based on the multiple object sample images, the undirected graph includes interconnected image nodes, the image nodes represent the object sample images, and the image nodes include image features of the object sample images; based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the multiple object sample images, determine the spatiotemporal transfer probability between adjacent image nodes in the undirected graph; calculate the image similarity between adjacent image nodes in the undirected graph through the image features of each image node; based on the neural network model, the spatiotemporal transfer probability, the image similarity and the sample labels of the multiple object sample images, perform object recognition on the image features of the target object sample images to obtain the prediction results of the target object sample images; based on the image features and sample labels of the multiple object sample images, and the prediction results, adjust the network parameters of the neural network model to perform object re-identification on the multiple object images to be recognized through the trained neural network model.
[0071] It should be noted that Figure 1 The scene diagram of the object re-identification system shown is merely an example. The object re-identification system and scene described in the embodiment of the present application are intended to more clearly illustrate the technical solution of the embodiment of the present application, and do not constitute a limitation on the technical solution provided in the embodiment of the present application. A person of ordinary skill in the art can appreciate that with the evolution of the object re-identification device and the emergence of new business scenarios, the technical solution provided in the embodiment of the present application is equally applicable to similar technical problems.
[0072] In this embodiment, the object re-identification method is described in detail. The object re-identification method can be integrated on a computer device, such as Figure 2 As shown, Figure 2 : is a flow chart of an object re-identification method provided in an embodiment of the present application. The object re-identification method may include:
[0073] 101. Acquire multiple object sample images in a target area, as well as a sample label and spatiotemporal information of each object sample image.
[0074] Among them, the target area may include any area with limited range, such as shopping malls, residential areas, cities, streets, scenic spots, the earth, or villages. The street target area may include several image acquisition devices. When the image acquisition device acquires the object image or the object sample image, it is necessary to determine the location information and time information at the time of acquisition. The image acquisition device can be fixed or mobile. If it is fixed, the location of the image acquisition setting is the location information at the time of acquisition. If it is mobile, the location information can be determined by configuring a location determination function interface for the image acquisition device.
[0075] The object sample image may be an image in the target area that has been collected, and the object may be a movable object such as a person, an animal, or an intelligent device, or an object that moves relatively to a movable object, such as a suitcase, a flower pot, or a doll, etc. The object sample image may be used for training a neural network model.
[0076] The sample label can be information that uniquely identifies the object in the object sample image. There can be many representations of the sample label. For example, the sample label can be a description of the main features of the object in the object sample image, such as woman 1, blue cat 2. In order to facilitate the storage and management of object sample data, the sample label can also be in computer digital or character form, such as budug, 234e. At the same time, a mapping relationship between this sample label and the main features of the object in the object sample image is established. The main features can be recorded in the form of images, texts, etc.
[0077] The spatiotemporal information may include time and space information that can characterize the object sample image when it is collected. One object sample image corresponds to one spatiotemporal information. The spatiotemporal information of the object sample image can be used to prove that the object in the object sample image is at a specific position at a specific time.
[0078] Due to differences in the image acquisition frequency of the image acquisition device and the movement rate of the object within the capture range of the image acquisition device, the spatiotemporal information of the object sample image obtained by the image acquisition device can be a continuous period of time or space, multiple time points or space points. At this time, the acquired spatiotemporal information can be simplified. For example, a time point or space point (position) can be selected as the spatiotemporal information of the object sample image.
[0079] Specifically, there are many ways to obtain multiple object sample images in the target area, as well as the sample label and spatiotemporal information of each object sample image, where each object sample image and its sample label and spatiotemporal information can be referred to as sample data, for example, sending a data request to other computer devices (such as a server) and receiving sample data returned by other computer devices, or directly obtaining from a computer device integrated with the present solution, etc.
[0080] For example, multiple object sample images in cell A, as well as sample labels and spatiotemporal information of each object sample image, are obtained.
[0081] 102. Construct an undirected graph based on multiple object sample images, where the undirected graph includes interconnected image nodes, the image nodes represent the object sample images, and the image nodes include image features of the object sample images.
[0082] The undirected graph may include a plurality of interconnected nodes, each group of interconnected nodes does not indicate a direction, and the image node may identify an object sample image, and the two are in a one-to-one correspondence. The process of constructing an undirected graph based on multiple object sample data may be implemented in a variety of ways, such as an adjacency matrix or an adjacency list, etc. In practical applications, it may be flexibly selected according to the number of object sample data, which will not be described in detail here.
[0083] The image features may include content obtained by extracting features from the sample image of the object. The image features may be extracted using an existing feature extraction model or feature extraction algorithm, such as a backbone network model (BackboneNetwork).
[0084] For example, an undirected graph M may be constructed based on a plurality of object sample images, wherein the undirected graph M includes interconnected image nodes, and each image node may include an image feature of the object sample image.
[0085] In some embodiments, the object re-identification method further includes:
[0086] The first sub-model of the neural network model is used to extract features of multiple object sample images to obtain image features of each object sample image.
[0087] The neural network model to be trained may include at least one sub-model. For example, before extracting features from the sample image of the object to obtain image features, the first sub-model of the neural network model may be pre-constructed, and the network parameters in the first sub-model may be initialized. Then, the first sub-model may be used to extract features from the sample image of the object. Specifically, the feature extraction may include convolution, pooling, and other processes, and finally the image features of each sample image of the object may be obtained. The first sub-model may be constructed based on an existing network model, for example, the first sub-model may be constructed based on a backbone network model.
[0088] For example, feature extraction is performed through the first sub-model S1 of the neural network model to obtain image features of each object sample image.
[0089] 103. Based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of multiple object sample images, determine the spatiotemporal transfer probability between adjacent image nodes in the undirected graph.
[0090] Among them, the spatiotemporal probability distribution of object transfer can characterize the probability distribution of the time required for the object to transfer between specific locations in the target area. For example, the probability distribution of the time required for Xiao Wang to walk from milk tea shop 1 to milk tea shop 2 in the shopping mall. The probability distribution can be a mapping relationship between time information and probability information.
[0091] The spatiotemporal probability distribution of the target area can be determined in advance. In actual application, the images captured of an object at one location (location information recorded by the image acquisition device) may include multiple images, each corresponding to a time point. The middle value of the time points of these images can be taken and used as the time point of the object at that location.
[0092] Then, for two specific positions in the target area (such as position 1 and position 2), the time it takes for the object to move between position 1 and position 2 can be counted, the time 1 when the object appears at position 1 can be determined by the object image captured by the image acquisition device at position 1, the time 2 when the object appears at position 2 can be determined by the object image captured by the image acquisition device at position 2, and the time it takes for the object to move between position 1 and position 2 can be represented by the difference between time 1 and time 2.
[0093] The time taken by multiple objects to move between position 1 and position 2 is counted to obtain data for multiple time periods, and then a spatiotemporal probability distribution in the target area can be obtained based on the data for these time periods.
[0094] Specifically, to facilitate subsequent operations, the possible time period (between the maximum and minimum values) that it takes to move between position 1 and position 2 can be determined based on the maximum and minimum values in the statistical time period data, and the possible time period can be evenly divided based on actual needs. For example, if the maximum value is 60 seconds and the minimum value is 20 seconds, then the possible time period that it takes to move between position 1 and position 2 is 40 seconds. Divide 40 seconds evenly into 4 minutes, and you will get four interval time periods: 0 to 10 seconds, 10 to 20 seconds, 20 to 30 seconds, and 30 to 40 seconds.
[0095] Then, according to the statistical time period data, the frequency of each interval time period is obtained in turn. For example, after statistics, the frequency of 0 to 10 seconds is 20, the frequency of 10 to 20 seconds is 18, the frequency of 20 to 30 seconds is 35, and the frequency of 30 to 40 seconds is 19. The frequency of each interval time period can be obtained through the frequency of each interval time period, and finally the spatiotemporal transfer probability between position 1 and position 2 is obtained. For example, the frequency is smoothed by a statistical method (such as smoothing by a Gaussian kernel function).
[0096] The spatiotemporal transfer probability between adjacent image nodes can be the probability that an object moves between sample positions in a sample time, wherein the sample time and sample position can be determined based on the sample image of the object at the adjacent image nodes. The spatiotemporal transfer probability between adjacent image nodes can be determined by searching in the spatiotemporal probability distribution of the target area based on the sample time and sample position.
[0097] For example, based on the spatiotemporal probability distribution O of object transfer in a small area of the target area A and the spatiotemporal information of multiple object sample images, the spatiotemporal transfer probability between adjacent image nodes in the undirected graph M is determined.
[0098] In some embodiments, the spatiotemporal information includes time information and space information, and the step of "determining the spatiotemporal transition probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transitions in the target area and the spatiotemporal information of multiple object sample images" may include:
[0099] According to the time information and space information of the object sample images of adjacent image nodes in the undirected graph, the time difference information and space transfer information between adjacent image nodes are calculated; according to the space transfer information, the target space-time probability distribution is determined from the space-time probability distribution of the object transfer in the target area, and the target space-time probability distribution includes the mapping relationship between the time information and the probability information; according to the time difference information and the target space-time probability distribution, the space-time transfer probability between adjacent image nodes in the undirected graph is determined.
[0100] Specifically, the time information can be the time point when the object sample image is collected, and the spatial sample information can be the position when the object sample image is collected. The spatial information can be collected manually or determined based on the position information of the image acquisition device. For example, the position of the image acquisition device is the position of the object sample image.
[0101] The spatiotemporal probability distribution of the target area may include multiple ones, each of which indicates two position information. Therefore, the time difference information and spatial transfer information between adjacent image nodes can be calculated through the time information and spatial information of the object sample images of adjacent image nodes, and the target spatiotemporal probability distribution corresponding to the adjacent image nodes can be determined through the spatial transfer information. According to the time information, the table in the target spatiotemporal probability distribution is looked up to determine the spatiotemporal transfer probability between the adjacent image nodes. The above operation is performed for each group of adjacent image nodes in the undirected graph, and the spatiotemporal transfer probability between all adjacent image nodes in the undirected graph can be finally obtained.
[0102] For example, the spatiotemporal probability distribution O of the target area A cell may include spatiotemporal probability distribution 1, spatiotemporal probability distribution 2 and spatiotemporal probability distribution 3. A group of adjacent image nodes in the undirected graph M includes image node J1 and image node J2. Image node J1 represents object sample image 1, and object sample image 1 corresponds to time information t1 and spatial information p1. Image node J2 represents object sample image 2, and object sample image 2 corresponds to time information t2 and spatial information p2. The time difference information t1-t2 and spatial transfer information p2_p1 between image node T1 and image node T2 can be calculated. Then, according to the spatial transfer information p2_p1, the target usage probability distribution is determined: spatiotemporal probability distribution 1. Finally, the spatiotemporal probability between image node J1 and image node J2 is determined according to the time difference information t1-t2 and spatiotemporal probability distribution 1. The above operations are performed on all adjacent image nodes in the undirected graph M to determine the spatiotemporal transfer probability between all adjacent nodes in the undirected graph M.
[0103] 104. Calculate the image similarity between adjacent image nodes in the undirected graph through the image features of each image node.
[0104] Image similarity can measure the similarity of sample images of an object. Image similarity can be determined by calculation. Before calculating image similarity, the image features and network parameters can be convolved first, and then the convolved features can be processed by activation functions. Nonlinear elements can be introduced into the neural network model. Common activation functions can include Sigmoid function (an activation function), Tanh nonlinear function (an activation function), Leaky ReLU function (an activation function), or ReLU (an activation function). For example, the formula for convolution and activation of image features can be:
[0105]
[0106] Among them, W l is a network parameter of the neural network model, is the image feature, is the initial image feature obtained after convolution and activation of the image feature.
[0107] Then, the image similarity between adjacent image nodes can be calculated. For example, the calculation formula for image similarity can be:
[0108]
[0109] Among them, s is the image similarity between adjacent image nodes, i and j are image nodes, and is the initial image feature of the adjacent image nodes.
[0110] For example, the image features of each image node are convolved and activated to obtain the initial image features corresponding to the image features of each image node, and then the image similarity between adjacent image nodes in the undirected graph M is calculated using the initial image features of each image node.
[0111] 105. Based on the neural network model, spatiotemporal transfer probability, image similarity and sample labels of multiple object sample images, object recognition is performed on the image features of the target object sample image to obtain a prediction result of the target object sample image.
[0112] The prediction result of the target object sample image can be obtained by performing object recognition based on the image features of the target object sample image through the spatiotemporal transition probabilities and image similarities of all adjacent image nodes in the undirected graph, the neural network model, the sample labels and image features of multiple object sample images.
[0113] The prediction result may be a prediction result of the object in the target object sample image, or a prediction result of the target object sample image and other standard images. For example, the objects in the target object sample image and other standard images are the same object.
[0114] For example, based on the neural network model X to be trained, the spatiotemporal transition probabilities and image similarities of all adjacent image nodes in the undirected graph M, and the sample labels of all object sample images, object recognition can be performed on the image features of the target object sample image 1 to obtain the prediction result yy of the target object sample image.
[0115] In some embodiments, the step of “performing object recognition on image features of target object sample images based on a neural network model, spatiotemporal transition probability, image similarity, and sample labels of multiple object sample images to obtain prediction results of target object sample images” may include:
[0116] Based on the second sub-model of the neural network model, the spatiotemporal transfer probability, the image similarity and the sample labels of multiple object sample images, feature extraction is performed on the image features of the target object sample images to obtain the target image features of the target object sample images; object recognition is performed on the target object sample images according to the target image features to obtain the prediction results of the target object sample images.
[0117] Specifically, the neural network model may include a second sub-model, which can further perform feature extraction on image features. The network parameters of the second sub-model may be the network parameters mentioned in step 104. The second sub-model may complete feature extraction through the spatiotemporal transfer probabilities between all adjacent image nodes in the undirected graph, image similarities, and sample labels of individual object sample images to obtain target image features of the target object sample image. Then, the target image features are input into the fully connected layer to obtain the prediction results of the target object sample image output by the fully connected layer.
[0118] For example, based on the second sub-model of the neural network model X, the spatiotemporal transition probabilities and image similarities of all adjacent image nodes in the undirected graph M, and the sample labels of all object sample images, feature extraction is performed on the image features of the target object sample image 1 to obtain the target image features 1Q of the target object sample image; object recognition is performed on the target object sample image 1 according to the target image features 1Q to obtain the prediction result yy of the target object sample image.
[0119] In some embodiments, the step of “extracting image features of the target object sample image based on the second sub-model of the neural network model, the spatiotemporal transition probability, the image similarity, and the sample labels of the plurality of object sample images to obtain target image features of the target object sample image” may include:
[0120] When the sample labels of the object sample images of adjacent image nodes are the same, the adjacent image nodes are determined to be candidate adjacent image nodes; based on the second sub-model of the neural network model, the spatiotemporal transfer probability and image similarity of the candidate adjacent image nodes in the undirected graph, the image features of the target object sample image are extracted to obtain the target image features of the target object sample image.
[0121] Specifically, the sample labels of the object sample images represented by the image nodes in the undirected graph may be the same or different. If the sample labels are different, the objects in the object sample images are different people. Since the spatiotemporal transfer probability refers to the probability that it takes time for a specific object to move, in this application, only adjacent image nodes with the same sample labels are required, that is, by comparing the sample labels of each group of adjacent image nodes, if they are the same, then this adjacent image node is a candidate adjacent image node, and ultimately all the candidate adjacent image nodes in the undirected graph can be determined.
[0122] Then, the initial image features of the target object sample image can be extracted through the spatiotemporal transition probabilities and image similarities of all candidate adjacent image nodes in the undirected graph to obtain the target image features of the target object sample image.
[0123] It should be noted that in the present application, the step of "determining candidate adjacent image nodes in an undirected graph", the step of "calculating the image similarity between adjacent image nodes", and the step of "determining the spatiotemporal transition probability between adjacent image nodes" have no restrictions on the order of operation, and the order of performing different steps can be flexibly selected according to actual conditions, which will not be repeated here.
[0124] For example, when the sample labels of the object sample images of adjacent image nodes are the same, the adjacent image nodes are determined to be candidate adjacent image nodes to determine all candidate adjacent image nodes in the undirected graph M. Based on the second sub-model of the neural network model X, the spatiotemporal transfer probability and image similarity of the candidate adjacent image nodes in the undirected graph M, the image features of the target object sample image 1 are extracted to obtain the target image features 1Q of the target object sample image.
[0125] In some embodiments, the step of “extracting image features of the target object sample image based on the second sub-model of the neural network model, the spatiotemporal transition probability of candidate adjacent image nodes in the undirected graph, and the image similarity to obtain target image features of the target object sample image” may include:
[0126] At least one target adjacent image node associated with a target object sample image is determined from candidate adjacent image nodes of an undirected graph, wherein the target adjacent image node represents the target object sample image and the adjacent object sample image; based on the spatiotemporal transition probability and image similarity of all target adjacent image nodes, the feature weight of each adjacent object sample image is determined; the image features and feature weights of each adjacent object sample image and the image features of the target object sample image are fused to obtain the target image features of the target object sample image.
[0127] Among them, a group of adjacent image nodes may include two image nodes, each image node represents an object sample image, and the target adjacent image node may include the target object sample image and the adjacent object sample image. Then, the similarity of each adjacent object sample image may be obtained according to the spatiotemporal transition probability and image similarity of all target adjacent image nodes, and then the feature weight of each adjacent object sample image may be calculated according to the similarity. Specifically, the calculation formula of the similarity of adjacent object sample images may be:
[0128]
[0129] Among them, i and j are image nodes, and is the initial image feature of the adjacent image nodes, is the indicator function. When the sample labels of image nodes i and j are the same, the indicator function output is 1, otherwise it is 0.
[0130] The calculation formula of the feature weight of the adjacent object sample image can be:
[0131]
[0132] Where i is the image node of the target object sample image, N(i) is the image node of the adjacent object sample node, that is, i and N(i) are a set of target adjacent image nodes. is the similarity of the target adjacent object sample nodes, is the feature weight of the adjacent object sample image.
[0133] Finally, the target image feature of the target object sample image can be obtained based on the feature weights and initial image features of the adjacent object sample images and the image features of the target object sample image, wherein the calculation formula of the target image feature can be:
[0134]
[0135] in, is the image feature of the target object sample image, is the feature weight of the adjacent object sample image, N(i) is the image node of the adjacent object sample node, that is, i and N(i) are a set of target adjacent image nodes, is the image feature of the sample image of the target object.
[0136] 106. Based on the image features and sample labels of the plurality of object sample images and the prediction results, the network parameters of the neural network model are adjusted to perform object re-identification on the plurality of to-be-identified object images through the trained neural network model.
[0137] The process of adjusting the network parameters of the neural network model is the process of training the neural network model. After the training is completed, the trained model can be used to re-identify multiple images of objects to be identified.
[0138] For example, based on the image features and sample labels of multiple object sample images and the prediction results of the target object sample image 1, the network parameters of the neural network model X are adjusted to perform object re-identification on multiple object images to be identified through the trained neural network model X.
[0139] In some embodiments, the step of “performing object re-identification on multiple to-be-identified object images by using a trained neural network model” may include:
[0140] Acquire multiple images of objects to be identified; extract features of the multiple images of objects to be identified through a trained neural network model to obtain target image features of each image of the object to be identified; calculate the target similarity between the images of objects to be identified based on the spatiotemporal information and target image features of each image of the object to be identified; perform object re-identification based on the target similarity between the images of the object to be identified to obtain a recognition result.
[0141] When the trained neural network model is used for object re-identification, the first sub-model and the second sub-model can be used to extract features of the to-be-identified object image in turn to obtain target image features of each to-be-identified object image.
[0142] Then, in the process of object re-identification, a reference object image can be determined first (the reference object image can be one of the object images to be identified, or an image different from the object image to be identified), and then the target similarity between each object image to be identified and the reference object image can be determined. Finally, based on the target similarity of each object image to be identified, a target object sample image that is the same as the object in the reference object image is determined from multiple object images to be identified, thereby obtaining the recognition result of object re-identification.
[0143] For example, multiple images of objects to be identified can be obtained, and a reference object image CC can be determined from them. Then, the trained neural network model X can be used to extract features of each image of the object to be identified to obtain target image features of each object to be identified. Then, based on the spatiotemporal information and target image features of each object to be identified, the target similarity between the reference object image CC and the image of the object to be identified can be calculated. Based on this, the image of the object to be identified can be re-identified to determine a sample image of the target object that is the same as the object in the reference object image CC.
[0144] In some embodiments, the step of “calculating the target similarity between the images of the objects to be identified based on the spatiotemporal information of each image of the object to be identified and the target image features” may include:
[0145] According to the target image features of each image of the object to be identified, the feature similarity between the images of the object to be identified is calculated; based on the spatiotemporal transfer probability distribution and the spatiotemporal information of the image of the object to be identified, the spatiotemporal transfer probability between the images of the object to be identified is determined; the feature similarity and the spatiotemporal transfer probability between the images of the object to be identified are fused to obtain the target similarity between the images of the object to be identified.
[0146] Specifically, the target similarity can be determined by the spatiotemporal transfer probability and feature similarity between the images of the objects to be identified, wherein the spatiotemporal transfer probability can be determined by the spatiotemporal information of the images of the objects to be identified and the spatiotemporal probability distribution of the target area. The implementation process is similar to the process of determining the corresponding spatiotemporal transfer probability of the sample object image, and will not be repeated here. The determination of the feature similarity between the images of the objects to be identified can be measured by relevant distance formulas, such as cosine distance, Euclidean distance, etc.
[0147] There are many ways to fuse spatiotemporal transfer probability and feature similarity, such as weighted average, addition, multiplication, etc., which can be flexibly selected according to needs in practical applications. For example, the calculation formula of target similarity can be:
[0148]
[0149] in, is the feature similarity between the images of the objects to be identified, is the spatiotemporal transition probability between the images of the objects to be identified, s i,j is the target similarity between the sample images of the object to be identified.
[0150] In some embodiments, the step of “adjusting network parameters of the neural network model based on image features and sample labels of multiple object sample images and prediction results” may include:
[0151] Based on the image features and sample labels of multiple object sample images, the first loss of the neural network model is calculated; based on the prediction results and the sample labels of the target object sample images, the second loss of the neural network model is calculated; and the network parameters of the neural network model are adjusted by combining the first loss and the second loss.
[0152] Before adjusting the network parameters of the neural network model, it is necessary to calculate the loss of the neural network model. The loss may include a first loss and a second loss, wherein the first loss may be for the first sub-model and the second loss may be for the second sub-model. After extracting features of the object sample image through the first sub-model and obtaining the image features, the triplet loss (Triplet Loss) may be calculated. The triplet loss may be calculated through three image features, and these three image features may correspond to two sample labels, that is, image features containing two sample labels with the same label.
[0153] The second loss can be calculated by the predicted value of the target object sample image and the sample label, and the loss function can be flexibly selected according to actual needs, such as the softmax function (a loss function).
[0154] Then, the first loss and the second loss can be combined to perform model training. For example, the first loss and the second loss can be fused to obtain the target loss of the neural network model, and the network parameters of the neural network model can be adjusted by the target loss to complete the model training process.
[0155] The present application can integrate the spatiotemporal transfer probability into the training process and application process of the neural network model. In the training process, feature extraction and neural network model training can be performed based on sample labels, spatiotemporal transfer probability and image similarity, thereby improving the continuity of the statistically obtained spatiotemporal probability distribution. In the application process, the spatiotemporal transfer probability and image similarity can be fused based on the trained neural network model, and the object can be re-identified through the fused target similarity, thereby improving the accuracy of object re-identification.
[0156] The method described in the above embodiment is further described in detail below with examples.
[0157] This application will take the object re-identification system integrated in the server as an example to introduce the object re-identification method. Figure 3 As shown, Figure 3 : is a flow chart of an object re-identification method provided in an embodiment of the present application. The object re-identification method may include:
[0158] 201. A computer device obtains a plurality of object sample images in a target area, as well as a sample label and spatiotemporal information of each object sample image.
[0159] 202. The computer device constructs an undirected graph based on multiple object sample images. The undirected graph includes interconnected image nodes. The image nodes represent the object sample images. The image nodes include image features of the object sample images. The image features are obtained by extracting features of the object images by the first sub-model of the neural network model.
[0160] Among them, see Figure 4 , the first sub-model can be Figure 4The backbone network (Backbone Network) in the method may be a deep network model such as a residual network (ResNet), a dense convolutional neural network (DenseNet), or a neural architecture search network (NASNet) on a neuron. After the object sample image is input into the backbone network, the image feature of the object sample image can be obtained: Feature 1. Then, an undirected graph is constructed based on the image feature of each object sample image to obtain a graph convolutional neural network (GCN). The graph convolutional neural network includes interconnected image nodes, and the image nodes include the image features of the object sample image.
[0161] 203. The computer device determines the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of multiple object sample images.
[0162] For example, the spatiotemporal probability distribution of the target area can be found in Figure 5 , different curves represent different specific locations in the target area. In some embodiments, the location can be determined by a camera installed at the location. Figure 5 The different curves in may be between different cameras, and each curve may represent the probability distribution of the time required for the transfer between the cameras.
[0163] The spatiotemporal probability distribution of object transfer in the target area may be updated as data changes, for example, by updating the spatiotemporal probability distribution through newly acquired sample images of objects in the target area.
[0164] 204. The computer device calculates the image similarity between adjacent image nodes in the undirected graph through the second sub-network of the neural network model and the image features of each image node.
[0165] 205. When the sample labels of the object sample images of adjacent image nodes are the same, the computer device determines the adjacent image nodes as candidate adjacent image nodes to obtain all candidate adjacent image nodes in the undirected graph.
[0166] 206. The computer device extracts image features of the target object sample image based on the second sub-model of the neural network model, the spatiotemporal transfer probability of candidate adjacent image nodes in the undirected graph, and the image similarity to obtain target image features of the target object sample image.
[0167] For example, the second subnetwork can be a graph convolutional neural network, see Figure 4 , the weight (Attention) of the edge in the undirected graph can be calculated based on the same identity (i.e. the same sample label), feature similarity (i.e. image similarity), and spatiotemporal probability (i.e. spatiotemporal transition probability), and the target image feature of the target object sample image is obtained: Feature 2 (Feature2).
[0168] 207. The computer device adjusts the network parameters of the neural network model based on the image features and sample labels of the multiple object sample images and the prediction results to obtain a trained neural network model.
[0169] Before model training, sampling can be performed from the object sample data set to obtain several batches of object sample image data. To ensure that the number of object sample images corresponding to the sample labels in each batch of object sample image data is the same, uniform sampling can be used.
[0170] like Figure 4 , the loss 1 obtained by the first sub-network and the loss 2 obtained by the second sub-network can be combined to train the neural network model, where the loss 1 obtained by the first sub-network can be a triplet loss, and the target image features obtained by the second sub-network are input into the fully connected layer to obtain the prediction results corresponding to the target image features, and then combined with the sample labels, the loss 2 obtained by the second sub-network can be obtained.
[0171] In the process of training the neural network model, you can use optimization algorithms such as stochastic gradient descent (SGD), stochastic gradient descent using momentum (Momentum SGD), and adaptive gradient (AdaGrad).
[0172] 208. The computer device extracts features of multiple to-be-identified object images through the trained neural network model to obtain target image features of each to-be-identified object image.
[0173] 209. The computer device calculates the target similarity between the images of the objects to be identified based on the spatiotemporal information and target image features of each image of the object to be identified.
[0174] 210. The computer device performs object re-identification based on the target similarity between the images of the objects to be identified, and obtains a recognition result.
[0175] The present application can integrate the spatiotemporal transfer probability into the training process and application process of the neural network model. In the training process, feature extraction and neural network model training can be performed based on sample labels, spatiotemporal transfer probability and image similarity, thereby improving the continuity of the statistically obtained spatiotemporal probability distribution. In the application process, the spatiotemporal transfer probability and image similarity can be fused based on the trained neural network model, and the object can be re-identified through the fused target similarity, thereby improving the accuracy of object re-identification.
[0176] In order to better implement the object re-identification method provided in the embodiment of the present application, the embodiment of the present application also provides a device based on the above object re-identification method. The meanings of the terms are the same as those in the above object re-identification method, and the specific implementation details can refer to the description in the method embodiment.
[0177] like Figure 6 As shown, Figure 6 A schematic diagram of the structure of an object re-identification device provided in an embodiment of the present application, wherein the object re-identification device may include an acquisition module 301, a construction module 302, a determination module 303, a calculation module 304, an identification module 305 and an adjustment module 306, wherein:
[0178] An acquisition module 301 is used to acquire multiple object sample images in a target area, as well as a sample label and spatiotemporal information of each object sample image;
[0179] A construction module 302 is used to construct an undirected graph according to a plurality of object sample images, wherein the undirected graph includes interconnected image nodes, the image nodes represent the object sample images, and the image nodes include image features of the object sample images;
[0180] A determination module 303, for determining the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of multiple object sample images;
[0181] A calculation module 304, used to calculate the image similarity between adjacent image nodes in the undirected graph through the image features of each image node;
[0182] The recognition module 305 is used to perform object recognition on the image features of the target object sample image based on the neural network model, the spatiotemporal transition probability, the image similarity and the sample labels of the multiple object sample images to obtain the prediction result of the target object sample image;
[0183] The adjustment module 306 is used to adjust the network parameters of the neural network model based on the image features and sample labels of multiple object sample images and the prediction results, so as to perform object re-identification on multiple to-be-identified object images through the trained neural network model.
[0184] In some embodiments, the object re-identification apparatus further includes:
[0185] The extraction module is used to extract features from multiple object sample images through the first sub-model of the neural network model to obtain image features of each object sample image.
[0186] In some embodiments, see Figure 7 , the identification module 305 may include an extraction submodule 3051 and an identification submodule 3052, wherein,
[0187] An extraction submodule 3051 is used to extract image features of the target object sample image based on the second submodel of the neural network model, the spatiotemporal transition probability, the image similarity, and the sample labels of the plurality of object sample images, so as to obtain target image features of the target object sample image;
[0188] The recognition submodule 3052 is used to perform object recognition on the target object sample image according to the target image features to obtain a prediction result of the target object sample image.
[0189] In some embodiments, the identification submodule may include a determination unit and an extraction unit, wherein:
[0190] a determination unit, configured to determine an adjacent image node as a candidate adjacent image node when the sample labels of the object sample images of the adjacent image nodes are the same;
[0191] The extraction unit is used to extract the image features of the target object sample image based on the second sub-model of the neural network model, the spatiotemporal transfer probability of candidate adjacent image nodes in the undirected graph, and the image similarity, so as to obtain the target image features of the target object sample image.
[0192] In some embodiments, the extraction unit may be specifically configured to:
[0193] Determine at least one target adjacent image node associated with the target object sample image from the candidate adjacent image nodes of the undirected graph, the target adjacent image node representing the target object sample image and the adjacent object sample image;
[0194] Determine the feature weight of each adjacent object sample image based on the spatiotemporal transition probability and image similarity of all target adjacent image nodes;
[0195] The image features and feature weights of each adjacent object sample image and the image features of the target object sample image are fused to obtain the target image features of the target object sample image.
[0196] In some embodiments, the adjustment module may include an adjustment submodule and a re-identification submodule, wherein:
[0197] An adjustment submodule, used to adjust network parameters of the neural network model based on image features and sample labels of multiple object sample images and prediction results;
[0198] The re-identification submodule is used to perform object re-identification on multiple images of objects to be identified through the trained neural network model.
[0199] In some embodiments, the re-identification submodule includes an acquisition unit, an extraction unit, a calculation unit, and a re-identification unit, wherein:
[0200] An acquisition unit, used for acquiring a plurality of images of objects to be identified;
[0201] An extraction unit, used to extract features from a plurality of to-be-identified object images through a trained neural network model, and obtain target image features of each to-be-identified object image;
[0202] A calculation unit, used for calculating the target similarity between the images of the objects to be identified based on the spatiotemporal information of each image of the object to be identified and the target image features;
[0203] The re-identification unit is used to perform object re-identification based on the target similarity between the images of the objects to be identified to obtain a recognition result.
[0204] In some embodiments, the computing unit may be specifically configured to:
[0205] Calculating the feature similarity between the images of the objects to be identified based on the target image features of each image of the object to be identified;
[0206] Determine the spatiotemporal transfer probability between the images of the objects to be identified based on the spatiotemporal transfer probability distribution and the spatiotemporal information of the images of the objects to be identified;
[0207] The target similarity between the images of the objects to be identified is obtained by fusing the feature similarity and spatiotemporal transition probability between the images of the objects to be identified.
[0208] In some embodiments, the spatiotemporal information includes time information and space information, and the determination module is specifically used to:
[0209] According to the time information and space information of the object sample images of the adjacent image nodes in the undirected graph, the time difference information and space transfer information between the adjacent image nodes are calculated;
[0210] According to the spatial transfer information, a target spatiotemporal probability distribution is determined from the spatiotemporal probability distribution of the object transfer in the target area, wherein the target spatiotemporal probability distribution includes a mapping relationship between time information and probability information;
[0211] According to the time difference information and the target spatiotemporal probability distribution, the spatiotemporal transfer probability between adjacent image nodes in the undirected graph is determined.
[0212] In some embodiments, the adjustment submodule is specifically used to:
[0213] Calculating a first loss of the neural network model based on image features and sample labels of the plurality of object sample images;
[0214] Calculate the second loss of the neural network model based on the prediction result and the sample label of the target object sample image;
[0215] The first loss and the second loss are combined to adjust the network parameters of the neural network model.
[0216] In the present application, the acquisition module 301 can acquire multiple object sample images in the target area, as well as the sample label and spatiotemporal information of each object sample image. The construction module 302 constructs an undirected graph based on the multiple object sample images, the undirected graph includes interconnected image nodes, the image nodes represent the object sample images, and the image nodes include image features of the object sample images. The determination module 303 determines the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the multiple object sample images. The calculation module 304 calculates the image similarity between adjacent image nodes in the undirected graph through the image features of each image node. The recognition module 305 performs object recognition on the image features of the target object sample images based on the neural network model, the spatiotemporal transfer probability, the image similarity and the sample labels of the multiple object sample images to obtain the prediction results of the target object sample images. Finally, the adjustment module 306 adjusts the network parameters of the neural network model based on the image features and sample labels of the multiple object sample images and the prediction results, so as to re-recognize the multiple object images to be recognized through the trained neural network model.
[0217] The present application can integrate the spatiotemporal transfer probability into the training process and application process of the neural network model. In the training process, feature extraction and neural network model training can be performed based on sample labels, spatiotemporal transfer probability and image similarity, thereby improving the continuity of the statistically obtained spatiotemporal probability distribution. In the application process, the spatiotemporal transfer probability and image similarity can be fused based on the trained neural network model, and the object can be re-identified through the fused target similarity, thereby improving the accuracy of object re-identification.
[0218] In addition, the embodiment of the present application also provides a computer device, which can be a terminal or a server. Figure 8 As shown, it shows a schematic diagram of the structure of the computer device involved in the embodiment of the present application, specifically:
[0219] The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that Figure 8 The computer device structure shown in the figure does not constitute a limitation on the computer device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. Among them:
[0220] The processor 401 is the control center of the computer device, and uses various interfaces and lines to connect various parts of the entire computer device. By running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, the processor 401 performs various functions of the computer device and processes data. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user pages and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 401.
[0221] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0222] The computer device also includes a power supply 403 for supplying power to various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, so as to manage charging, discharging, and power consumption through the power management system. The power supply 403 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.
[0223] The computer device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.
[0224] Although not shown, the computer device may further include a display unit, etc., which will not be described in detail herein. Specifically in this embodiment, the processor 401 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 402 according to the following instructions, and the processor 401 will run the application programs stored in the memory 402, thereby realizing various functions, as follows:
[0225] Acquire multiple object sample images in a target area, as well as sample labels and spatiotemporal information of each object sample image; construct an undirected graph based on the multiple object sample images, the undirected graph includes interconnected image nodes, the image nodes represent object sample images, and the image nodes include image features of the object sample images; determine the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the multiple object sample images; calculate the image similarity between adjacent image nodes in the undirected graph through the image features of each image node; perform object recognition on the image features of the target object sample images based on the neural network model, the spatiotemporal transfer probability, the image similarity, and the sample labels of the multiple object sample images, and obtain the prediction results of the target object sample images; adjust the network parameters of the neural network model based on the image features and sample labels of the multiple object sample images, so as to perform object re-recognition on the multiple object images to be recognized through the trained neural network model.
[0226] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0227] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in various optional implementations in the above-mentioned embodiments.
[0228] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by a computer program, or by controlling related hardware through a computer program. The computer program may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0229] To this end, the embodiment of the present application further provides a storage medium, in which a computer program is stored, and the computer program can be loaded by a processor to execute the steps in any object re-identification method provided in the embodiment of the present application. For example, the computer program can execute the following steps:
[0230] Acquire multiple object sample images in a target area, as well as sample labels and spatiotemporal information of each object sample image; construct an undirected graph based on the multiple object sample images, the undirected graph includes interconnected image nodes, the image nodes represent object sample images, and the image nodes include image features of the object sample images; determine the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the multiple object sample images; calculate the image similarity between adjacent image nodes in the undirected graph through the image features of each image node; perform object recognition on the image features of the target object sample images based on the neural network model, the spatiotemporal transfer probability, the image similarity, and the sample labels of the multiple object sample images, and obtain the prediction results of the target object sample images; adjust the network parameters of the neural network model based on the image features and sample labels of the multiple object sample images, so as to perform object re-recognition on the multiple object images to be recognized through the trained neural network model.
[0231] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0232] Since the computer program stored in the storage medium can execute the steps in any object re-identification method provided in the embodiments of the present application, the beneficial effects that can be achieved by any object re-identification method provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.
[0233] The above is a detailed introduction to an object re-identification method and device provided in an embodiment of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A method for object re-identification, characterized in that: include: Acquire multiple object sample images in the target area, as well as sample labels and spatiotemporal information of each object sample image; constructing an undirected graph according to the plurality of object sample images, the undirected graph comprising interconnected image nodes, the image nodes representing the object sample images, and the image nodes comprising image features of the object sample images; Determining the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the plurality of object sample images; Calculating the image similarity between adjacent image nodes in the undirected graph based on the image features of each image node; Based on the neural network model, the spatiotemporal transition probability, the image similarity, and the sample labels of the multiple object sample images, object recognition is performed on the image features of the target object sample image to obtain a prediction result of the target object sample image; Based on the image features and sample labels of the multiple object sample images and the prediction results, the network parameters of the neural network model are adjusted to perform object re-identification on the multiple object images to be identified through the trained neural network model.
2. The method according to claim 1, characterized in that The method further comprises: The first sub-model of the neural network model is used to extract features of the multiple object sample images to obtain image features of each object sample image.
3. The method according to claim 2, characterized in that The method of performing object recognition on the image features of the target object sample image based on the neural network model, the spatiotemporal transition probability, the image similarity and the sample labels of the multiple object sample images to obtain the prediction result of the target object sample image includes: Based on the second sub-model of the neural network model, the spatiotemporal transition probability, the image similarity, and the sample labels of the plurality of object sample images, feature extraction is performed on the image features of the target object sample image to obtain the target image features of the target object sample image; Object recognition is performed on the target object sample image according to the target image feature to obtain a prediction result of the target object sample image.
4. The method according to claim 3, characterized in that The second sub-model based on the neural network model, the spatiotemporal transition probability, the image similarity and the sample labels of the plurality of object sample images, extracts the image features of the target object sample image to obtain the target image features of the target object sample image, including: When the sample labels of the object sample images of adjacent image nodes are the same, determining the adjacent image nodes as candidate adjacent image nodes; Based on the second sub-model of the neural network model, the spatiotemporal transfer probability and image similarity of the candidate adjacent image nodes in the undirected graph, feature extraction is performed on the image features of the target object sample image to obtain the target image features of the target object sample image.
5. The method according to claim 4, characterized in that The second sub-model based on the neural network model, the spatiotemporal transition probability of the candidate adjacent image nodes in the undirected graph and the image similarity, extracts the image features of the target object sample image to obtain the target image features of the target object sample image, including: Determine at least one target adjacent image node associated with a target object sample image from the candidate adjacent image nodes of the undirected graph, wherein the target adjacent image node represents the target object sample image and an adjacent object sample image; Based on the spatiotemporal transition probability and image similarity of all target adjacent image nodes, the feature weight of each adjacent object sample image is determined; The image features and feature weights of each adjacent object sample image and the image features of the target object sample image are fused to obtain the target image features of the target object sample image.
6. The method according to claim 1, characterized in that The method of re-identifying a plurality of to-be-identified object images by using the trained neural network model comprises: Acquire multiple images of objects to be identified; Extracting features from the plurality of to-be-identified object images by using the trained neural network model to obtain target image features of each to-be-identified object image; Calculate the target similarity between the images of the objects to be identified based on the spatiotemporal information and target image features of each image of the object to be identified; Object re-identification is performed based on the target similarity between the images of the objects to be identified to obtain the recognition results.
7. The method according to claim 6, characterized in that The calculating the target similarity between the images of the objects to be identified based on the spatiotemporal information of each image of the object to be identified and the target image features includes: Calculating the feature similarity between the images of the objects to be identified based on the target image features of each image of the object to be identified; Determine the spatiotemporal transfer probability between the images of the objects to be identified based on the spatiotemporal transfer probability distribution and the spatiotemporal information of the images of the objects to be identified; The target similarity between the images of the objects to be identified is obtained by fusing the feature similarity and spatiotemporal transition probability between the images of the objects to be identified.
8. The method according to claim 1, characterized in that The spatiotemporal information includes time information and space information. The determining of the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the plurality of object sample images includes: Calculating time difference information and spatial transfer information between adjacent image nodes according to time information and spatial information of object sample images of adjacent image nodes in the undirected graph; Determine a target spatiotemporal probability distribution from the spatiotemporal probability distribution of object transfers in the target area according to the spatial transfer information, wherein the target spatiotemporal probability distribution includes a mapping relationship between time information and probability information; The spatiotemporal transfer probability between adjacent image nodes in the undirected graph is determined according to the time difference information and the target spatiotemporal probability distribution.
9. The method according to claim 1, characterized in that: The adjusting of the network parameters of the neural network model based on the image features and sample labels of the plurality of object sample images and the prediction results comprises: Calculating a first loss of the neural network model based on image features and sample labels of the plurality of object sample images; Calculating a second loss of the neural network model based on the prediction result and the sample label of the target object sample image; The first loss and the second loss are combined to adjust the network parameters of the neural network model.
10. An object re-identification device, characterized in that: include: An acquisition module, used to acquire multiple object sample images in the target area, as well as a sample label and spatiotemporal information of each object sample image; A construction module, configured to construct an undirected graph according to the plurality of object sample images, wherein the undirected graph comprises interconnected image nodes, the image nodes represent object sample images, and the image nodes comprise image features of the object sample images; A determination module, configured to determine the spatiotemporal transfer probability between adjacent image nodes in the undirected graph based on the spatiotemporal probability distribution of object transfer in the target area and the spatiotemporal information of the plurality of object sample images; A calculation module, used for calculating the image similarity between adjacent image nodes in the undirected graph through the image features of each image node; an identification module, configured to perform object identification on the image features of the target object sample image based on the neural network model, the spatiotemporal transition probability, the image similarity, and the sample labels of the plurality of object sample images, and obtain a prediction result of the target object sample image; An adjustment module is used to adjust the network parameters of the neural network model based on the image features and sample labels of the multiple object sample images and the prediction results, so as to perform object re-identification on the multiple object images to be identified through the trained neural network model.
