Media data deduplication method, target model training method and device
By performing object detection and representation extraction on media data and constructing an object representation library, it solves the problem of low recall accuracy caused by the background occupying most areas in traditional technology, and achieves more accurate media data sorting.
Patent Information
- Application Number
- CN202210934297.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-04
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2042-08-04
AI Technical Summary
Traditional media data deduplication technology uses global features to describe background information when the background occupies most of the entire image, resulting in low recall accuracy.
By performing object detection on the media data to be processed, dividing object sub-graphs, extracting object representations, building an object representation library, searching for reference object representations with similar conditions to the target object representation, and determining the deduplication results.
It improves the recall accuracy of media data, avoids the recall of data with similar backgrounds but different objects, and enhances the duplication detection results of media data.
Smart Images

Figure CN115292541B
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a method for removing duplicates from media data, a method, apparatus, computer equipment, storage medium and computer program product for training a target model. Background Art
[0002] With the rise of various visualization applications, more and more scenarios require the use of media data deduplication technology. Media data deduplication technology is to search for media data similar to the current media data from the media library.
[0003] In conventional techniques, the global features of the media data to be processed are often directly compared with the global features corresponding to each media data stored in the media library, and the media data to be processed are directly deduplicated based on the comparison results of the global features.
[0004] However, in some cases, such as when the background occupies most of the entire image, the global features often describe the background information on the image. The media data recalled in this way is prone to the problem of low accuracy of duplicate elimination results. Summary of the invention
[0005] Based on this, it is necessary to provide a method, device, computer equipment, storage medium and computer program product for deduplicating media data that can improve recall accuracy, and also provide a method, device, computer equipment, storage medium and computer program product for training a target model in response to the above-mentioned technical problems.
[0006] In one aspect, the present application provides a method for removing duplicate media data. The method comprises:
[0007] Performing object detection on the media data to be processed, and dividing the media data to be processed into a plurality of object sub-graphs based on the object detection result, wherein each object sub-graph corresponds to an object;
[0008] Extracting an object representation of each object sub-image, wherein the object representation extracted from the object sub-image is used to represent a hidden layer feature of an object corresponding to the corresponding object sub-image;
[0009] Determine target object representations corresponding to each object based on the extracted object representations;
[0010] Acquire an object representation library, wherein the object representation library stores a plurality of reference object representations and a corresponding relationship between each reference object representation and the media data to which it belongs;
[0011] A reference object representation that satisfies similarity conditions with the target object representation is searched from the object representation library, and a deduplication result of the media data to be processed is determined according to the search result.
[0012] On the other hand, the present application also provides a media data deduplication device. The device includes:
[0013] A partitioning module is used to perform object detection on the media data to be processed, and to partition the media data to be processed based on the object detection result to obtain a plurality of object sub-graphs, wherein each object sub-graph corresponds to an object;
[0014] An extraction module, used to extract the object representation of each object sub-image, wherein the object representation extracted from the object sub-image is used to represent the hidden layer features of the object corresponding to the corresponding object sub-image;
[0015] A determination module, configured to determine target object representations corresponding to respective objects based on the extracted object representations;
[0016] An acquisition module is used to acquire an object representation library, in which a plurality of reference object representations and a corresponding relationship between each reference object representation and the media data to which it belongs are stored;
[0017] The deduplication module is used to search for reference object representations that meet similarity conditions with the target object representation from the object representation library, and determine the deduplication results of the media data to be processed based on the search results.
[0018] In some embodiments, the media data to be processed includes a video to be processed, and the partitioning module is specifically used to: extract at least one frame of global image from the video to be processed; perform object detection on each frame of the global image to obtain a feature heat map corresponding to each frame of the global image; and based on the feature heat map corresponding to each frame of the global image, extract multiple object sub-images from at least one frame of the global image.
[0019] In some embodiments, the determination module is specifically used to: cluster the object representations to obtain a first preset number of cluster centers and the object representations corresponding to each cluster center; wherein one cluster center corresponds to one object; calculate the distances between the object representations corresponding to each cluster center and the corresponding cluster centers; and filter the object representations corresponding to each cluster center according to the distance to obtain the target object representations corresponding to each object.
[0020] In some embodiments, the determination module is specifically used to: sort the object representations corresponding to each cluster center in order of distance from small to large; obtain a second preset number of object representations that are ranked in front, and extract object representations whose distances are less than a preset value from the obtained object representations as target object representations corresponding to the corresponding objects.
[0021] In some embodiments, the acquisition module is specifically used to: perform object detection on each media data in the media library, and divide the corresponding media data based on the object detection result to obtain multiple object sub-graphs of the corresponding media data; extract the object representation of each object sub-graph of each media data; determine the reference object representation corresponding to each object from the multiple object representations corresponding to each media data; and construct an object representation library based on each reference object representation and the corresponding relationship between each reference object representation and the media data to which it belongs.
[0022] In some embodiments, the deduplication module is specifically used to: calculate the characteristic distance between each target object representation and each reference object representation in the object representation library; and use the reference object representation whose characteristic distance with the target object representation is less than or equal to a preset distance threshold as the reference object representation that meets the similarity condition with the corresponding target object representation.
[0023] In some embodiments, the deduplication module is specifically used to: when a reference object representation that meets the similarity condition with the target object representation is found in the object representation library, use the media data belonging to each of the found reference object representations as similar media data of the media data to be processed; determine the matching score of each similar media data; sort the similar media data according to the size of the matching score to obtain a sorting result, and determine the deduplication result of the media data to be processed based on the sorting result.
[0024] In some embodiments, the deduplication module is specifically used to: determine the target object identification included in the media data to be processed and the similar media data based on the object identification included in the media data to be processed and the object identification included in the similar media data; determine the category weight of the category to which each target object identification belongs; determine the total first object quantity of the objects included in the media data to be processed; determine the first quantity of target object representations in the media data to be processed that meet the similarity condition under the same target object identification for the media data to be processed and the similar media data, and the second quantity of target object representations in the media data to be processed that correspond to the same target object identification; determine the matching score of the similar media data based on the category weight, the total first object quantity, the first quantity, and the second quantity.
[0025] In some embodiments, the deduplication module is specifically used to: determine the target object identification included in the media data to be processed and the similar media data based on the object identification included in the media data to be processed and the object identification included in the similar media data; determine the category weight of the category to which each target object identification belongs; determine the total number of second objects of the objects included in the similar media data; determine a first number of target object representations that meet the similarity condition in the media data to be processed and the similar media data under the same target object identification; and determine a third number of reference object representations in the similar media data corresponding to the same target object identification; determine the matching score of the similar media data based on the category weight, the total number of second objects, the first number and the third number.
[0026] In some embodiments, the division module is specifically used to perform object detection on the media data to be processed through the object detection structure in the trained target model; the extraction module is specifically used to extract the object representation of each object sub-image through the object representation structure in the trained target model.
[0027] In some embodiments, the media data deduplication device also includes: a model training module, which is used to obtain a training sample set, and perform object detection on each sample image in the training sample set through the object detection structure of the target model to be trained to obtain an object detection result; divide each sample image based on the object detection result to obtain a plurality of sample sub-images; perform feature extraction on each sample sub-image through the object representation structure in the target model to be trained to obtain an object representation corresponding to each sample sub-image; construct an object multi-group according to the sample sub-images, each object multi-group includes a first sample sub-image, a second sample sub-image belonging to the same object as the first sample sub-image, and a third sample sub-image belonging to a different object from the first sample sub-image; determine the object multi-group loss according to the difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and the difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and construct a target loss function according to the object multi-group loss; adjust the parameters of the target model to be trained through the target loss function, and continue training based on the target model after the parameter adjustment until the stop condition is reached to obtain a trained target model.
[0028] In some embodiments, the training sample set includes image positive sample pairs and image negative sample pairs, the image positive sample pairs include a first sample image and a second sample image having a similar relationship, and the image negative sample pairs include a third sample image and a fourth sample image that do not have a similar relationship. The model training module is specifically used to determine a first joint representation of the first sample image at least based on the object representation of each sample sub-image included in the first sample image; determine a second joint representation of the second sample image at least based on the object representation of each sample sub-image included in the second sample image; determine a third joint representation of the third sample image at least based on the object representation of each sample sub-image included in the third sample image; determine a fourth joint representation of the fourth sample image at least based on the object representation of each sample sub-image included in the fourth sample image; determine the image consistency loss based on the distance between the first joint representation and the second joint representation, and the distance between the third joint representation and the fourth joint representation; and construct a target loss function based on the object multi-group loss and the image consistency loss.
[0029] In some embodiments, the training sample set includes multiple image positive sample pairs, each image positive sample pair includes two sample images with a similar relationship, and the model training module is specifically used to extract a training batch of image positive sample pairs from the multiple image positive sample pairs; for each extracted image positive sample pair, the image joint representation corresponding to each sample image in each image positive sample pair is obtained to obtain multiple positive sample joint representation pairs; for each positive sample joint representation pair, a negative sample joint representation is determined from the positive sample joint representation pairs other than the current positive sample joint representation pair, and an image representation tuple is constructed based on the current positive sample joint representation pair and the negative sample joint representation; based on the image representation tuple, the image tuple loss is determined; and a target loss function is constructed according to the object tuple loss and the image tuple loss.
[0030] On the other hand, the present application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned media data deduplication method when executing the computer program.
[0031] On the other hand, the present application also provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the above-mentioned method for deduplication of media data is implemented.
[0032] On the other hand, the present application also provides a computer program product, including a computer program, which implements the above-mentioned media data deduplication method when executed by a processor.
[0033] The above-mentioned media data deduplication method, device, computer equipment, storage medium and computer program product perform object detection on the media data to be processed, and divide the media data to be processed based on the object detection results to obtain multiple object sub-graphs, and extract the object representation of each object sub-graph. Since the object representation extracted from the object sub-graph is used to represent the hidden layer features of the object corresponding to the corresponding object sub-graph, the object representation can well reflect the object details in the media data to be processed, and realize the targeted representation of the object. Based on the extracted object representation, the target object representation corresponding to each object is determined, and the obtained target object representation is an object representation that can better represent the corresponding object. In this way, the media data with similarity recalled from the object representation library based on the target object representation is more similar to the media data to be processed at the object level. In the present application, since the deduplication process is implemented based on the object representation, the recalled media data is data similar to the media data to be processed at the object level, which can avoid the problem of recalling media data with similar backgrounds but different objects, and greatly improve the deduplication detection results of the media data.
[0034] On the other hand, the present application also provides a method for training a target model, the method comprising:
[0035] Obtaining a training sample set, and performing object detection on each sample image in the training sample set using the object detection structure of the target model to be trained to obtain an object detection result;
[0036] Dividing each of the sample images based on the object detection result to obtain a plurality of sample sub-images;
[0037] By using the object representation structure in the target model to be trained, feature extraction is performed on each of the sample sub-graphs to obtain the object representation corresponding to each of the sample sub-graphs;
[0038] Constructing object tuples according to the sample subgraphs, each of the object tuples comprising a first sample subgraph, a second sample subgraph belonging to the same object as the first sample subgraph, and a third sample subgraph belonging to different objects from the first sample subgraph;
[0039] Determine an object multi-group loss according to a difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and a difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and construct a target loss function according to the object multi-group loss;
[0040] The parameters of the target model to be trained are adjusted by the target loss function, and the training is continued based on the target model after the parameter adjustment until a stopping condition is reached, thereby obtaining a trained target model.
[0041] On the other hand, the present application also provides a training device for a target model, including: an acquisition module, used to acquire a training sample set, and perform object detection on each sample image in the training sample set through an object detection structure of the target model to be trained to obtain an object detection result;
[0042] A division module is used to divide each sample image based on the object detection result to obtain multiple sample sub-images;
[0043] An extraction module is used to extract features from each sample sub-image through the object representation structure in the target model to be trained, so as to obtain the object representation corresponding to each sample sub-image;
[0044] A construction module, used for constructing object tuples according to the sample sub-graphs, each object tuple comprising a first sample sub-graph, a second sample sub-graph belonging to the same object as the first sample sub-graph, and a third sample sub-graph belonging to different objects from the first sample sub-graph;
[0045] A determination module, configured to determine an object multi-group loss according to a difference between an object representation of the first sample sub-image and an object representation of the second sample sub-image, and a difference between an object representation of the first sample sub-image and an object representation of the third sample sub-image, and to construct a target loss function according to the object multi-group loss;
[0046] The training module is used to adjust the parameters of the target model to be trained through the target loss function, and continue training based on the target model after the parameter adjustment until the stopping condition is reached, thereby obtaining the trained target model.
[0047] In some embodiments, the training sample set includes image positive sample pairs and image negative sample pairs, the image positive sample pairs include a first sample image and a second sample image having a similar relationship, and the image negative sample pairs include a third sample image and a fourth sample image that do not have a similar relationship, and the determination module is further used to: determine a first joint representation of the first sample image at least based on the object representation of each sample sub-image included in the first sample image; determine a second joint representation of the second sample image at least based on the object representation of each sample sub-image included in the second sample image; determine a third joint representation of the third sample image at least based on the object representation of each sample sub-image included in the third sample image; determine a fourth joint representation of the fourth sample image at least based on the object representation of each sample sub-image included in the fourth sample image; determine the image consistency loss based on the distance between the first joint representation and the second joint representation, and the distance between the third joint representation and the fourth joint representation; and construct a target loss function based on the object multi-group loss and the image consistency loss.
[0048] In some embodiments, the target model to be trained also includes a representation joint structure, and the determination module is specifically used to: through the representation joint structure, splice the object representations of each sample sub-image of the first sample image output by the object representation structure and the image representation of the first sample image extracted by the object detection module to obtain a first joint representation.
[0049] In some embodiments, the training sample set includes multiple image positive sample pairs, each image positive sample pair includes two sample images with a similar relationship, and the determination module is also used to: extract a training batch of image positive sample pairs from the multiple image positive sample pairs; for each extracted image positive sample pair, obtain the image joint representation corresponding to each sample image in each image positive sample pair, and obtain multiple positive sample joint representation pairs; for each positive sample joint representation pair, determine the negative sample joint representation from the positive sample joint representation pairs other than the current positive sample joint representation pair, and construct an image representation tuple based on the current positive sample joint representation pair and the negative sample joint representation; based on the image representation tuple, determine the image tuple loss; and construct a target loss function according to the object tuple loss and the image triplet loss.
[0050] In some embodiments, the target model to be trained also includes a representation joint structure, and the determination module is specifically used to: use the representation joint structure to splice the object representation of each sample sub-image included in each sample image output by the object representation structure, and the image representation of the sample image extracted by the object detection module, to obtain an image joint representation of the corresponding sample image; and use the image joint representation of the sample image in each image positive sample pair as a positive sample joint representation pair.
[0051] In some embodiments, the construction module is specifically used to: extract a training batch of image positive sample pairs from multiple image positive sample pairs; for each extracted image positive sample pair, construct multiple object positive sample pairs according to the sample sub-graphs corresponding to each sample image in each image positive sample pair; for each object positive sample pair, determine the object negative samples from the other sample sub-graphs except the current object positive sample pair, and construct an object multi-group based on the current object positive sample pair and the object negative samples.
[0052] In some embodiments, the construction module is specifically used to: select an anchor image from the current object positive sample pair, and select a candidate sample sub-image from other sample sub-images except the current object positive sample pair; calculate the distance between each candidate sample sub-image and the anchor image; sort multiple candidate sample sub-images according to the size of the distance, and determine the object negative sample based on the sorting result.
[0053] In some embodiments, the training sample set includes a plurality of positive sample pairs of images, the positive sample pairs include a first sample image and a second sample image having a similar relationship, and the second sample image is a sample image obtained after image enhancement processing is performed on the first sample image.
[0054] On the other hand, the present application also provides a computer device, which includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the above-mentioned media data deduplication method or target model training method when executing the computer program.
[0055] On the other hand, the present application also provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the training method of the target model is implemented.
[0056] On the other hand, the present application also provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the training method of the target model is implemented.
[0057] The training method, apparatus, computer equipment, storage medium and computer program product of the target model described above respectively perform object detection on each sample image in the training sample set through the object detection structure of the target model to be trained to obtain object detection results; divide each sample image based on the object detection results to obtain multiple sample sub-images, which can be used to construct subsequent object multi-groups. The object multi-group is the sample basis for the training target model to have object representation capabilities. Through the object representation structure in the target model to be trained, feature extraction is performed on each sample sub-image to obtain the object representation corresponding to each sample sub-image; object multi-groups are constructed based on the sample sub-images, and each object The multi-tuple includes a first sample sub-image, a second sample sub-image belonging to the same object as the first sample sub-image, and a third sample sub-image belonging to a different object from the first sample sub-image; thus, an object sample for training the target model is obtained, and then the object multi-tuple loss can be determined according to the difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and the difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and the target loss function is constructed according to the object multi-tuple loss. By training the model with the target loss function, the target model can enhance the ability to identify similar images and irrelevant images, that is, enhance the ability of the target model to represent object details. In addition, since the target model uses the object multi-tuple in the training process, the target model has the ability to specifically represent objects, which is convenient for specifically representing object images in practical applications. In this way, the trained target model can accurately identify objects in the media data to be processed in subsequent applications, and accurately extract the object representation corresponding to the object, so that similar media data can be recalled based on the object representation, and the recalled media data can be deduplicated. Since the deduplication process is implemented based on object representation, the recalled media data is data that is relatively similar to the media data to be processed at the object level. This can avoid the problem of recalling media data with similar backgrounds but different objects, greatly improving the deduplication detection results of media data. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] Figure 1 is an application environment diagram of a target method in an embodiment;
[0059] Figure 2 is a flow chart of a method for deduplication of media data in one embodiment;
[0060] Figure 3 A schematic diagram of a process for training a target model in an embodiment;
[0061] Figure 4 is a schematic diagram of an image similarity sample group in one embodiment;
[0062] Figure 5is a schematic diagram of a feature extraction module and a multi-label classification module in one embodiment;
[0063] Figure 6 is a schematic diagram of a characteristic heat map in one embodiment;
[0064] Figure 7 It is a schematic diagram of the effect when a feature heat map is restored to the original map in one embodiment;
[0065] Figure 8 is a schematic diagram of the structure of a target model in an embodiment;
[0066] Fig. 9 is a schematic diagram of the structure of a target model in another embodiment;
[0067] Fig.10 is a schematic diagram of a similar sample group of objects in one embodiment;
[0068] Fig.11 is a schematic diagram of the structure of a target model in another embodiment;
[0069] Fig.12 is a schematic diagram of the structure of a target model in another embodiment;
[0070] Fig.13 A schematic diagram of a region where an object is located in one embodiment;
[0071] Fig.14 is a structural block diagram of a device for deduplicating media data in one embodiment;
[0072] Fig.15 is a structural block diagram of a training device for a target model in one embodiment;
[0073] Fig.16 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0074] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0075] The media data deduplication method provided in the embodiment of the present application can be applied to Figure 1In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The data storage system can store the data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other servers. The media data deduplication method provided in each embodiment of the present application can be executed separately by the terminal 102 or the server 104, and can also be executed jointly by the terminal 102 and the server 104. Take the terminal alone as an example for explanation: the terminal includes a media database, which includes multiple media data. After the terminal receives the media data to be processed, it can search the media database for media data that is repeated or partially repeated with the media data to be processed, and sort the found media data according to the degree of repetition, so as to obtain the deduplication result of the media data to be processed. Specifically, on the one hand, after receiving the media data to be processed, the terminal can perform object detection on the media data to be processed, and divide the media data to be processed based on the object detection result to obtain multiple object sub-graphs, and then extract the object representation of each object sub-graph, and determine the target object representation corresponding to each object based on the extracted object representation. On the other hand, the terminal may obtain an object representation library based on the media database, search for reference object representations that meet similarity conditions with the target object representation from the object representation library, and determine deduplication results for the media data to be processed based on the search results.
[0076] The terminal 102 includes but is not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc. The embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, audio and video, etc. The server 104 can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0077] The method for removing duplicates from media data provided in the embodiment of the present application involves computer vision technology. In addition, the specific removal process can be achieved through artificial intelligence. Among them, artificial intelligence (AI) is a 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, which 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 the machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology is a comprehensive discipline that involves a wide range of fields, including both hardware-level technology and software-level technology. Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technology mainly includes several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0078] Among them, 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, continuously detect and measure targets, and further perform graphic processing to make computer processing into images that are more suitable for human eye 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 map construction, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0079] The training method of the target model provided in the embodiment of the present application can be achieved through machine learning. Machine Learning (ML) is a multi-field interdisciplinary subject involving multiple disciplines such as probability theory, statistics, approximation theory, convex analysis, and algorithmic complexity theory. It specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all fields of artificial intelligence. Machine learning and deep learning generally include technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by teaching.
[0080] The solution provided in the embodiments of the present application involves artificial intelligence computer vision technology and machine learning technology, which is specifically described by the following embodiments:
[0081] In some embodiments, Figure 2 As shown, a method for deduplication of media data is provided. This embodiment takes the method applied to a computer device as an example. The computer device can be Figure 1 In this embodiment, the method includes the following steps:
[0082] S202: Perform object detection on the media data to be processed, and divide the media data to be processed into a plurality of object sub-graphs based on the object detection result, wherein each object sub-graph corresponds to an object.
[0083] The media data to be processed may be an image to be processed or a video to be processed, which is not limited in the embodiment of the present application.
[0084] In some embodiments, when the media data to be processed is an image to be processed, the computer device may perform object detection on the image to be processed, and divide the image to be processed based on the detection result to obtain multiple object sub-graphs. When the media data to be processed is a video to be processed, the computer device may extract image frames from the video to be processed, perform object detection on each image frame, and divide the corresponding image frame based on the detection result to obtain multiple object sub-graphs, and the object sub-graphs corresponding to all the image frames constitute the object sub-graphs of the video to be processed.
[0085] In some embodiments, taking an image frame as an example, the computer device may input the image frame into an object detection model, and the object detection model may detect the object in the image frame and mark the object in the form of a detection frame, and may copy the image in the detection frame as an object sub-image of the image frame. The object detection model here may be an open source object detection model, such as the target detection algorithm yolo v5.
[0086] In some embodiments, taking an image frame as an example, a computer device may input the image frame into an object detection structure in a trained target model, and the object detection structure may output a feature heat map corresponding to the image frame, and based on the feature heat map, a corresponding object sub-image may be obtained from the image frame. The training process of the target model is described in detail in the embodiments below.
[0087] It should be noted that: here only the image frame is used as an example to illustrate the process of obtaining the object sub-image. When the media data to be processed is an image to be processed, the same method can also be used to obtain the object sub-image of the image to be processed, and the embodiments of the present application will not go into details.
[0088] It should be noted that: whether the object sub-image is obtained through the object detection model or through the object detection structure in the target model, since the embodiment of the present application detects objects in the image, each object sub-image obtained corresponds to one object. Since the video has continuity, the same object may appear repeatedly in multiple image frames contained in the video. Therefore, the same object may correspond to multiple object sub-images or one object sub-image, and the embodiment of the present application does not limit this.
[0089] Exemplarily, the media data to be processed is a video to be processed. Assume that the computer device extracts 3 image frames from the video to be processed. The 3 image frames are image frame 1, image frame 2, and image frame 3. Image frame 1 includes 3 objects, namely, car 1, car 2, and person 1. Image frame 1 includes 2 objects, namely, car 1 and person 1. Image frame 3 includes 2 objects, namely, car 2 and person 1. The object sub-images corresponding to image frame 1 can be obtained by the above method, namely, sub-images 1, 2, and 3. Figure 1 (Picture of car 1), Figure 2 (Picture of car 2) and the child Figure 3 (Image of person 1). By the above method, the object sub-images of image frame 2 can be obtained, which are: Figure 4 (Picture of car 1), Figure 5 (Image of person 1). By the above method, the object sub-images of image frame 3 can be obtained, which are: Figure 6 (Picture of car 2), Figure 7 (Figure 1). Figure 1 To the son Figure 7 It can be used as the object sub-image corresponding to the video to be processed.
[0090] S204: extracting an object representation of each object sub-image, wherein the object representation extracted from the object sub-image is used to represent a hidden layer feature of an object corresponding to the corresponding object sub-image.
[0091] In some embodiments, after obtaining the object sub-graph corresponding to the media data to be processed, the computer device may input each object sub-graph into the image representation model, and may use the features output by the image representation model as the object representation of the corresponding object sub-graph. Alternatively, each object sub-graph may be input into the object representation structure in the trained target model, and the hidden layer features of the object corresponding to the corresponding object sub-graph output by the object representation structure may be used as the object representation of the corresponding object sub-graph.
[0092] It should be noted that the media data to be processed here can be a video to be processed or an image to be processed. The processing process when the media data to be processed is a video to be processed, and the processing process when the media data to be processed is an image to be processed are similar to the above process, and the embodiments of the present application will not be repeated here.
[0093] It should be noted that: when the number of object sub-images is greater than one, it is necessary to extract the object features of each object sub-image. For example, if there are 7 object sub-images corresponding to the video to be processed, it is necessary to extract the object features of these 7 object sub-images respectively to obtain 7 object features.
[0094] S206 : Determine target object representations corresponding to the respective objects based on the extracted object representations.
[0095] Specifically, the computer device can determine the target object representations corresponding to each object based on the extracted object representations. In some cases, a certain object may appear multiple times in the media data to be processed, and thus may correspond to multiple object sub-images, and accordingly there will be multiple object representations. The computer device can directly use the multiple object representations corresponding to the object as the target object representation of the object, or filter out a part of the object representations from the multiple object representations corresponding to the object as the target object representation of the object, etc., and the embodiments of the present application are not limited to this. The screening method can specifically be random screening, or screening based on the similarities between the object representations, etc., and can be set according to the actual situation.
[0096] In some embodiments, after obtaining multiple object representations corresponding to the media data to be processed, the computer device can group the object representations whose distances are less than a preset threshold into a representation set to obtain multiple sets, each set corresponding to an object, and the object representations in each set can be used as the target object representation of the corresponding object.
[0097] In one embodiment, after obtaining multiple object representations corresponding to the media data to be processed, the computer device may cluster the multiple object representations to obtain multiple cluster centers and object representations corresponding to each cluster center, each cluster center corresponding to an object. Based on each cluster center, the object representation corresponding to the cluster center may be screened, and the object representation corresponding to each cluster center after screening may be used as the target object representation of the corresponding object.
[0098] In the case where the media data to be processed is an image to be processed, the computer device may use the object representations corresponding to the respective object sub-images of the image to be processed as the target object representations.
[0099] S208: Acquire an object representation library, wherein the object representation library stores a plurality of reference object representations and a correspondence between each reference object representation and the media data to which it belongs.
[0100] The media data to which the reference object feature belongs may include the corresponding video. The object representation library may store the corresponding relationship between each reference object representation and the corresponding video.
[0101] In some embodiments, considering the media data deduplication method provided in the embodiments of the present application, it can be used to search for media data that is repeated or partially repeated with the media data to be processed from a media database, and sort the found media data according to the degree of repetition, thereby obtaining the deduplication results of the media data to be processed. Therefore, the computer device can build an object representation library based on the media database.
[0102] In some embodiments, when the media data to be processed is an image to be processed and the media database is an image library, for each image in the image library, the computer device may perform object detection on the image, and divide the image based on the detection result to obtain multiple object sub-images, extract the object representation of each object sub-image, and obtain all object representations corresponding to the image, and each object representation may be used as a reference object representation. For each reference object representation, the image to which the reference object representation belongs may be obtained. Finally, based on each reference object feature and the image to which each reference object belongs, an object representation library is constructed.
[0103] In some embodiments, when the media data to be processed is a video to be processed and the media database is a video library, for each video in the video library, the computer device can extract image frames from the video, perform object detection on each image frame, and divide the image frame based on the detection result to obtain multiple object sub-images, extract the object representation of each object sub-image, and obtain all object representations corresponding to the video. Each object representation corresponding to the video can be used as a reference object representation. For each reference object representation, information such as the object to which the reference object representation belongs and the video to which it belongs can be obtained. Finally, based on the features of each reference object, as well as the information such as the object to which each reference object belongs and the video to which it belongs, an object representation library is constructed.
[0104] In some embodiments, for each video in the video library, after obtaining all object representations corresponding to the video, the computer device can also determine the reference object representations corresponding to each object based on all object representations corresponding to the video by forming a representation set in S206 or by clustering, thereby obtaining multiple reference object representations corresponding to the video. On this basis, for each reference object representation, information such as the object to which the reference object representation belongs, the video to which it belongs, etc. can be obtained. Finally, an object representation library can be constructed based on the features of each reference object, as well as information such as the object to which each reference object belongs, the video to which it belongs, etc.
[0105] It should be noted that when constructing an object representation library, the method of extracting the object representation may be the method in S204 or other methods, which is not limited in this embodiment of the present application.
[0106] S2010: Searching for a reference object representation that satisfies a similarity condition with the target object representation from the object representation library, and determining a deduplication result of the to-be-processed media data according to the search result.
[0107] In some embodiments, when the object representation library is constructed based on a media library, after obtaining the target object representation, the computer device can calculate the distance between the target object representation and each reference object representation. If the distance between the target object representation and a reference object representation is less than a preset value, the media data belonging to the reference object representation is obtained, and the media data can be regarded as media data that is duplicated with the media data to be processed, that is, similar media data.
[0108] In some embodiments, when the media data to be processed is an image to be processed and the object representation library is constructed based on the image library, after obtaining the target object representation, the computer device can calculate the distance between the target object representation and each reference object representation. If the distance between the target object representation and a reference object representation is less than a preset value, the image to which the reference object representation belongs is obtained, and the image can be used as a video that is repeated with the video to be processed, that is, a similar image.
[0109] In some embodiments, when there are multiple similar images, the computer device may calculate the distance between the image to be processed and each similar image, sort the similar images in descending order of the distance, and use the sorting result as the deduplication result of the image to be processed.
[0110] In some embodiments, when the media data to be processed is a video to be processed and the object representation library is constructed based on a video library, after obtaining the target object representation, the computer device can calculate the distance between the target object representation and each reference object representation. If the distance between the target object representation and a reference object representation is less than a preset value, the video to which the reference object representation belongs is obtained, and the video can be regarded as a video that is repeated with the video to be processed, that is, a similar video.
[0111] In some embodiments, when there are multiple similar videos, the computer device can determine the matching scores between the similar videos and the video to be processed based on the target object features corresponding to the video to be processed and the reference object representations corresponding to the similar videos. After obtaining the matching scores corresponding to each similar video, the similar videos can be sorted in descending order according to the matching scores, and the sorting results can be used as the deduplication results of the video to be processed.
[0112] The above-mentioned media data deduplication method, device, computer equipment, storage medium and computer program product perform object detection on the media data to be processed, and divide the media data to be processed based on the object detection results to obtain multiple object sub-graphs, and extract the object representation of each object sub-graph. Since the object representation extracted from the object sub-graph is used to represent the hidden layer features of the object corresponding to the corresponding object sub-graph, the object representation can well reflect the object details in the media data to be processed, and realize the targeted representation of the object. Based on the extracted object representation, the target object representation corresponding to each object is determined, and the obtained target object representation is an object representation that can better represent the corresponding object. In this way, the media data with similarity recalled from the object representation library based on the target object representation is more similar to the media data to be processed at the object level. In the present application, since the deduplication process is implemented based on the object representation, the recalled media data is data similar to the media data to be processed at the object level, which can avoid the problem of recalling media data with similar backgrounds but different objects, and greatly improve the deduplication detection results of the media data.
[0113] In some embodiments, the media data to be processed includes a video to be processed, object detection is performed on the media data to be processed, and the steps of dividing the media data to be processed based on the object detection result to obtain multiple object sub-graphs include: extracting at least one frame of global image from the video to be processed; performing object detection on each frame of the global image to obtain a feature heat map corresponding to each frame of the global image; and based on the feature heat map corresponding to each frame of the global image, extracting multiple object sub-graphs from at least one frame of the global image.
[0114] In some embodiments, the computer device may extract all image frames contained in the video to be processed as at least one global image frame. It may also extract one frame every preset time length or every preset number of frames, and use the extracted image frame as at least one global image frame. Exemplarily, the preset time length may be 1 second, and the preset number of frames may be 10 frames.
[0115] In some embodiments, the computer device can input the global image into the object detection structure in the trained target model, and the object detection structure can output a feature heat map, and the feature heat map can be matrix transformed (reshaped) to obtain a matrix transformation processing result. The matrix transformation processing result is further subjected to non-maximum suppression (NMS) to obtain the area where the object is located on the global image, and the area where the object is located can be cut out to obtain an object sub-image of the global image.
[0116] It should be noted that: by performing the above processing on all global images, object sub-images corresponding to all global images can be obtained, and all object sub-images can be used as object sub-images of the video to be processed.
[0117] In the above embodiment, a process of obtaining an object sub-graph when the media data to be processed includes a video to be processed is introduced. The object sub-graph obtained in this way can be used for subsequent object-level retrieval and recall. The recalled media data and the media data to be processed are more similar at the object level, thereby improving the recall accuracy.
[0118] In some embodiments, target object representations corresponding to respective objects are determined based on the extracted object representations, including: clustering the object representations to obtain a first preset number of cluster centers, and an object representation corresponding to each cluster center; wherein one cluster center corresponds to one object; calculating the distance between the object representation corresponding to each cluster center and the corresponding cluster center; and screening the object representation corresponding to each cluster center according to the distance to obtain a target object representation corresponding to each object.
[0119] The object representations may be clustered based on a first preset number to obtain a first preset number of cluster centers and an object representation corresponding to each cluster center.
[0120] Among them, when the media data to be processed is a video to be processed, the first preset number can be a fixed value, or it can be the total number of object representations of the video to be processed divided by the preset value. Exemplarily, the preset value can be 10, which is not limited to this embodiment of the present application.
[0121] In some embodiments, taking the first preset number of 10 as an example, 10 cluster centers can be pre-set, and for each object representation corresponding to the video to be processed, the computer device calculates the distance between the object representation and each cluster center, and classifies the object representation into the cluster cluster corresponding to the cluster center closest to it, and based on the obtained cluster cluster, re-determines 10 cluster centers, and repeats the above process until the stopping condition is met, to obtain the final 10 cluster centers and the cluster cluster corresponding to each cluster center, and the object representation contained in the cluster cluster corresponding to each cluster center can be used as the object representation corresponding to the corresponding cluster center.
[0122] In some embodiments, for each cluster center, after obtaining the object representation corresponding to the cluster center, the computer device calculates the distance between each object representation and the corresponding cluster center, and eliminates the object representations whose distance is less than a preset threshold. After the elimination process, the object representation corresponding to each cluster center is used as the target object representation corresponding to the corresponding object.
[0123] In some embodiments, for each cluster center, after obtaining the object representation corresponding to the cluster center, the distance between each object representation and the corresponding cluster center can be calculated, and the object representation corresponding to each cluster center can be sorted in order of distance from small to large; the second preset number of object representations in the front are obtained, and the object representations with a distance less than the preset value are extracted from the obtained object representations as the target object representations corresponding to the corresponding objects. Exemplarily, the object features in the front 40% can be obtained, and for each object feature obtained, the distance between the object feature and the corresponding cluster center can be calculated. If the distance is less than 0.2, the object representation is used as the target object representation.
[0124] Among them, each cluster center corresponds to an object, and a unique cluster ID can be set for each cluster center. The object ID can also be marked for each cluster center through manual labeling.
[0125] In some embodiments, for each target object representation, in addition to storing the target object representation, the ID of the target object representation, the cluster ID of the cluster to which it belongs, the object ID of the object to which it belongs, the video ID of the video to which it belongs, the total number of objects under the video to be processed, the total number of object representations under the object, etc. can also be stored.
[0126] Exemplarily, the target object representation may be stored in the following storage format:
[0127] embedding->(embedding ID, object ID, cluster ID, video ID, total number of objects in the video to be processed Nq3, total number of embeddings under the object ID Nq4).
[0128] In the above embodiment, after obtaining multiple object representations, the multiple object representations are clustered to obtain a preset number of cluster centers and the object representation corresponding to each cluster center. The object representation corresponding to each cluster center can be screened to obtain the target object representation corresponding to each object. The target object representation obtained after screening is more representative, that is, it can better reflect the detailed characteristics of the corresponding object, so the subsequent media data recalled based on the target object characteristics is more accurate.
[0129] In some embodiments, the step of constructing the object representation library includes:
[0130] Perform object detection on each media data in the media library, and divide the corresponding media data based on the object detection result to obtain multiple object sub-graphs of the corresponding media data; extract the object representation of each object sub-graph of each media data; determine the reference object representation corresponding to each object from the multiple object representations corresponding to each media data; and construct an object representation library based on each reference object representation and the corresponding relationship between each reference object representation and the media data to which it belongs.
[0131] In some embodiments, when the media library is an image library, the computer device may perform object detection on each image in the image library, and divide the corresponding image based on the object detection result to obtain object sub-images of the corresponding image, extract the object representation of each object sub-image, and obtain all object representations corresponding to the corresponding image. All object representations may be used as reference object representations, and for each reference object representation, the image to which the reference object representation belongs may be obtained. Finally, based on each reference object representation and the image to which each reference object representation belongs, an object representation library is constructed.
[0132] Exemplarily, the reference object representation may be stored in the following storage format:
[0133] embedding->(embedding ID, image ID, total number of embeddings under image ID).
[0134] In some implementations, when the media library is a video library, for each video in the video, the computer device extracts an image frame from the video at a preset time interval to obtain at least one frame of global image, performs object detection on each frame of global image, and divides the corresponding global image based on the object detection result to obtain the object sub-image of the corresponding global image, and uses the object sub-image corresponding to each frame of global image as the object sub-image of the corresponding video. By extracting the object representation of each object sub-image, all object representations corresponding to the corresponding video can be obtained, and all object representations are clustered to obtain a preset number of cluster centers and the object representation corresponding to each cluster center. The object representation corresponding to each cluster center is screened to obtain the reference object representation corresponding to each object. On this basis, for each reference object representation, the ID of the reference object representation, the cluster ID of the cluster to which it belongs, the object ID of the object to which it belongs, the video ID of the video to which it belongs, the total number of objects under the video to which it belongs, and the total number of object representations under the object to which it belongs can be obtained.
[0135] Exemplarily, the reference object representation may be stored in the following storage format:
[0136] embedding->(embedding ID, object ID, cluster ID, video ID, total number of objects in the video N3, total number of embeddings in the object N4).
[0137] In the above embodiment, the specific implementation process of constructing an object representation library is introduced. The object representation library stores reference object representations and the corresponding relationship between each reference object representation and the media data to which it belongs. After obtaining the target object representation of the media data to be processed, the media data in the media library that has a similar relationship with the media data to be processed can be recalled based on the target object representation and the reference object representation. Since the basis for the recall is positioned at the object representation level, the recalled media data and the media data to be processed have a high similarity at the object level, which can avoid recalling media data with similar backgrounds but different objects, thereby improving the recall accuracy.
[0138] In some embodiments, searching for a reference object representation that satisfies a similarity condition with the target object representation from an object representation library includes:
[0139] The characteristic distance between each target object representation and each reference object representation in the object representation library is calculated; the reference object representation whose characteristic distance with the target object representation is less than or equal to a preset distance threshold is used as the reference object representation that meets the similarity condition with the corresponding target object representation.
[0140] The preset distance threshold can be flexibly set according to actual conditions. For example, the preset distance threshold can be 0.3. For each target object representation, the computer device calculates the characteristic distance between the target object representation and each reference object representation in the object representation library. If the calculated characteristic distance between the target object representation and a reference object representation is less than 0.3, the reference object representation is considered as a reference object representation that meets the similarity condition with the target object representation. The above process is performed on each target object representation to obtain a reference object representation that meets the similarity condition with each target object representation.
[0141] In the above embodiment, the distance between the target object representation and the reference object representation is used to find the reference object representation that satisfies the similarity condition with the target object representation. Subsequently, media data having a similar relationship with the media data to be processed can be located based on the reference object representation. Since the basis for recall is located at the object representation level, the recalled media data and the media data to be processed have a high similarity at the object level, which can avoid recalling media data with similar backgrounds but different objects, thereby improving the recall accuracy.
[0142] In some embodiments, determining the result of deduplication of the to-be-processed media data according to the search result includes:
[0143] When a reference object representation that meets similarity conditions with the target object representation is found in the object representation library, the media data to which each reference object representation belongs is used as similar media data of the media data to be processed; the matching score of each similar media data is determined; the similar media data are sorted according to the matching score to obtain a sorting result, and the deduplication result of the media data to be processed is determined based on the sorting result.
[0144] In some embodiments, when the media data to be processed is an image to be processed, and an object representation library is constructed based on an image library, since the reference object representation is stored in the following storage format: embedding->(embeddingID, image ID, total number of embeddings under image ID), after obtaining a reference object representation that satisfies similarity conditions with the target object representation, the computer device may search for the image ID of the image to which the reference object representation belongs, and use the image corresponding to the image ID as a similar image to the image to be processed.
[0145] In some embodiments, when there are multiple similar images, the computer device can calculate the distance between each similar image and the image to be processed, and use the distance as the matching score between the similar image and the image to be processed. After obtaining the matching score corresponding to each similar image, the similar images can be sorted in descending order according to the matching score, and the sorting result can be used as the deduplication result of the image to be processed.
[0146] In some embodiments, when the media data to be processed is a video to be processed, and the object representation is obtained based on the video library, since the reference object representation is stored in the following storage format: embedding->(embedding ID, object ID, cluster ID, video ID, total number of objects under the corresponding video N3, total number of embeddings under the corresponding object N4), after obtaining the reference object representation that meets the similarity condition with the target object representation, the computer device can search for the video ID of the video to which the reference object representation belongs, and use the image corresponding to the video ID as a similar video to the video to be processed.
[0147] In some embodiments, when there are multiple similar videos, for each similar video, the computer device can extract all reference object representations corresponding to the similar video from the object representation library, determine the matching scores of the similar video and the video to be processed based on all reference object representations corresponding to the similar videos and all target object representations corresponding to the video to be processed, and after obtaining the matching scores corresponding to each similar video, sort the similar videos in descending order of the matching scores, and use the sorting results as the deduplication results of the video to be processed.
[0148] In the above embodiment, when determining a reference object representation that satisfies similarity conditions with the target object representation, the media data to which each reference object representation finds belongs are used as similar media data of the media data to be processed, and then the matching scores of each similar media data are determined. Finally, based on the matching scores of each similar media data, the deduplication results of the media data to be processed are determined. Since this embodiment is based on the target object representation and the reference object representation to recall media data in the media library that have a similar relationship with the media data to be processed, and since the basis for the recall is located at the object representation level, the recalled media data and the media data to be processed have a high similarity at the object level, which can avoid recalling media data with similar backgrounds but different objects, thereby improving the recall accuracy.
[0149] In some embodiments, the step of determining the matching score of each similar media data includes:
[0150] Determine the target object identification included in the media data to be processed and the similar media data based on the object identification included in the media data to be processed and the object identification included in the similar media data; determine the category weight of the category to which each target object identification belongs; determine the total first object quantity of the objects included in the media data to be processed; determine the first quantity of target object representations that meet the similarity condition under the same target object identification for the media data to be processed and the similar media data, and the second quantity of target object representations in the media data to be processed that correspond to the same target object identification; determine the matching score of the similar media data based on the category weight, the total first object quantity, the first quantity, and the second quantity.
[0151] Among them, the object identification can be understood as the object ID, and the object ID can be text, numbers, characters, strings, etc. that can identify the object. The embodiment of the present application does not limit the composition form of the object ID.
[0152] Among them, the category weights of the categories to which each object belongs can be pre-set. For example, the weight of people can be set to 1.5, animals to 1, cars to 0.8, etc., or the weights of all categories can be set to 1. In addition, the category weights can be personalized according to business scenarios. For example, when deduplicating life videos, since people tend to identify the real objects or animals in the video and do not care whether the same person is introducing these objects, the weight of people can be set to 0.5, and the weights of other categories can be set to 1. For another example, for a video obtained by shooting a person introducing a product, since the product in the video may be more valued during recall, the weight of the person can be set to 0, and the weights of other categories can be set to 1.
[0153] In some embodiments, when the media data to be processed is a video to be processed, and multiple similar videos are recalled from the video library, for each similar video, the computer device may extract all reference object representations corresponding to the similar video from the object representation library, count the object IDs to which each reference object feature belongs, and use the counted object IDs as the object IDs included in the similar video. On the other hand, the object IDs to which each target object representation belongs may be counted, and the counted object IDs may be used as the object IDs included in the video to be processed. By matching the object ID included in the similar video with the object ID included in the video to be processed, the target object ID included in both the video to be processed and the similar video can be obtained. The number of target object IDs can be counted as the total number of matching objects, the category weight of the category to which each target object ID belongs is found, and the number of clustering centers corresponding to the video to be processed is obtained as the total number of first objects included in the video to be processed. For each target object ID, the target object representation of the video to be processed under the target object ID and the reference object representation of the similar video under the target object ID can be obtained. The target object representation that can meet the similarity condition with any reference object representation is found among all target object representations, and the number of these target object representations is counted as the first number, and the number of target object representations of the video to be processed under the target object ID is counted as the second number.
[0154] In some embodiments, the computer device may use the following formula to calculate the matching score of similar videos:
[0155]
[0156] Among them, score_query represents the matching score of similar videos, n1 represents the total number of matching objects, and C i represents the category weight of the category to which the i-th matching object belongs, Nq3 represents the total number of first objects, n0_i represents the first number, and Nq4 represents the second number.
[0157] In the above embodiment, it is introduced to determine the matching score of each recalled similar media data. In the process of determining the matching score, the category weight of the category to which each matching object belongs, the number of object representations that can be successfully matched under each matching object in the video to be processed, and other information are taken into consideration, so that the determined matching score can better meet the current business scenario requirements and is more flexible.
[0158] In some embodiments, the step of determining the matching score of each similar media data includes:
[0159] Based on the object identification included in the media data to be processed and the object identification included in the similar media data, determine the target object identification included in both the media data to be processed and the similar media data; determine the category weight of the category to which each target object identification belongs; determine the total number of second objects of the objects included in the similar media data; determine a first number of target object representations that meet similarity conditions in the similar media data under the same target object identification for the media data to be processed and the similar media data, and a third number of target object representations in the similar media data that correspond to the same target object identification; determine the matching score of the similar media data based on the category weight, the total number of second objects, the first number and the third number.
[0160] Similar to the above embodiment, the object identification can be understood as the object ID, and the method of pre-setting the category weight of the category to which each object belongs is also similar to the above embodiment, and the embodiments of the present application will not be repeated here.
[0161] In some embodiments, when the media data to be processed is a video to be processed, and multiple similar videos are recalled from the video library, for each similar video, the computer device may extract all reference object representations corresponding to the similar video from the object representation library, count the object IDs to which each reference object feature belongs, and use the counted object IDs as the object IDs included in the similar video. On the other hand, the object IDs to which each target object representation belongs may be counted, and the counted object IDs may be used as the object IDs included in the video to be processed. By matching the object ID included in the similar video with the object ID included in the video to be processed, the target object ID included in both the video to be processed and the similar video can be obtained. The number of target object IDs can be counted as the total number of matching objects, the category weight of the category to which each target object ID belongs is found, and the number of cluster centers corresponding to the similar videos is obtained as the second total number of objects included in the similar videos. For each target object ID, the target object representation of the video to be processed under the target object ID and the reference object representation of the similar video under the target object ID can be obtained. The target object representation that can meet the similarity condition with any reference object representation is found among all target object representations, and the number of these target object representations is counted as the first number. The number of reference object representations of similar videos under the target object ID is counted as the third number.
[0162] In some embodiments, the computer device may use the following formula to calculate the matching score of similar videos:
[0163]
[0164] Among them, score_db represents the matching score of similar videos, n1 represents the total number of matching objects, and C irepresents the category weight of the category to which the i-th matching object belongs, N3 represents the total number of second objects, n0_i represents the first number, and N4 represents the third number.
[0165] In the above embodiment, it is introduced to determine the matching score of each recalled similar media data. In the process of determining the matching score, the category weight of the category to which each matching object belongs, the number of object representations that can be successfully matched under each matching object in the video to be processed, and other information are taken into consideration, so that the determined matching score can better meet the current business scenario requirements and is more flexible.
[0166] It should be noted that: the above embodiments introduce two methods of calculating the matching scores of similar media data. score_query can be used as the first matching score, and score_db can be used as the second matching score. The first matching score can be directly used as the matching score of the similar media data, or the second matching score can be used as the matching score of the similar media data. Alternatively, after obtaining the first matching score and the second matching score, the first matching score and the second matching score are weighted averaged, and the weighted average result is used as the matching score of the similar media data. The embodiments of the present application are not limited to this.
[0167] In some embodiments, as described above, the object detection structure in the trained target model can be used to perform object detection on the media data to be processed; the object representation structure in the trained target model can be used to extract the object representation of each object sub-graph. The following embodiment describes the training process of the target model in detail.
[0168] In some embodiments, Figure 3 As shown, a method for training a target model is provided. This embodiment uses the method applied to a computer device as an example. The computer device can be Figure 1 In this embodiment, the method includes the following steps:
[0169] S302: Obtain a training sample set, and perform object detection on each sample image in the training sample set using the object detection structure of the target model to be trained to obtain an object detection result.
[0170] The training sample set may include multiple positive image sample pairs and multiple negative image sample pairs, or the training sample set may only include multiple positive image samples, etc., which is not limited in the embodiments of the present application.
[0171] Among them, the positive sample pair of images includes two sample images with similarity, and the negative sample pair of images includes two sample images without similarity. The two sample images included in the positive sample pair of images can be obtained by manual annotation or by image enhancement. The two sample images included in the negative sample pair of images can be obtained by manual annotation or by mining. The embodiments of the present application are not limited to this.
[0172] For example, Figure 4 Three groups of image similarity sample groups are shown. In each image similarity sample group, two images have similarity relationships, and any two images can form an image positive sample pair. A scene can be photographed to obtain a video of the scene. Image frames with changes in the posture of the object can be selected from the video. These image frames can form a group of image similarity sample groups, such as Figure 4 Image similar sample group 1 and image similar sample group 3 in the image. Alternatively, an image is obtained, which may be an image frame in a video or an image obtained by a single shot, and the present application embodiment does not limit this. The image may be enhanced to different degrees to obtain multiple enhanced images, which may form a group of image similar sample groups. The enhancement process may be color change, chromaticity change, cropping, brightness change, or adding filters, etc. Figure 4 The image similarity sample group 2 in illustrative examples shows images obtained after performing brightness transformations of different degrees on the same image.
[0173] The target model may include an object detection structure, and the object detection structure may include a feature extraction module and a key object prediction module. Exemplarily, the feature extraction module may adopt the structure of resnet101, as shown in Table 1, and the key object prediction module may adopt the structure shown in Table 2.
[0174] Table 1
[0175]
[0176] Table 2
[0177]
[0178] Among them, see Figure 5 As shown in FIG. 3 , the multi-label classification module can be used to pre-train the feature extraction module. The multi-label classification module is only used during pre-training. During the pre-training process, the binary cross entropy loss of the multi-label classification can be used to update the parameters of the feature extraction module and the multi-label classification module by the stochastic gradient descent method. After the pre-training is completed, the parameters of the feature extraction module can be obtained, and the parameters of the feature extraction module can be fixed, that is, the parameters of the feature extraction module are not updated in the subsequent learning process. The multi-label classification module can adopt the structure shown in Table 3.
[0179] Table 3
[0180] Layer name Output size Layer Pooling layer 1x2048 Max pool Fully connected layer Fc-class 1x10000 Full connection layer
[0181] Among them, the key object prediction module includes at least one downsampling layer, each downsampling layer is connected to a prediction layer, and exemplarily, the key object prediction module shown in Table 2 includes two downsampling layers, and the two downsampling layers are each connected to an object prediction layer. It should be noted that: the setting of two downsampling layers in Table 2 is only an example, and one downsampling layer or more than two downsampling layers may also be set, and the embodiments of the present application are not limited to this.
[0182] In some embodiments, for each sample image in the training sample set, the computer device may input the sample image into a feature extraction module, the feature extraction module outputs a basic feature map, the basic feature map is input into a key object prediction module to obtain a feature heat map, and the feature heat map may be used as an object detection result for the sample image. For example, see Figure 6 As shown, Figure 6 The first row in the figure shows sample images, and the images below the sample images are corresponding feature heat maps.
[0183] S304 . Divide each sample image based on the object detection result to obtain multiple sample sub-images.
[0184] In some embodiments, for each sample image in the training sample set, after obtaining the characteristic heat map of the sample image, the computer device can perform matrix transformation (reshape) processing on the characteristic heat map to obtain the matrix transformation processing result, and further perform non-maximum suppression (NMS) on the matrix transformation processing result to obtain the area where the object is located on the sample image. The area where the object is located can be cut out to obtain the object sub-image of the sample image. Exemplarily, the effect of restoring the characteristic heat map to the original image can be as follows: Figure 7 Indicates.
[0185] S306 , extracting features from each sample sub-image respectively through the object representation structure in the target model to be trained, and obtaining the object representation corresponding to each sample sub-image.
[0186] The object representation structure in the target model may include a feature extraction module and a representation extraction module. Exemplarily, the representation extraction module may adopt the structure shown in Table 4.
[0187] Table 4
[0188]
[0189] In some embodiments, for each sample image in the training sample set, after obtaining the sample sub-image of the sample image, the computer device can input the sample sub-image into a feature extraction module, the feature extraction module outputs a basic feature map, and the basic feature map is input into a value representation extraction module, and the representation extraction module outputs an object representation corresponding to the sample sub-image.
[0190] It should be noted that: since both the object detection structure and the object characterization structure include a feature extraction module, the object detection structure and the object characterization structure may share a feature extraction module, or the object detection structure and the object characterization structure may each have a feature extraction module, and the embodiments of the present application are not limited to this.
[0191] S308 . Construct object tuples according to the sample subgraphs, each object tuple comprising a first sample subgraph, a second sample subgraph belonging to the same object as the first sample subgraph, and a third sample subgraph belonging to a different object from the first sample subgraph.
[0192] Among them, the object multi-tuple can be an object triple, or an object quadruple, an object quintuple, etc., which is not limited in the embodiment of the present application. The embodiment of the present application takes the object triple as an example to illustrate the process of constructing the object triple.
[0193] In some embodiments, the training sample set includes N image positive sample pairs, each image positive sample pair includes two sample images with a similar relationship, and the computer device can select bs0 image positive sample pairs from the N image positive sample pairs as samples of a training batch. For each of the bs0 image positive sample pairs, the two sample images with a similar relationship are processed respectively to obtain object sub-images corresponding to the two sample images, thereby obtaining multiple object sub-images, and two object sub-images belonging to the same object can be found from the multiple object sub-images, and then another object sub-image belonging to a different object from the two object sub-images can be found from the remaining object sub-images, and the combination of these three object sub-images can be used as an object triplet.
[0194] In some embodiments, for each of the bs0 positive sample pairs of images, after obtaining the object sub-images corresponding to the two sample images, the computer device can search for two object sub-images belonging to the same object from the object sub-images corresponding to the two sample images, and use the two object sub-images belonging to the same object as the object positive sample pair. Assuming that bs object positive sample pairs are obtained, for each object positive sample pair, object negative samples can be mined from the remaining bs-1 object positive sample pairs other than the object positive sample pair, and the combination of the object positive sample pair and the object negative sample is used as an object triplet. Exemplarily, assuming that 20 negative samples can be mined for each object positive sample pair, 20 object triplets can be formed based on the object positive sample pair and the 20 object negative samples. Since there are bs object positive sample pairs, bs*20 object triplets can be obtained.
[0195] S3010. Determine the object multi-group loss based on the difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and the difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and construct a target loss function based on the object multi-group loss.
[0196] In some embodiments, the computer device may obtain a preset boundary threshold, and calculate the difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and the difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and may calculate the object multi-group loss based on the preset boundary threshold and these two differences.
[0197] In some embodiments, after obtaining the preset boundary threshold and the above two differences, the computer device may calculate the object multi-group loss using the following formula:
[0198] l tri =max(||x a -x p ||-||x a -x n ||+α, 0)
[0199] Among them, l tri represents the object multi-group loss, x a represents the object representation of the first sample sub-image, x p represents the object representation of the second sample sub-image, x n represents the object representation of the third sample sub-image, and α represents the boundary threshold.
[0200] In some embodiments, since an object multi-tuple loss can be calculated for each triple, when bs*20 object triplets are mined by the method provided above, a bs*20 object multi-tuple loss can be obtained. The computer device can average the bs*20 object multi-tuple losses and use the average value as the final object triplet loss.
[0201] In some embodiments, when the training sample set includes image positive sample pairs and image negative sample pairs, the computer device may obtain the joint representation corresponding to each of the two sample images in the image positive sample pair, and the joint representation corresponding to each of the two sample images in the image negative sample pair, calculate the distance between the two joint representations corresponding to the image positive sample pair, and the distance between the two joint representations corresponding to the image negative sample pair, determine the image consistency loss based on the two distances, and further construct a target loss function based on the object triplet loss and the image consistency loss.
[0202] In some embodiments, when the training sample set only includes positive image sample pairs, assuming that the number of positive image sample pairs is N, the computer device may select bs0 positive image sample pairs from the N positive image sample pairs as samples of a training batch. For each of the bs0 positive image sample pairs, the joint representation corresponding to each of the two sample images may be obtained to obtain bs0 positive sample joint representation pairs. For each positive sample joint representation pair, a negative sample joint representation is determined. The combination of the positive sample joint representation pair and the negative sample joint representation may be used as an image representation tuple. Based on the image representation tuple, the image tuple loss may be determined. Furthermore, based on the object tuple loss and the image tuple loss, a target loss function is constructed.
[0203] In some embodiments, the computer device may use the object multi-group loss directly as the target loss function, or use the sum of the object multi-group loss and the image consistency loss as the target loss function, or use the sum of the object multi-group loss and the image multi-group loss as the target loss function, or use the sum of the object multi-group loss, the image consistency loss, and the image multi-group loss as the target loss function. It should be noted that the sum of the losses mentioned above can be a simple summation result or a weighted summation result, which is not limited in the embodiments of the present application.
[0204] S3012. Adjust the parameters of the target model to be trained through the target loss function, continue training based on the target model after the parameter adjustment, and stop when the stopping condition is reached to obtain the trained target model.
[0205] As described above, the target model may include a feature extraction module, a key object prediction module, and a representation extraction module. Adjusting the parameters of the target model through the target loss function can be understood as adjusting the parameters of the feature extraction module, the key object prediction module, and the representation extraction module through the target loss function.
[0206] Among them, as described above, after the pre-training of the feature extraction module is completed, the parameters of the feature extraction module can be obtained, and the parameters of the feature extraction module can be fixed, that is, the parameters of the feature extraction module may not be updated during the training process of this step. The parameters of the key object prediction module and the characterization extraction module can be initialized using a Gaussian distribution with a variance of a first preset value and a mean of a second preset value. For example, the first preset value can be 0.01 and the second preset value can be 0. This is not limited in the embodiments of the present application.
[0207] In some embodiments, during each iteration, the computer device may learn and update the parameters of the target model in batches. Exemplarily, bs0 sample pairs may be randomly selected from the N positive image sample pairs as the training samples for the first batch. After the target loss function corresponding to this batch is obtained by the above method, the parameters of the target model may be updated based on the target loss function. Among the remaining N-bs0 positive sample pairs, bs0 sample pairs are randomly selected again as the training samples for the second batch. After the target loss function corresponding to this batch is obtained by the above method, the parameters of the target model may be updated again based on the target loss function. And so on, until N / bs0 batches are processed. Since one iteration processes a total of N / bs0 batches, the parameters of the target model are updated N / bs0 times in one iteration.
[0208] In some embodiments, the stopping condition may be that the number of iterations reaches a first preset number of times, or that the target loss function obtained by the second preset number of iterations has not decreased. Exemplarily, taking the first preset number of times as 10 as an example, when the number of iterations reaches 10, the training can be stopped, and the model obtained at this time can be used as the target model after training. Exemplarily, taking the second preset number of times as 20 as an example, the target loss function obtained by each iteration is compared with the target loss function obtained by the previous iteration. If the target loss function obtained by 20 consecutive iterations has not decreased, the training can be stopped, and the model obtained at this time can be used as the target model after training.
[0209] In some embodiments, the computer device can learn and update the parameters of the target model in batches. For a certain batch, after obtaining the target loss function corresponding to the batch in the above manner, the target loss function can be used to perform gradient backward calculation to obtain the gradient of the parameter to be updated, and based on the gradient, the parameter is updated. Specifically, when updating the parameters based on the gradient, the parameters can be updated according to the corresponding learning rate. Exemplarily, the initial value of the learning rate can be set to 0.0005, and each time the training batch reaches the preset value, the learning rate is adjusted to 0.1 times the original value.
[0210] The training method of the target model provided in the embodiment of the present application performs object detection on each sample image in the training sample set through the object detection structure of the target model to be trained to obtain the object detection result; divides each sample image based on the object detection result to obtain multiple sample sub-images, and these sample sub-images can be used for the subsequent construction of object multi-groups. The object multi-group is the sample basis for the training target model to have the object representation ability. Through the object representation structure in the target model to be trained, feature extraction is performed on each sample sub-image to obtain the object representation corresponding to each sample sub-image; constructs object multi-groups according to the sample sub-images, and each object multi-group includes the first The first sub-image, the second sample sub-image belonging to the same object as the first sample sub-image, and the third sample sub-image belonging to different objects from the first sample sub-image; in this way, the object sample of the training target model is obtained, and then the object multi-group loss can be determined according to the difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and the difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and the target loss function is constructed according to the object multi-group loss. By training the model with the target loss function, the target model can enhance the ability to identify similar images and irrelevant images, that is, enhance the ability of the target model to represent the details of the object. In addition, since the target model uses the object multi-group in the training process, the target model has the ability to specifically represent the object, which is convenient for the targeted representation of the object image in practical applications. In this way, the trained target model can accurately identify the objects in the media data to be processed in subsequent applications, and accurately extract the object representation corresponding to the object, so that similar media data can be recalled based on the object representation, and the recalled media data can be deduplicated. Since the deduplication process is implemented based on object representation, the recalled media data is data that is relatively similar to the media data to be processed at the object level. This can avoid the problem of recalling media data with similar backgrounds but different objects, greatly improving the deduplication detection results of media data.
[0211] In some embodiments, the training sample set includes a positive sample pair of images and a negative sample pair of images, the positive sample pair includes a first sample image and a second sample image having a similar relationship, and the negative sample pair includes a third sample image and a fourth sample image having no similar relationship, and the method further includes:
[0212] Determine a first joint representation of the first sample image at least based on the object representation of each sample sub-image included in the first sample image; determine a second joint representation of the second sample image at least based on the object representation of each sample sub-image included in the second sample image; determine a third joint representation of the third sample image at least based on the object representation of each sample sub-image included in the third sample image; determine a fourth joint representation of the fourth sample image at least based on the object representation of each sample sub-image included in the fourth sample image; determine an image consistency loss based on the distance between the first joint representation and the second joint representation, and the distance between the third joint representation and the fourth joint representation; construct a target loss function based on the object multi-group loss, including: constructing a target loss function based on the object multi-group loss and the image consistency loss.
[0213] In some embodiments, the computer device may stitch together the object representations of the sample sub-images included in the first sample image to obtain a first joint representation of the first sample image, stitch together the object representations of the sample sub-images included in the second sample image to obtain a second joint representation of the second sample image, stitch together the object representations of the sample sub-images included in the third sample image to obtain a third joint representation of the third sample image, and stitch together the object representations of the sample sub-images included in the fourth sample image to obtain a fourth joint representation of the fourth sample image.
[0214] In some embodiments, after obtaining the first joint representation, the second joint representation, the third joint representation, and the fourth joint representation, the computer device may calculate the image consistency loss by the following formula:
[0215]
[0216] Among them, L c Represents the image consistency loss, when When y represents the distance between the first joint representation and the second joint representation, y = 1. When y represents the distance between the third joint representation and the fourth joint representation, y=0.
[0217] In some embodiments, the training sample set includes N image positive sample pairs and N image negative sample pairs. The computer device can select bs0 image positive sample pairs from the N image positive sample pairs and bs0 image negative sample pairs from the N image negative sample pairs as samples of a training batch. For each image positive sample pair, the corresponding image consistency loss can be calculated in the above manner, and a total of bs0 image consistency losses can be obtained. Similarly, for each image negative sample pair, the corresponding image consistency loss can also be calculated in the above manner, and a total of bs0 image consistency losses can be obtained. Therefore, for a training batch of samples, 2*bs0 image consistency losses can be obtained, and the 2*bs0 image consistency losses can be averaged to obtain the image consistency loss corresponding to a training batch.
[0218] In some embodiments, after obtaining the object multi-group loss corresponding to a training batch and the image consistency loss corresponding to the training batch, the computer device may use the sum of the object multi-group loss and the image consistency loss as the target loss function.
[0219] In the above embodiment, the training sample set includes N image positive sample pairs and N image negative sample pairs, and bs0 image positive sample pairs and bs0 image negative sample pairs can be selected as samples of a training batch. Based on each image positive sample pair in the bs0 image positive sample pairs, an object multi-group can be mined, and based on the object multi-group, the object multi-group loss can be calculated. Based on each image positive sample pair and each image negative sample pair, the image consistency loss can be calculated. Based on the object multi-group loss and the image consistency loss, a target loss function can be constructed. The target loss function enables the target model to have the ability of global description in addition to the ability of targeted description of the object, so that the functionality of the target model is enhanced.
[0220] In some embodiments, the target model to be trained further includes a representation joint structure, and determining a first joint representation of the first sample image at least according to the object representations of each sample sub-image included in the first sample image includes:
[0221] The object representations of each sample sub-image of the first sample image output by the object representation structure and the image representation of the first sample image extracted by the object detection module are spliced through the representation joint structure to obtain a first joint representation.
[0222] Among them, the characterization joint structure can adopt the structure shown in Table 5. It should be noted that Table 5 is only an example, and the characterization joint structure can also adopt other structures that can achieve corresponding functions. The embodiment of the present application is not limited to this.
[0223] Table 5
[0224] Layer name Output size Layer Concat 1x64(K+1) No network backward calculation to learn weights Feature fusion layer 1x64(K+1) Full connection layer
[0225] It should be noted that the structures shown in Tables 1 to 5 in the embodiments of the present application are only examples, and the various structures in the target model may also adopt other designs. For example, the feature extraction module CNN1 may be a detection model trained based on business data. For example, for game A, a character detection model may be trained for the characters in game A.
[0226] In some embodiments, a computer device may input a first sample image into an object representation structure to obtain an image representation corresponding to the first sample image, and input each sample sub-image of the first sample image into the object representation structure to obtain an object representation corresponding to each sample sub-image. The image representation corresponding to the first sample image and the object representation corresponding to each sample sub-image may be input into a value representation joint structure. The representation joint structure first concatenates each input feature and then performs feature fusion to obtain a first joint representation of the first sample image.
[0227] It can be understood that the second joint representation of the second sample image, the third joint representation of the third sample image, and the fourth joint representation of the fourth sample image can be obtained in a similar manner, which will not be described in detail in this embodiment of the present application.
[0228] In some embodiments, see Figure 8 As shown, the object detection structure includes a feature extraction module CNN1 and a key object prediction module CNN2, and the object representation structure includes a feature extraction module CNN1 and a representation extraction module CNN3. The positive sample pairs of images in the training sample set can be obtained by image enhancement, that is, for any image, the image is subjected to image enhancement processing, and the image and the processed image can be used as an image positive sample pair. For each positive sample pair of images, the two sample images included in the positive sample pair of images are called sample image 1 and sample image 2, and the sample image 1 is input into CNN1, and processed by CNN1 and CNN2 in turn, and a feature heat map can be obtained. Based on the feature heat map, an object sub-image can be cut out from the sample image 1. The sample image 1 is input into CNN1, and processed by CNN1 and CNN3 in turn, and the corresponding image representation can be obtained. Each object sub-image is input into CNN1 respectively, and processed by CNN1 and CNN3 in turn, and multiple object representations can be obtained. The image representation and multiple object representations are input into the representation joint structure, and the joint representation of the sample image 1 can be obtained. The joint representation of the sample image 2 is obtained in the same way. Based on the joint representation of sample image 1 and the joint representation of image 2, the image consistency loss is calculated.
[0229] In the above embodiment, an implementation method for obtaining a joint representation is provided. The joint representation can be used to calculate the image consistency loss, and the image consistency loss can be used to construct a target loss function, so that the target model has not only the ability to describe the object specifically, but also the ability to describe the object globally, thereby enhancing the functionality of the target model.
[0230] In some embodiments, the training sample set includes a plurality of positive image sample pairs, each positive image sample pair includes two sample images having a similar relationship, and the method further includes:
[0231] Extract image positive sample pairs of a training batch from multiple image positive sample pairs; for each extracted image positive sample pair, obtain the image joint representation corresponding to each sample image in each image positive sample pair to obtain multiple positive sample joint representation pairs; for each positive sample joint representation pair, determine the negative sample joint representation from the positive sample joint representation pairs other than the current positive sample joint representation pair, and construct an image representation tuple based on the current positive sample joint representation pair and the negative sample joint representation; determine the image tuple loss based on the image representation tuple; construct a target loss function based on the object tuple loss, including: constructing a target loss function based on the object tuple loss and the image triplet loss.
[0232] In some embodiments, the training sample set includes N image positive sample pairs, and the computer device can select bs0 image positive sample pairs as samples of a training batch. For the two sample images in each image positive sample pair in the bs0 image positive sample pairs, the image joint representations corresponding to the two sample images can be obtained, and the image joint representations corresponding to the two sample images can be used as a positive sample joint representation pair. The above processing is performed on each image positive sample pair to obtain bs0 positive sample joint representation pairs. For each positive sample joint representation pair, an image joint representation can be randomly selected as an anchor image joint representation, and an image joint representation other than the positive sample joint representation pair can be randomly selected as an anchor image joint representation. , randomly select an image joint representation from each positive sample joint representation pair to obtain bs0-1 image joint representations, calculate the distance between each image joint representation in bs0-1 image joint representations and the anchor image joint representation, sort the bs0-1 image joint representations in ascending order of distance, remove the image joint representations that are in the front of the preset number, and take the image joint representations that are in the front of the second preset number from the remaining image joint representations as negative sample joint representations. Each negative sample joint representation and the positive sample joint representation pair can form an image representation tuple. Assuming that the second preset number is 20, 20 image representation tuples can be formed. Perform the above processing on each positive sample joint representation pair to obtain bs0*20 image representation tuples. The two image joint representations corresponding to the image positive sample pair in each image representation tuple are respectively called the first image joint representation and the second image joint representation, and the other image joint representation can be called the third image joint representation.
[0233] In some embodiments, the computer device may input the sample image into an object representation structure, and use the features output by the object representation structure as the joint image representation corresponding to the sample image; or input each sample sub-image corresponding to the sample image into the object representation structure respectively, obtain the object representation corresponding to each sample sub-image, and splice and fuse each object representation to obtain the joint image representation corresponding to the corresponding sample image; or input each sample sub-image corresponding to the sample image into the object representation structure respectively, obtain the object representation corresponding to each sample sub-image, and simultaneously obtain the image representation corresponding to the sample image, and splice and fuse the image representation corresponding to the sample image and the object representation corresponding to each sample sub-image to obtain the joint image representation corresponding to the corresponding sample image.
[0234] In some embodiments, after obtaining the image representation tuple, the computer device may calculate the image tuple loss using the following formula:
[0235] l tri =max(||x a -x p ||-||x a-x n ||+α, 0)
[0236] Among them, l tri represents the image multi-tuple loss, x a represents the first image joint representation, x p represents the joint representation of the second image, x n represents the third image joint representation, and α represents the boundary threshold.
[0237] In some embodiments, as described above, each training batch can be mined to obtain bs0*20 image representation tuples. For each image representation tuple, the image tuple loss can be calculated in the above manner. After obtaining the bs0*20 image tuple losses, the computer device can average the bs0*20 image tuple losses and use the obtained mean as the image tuple loss corresponding to the corresponding training batch.
[0238] In some embodiments, after obtaining the object multi-group loss corresponding to a training batch and the image multi-group loss corresponding to the training batch, the computer device may use the sum of the object multi-group loss and the image multi-group loss as the target loss function.
[0239] In the above embodiment, an image tuple can be obtained through feature mining, and the image tuple loss can be calculated based on the image tuple. A target loss function can be constructed based on the object tuple loss and the image tuple. The target loss function enables the target model to have the ability of global description in addition to the ability of specific description of the object, thereby enhancing the functionality of the target model.
[0240] In some embodiments, the target model to be trained further includes a representation joint structure, and obtaining an image joint representation corresponding to each sample image in each image positive sample pair includes:
[0241] Through the representation joint structure, the object representation of each sample sub-image included in each sample image output by the object representation structure and the image representation of the sample image extracted by the object detection module are spliced to obtain the image joint representation of the corresponding sample image; the image joint representation of the sample image in each image positive sample pair is taken as a positive sample joint representation pair.
[0242] In some embodiments, for each sample image included in the image sample pair, the computer device may input the sample image into the object representation structure to obtain the image representation corresponding to the sample image, and input each sample sub-image of the sample image into the object representation structure to obtain the object representation corresponding to each sample sub-image. The image representation corresponding to the sample image and the object representation corresponding to each sample sub-image may be input into a value representation joint structure. The representation joint structure first splices the input features and then performs feature fusion to obtain the image joint representation of the corresponding sample image.
[0243] In some embodiments, see Fig. 9 As shown, the object detection structure includes a feature extraction module CNN1 and a key object prediction module CNN2, and the object representation structure includes a feature extraction module CNN1 and a representation extraction module CNN3. For each positive sample pair of images, the two sample images are processed as follows: the sample image is input into CNN1, and processed by CNN1 and CNN2 in turn to obtain a feature heat map, and the object sub-image can be cut out from the sample image based on the feature heat map. The sample image is input into CNN1, and processed by CNN1 and CNN3 in turn to obtain the corresponding image representation, and each object sub-image is input into CNN1 respectively, and processed by CNN1 and CNN3 in turn to obtain multiple object representations, and the image representation and multiple object representations are input into the representation joint structure to obtain the joint representation of the sample image. Based on the joint representation of the sample image, triple mining is performed to obtain the image representation triple, and based on the image representation triple, the image triple loss is calculated.
[0244] In the above embodiment, an implementation method for obtaining a joint representation is provided. The joint representation can be used to calculate the image multi-group loss, and the image multi-group loss can be used to construct a target loss function, so that the target model has not only the ability to describe the object specifically, but also the ability to describe the object globally, thereby enhancing the functionality of the target model.
[0245] In some embodiments, the training sample set includes a plurality of positive image sample pairs, each positive image sample pair includes two sample images with similar relationships, and constructing an object multi-tuple according to the sample sub-images includes:
[0246] A training batch of image positive sample pairs is extracted from multiple image positive sample pairs; for each extracted image positive sample pair, multiple object positive sample pairs are constructed according to the sample sub-graphs corresponding to each sample image in each image positive sample pair; for each object positive sample pair, object negative samples are determined from other sample sub-graphs except the current object positive sample pair, and an object multi-tuple is constructed based on the current object positive sample pair and the object negative samples.
[0247] In some embodiments, when the training sample set includes N image positive sample pairs, the computer device may select bs0 image positive sample pairs as samples of a training batch, and for each extracted image positive sample pair, each sample image included in the image positive sample pair is respectively input into the object detection structure to obtain the object detection result, and the sample image is divided based on the object detection structure to obtain the sample sub-image corresponding to the sample image. The sample sub-images corresponding to the two sample images included in each image positive sample can be matched to obtain the object positive sample pair. Assume that the above processing is performed on each image positive sample pair, and a total of bs object positive sample pairs are obtained. For each object positive sample pair, object negative samples are mined from other sample sub-images except the current object positive sample pair. Assume that for each object positive sample pair, 20 object negative samples can be mined, and each object negative sample and object positive sample pair can form an object triplet. Since a training batch can obtain bs object positive sample pairs, bs*20 object triplets can be obtained through the above mining. Exemplarily, Fig.10 Three groups of object similarity sample groups are shown, and any two images in each group of object similarity sample groups can be used as object positive sample pairs.
[0248] In the above embodiment, an implementation method for constructing object triples is provided. The object triples can be used as sample basis for subsequent training of object representation structure. The object representation structure obtained with object triples as training samples can extract object detail features, thereby improving the accuracy of object representation.
[0249] In some embodiments, for each object positive sample pair, an object negative sample is determined from other sample sub-images except the current object positive sample pair, including: selecting an anchor image from the current object positive sample pair, and selecting candidate sample sub-images from other sample sub-images except the current object positive sample pair; calculating the distance between each candidate sample sub-image and the anchor image; sorting multiple candidate sample sub-images according to the size of the distance, and determining the negative sample based on the sorting result.
[0250] In some embodiments, when the training sample set includes N image positive sample pairs, the computer device may select bs0 image positive sample pairs as samples of a training batch, and may mine bs object positive sample pairs based on bs0 image positive sample pairs. For each object positive sample pair, a random object sub-image is selected from the object positive sample pair as an anchor image, and all other object positive sample pairs except the object positive sample pair are obtained. For each sample image included in all other object positive sample pairs, the distance between the sample image and the anchor image is calculated, and all sample sub-images are sorted in order of the distance from small to large, and the sample sub-images that are ranked in the first preset number are eliminated. After the elimination process, the sample sub-images that are ranked in the second preset number are all used as object negative samples.
[0251] Among them, the first preset number and the second preset number can be flexibly set according to actual conditions. For example, the first preset number can be 5 and the second preset number can be 20. The embodiment of the present application does not limit this.
[0252] In the above embodiment, a specific implementation method of how to mine negative samples of objects is provided. After the negative samples of objects are mined based on this method, an object multi-tuple can be constructed based on the pair of the object negative samples and the object positive samples. The object triplet can be used as a sample basis for subsequent training of the object representation structure. The object representation structure obtained with the object triplet as the training sample can extract the detailed features of the object, thereby improving the accuracy of the object representation.
[0253] In some embodiments, the training sample set includes a plurality of positive sample pairs of images, the positive sample pairs include a first sample image and a second sample image having a similar relationship, and the second sample image is a sample image obtained after image enhancement processing is performed on the first sample image.
[0254] Among them, the image enhancement processing includes: at least one of color change, chromaticity change, cropping, brightness, and filter, which is not limited in the embodiment of the present application.
[0255] In the above embodiment, an implementation method for obtaining a positive image sample pair is provided, that is, for any image, image enhancement processing is performed on the image to obtain an image after image enhancement processing. The image and the image after image enhancement processing can constitute an image positive sample pair. This method does not require manual annotation of similar images, thus saving annotation resources.
[0256] In some embodiments, a method for deduplication of media data is provided, which is described by taking the method executed by a computer device as an example, and the method includes:
[0257] At least one frame of global image is extracted from the video to be processed, and object detection is performed on each frame of global image through the object detection structure in the trained target model to obtain the feature heat map corresponding to each frame of global image, and based on the feature heat map corresponding to each frame of global image, multiple object sub-images are intercepted from at least one frame of global image, where each object sub-image corresponds to one object.
[0258] The object representation of each object sub-image is extracted through the object representation structure in the trained target model, wherein the object representation extracted from the object sub-image is used to represent the hidden layer features of the object corresponding to the corresponding object sub-image.
[0259] The object representations are clustered to obtain a first preset number of cluster centers and an object representation corresponding to each cluster center; wherein one cluster center corresponds to one object, and the distances between the object representations corresponding to each cluster center and the corresponding cluster center are calculated, and the object representations corresponding to each cluster center are sorted in order of distance from small to large, and a second preset number of object representations at the front are obtained, and object representations whose distances are less than a preset value are extracted from the obtained object representations as target object representations corresponding to the corresponding objects.
[0260] Object detection is performed on each media data in the media library, and the corresponding media data is divided based on the object detection result to obtain multiple object subgraphs of the corresponding media data, and the object representation of each object subgraph of each media data is extracted. From the multiple object representations corresponding to each media data, a reference object representation corresponding to each object is determined, and an object representation library is constructed based on each reference object representation and the corresponding relationship between each reference object representation and the media data to which it belongs. The object representation library stores multiple reference object representations and the corresponding relationship between each reference object representation and the media data to which it belongs.
[0261] The characteristic distance between each target object representation and each reference object representation in the object representation library is calculated, and the reference object representation whose characteristic distance with the target object representation is less than or equal to a preset distance threshold is used as the reference object representation that meets the similarity condition with the corresponding target object representation.
[0262] When reference object representations that meet similarity conditions with the target object representation are found in the object representation library, media data to which each of the found reference object representations belongs is used as similar media data to the media data to be processed.
[0263] Based on the object identifiers included in the media data to be processed and the object identifiers included in the similar media data, the target object identifiers included in both the media data to be processed and the similar media data are determined, the category weights of the categories to which each target object identifier belongs are determined, the total first object quantity of the objects included in the media data to be processed is determined, the first quantity of target object representations that meet the similarity condition in the media data to be processed and the similar media data are determined under the same target object identifier, and the second quantity of target object representations in the media data to be processed that correspond to the same target object identifier is determined, and the matching score of the similar media data is determined based on the category weights, the total first object quantity, the first quantity, and the second quantity.
[0264] Alternatively, based on the object identifiers included in the media data to be processed and the object identifiers included in the similar media data, the target object identifiers included in both the media data to be processed and the similar media data are determined, the category weights of the categories to which each target object identifier belongs are determined, the total number of second objects of the objects included in the similar media data is determined, and under the same target object identifier for the media data to be processed and the similar media data, a first number of target object representations in the media data to be processed that meet the similarity condition and a third number of reference object representations in the similar media data corresponding to the same target object identifier are determined; and based on the category weights, the total number of second objects, the first number and the third number, the matching score of the similar media data is determined.
[0265] The similar media data are sorted according to the matching scores to obtain a sorting result, and a deduplication result of the media data to be processed is determined based on the sorting result.
[0266] The method for deduplication of media data provided in the embodiment of the present application performs object detection on the media data to be processed, and divides the media data to be processed based on the object detection results to obtain multiple object sub-graphs, and extracts the object representation of each object sub-graph. Since the object representation extracted from the object sub-graph is used to represent the hidden layer features of the object corresponding to the corresponding object sub-graph, the object representation can well reflect the object details in the media data to be processed, and realizes the targeted representation of the object. Based on the extracted object representation, the target object representation corresponding to each object is determined, and the obtained target object representation is an object representation that can better represent the corresponding object. In this way, the media data with similarity recalled from the object representation library based on the target object representation is more similar to the media data to be processed at the object level. In the present application, since the deduplication process is implemented based on the object representation, the recalled media data is data similar to the media data to be processed at the object level, which can avoid the problem of recalling media data with similar backgrounds but different objects, and greatly improve the deduplication detection results of the media data.
[0267] In some embodiments, a method for training a target model is provided, which is described by taking the method executed by a computer device as an example, and the method includes:
[0268] A training sample set is obtained, and object detection is performed on each sample image in the training sample set through the object detection structure of the target model to be trained to obtain an object detection result, and each sample image is divided based on the object detection result to obtain multiple sample sub-images.
[0269] Through the object representation structure in the target model to be trained, features are extracted for each sample sub-image respectively to obtain the object representation corresponding to each sample sub-image.
[0270] The training sample set includes multiple image positive sample pairs, and a training batch of image positive sample pairs is extracted from the multiple image positive sample pairs; for each extracted image positive sample pair, multiple object positive sample pairs are constructed according to the sample sub-graphs corresponding to each sample image in each image positive sample pair. An anchor image is selected from the current object positive sample pair, and candidate sample sub-graphs are selected from other sample sub-graphs except the current object positive sample pair. The distance between each candidate sample sub-graph and the anchor image is calculated, and multiple candidate sample sub-graphs are sorted according to the size of the distance, and the object negative sample is determined based on the sorting result. An object multi-tuple is constructed based on the current object positive sample pair and the object negative sample.
[0271] The object multi-group loss is determined according to a difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and a difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image.
[0272] The training sample set also includes a positive image sample pair and a negative image sample pair. The positive image sample pair includes a first sample image and a second sample image having a similar relationship. The negative image sample pair includes a third sample image and a fourth sample image that do not have a similar relationship. The second sample image is a sample image obtained after image enhancement processing is performed on the first sample image. The target model to be trained also includes a representation joint structure. Through the representation joint structure, the object representation of each sample sub-image of the first sample image output by the object representation structure and the image representation of the first sample image extracted by the object detection module are spliced to obtain a first joint representation. At least based on the object representation of each sample sub-image included in the second sample image, a second joint representation of the second sample image is determined. At least based on the object representation of each sample sub-image included in the third sample image, a third joint representation of the third sample image is determined. At least based on the object representation of each sample sub-image included in the fourth sample image, a fourth joint representation of the fourth sample image is determined. Based on the distance between the first joint representation and the second joint representation, and the distance between the third joint representation and the fourth joint representation, the image consistency loss is determined.
[0273] The target loss function is constructed based on the object multi-group loss and image consistency loss.
[0274] Alternatively, a training batch of image positive sample pairs are extracted from multiple image positive sample pairs. For each extracted image positive sample pair, the object representation of each sample sub-image included in each sample image output by the object representation structure and the image representation of the sample image extracted by the object detection module are spliced through the representation joint structure to obtain an image joint representation of the corresponding sample image; the image joint representation of the sample image in each image positive sample pair is taken as a positive sample joint representation pair. Multiple positive sample joint representation pairs are obtained. For each positive sample joint representation pair, a negative sample joint representation is determined from the positive sample joint representation pairs other than the current positive sample joint representation pair, and an image representation tuple is constructed based on the current positive sample joint representation pair and the negative sample joint representation. Based on the image representation tuple, the image tuple loss is determined.
[0275] The target loss function is constructed based on the object multi-tuple loss and the image multi-tuple loss.
[0276] The parameters of the target model to be trained are adjusted through the target loss function, and the training is continued based on the target model after the parameter adjustment until the stopping condition is reached, thereby obtaining the trained target model.
[0277] The training method of the target model provided in the embodiment of the present application performs object detection on each sample image in the training sample set through the object detection structure of the target model to be trained to obtain the object detection result; divides each sample image based on the object detection result to obtain multiple sample sub-images, and these sample sub-images can be used for the subsequent construction of object multi-groups. The object multi-group is the sample basis for the training target model to have the object representation ability. Through the object representation structure in the target model to be trained, feature extraction is performed on each sample sub-image to obtain the object representation corresponding to each sample sub-image; constructs object multi-groups according to the sample sub-images, and each object multi-group includes the first The first sub-image, the second sample sub-image belonging to the same object as the first sample sub-image, and the third sample sub-image belonging to different objects from the first sample sub-image; in this way, the object sample of the training target model is obtained, and then the object multi-group loss can be determined according to the difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and the difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and the target loss function is constructed according to the object multi-group loss. By training the model with the target loss function, the target model can enhance the ability to identify similar images and irrelevant images, that is, enhance the ability of the target model to represent the details of the object. In addition, since the target model uses the object multi-group in the training process, the target model has the ability to specifically represent the object, which is convenient for the targeted representation of the object image in practical applications. In this way, the trained target model can accurately identify the objects in the media data to be processed in subsequent applications, and accurately extract the object representation corresponding to the object, so that similar media data can be recalled based on the object representation, and the recalled media data can be deduplicated. Since the deduplication process is implemented based on object representation, the recalled media data is data that is relatively similar to the media data to be processed at the object level. This can avoid the problem of recalling media data with similar backgrounds but different objects, greatly improving the deduplication detection results of media data.
[0278] In one possible scenario, see Fig.11 As shown, the object detection structure includes a feature extraction module CNN1 and a key object prediction module CNN2, and the object representation structure includes a feature extraction module CNN1 and a representation extraction module CNN3. Fig.12As shown, the key object prediction module (CNN2) includes a downsampling layer and a prediction layer connected to the downsampling layer. After obtaining the training sample set, for each sample image in the training sample set, the sample image can be input into the feature extraction module CNN1, CNN1 inputs the extracted features into the downsampling layer, the downsampling layer performs downsampling processing on the sample image to obtain a downsampling feature layer, the downsampling feature layer is input into the prediction layer of the object detection structure, the prediction layer outputs the prediction scores of each position in the downsampling feature layer, the matrix transformation (reshape) processing module performs matrix transformation (reshape) processing on the downsampling feature layer based on the prediction scores of each position in the downsampling feature layer to obtain the matrix transformation processing result, the non-maximum suppression (NMS) module further processes the matrix transformation processing result to obtain the area where the object is located on the sample image, and the object sub-image is intercepted from the area. The above processing can be performed on each sample image in the training sample set to obtain multiple object sub-images, and object triples can be mined based on all object sub-images. Based on the object triples, the object triple loss loss.obj is calculated. On the other hand, for each sample image, the sample image is directly input into the object representation structure to obtain the image representation of the sample image. The image representation and the object representation corresponding to each object sub-image of the sample image can be spliced to obtain a joint representation. Based on the joint representation, the image consistency loss loss.all can be determined. Finally, the target loss function is constructed based on the object triplet loss loss.obj and the image consistency loss loss.all. The parameters of the target model to be trained are adjusted through the target loss function, and the training is continued based on the target model with adjusted parameters until the stopping condition is reached to obtain the trained target model.
[0279] In some possible scenarios, the key object prediction module (CNN2) may include two downsampling layers and two prediction layers, the two downsampling layers are respectively: downsampling layer down1 and downsampling layer down2, and the two prediction layers are respectively prediction layer proposal1 and prediction layer proposal2. Exemplarily, the output of the residual network (CNN1) may be 1x14x14x2048, where 1 represents the number of samples in a training batch, 14x14 is the length and width of the feature heat map, and 2048 is the number of channels of the convolution. The output of the feature extraction module CNN1 is processed by down1 and proposal1 in turn, and the output matrix size may be bs*6*7*7, where 6 represents the number of channels, and 7*7 represents the length and width of the feature map obtained after convolution. The point in 7*7 represents the attention intensity value of the spatial coordinate of the point. The matrix transformation (reshape) processing module can transform the output of proposal1, thereby obtaining 6*7*7=294 candidate point scores. The 294 candidate points are respectively de-mapped to the original image, and 294 original image blocks can be obtained. It should be noted that the output of the feature extraction module CNN1 is processed by down1, downsampling layer down2 and prediction layer proposal2 in sequence, and the output matrix size can be bs*6*4*4. For the output of proposal2, the same method as above can be used to obtain the corresponding original image block.
[0280] In some possible scenarios, after obtaining multiple original image blocks, sort the multiple original image blocks in descending order of confidence, retain the original image block with the largest confidence, calculate the IOU between other original image blocks and the original image block, find the original image blocks with an IOU greater than a preset threshold, and merge the largest original image blocks of these original image blocks. Repeat the above process for the original image blocks other than those involved in the merging process. Get several result boxes, such as Fig.13 Based on the position of the result box, the area corresponding to the result box is cut out on the corresponding image as the object sub-image.
[0281] For example, suppose there are 4 original blocks, namely: (box1, 0.8), (box2, 0.9), (box3, 0.7), (box4, 0.5), sort these four original blocks from large to small according to confidence: box2>box1>box3>box4; now keep the original block box2 with the highest confidence, and then calculate the IoU between the remaining three boxes and box2. If the IoU is greater than a pre-set threshold, then merge this box with box2. Assume that the threshold is 0.5, IoU(box1, box2) = 0.1 < 0.5, IoU(box3, box2) = 0.7 > 0.5, IoU(box4, box2) = 0.2 < 0.5, then merge box2 and box3 as the result box; repeat the above process for the remaining box1 and box4.
[0282] In some possible scenarios, the deduplication method provided in the embodiments of the present application can be applied to scenarios such as image deduplication retrieval and video deduplication retrieval. The specific deduplication process can refer to the description of the above embodiments.
[0283] The deduplication method provided in the embodiment of the present application can also be applied to the scenario of deduplication of game characters. Specifically, for a certain game, game images can be collected during the running of the game, and the collected game images can be stored in an image library, and an object representation library can be constructed based on the image library. For the game image to be processed, the object representation of the object sub-image of the game image to be processed can be obtained, where the object can be a game character. Based on the object representation and each object representation in the object representation library, it is determined whether there are game images similar to the game image to be processed in the image library. If so, these images are regarded as duplicate images of the game characters in the game image to be processed, and these images are further sorted according to the degree of similarity to obtain deduplication results.
[0284] It should be noted that the purpose of deduplication of media data is to determine whether the media data to be processed is the same or similar to the media data in the media library. The media data can be images, videos, audio, etc., and the embodiment of the present application does not limit the application scenario of deduplication.
[0285] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0286] Based on the same inventive concept, the embodiment of the present application also provides a target device for implementing the above-mentioned media data deduplication method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of one or more media data deduplication devices provided below can refer to the limitations of the media data deduplication method above, and will not be repeated here.
[0287] In one embodiment, Fig.14 As shown, a media data deduplication device is provided, comprising:
[0288] The division module 1401 is used to perform object detection on the media data to be processed, and divide the media data to be processed into multiple object sub-graphs based on the object detection result, wherein each object sub-graph corresponds to an object.
[0289] The extraction module 1402 is used to extract the object representation of each object sub-image, wherein the object representation extracted from the object sub-image is used to represent the hidden layer features of the object corresponding to the corresponding object sub-image.
[0290] The determination module 1403 is used to determine the target object representations corresponding to the respective objects based on the extracted object representations.
[0291] The acquisition module 1404 is used to acquire an object representation library, in which a plurality of reference object representations and a correspondence between each reference object representation and the media data to which it belongs are stored.
[0292] The deduplication module 1405 is used to search for reference object representations that meet similarity conditions with the target object representation from the object representation library, and determine deduplication results for the to-be-processed media data according to the search results.
[0293] In some embodiments, the media data to be processed includes a video to be processed, and the division module 1401 is specifically used to: extract at least one frame of global image from the video to be processed; perform object detection on each frame of the global image to obtain a feature heat map corresponding to each frame of the global image; and based on the feature heat map corresponding to each frame of the global image, extract multiple object sub-images from at least one frame of the global image.
[0294] In some embodiments, the determination module 1403 is specifically used to: cluster the object representations to obtain a first preset number of cluster centers and the object representations corresponding to each cluster center; wherein one cluster center corresponds to one object; calculate the distances between the object representations corresponding to each cluster center and the corresponding cluster centers; and filter the object representations corresponding to each cluster center according to the distance to obtain the target object representations corresponding to each object.
[0295] In some embodiments, the determination module 1403 is specifically used to: sort the object representations corresponding to each cluster center in order of distance from small to large; obtain the second preset number of object representations in the front, and extract the object representations whose distances are less than the preset value from the obtained object representations as the target object representations corresponding to the corresponding objects.
[0296] In some embodiments, the acquisition module 1404 is specifically used to: perform object detection on each media data in the media library, and divide the corresponding media data based on the object detection result to obtain multiple object sub-graphs of the corresponding media data; extract the object representation of each object sub-graph of each media data; determine the reference object representation corresponding to each object from the multiple object representations corresponding to each media data; and construct an object representation library based on each reference object representation and the correspondence between each reference object representation and the media data to which it belongs.
[0297] In some embodiments, the deduplication module 1405 is specifically used to: calculate the characteristic distance between each target object representation and each reference object representation in the object representation library; and use the reference object representation whose characteristic distance with the target object representation is less than or equal to a preset distance threshold as the reference object representation that meets the similarity condition with the corresponding target object representation.
[0298] In some embodiments, the deduplication module 1405 is specifically used to: when a reference object representation that meets the similarity condition with the target object representation is found in the object representation library, use the media data belonging to each of the reference object representations found as similar media data of the media data to be processed; determine the matching score of each similar media data; sort the similar media data according to the matching score to obtain a sorting result, and determine the deduplication result of the media data to be processed based on the sorting result.
[0299] In some embodiments, the deduplication module 1405 is specifically used to: determine the target object identification included in the media data to be processed and the similar media data based on the object identification included in the media data to be processed and the object identification included in the similar media data; determine the category weight of the category to which each target object identification belongs; determine the total first object quantity of the objects included in the media data to be processed; determine the first quantity of target object representations in the media data to be processed that meet the similarity condition under the same target object identification for the media data to be processed and the similar media data, and the second quantity of target object representations in the media data to be processed that correspond to the same target object identification; determine the matching score of the similar media data based on the category weight, the total first object quantity, the first quantity, and the second quantity.
[0300] In some embodiments, the deduplication module 1405 is specifically used to: determine the target object identification included in the media data to be processed and the similar media data based on the object identification included in the media data to be processed and the object identification included in the similar media data; determine the category weight of the category to which each target object identification belongs; determine the total number of second objects of the objects included in the similar media data; determine a first number of target object representations that meet the similarity condition in the media data to be processed and the similar media data under the same target object identification; and determine a third number of reference object representations in the similar media data corresponding to the same target object identification; determine the matching score of the similar media data based on the category weight, the total number of second objects, the first number and the third number.
[0301] In some embodiments, the division module 1401 is specifically used to perform object detection on the media data to be processed through the object detection structure in the trained target model; the extraction module is specifically used to extract the object representation of each object sub-image through the object representation structure in the trained target model.
[0302] In some embodiments, in some embodiments, the media data deduplication device also includes: a model training module, which is used to obtain a training sample set, and perform object detection on each sample image in the training sample set through the object detection structure of the target model to be trained to obtain an object detection result; divide each sample image based on the object detection result to obtain a plurality of sample sub-images; perform feature extraction on each sample sub-image through the object representation structure in the target model to be trained to obtain an object representation corresponding to each sample sub-image; construct an object multi-group according to the sample sub-images, each object multi-group includes a first sample sub-image, a second sample sub-image belonging to the same object as the first sample sub-image, and a third sample sub-image belonging to a different object from the first sample sub-image; determine the object multi-group loss according to the difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and the difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and construct a target loss function according to the object multi-group loss; adjust the parameters of the target model to be trained through the target loss function, and continue training based on the target model after the parameter adjustment until the stop condition is reached to obtain a trained target model.
[0303] In some embodiments, the training sample set includes image positive sample pairs and image negative sample pairs, the image positive sample pairs include a first sample image and a second sample image having a similar relationship, and the image negative sample pairs include a third sample image and a fourth sample image that do not have a similar relationship. The model training module is specifically used to determine a first joint representation of the first sample image at least based on the object representation of each sample sub-image included in the first sample image; determine a second joint representation of the second sample image at least based on the object representation of each sample sub-image included in the second sample image; determine a third joint representation of the third sample image at least based on the object representation of each sample sub-image included in the third sample image; determine a fourth joint representation of the fourth sample image at least based on the object representation of each sample sub-image included in the fourth sample image; determine the image consistency loss based on the distance between the first joint representation and the second joint representation, and the distance between the third joint representation and the fourth joint representation; and construct a target loss function based on the object multi-group loss and the image consistency loss.
[0304] In some embodiments, the training sample set includes multiple image positive sample pairs, each image positive sample pair includes two sample images with a similar relationship, and the model training module is specifically used to extract a training batch of image positive sample pairs from the multiple image positive sample pairs; for each extracted image positive sample pair, the image joint representation corresponding to each sample image in each image positive sample pair is obtained to obtain multiple positive sample joint representation pairs; for each positive sample joint representation pair, a negative sample joint representation is determined from the positive sample joint representation pairs other than the current positive sample joint representation pair, and an image representation tuple is constructed based on the current positive sample joint representation pair and the negative sample joint representation; based on the image representation tuple, the image tuple loss is determined; and a target loss function is constructed according to the object tuple loss and the image tuple loss.
[0305] In one embodiment, Fig.15 As shown, a training device for a target model is provided, comprising:
[0306] The acquisition module 1501 is used to acquire a training sample set, and perform object detection on each sample image in the training sample set through the object detection structure of the target model to be trained to obtain an object detection result;
[0307] A division module 1502 is used to divide each sample image based on the object detection result to obtain multiple sample sub-images;
[0308] An extraction module 1503 is used to extract features from each sample sub-graph through the object representation structure in the target model to be trained, so as to obtain the object representation corresponding to each sample sub-graph;
[0309] A construction module 1504 is used to construct object tuples according to the sample sub-graphs, each object tuple comprising a first sample sub-graph, a second sample sub-graph belonging to the same object as the first sample sub-graph, and a third sample sub-graph belonging to a different object from the first sample sub-graph;
[0310] A determination module 1505, configured to determine an object multi-group loss according to a difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and a difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image, and construct a target loss function according to the object multi-group loss;
[0311] The training module 1506 is used to adjust the parameters of the target model to be trained through the target loss function, and continue training based on the target model after the parameters are adjusted until the stopping condition is reached, thereby obtaining a trained target model.
[0312] In some embodiments, the training sample set includes image positive sample pairs and image negative sample pairs, the image positive sample pairs include a first sample image and a second sample image having a similar relationship, and the image negative sample pairs include a third sample image and a fourth sample image that do not have a similar relationship, and the determination module 1505 is further used to: determine a first joint representation of the first sample image at least based on the object representation of each sample sub-image included in the first sample image; determine a second joint representation of the second sample image at least based on the object representation of each sample sub-image included in the second sample image; determine a third joint representation of the third sample image at least based on the object representation of each sample sub-image included in the third sample image; determine a fourth joint representation of the fourth sample image at least based on the object representation of each sample sub-image included in the fourth sample image; determine the image consistency loss based on the distance between the first joint representation and the second joint representation, and the distance between the third joint representation and the fourth joint representation; and construct a target loss function based on the object multi-group loss and the image consistency loss.
[0313] In some embodiments, the target model to be trained also includes a representation joint structure, and the determination module 1505 is specifically used to: through the representation joint structure, splice the object representation of each sample sub-image of the first sample image output by the object representation structure and the image representation of the first sample image extracted by the object detection module to obtain a first joint representation.
[0314] In some embodiments, the training sample set includes multiple image positive sample pairs, each image positive sample pair includes two sample images with a similar relationship, and the determination module 1505 is also used to: extract a training batch of image positive sample pairs from the multiple image positive sample pairs; for each extracted image positive sample pair, obtain the image joint representation corresponding to each sample image in each image positive sample pair, and obtain multiple positive sample joint representation pairs; for each positive sample joint representation pair, determine the negative sample joint representation from the positive sample joint representation pairs other than the current positive sample joint representation pair, and construct an image representation tuple based on the current positive sample joint representation pair and the negative sample joint representation; based on the image representation tuple, determine the image tuple loss; and construct a target loss function according to the object tuple loss and the image triplet loss.
[0315] In some embodiments, the target model to be trained also includes a representation joint structure, and the determination module 1505 is specifically used to: through the representation joint structure, splice the object representation of each sample sub-image included in each sample image output by the object representation structure, and the image representation of the sample image extracted by the object detection module, to obtain the image joint representation of the corresponding sample image; and take the image joint representation of the sample image in each image positive sample pair as a positive sample joint representation pair.
[0316] In some embodiments, construction module 1504 is specifically used to: extract a training batch of image positive sample pairs from multiple image positive sample pairs; for each extracted image positive sample pair, construct multiple object positive sample pairs according to the sample sub-graphs corresponding to each sample image in each image positive sample pair; for each object positive sample pair, determine the object negative samples from the other sample sub-graphs except the current object positive sample pair, and construct an object multi-tuple based on the current object positive sample pair and the object negative samples.
[0317] In some embodiments, construction module 1504 is specifically used to: select an anchor image from the current object positive sample pair, and select candidate sample sub-images from other sample sub-images except the current object positive sample pair; calculate the distance between each candidate sample sub-image and the anchor image; sort multiple candidate sample sub-images according to the size of the distance, and determine the object negative sample based on the sorting result.
[0318] In some embodiments, the training sample set includes a plurality of positive sample pairs of images, the positive sample pairs include a first sample image and a second sample image having a similar relationship, and the second sample image is a sample image obtained after image enhancement processing is performed on the first sample image.
[0319] Each module in the above target device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0320] In one embodiment, a computer device is provided. The computer device may be a server or a terminal. The internal structure diagram thereof may be as follows: Fig.16 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store media library and object representation library data. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for deduplicating media data or a method for training a target model is implemented.
[0321] Those skilled in the art will understand that Fig.16 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0322] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.
[0323] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0324] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0325] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0326] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0327] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for training a target model, characterized in that: The method comprises: Obtaining a training sample set, and performing object detection on each sample image in the training sample set using the object detection structure of the target model to be trained to obtain an object detection result; Dividing each of the sample images based on the object detection result to obtain a plurality of sample sub-images; By using the object representation structure in the target model to be trained, feature extraction is performed on each of the sample sub-graphs to obtain the object representation corresponding to each of the sample sub-graphs; Constructing object tuples according to the sample subgraphs, each of the object tuples comprising a first sample subgraph, a second sample subgraph belonging to the same object as the first sample subgraph, and a third sample subgraph belonging to different objects from the first sample subgraph; Determine an object multi-group loss according to a difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and a difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image; Obtaining a joint representation corresponding to each of the two sample images in the positive sample pair of the image, and a joint representation corresponding to each of the two sample images in the negative sample pair of the image; the joint representation corresponding to the sample images is determined at least based on the object representation of each sample sub-image included in the sample image; Determining an image consistency loss based on a distance between two joint representations corresponding to the image positive sample pair and a distance between two joint representations corresponding to the image negative sample pair; According to the object multi-group loss and the image consistency loss, a target loss function is constructed; the parameters of the target model to be trained are adjusted by the target loss function, and training is continued based on the target model after the parameter adjustment until the stopping condition is reached, so as to obtain a trained target model, and the trained target model is used to deduplicate media data.
2. The method according to claim 1, characterized in that The target model to be trained also includes a step of acquiring a joint representation corresponding to a sample image and representing the joint structure, including: The object representation of each sample sub-image of the sample image output by the object representation structure and the image representation of the sample image extracted by the object detection module are spliced through the representation joint structure to obtain a joint representation corresponding to the sample image.
3. The method according to claim 1, characterized in that The training sample set includes a plurality of positive image sample pairs, each positive image sample pair includes two sample images having a similar relationship, and the method further includes: Extracting a training batch of positive image sample pairs from the plurality of positive image sample pairs; For each extracted positive sample pair of images, obtain the image joint representation corresponding to each sample image in each positive sample pair of images to obtain multiple positive sample joint representation pairs; For each positive sample joint representation pair, determine a negative sample joint representation from positive sample joint representation pairs other than the current positive sample joint representation pair, and construct an image representation multi-tuple based on the current positive sample joint representation pair and the negative sample joint representation; determining an image tuple loss based on the image representation tuple; The constructing a target loss function according to the object multi-group loss and the image consistency loss includes: The target loss function is constructed according to the image multi-group loss, the object multi-group loss and the image consistency loss.
4. The method according to claim 3, characterized in that The target model to be trained also includes a representation joint structure, and the step of obtaining the image joint representation corresponding to each sample image in each image positive sample pair includes: The object representation of each sample sub-image included in each sample image output by the object representation structure and the image representation of the sample image extracted by the object detection module are spliced together through the representation joint structure to obtain an image joint representation of the corresponding sample image; The image joint representation of the sample images in each image positive sample pair is taken as a positive sample joint representation pair.
5. The method according to claim 1, characterized in that The training sample set includes a plurality of positive image sample pairs, each positive image sample pair includes two sample images having a similar relationship, and constructing an object multi-tuple according to the sample sub-images includes: Extracting a training batch of positive image sample pairs from the plurality of positive image sample pairs; For each extracted positive sample pair of images, multiple positive sample pairs of objects are constructed according to the sample sub-images corresponding to each sample image in each positive sample pair of images; For each object positive sample pair, an object negative sample is determined from other sample sub-graphs except the current object positive sample pair, and an object multi-group is constructed based on the current object positive sample pair and the object negative sample.
6. The method according to claim 5, characterized in that For each object positive sample pair, determining the object negative sample from other sample sub-images except the current object positive sample pair includes: Select an anchor image from the positive sample pair of the current object, and select a candidate sample sub-image from other sample sub-images except the positive sample pair of the current object; Calculating the distance between each candidate sample sub-image and the anchor point image; According to the size of the distance, multiple candidate sample sub-graphs are sorted, and the object negative sample is determined based on the sorting result.
7. The method according to claim 1, characterized in that The method further comprises: Performing object detection on the media data to be processed by using the object detection structure in the trained target model; and dividing the media data to be processed into a plurality of object sub-graphs based on the object detection result, wherein each of the object sub-graphs corresponds to an object; Extracting the object representation of each object sub-image through the object representation structure in the trained target model; wherein the object representation extracted from the object sub-image is used to represent the hidden layer features of the object corresponding to the corresponding object sub-image; Determine target object representations corresponding to each object based on the extracted object representations; Acquire an object representation library, wherein the object representation library stores a plurality of reference object representations and a correspondence between each reference object representation and the media data to which it belongs; A reference object representation that satisfies a similarity condition with the target object representation is searched from the object representation library, and a deduplication result of the to-be-processed media data is determined according to the search result.
8. The method according to claim 7, characterized in that The media data to be processed includes a video to be processed, and object detection is performed on the media data to be processed, and the media data to be processed is divided into a plurality of object sub-graphs based on the object detection result, including: Extracting at least one frame of global image from the video to be processed; Perform object detection on each frame of the global image to obtain the feature heat map corresponding to each frame of the global image; Based on the characteristic heat map corresponding to each frame of the global image, a plurality of object sub-images are extracted from the at least one frame of the global image.
9. The method according to claim 7, characterized in that: The step of determining target object representations corresponding to respective objects based on the extracted object representations includes: Clustering the extracted object representations to obtain a first preset number of cluster centers and an object representation corresponding to each cluster center; wherein one cluster center corresponds to one object; Calculate the distance between the object representation corresponding to each cluster center and the corresponding cluster center; The object representation corresponding to each cluster center is screened according to the distance to obtain the target object representation corresponding to each object.
10. The method according to claim 7, characterized in that The steps of constructing the object representation library include: Performing object detection on each media data in the media library, and dividing the corresponding media data based on the object detection result to obtain multiple object subgraphs of the corresponding media data; Extracting an object representation of each object sub-graph of each media data; Determine, from the plurality of object representations corresponding to each media data, a reference object representation corresponding to each object; The object representation library is constructed based on each reference object representation and the corresponding relationship between each reference object representation and the media data to which it belongs.
11. The method according to claim 7, characterized in that The determining, according to the search result, a result of deduplication of the to-be-processed media data includes: When a reference object representation that satisfies a similarity condition with the target object representation is found in the object representation library, media data to which each of the found reference object representations belongs is used as similar media data to the media data to be processed; Determine the matching score of each similar media data; The similar media data are sorted according to the matching scores to obtain a sorting result, and a deduplication result of the media data to be processed is determined based on the sorting result.
12. The method according to claim 11, characterized in that The step of determining the matching score of each of the similar media data comprises: Determining a target object identifier included in both the media data to be processed and the similar media data according to the object identifier included in the media data to be processed and the object identifier included in the similar media data; Determining the category weight of each of the target object identifiers; Determine a first total number of objects included in the media data to be processed; Determine, under the same target object identifier for the media data to be processed and the similar media data, a first number of target object representations in the media data to be processed that meet a similarity condition, and a second number of target object representations in the media data to be processed that correspond to the same target object identifier; A matching score of the similar media data is determined according to the category weight, the total number of the first objects, the first number, and the second number.
13. The method according to claim 11, characterized in that The step of determining the matching score of each of the similar media data comprises: Determining a target object identifier included in both the media data to be processed and the similar media data according to the object identifier included in the media data to be processed and the object identifier included in the similar media data; Determining the category weight of each of the target object identifiers; Determine a total number of second objects of the objects included in the similar media data; Determine, under the same target object identifier for the media data to be processed and the similar media data, a first number of target object representations in the media data to be processed that meet a similarity condition, and a third number of reference object representations in the similar media data that correspond to the same target object identifier; A matching score of the similar media data is determined according to the category weight, the second total number of objects, the first number, and the third number.
14. A target model training device, characterized in that: The device comprises: An acquisition module is used to acquire a training sample set, and perform object detection on each sample image in the training sample set through the object detection structure of the target model to be trained to obtain an object detection result; A division module is used to divide each sample image based on the object detection result to obtain multiple sample sub-images; An extraction module is used to extract features from each sample sub-image through the object representation structure in the target model to be trained, so as to obtain the object representation corresponding to each sample sub-image; A construction module, used to construct an object tuple according to the sample sub-graphs, each object tuple comprising a first sample sub-graph, a second sample sub-graph belonging to the same object as the first sample sub-graph, and a third sample sub-graph belonging to a different object from the first sample sub-graph; A determination module, used to determine the object multi-group loss according to the difference between the object representation of the first sample sub-image and the object representation of the second sample sub-image, and the difference between the object representation of the first sample sub-image and the object representation of the third sample sub-image; obtain the joint representation corresponding to each of the two sample images in the image positive sample pair, and the joint representation corresponding to each of the two sample images in the image negative sample pair; the joint representation corresponding to the sample image is determined at least according to the object representation of each sample sub-image included in the sample image; based on the distance between the two joint representations corresponding to the image positive sample pair, and the distance between the two joint representations corresponding to the image negative sample pair, determine the image consistency loss; construct a target loss function according to the object multi-group loss and the image consistency loss; The training module is used to adjust the parameters of the target model to be trained through the target loss function, and continue training based on the target model after the parameter adjustment until the stopping condition is reached, so as to obtain the trained target model, and the trained target model is used to deduplicate the media data.
15. The device according to claim 14, characterized in that The target model to be trained also includes a representation joint structure, and the determination module is specifically used to: use the representation joint structure to splice the object representation of each sample sub-image of the sample image output by the object representation structure and the image representation of the sample image extracted by the object detection module to obtain a joint representation corresponding to the sample image.
16. The device according to claim 14, characterized in that The training sample set includes a plurality of image positive sample pairs, each image positive sample pair includes two sample images with a similar relationship, and the determination module is further used to: extract a training batch of image positive sample pairs from the plurality of image positive sample pairs; for each extracted image positive sample pair, obtain the image joint representation corresponding to each sample image in each image positive sample pair to obtain a plurality of positive sample joint representation pairs; for each positive sample joint representation pair, determine a negative sample joint representation from the positive sample joint representation pairs other than the current positive sample joint representation pair, and construct an image representation tuple based on the current positive sample joint representation pair and the negative sample joint representation; determining an image tuple loss based on the image representation tuple; The target loss function is constructed according to the image multi-group loss, the object multi-group loss and the image consistency loss.
17. The device according to claim 16, characterized in that The target model to be trained also includes a representation joint structure, and the determination module is specifically used to: use the representation joint structure to splice the object representation of each sample sub-image included in each sample image output by the object representation structure and the image representation of the sample image extracted by the object detection module to obtain an image joint representation of the corresponding sample image; and use the image joint representation of the sample image in each image positive sample pair as a positive sample joint representation pair.
18. The device according to claim 14, characterized in that The training sample set includes a plurality of image positive sample pairs, each image positive sample pair includes two sample images with a similar relationship, and the construction module is specifically used to extract a training batch of image positive sample pairs from the plurality of image positive sample pairs; for each extracted image positive sample pair, construct a plurality of object positive sample pairs according to the sample sub-graphs corresponding to each sample image in each image positive sample pair; For each object positive sample pair, an object negative sample is determined from other sample sub-graphs except the current object positive sample pair, and an object multi-group is constructed based on the current object positive sample pair and the object negative sample.
19. The device according to claim 18, characterized in that The construction module is specifically used to select an anchor image from the current object positive sample pair, and select a candidate sample sub-image from other sample sub-images except the current object positive sample pair; calculate the distance between each candidate sample sub-image and the anchor image; sort multiple candidate sample sub-images according to the size of the distance, and determine the object negative sample based on the sorting result.
20. The device according to claim 14, characterized in that Also includes weight removal module; The partitioning module is further used to perform object detection on the media data to be processed through the object detection structure in the trained target model, and to partition the media data to be processed based on the object detection result to obtain a plurality of object sub-graphs, wherein each object sub-graph corresponds to an object; The extraction module is also used to extract the object representation of each object sub-image through the object representation structure in the trained target model; wherein the object representation extracted from the object sub-image is used to represent the hidden layer features of the object corresponding to the corresponding object sub-image; The determination module is further used to determine the target object representations corresponding to each object based on the extracted object representations; The acquisition module is further used to acquire an object representation library, wherein the object representation library stores a plurality of reference object representations and a corresponding relationship between each reference object representation and the media data to which it belongs; The deduplication module is used to search the object representation library for a reference object representation that satisfies a similarity condition with the target object representation, and determine a deduplication result of the to-be-processed media data according to the search result.
21. The device according to claim 20, characterized in that The media data to be processed includes a video to be processed, and the division module is specifically used to extract at least one frame of global image from the video to be processed; perform object detection on each frame of the global image to obtain a feature heat map corresponding to each frame of the global image; based on the feature heat map corresponding to each frame of the global image, extract multiple object sub-images from the at least one frame of the global image.
22. The device according to claim 20, characterized in that The determination module is specifically used to: cluster the extracted object representations to obtain a first preset number of cluster centers and the object representation corresponding to each cluster center; wherein one cluster center corresponds to one object; calculate the distance between the object representation corresponding to each cluster center and the corresponding cluster center; and screen the object representation corresponding to each cluster center according to the distance to obtain the target object representation corresponding to each object.
23. The device according to claim 20, characterized in that The acquisition module is specifically used to perform object detection on each media data in the media library, and divide the corresponding media data based on the object detection result to obtain multiple object sub-graphs of the corresponding media data; Extracting an object representation of each object sub-graph of each media data; Determine, from the plurality of object representations corresponding to each media data, a reference object representation corresponding to each object; The object representation library is constructed based on each reference object representation and the corresponding relationship between each reference object representation and the media data to which it belongs.
24. The device according to claim 20, characterized in that The deduplication module is specifically configured to: when a reference object representation that satisfies a similarity condition with the target object representation is found in the object representation library, use the media data to which each of the found reference object representations belongs as similar media data to the media data to be processed; Determine the matching score of each similar media data; The similar media data are sorted according to the matching scores to obtain a sorting result, and a deduplication result of the media data to be processed is determined based on the sorting result.
25. The device according to claim 24, characterized in that The deduplication module is specifically used to: determine the target object identifier included in both the media data to be processed and the similar media data according to the object identifier included in the media data to be processed and the object identifier included in the similar media data; Determining the category weight of each of the target object identifiers; Determine a first total number of objects included in the media data to be processed; Determine, under the same target object identifier for the media data to be processed and the similar media data, a first number of target object representations in the media data to be processed that meet a similarity condition, and a second number of target object representations in the media data to be processed that correspond to the same target object identifier; A matching score of the similar media data is determined according to the category weight, the total number of the first objects, the first number, and the second number.
26. The device according to claim 24, characterized in that The deduplication module is specifically used to: determine the target object identifiers included in both the media data to be processed and the similar media data according to the object identifiers included in the media data to be processed and the object identifiers included in the similar media data; determine the category weights of the categories to which each of the target object identifiers belongs; Determine a total number of second objects of the objects included in the similar media data; Determine, under the same target object identification of the media data to be processed and the similar media data, a first number of target object representations that meet a similarity condition in the media data to be processed, and a third number of reference object representations in the similar media data that correspond to the same target object identification; determine a matching score for the similar media data based on the category weight, the total number of the second objects, the first number, and the third number.
27. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.
28. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
29. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.
Citation Information
Patent Citations
Image retrieval method based on object detection
CN107256262A
Multimedia file management system, method and device
CN107315800A
Data processing method and device and equipment
CN113705589A
Method for determining object detection model and related device
CN113887534A
Image recognition method and device, electronic equipment and readable storage medium
CN114595352A
