Image content recognition method, image recognition model training method, and medium
By training the tattoo detector using a comparative self-supervised learning method and integrating feature comparison and recognition to update the model, the problem of insufficient training data in tattoo image recognition is solved, thereby improving recognition efficiency and accuracy.
Patent Information
- Application Number
- CN202011261377.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-12
- Publication Date
- 2026-01-09
- Estimated Expiration
- 2041-02-28
AI Technical Summary
In existing technologies, deep learning-based tattoo image recognition methods rely on a large amount of tattoo data, resulting in low training efficiency and low recognition accuracy. Manual review is also inefficient and wastes human resources.
A contrastive self-supervised learning method is adopted. By fusing feature comparison to identify and update the image recognition model, a tattoo detector is trained using a small amount of tattoo data. By combining a feature extractor and a classifier, the high-level representation of the target image content is gradually learned.
It reduces the difficulty of collecting data for target image content samples, improves the training efficiency and recognition accuracy of image recognition models, and enhances the recognition efficiency of tattoo content.
Smart Images

Figure CN112257665B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of image recognition, and in particular to an image content recognition method, an image recognition model training method, and a medium. BACKGROUND
[0002] In online content review technology, the content of a video or image is reviewed to ensure that it does not contain illegal content, and then the video or image is displayed. For example, some video websites prohibit the appearance of tattoo-related content in video content.
[0003] In related technologies, a classifier is trained based on a deep learning classification method to detect whether a tattoo exists in an image. Alternatively, artificial review is used to determine whether a video or image content includes a tattoo.
[0004] However, this training method relies on a large amount of tattoo data, but it is difficult to collect online tattoo data, and the training method has limitations. The training efficiency of the classifier is low, and the classifier trained by a small amount of tattoo data has low recognition accuracy. Artificial review for identification results in low identification efficiency and waste of human resources. SUMMARY
[0005] Embodiments of the present application provide an image content recognition method, an image recognition model training method, and a medium, which can improve the training efficiency of the image recognition model. The technical solution is as follows:
[0006] In one aspect, an image content recognition method is provided, which includes:
[0007] inputting a target image into an image recognition model to obtain a target feature;
[0008] inputting the target feature into a detector to obtain a target detection result, the detector being configured to determine a target image content inclusion in the target image according to the target feature;
[0009] The image recognition model is obtained by comparing and recognizing the fusion feature, and the image recognition model is updated according to the comparison and recognition result until the image recognition model converges.
[0010] In another aspect, an image recognition model training method is provided, which is used for recognizing target image content and applied to a computer device, and includes:
[0011] obtaining a training image set, the training image set including a first training image and a second training image;
[0012] extracting first features of the first training image and second features of the second training image through the image recognition model;
[0013] identifying a first recognition result of the first features and a second recognition result of the second features, the image recognition model being configured to recognize target image content;
[0014] performing comparison recognition on fused features of the first features and the second features to obtain a third recognition result;
[0015] training the image recognition model based on a loss value obtained from the first recognition result, the second recognition result and the third recognition result.
[0016] In an optional embodiment, the comparison recognition on the fused features of the first features and the second features to obtain the third recognition result comprises:
[0017] performing first comparison recognition on the fused features to obtain a first comparison recognition result, the first comparison recognition result being configured to represent a similarity of the target image content in the first training image and the second training image.
[0018] In an optional embodiment, the comparison recognition on the fused features of the first features and the second features to obtain the third recognition result comprises:
[0019] performing second comparison recognition on the fused features to obtain a second comparison recognition result, the second comparison recognition result being configured to represent a size relationship between a corresponding size of the target image content in the first training image and a corresponding size of the target image content in the second training image.
[0020] In an optional embodiment, the training of the image recognition model based on the loss value obtained from the first recognition result, the second recognition result and the third recognition result comprises:
[0021] inputting the first recognition result, the second recognition result and the third recognition result into a preset loss function to obtain the loss value;
[0022] training the image recognition model based on the loss value.
[0023] In an optional embodiment, the inputting of the first recognition result, the second recognition result and the third recognition result into the preset loss function to obtain the loss value comprises:
[0024] inputting the first recognition result into the preset loss function to obtain a first loss value;
[0025] inputting the second recognition result into the preset loss function to obtain a second loss value;
[0026] inputting the third recognition result into the preset loss function to obtain a third loss value;
[0027] determining the loss value based on the first loss value, the second loss value and the third loss value.
[0028] In an optional embodiment, the image recognition model comprises model parameters;
[0029] The method further comprises:
[0030] adjusting the model parameters according to the loss value.
[0031] In an optional embodiment, the training image set comprises training images labeled with a first label for the target image content;
[0032] The method further comprises:
[0033] segmenting a third training image labeled with the first label to obtain at least two image regions based on the display region of the target image content;
[0034] recombining the at least two image regions to obtain an updated training image;
[0035] adding the updated training image to the training image set as the training image labeled with the first label.
[0036] In an optional embodiment, the method further comprises:
[0037] obtaining an expanded image set;
[0038] inputting an expanded image in the expanded image set into the image recognition model to obtain a recognition result, the expanded image being an image not labeled with a second label, the second label being used to indicate the inclusion of the target image content;
[0039] labeling the expanded image in the expanded image set with the second label according to the recognition result;
[0040] adding the expanded image labeled with the second label to the training image set.
[0041] In another aspect, an image content recognition device is provided, the device comprising:
[0042] an input module, configured to input a target image into an image recognition model to obtain a target feature;
[0043] an output module, configured to input the target feature into a detector to obtain a target detection result, the detector being configured to determine whether a target image content in the target image is contained according to the target feature;
[0044] a training module, configured to train the image recognition model, wherein the image recognition model is obtained by comparing and recognizing a fused feature, and the image recognition model is updated according to a result of the comparison and recognition until the image recognition model converges.
[0045] In another aspect, a training device of an image recognition model is provided, applied to a computer device, and the device comprises:
[0046] an acquisition module, configured to acquire a training image set, the training image set comprising a first training image and a second training image;
[0047] a feature extraction module, configured to extract a first feature of the first training image and a second feature of the second training image by using the image recognition model;
[0048] an identification module, configured to identify a first identification result of the first feature and a second identification result of the second feature, the image recognition model being configured to identify a target image content;
[0049] the identification module is further configured to compare and recognize a fused feature obtained by fusing the first feature and the second feature to obtain a third identification result;
[0050] a training module, configured to obtain a loss value based on the first identification result, the second identification result and the third identification result, and train the image recognition model.
[0051] In another aspect, a computer device is provided, comprising a processor and a memory, the memory storing at least one instruction, at least one program, a code set or an instruction set, the at least one instruction, the at least one program, the code set or the instruction set being loaded and executed by the processor to implement the image content identification method according to any one of the above embodiments of the present application, or to implement the training method of the image recognition model according to the above embodiments of the present application.
[0052] In another aspect, a computer-readable storage medium is provided, the computer-readable storage medium storing at least one program code, the program code being loaded and executed by a processor to implement the image content recognition method according to any one of the above embodiments of the present application, or to implement the image recognition model training method according to the above embodiments of the present application.
[0053] In another aspect, a computer program product or computer program is provided, the computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the image content recognition method according to any one of the above embodiments, or to implement the image recognition model training method according to the above embodiments of the present application.
[0054] The technical solutions provided by the embodiments of the present application have at least the following beneficial effects:
[0055] By inputting the target image into the image recognition model for target image content detection, a detection result is obtained. The image recognition model is obtained by comparing and recognizing the fusion features and is obtained through multiple updates. In the training process, the data collection difficulty of the target image content sample is reduced, the training efficiency of the image recognition model is improved, and the accuracy of the target image recognition is also improved. BRIEF DESCRIPTION OF DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0057] Figure 1 is a flowchart of an image content recognition method provided by an exemplary embodiment of the present application;
[0058] Figure 2 is a flowchart of an image recognition model training method provided by an exemplary embodiment of the present application;
[0059] Figure 3 is a structural schematic diagram of an image recognition model in a training process provided by an exemplary embodiment of the present application;
[0060] Figure 4 is a flowchart of a training image expansion method provided by an exemplary embodiment of the present application;
[0061] Figure 5An image segmentation method provided by an example embodiment of the present application is provided.
[0062] Figure 6 An image segmentation method provided by another example embodiment of the present application is provided.
[0063] Figure 7 A flowchart of a training method of an image recognition model provided by another example embodiment of the present application is provided.
[0064] Figure 8 An initial image recognition model schematic diagram provided by an example embodiment of the present application is provided.
[0065] Figure 9 An image recognition model schematic diagram provided by an example embodiment of the present application is provided.
[0066] Figure 10 A flowchart of an image recognition model training provided by an example embodiment of the present application is provided.
[0067] Figure 11 A structural block diagram of an image content recognition device provided by an example embodiment of the present application is provided.
[0068] Figure 12 A structural block diagram of an image content recognition device provided by another example embodiment of the present application is provided.
[0069] Figure 13 A structural block diagram of a training device of an image recognition model provided by an example embodiment of the present application is provided.
[0070] Figure 14 A structural schematic diagram of a computer device provided by an example embodiment of the present application is provided. DETAILED DESCRIPTION
[0071] In order to make the purpose, technical solutions and advantages of the present application clearer, the embodiments of the present application will be further described in detail below with reference to the drawings.
[0072] First, the terms involved in the embodiments of the present application are briefly introduced:
[0073] Artificial intelligence (AI) is to use digital computers or digital computer controlled machines to simulate, extend and expand human intelligence, perceive environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science, which tries to understand the essence of intelligence and produce a new intelligent machine that can react in a similar way to human intelligence. Artificial intelligence is to design and implement principles and methods of various intelligent machines, so that machines have the functions of perception, reasoning and decision making.
[0074] Artificial intelligence technology is a comprehensive discipline, involving a wide range of fields, both hardware and software level technology. Artificial intelligence basic technology generally includes, such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology and machine learning / deep learning and other major directions.
[0075] Computer vision (CV) is a science that studies how to make machines "see". Further, it refers to using cameras and computers to replace human eyes to identify and measure targets, and further process graphics, so that computer processing becomes more suitable for human eye observation or image transmission to instrument detection. As a scientific discipline, computer vision researches related theories and technologies, and tries to establish artificial intelligence systems that can obtain information from images or multidimensional data. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, optical character recognition (OCR), video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, three-dimensional technology, virtual reality, augmented reality, simultaneous localization and mapping, and other technologies, as well as common face recognition, fingerprint recognition and other biometric identification technologies.
[0076] Natural language processing (NLP) is an important direction in the field of computer science and artificial intelligence. It studies various theories and methods that can realize effective communication between people and computers using natural language. Natural language processing is a science that integrates linguistics, computer science and mathematics. Therefore, the research in this field will involve natural language, i.e. the language used in daily life, so it is closely related to the study of linguistics. Natural language processing technology usually includes text processing, semantic understanding, machine translation, robot question and answer, knowledge graph and other technologies.
[0077] Machine Learning (ML) is a multi-disciplinary subject, involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory, etc. It is a specialized study of how computers simulate or implement human learning behavior to acquire new knowledge or skills, reorganize existing knowledge structure to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental approach to making computers intelligent. Its applications are widespread in various fields of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and teaching learning.
[0078] Contrastive Self-supervised Learning is a machine learning technique that constructs representations by learning to encode the similarity or dissimilarity of two things. It mainly realizes self-supervised learning by constructing positive and negative samples, and then measuring the distance between positive and negative samples. In the embodiment, a small amount of images containing target image content are obtained as positive samples, and a large number of negative samples are obtained compared with the positive samples. The image recognition model is continuously updated through the feature comparison and recognition result between the positive and negative samples until the image recognition model converges. The training of the image recognition model is completed through the contrastive self-supervised learning technique.
[0079] The scheme provided in the embodiments of the present application relates to natural language processing and machine learning of artificial intelligence, etc. The training method of the image recognition model provided in the present application can be applied to the following scenarios:
[0080] The training method of the image recognition model can be applied in scenarios where training data is difficult to collect, the amount of training data is small, and the texture of the recognized target image content is simple. For example, the training of a traffic sign recognition model, the training of a handwritten character recognition model, the training of a tattoo content recognition model in a video or image, etc.
[0081] In the embodiments of the present application, the training method of the image recognition model is used to train a tattoo recognition model as an example for illustrative description. In the related art, the classification method based on deep learning is mainly used, that is, a classifier or detector based on deep learning method is trained to directly determine whether there is a tattoo pattern in the image and determine the position of the tattoo. This method is very dependent on the construction of training data, and a large amount of tattoo and non-tattoo training data is required. Since it is very difficult to collect tattoo data on the line, the existing method has poor effect and great limitations, and the detection and recognition result of the tattoo pattern content in the online image and video is not robust.
[0082] In the embodiment of the present application, when the tattoo recognition model is trained, the final model needs to classify the input image, that is, determine the label of the image, and the label set includes two categories of "with tattoo" and "without tattoo". In the training process, a part of images containing tattoo pattern content and non-tattoo pattern content are collected first, and the part of image set is used as training image to train a simple tattoo detector, wherein the tattoo detector includes two parts of feature extractor and classifier, and the simple tattoo detector is used to label the tattoo pattern content of the collected expansion image set, and the images with tattoo pattern content in the expansion image set are roughly labeled, and the images in the expansion image set are added to the training image set. Two training images in the training image set are randomly selected and input into the feature extractor to extract the corresponding features, and the features are identified to obtain the identification results corresponding to the two images respectively, then the features of the two images are fused to obtain the fusion features, and the fusion features are identified to obtain another identification result, and the parameters of the feature extractor are updated according to the three identification results, until the network of the whole tattoo recognition model converges, and the tattoo recognition model training is completed. That is, by using the contrast self-supervised learning method to understand the content of the video or image, the collection problem of training data is greatly reduced. Through the contrast learning and self-supervised method, more effective visual high-level expression of tattoo can be learned on limited training data, the data collection difficulty of target image content sample is reduced, the training efficiency of image recognition model is improved, and then whether the target image contains tattoo pattern content can be more accurately judged, and the recognition efficiency of tattoo content recognition is improved.
[0083] In combination with the above introduction of terms and description of application scenarios, the image content recognition method in the embodiment of the present application is described, Figure 1 The image content recognition method provided by an example embodiment of the present application is shown in the flowchart, and the method comprises:
[0084] Step 101, input the target image into the image recognition model to obtain the target feature.
[0085] The image recognition model includes a feature extractor and a detector. After the target image is input into the image recognition model, the target feature is obtained through the feature extractor.
[0086] Illustratively, the target image is an image used to detect whether the target image content exists. When the video needs to be detected for target image content, the video is frame extracted to obtain video frames, and then the video frames are input into the image recognition model one by one for recognition.
[0087] The image recognition model is obtained by comparing and identifying the fusion features, and updating the image recognition model according to the comparison and identification results until the image recognition model converges.
[0088] The training method of the feature extractor includes: inputting the first training image and the second training image into the image recognition model that has been preliminarily trained, obtaining the first feature of the first training image and the second feature of the second training image by the feature extractor, performing feature fusion on the first feature and the second feature to obtain a fused feature, detecting the first feature, the second feature and the fused feature by different classifiers, obtaining a first recognition result from the first feature, a second recognition result from the second feature, and a third recognition result from the fused feature, and training the image recognition model based on the loss values of the first recognition result, the second recognition result and the third recognition result, that is, updating the parameters of the feature extractor, and the feature extractor gradually learns the high-level expression of the target image content in repeated updates.
[0089] The feature extractor can be constructed according to a preset network layer number by at least one of ResNet, VGGNet, DenseNet, SENet and MobileNet. The features extracted by the feature extractor include at least one of texture features, color features, shape features, edge features and position features.
[0090] In step 102, the target feature is input into the detector to obtain a target detection result.
[0091] In the image recognition model, the target feature obtained by the feature extractor is input into the detector to obtain a target detection result. The detector is used to determine whether the target image content is contained in the target image according to the target feature. Illustratively, when the target image content is contained in the target image, the detector outputs 1, and when the target image content is not contained in the target image, the detector outputs 0.
[0092] The detector is a classifier of the image recognition model in the training process, that is, a classifier for recognizing the first feature or the second feature. Illustratively, the classifier is modeled by a SoftMax model. In the training process, the first feature is input into the classifier, the first feature is classified and predicted by the classifier, and a first recognition result is obtained. In the application process, the target feature is input into the detector, the target feature is classified and predicted by the detector, and a target detection result is obtained. The outputs of the two processes represent whether the image input into the model contains the target image content.
[0093] In summary, the image content recognition method provided in the embodiment can improve the recognition efficiency and accuracy of the target image content recognition by using the image recognition model obtained by the training method of the image recognition model.
[0094] Please refer toFigure 2 It shows a flowchart of a training method of an image recognition model provided by an embodiment of the present application. The method is applied to a computer device, which can be a server, a smartphone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, a vehicle-mounted computer, etc. The method comprises:
[0095] In step 201, a training image set is obtained, which comprises first training images and second training images.
[0096] In the embodiment of the present application, the training image set comprises training images with target image content and training images without target image content. Illustratively, the first training image and the second training image are two random training images in the training image set, i.e. the possible relationship between the two images includes: both the first training image and the second training image are training images with target image content, and the target image content of the two images is the same; both the first training image and the second training image are training images with target image content, but the target image content of the two images is different; one of the first training image and the second training image has target image content, and the other does not have target image content; neither the first training image nor the second training image has target image content. Optionally, two training images are determined from the training image set as the first training image and the second training image in a preset selection manner. In one example, the similarity of a training image pair is obtained, and when the similarity of the training image pair meets a preset threshold, the above training image pair is determined as the first training image and the second training image.
[0097] Illustratively, the target image content can be a tattoo pattern, a traffic sign pattern, a handwritten character, etc.
[0098] In step 202, a first feature of the first training image and a second feature of the second training image are extracted by an image recognition model.
[0099] The image recognition model is used to identify target image content. Illustratively, the image recognition model comprises a feature extractor, a classifier and a feature fusion module. After inputting an image into the image recognition model, it can output whether the image contains target image content.
[0100] In the embodiment of the present application, the first training image is input into the feature extractor in the image recognition model to obtain the first feature. The second training image is input into the feature extractor in the image recognition model to obtain the second feature.
[0101] Illustratively, the image recognition model is a preliminary trained model, the preliminary training includes manually labeling the training images containing the target image content in a small amount of training images, in an example, the position of the target image content in the training images is labeled manually; training an initial image recognition model using the training images labeled manually, the initial image recognition model learns the features of the target image content, such as texture features and shape features, from the training images.
[0102] In step 203, a first recognition result of the first feature and a second recognition result of the second feature are identified.
[0103] The first feature is input into the feature extractor to obtain the first recognition result, and the second feature is input into the feature extractor to obtain the second recognition result. The first recognition result is used to indicate whether the target image content exists in the first training image, and the second recognition result is used to indicate whether the target image content exists in the second training image. Illustratively, the classifier is modeled by a SoftMax model. The first feature is input into the classifier, and the first feature is classified and predicted by the classifier to obtain the first recognition result; the second feature is input into the classifier, and the second feature is classified and predicted by the classifier to obtain the second recognition result. Illustratively, when the output of the classifier is 1, it indicates that the input training image contains the target image content; when the output of the classifier is 0, it indicates that the input training image does not contain the target image content.
[0104] In step 204, a third recognition result is obtained by comparing and identifying the fused feature after the fusion of the first feature and the second feature.
[0105] In the embodiments of the present application, the first feature and the second feature are fused to obtain a corresponding fused feature, and the fused feature is input into the classifier for comparison and identification to obtain the third recognition result.
[0106] Illustratively, the feature fusion method can be feature subtraction of the first feature and the second feature, and the intermediate feature obtained by feature subtraction is input into a plurality of convolution layers to output the fused feature. The feature fusion method can also be to splice the first feature and the second feature in the channel dimension to obtain an intermediate feature, and input the intermediate feature into a plurality of convolution layers to output the fused feature.
[0107] In the embodiments of the present application, the fused feature is input into the classifier for comparison and identification to obtain the third recognition result, and illustratively, the classifier can be the same as or different from the classifier directly input by the first feature and the second feature. Optionally, the fused feature is input into a classifier to directly obtain the third recognition result, and the third recognition result is used to indicate whether the image represented by the fused feature contains the target image content.
[0108] Optionally, the fusion feature is input into a first sub-classifier to perform first comparison recognition on the fusion feature, and a first comparison recognition result is output from the first sub-classifier; the fusion feature is input into a second sub-classifier to perform second comparison recognition on the fusion feature, and a second comparison recognition result is output from the second sub-classifier. The first comparison recognition result is used to represent the similarity of the target image content in the first training image and the second training image, that is, to judge whether the contained conditions are the same. Illustratively, when the first training image and the second training image contain the same target image content, the output first comparison recognition result corresponds to 1; when neither the first training image nor the second training image includes the target image content, the output first comparison recognition result is 1; when the target image content in the first training image is different from the target image content in the second training image, the output first comparison recognition result is 0; when only one of the first training image and the second training image contains the target image content, the output first comparison recognition result is 0. The second comparison recognition result is used to represent the size relationship between the corresponding size of the target image content in the first training image and the corresponding size of the target image content in the second training image. Illustratively, when the first training image and the second training image contain the same target image content, and the target image content in the first training image is smaller than the target image content in the second training image, the output second comparison recognition result is 1; when the first training image does not contain the target image content, and the second training image contains the target image content, the output second comparison recognition result is 1; in other cases, the output second comparison recognition result is 0. Illustratively, the third recognition result is composed of the first comparison recognition result and the second comparison recognition result.
[0109] In step 205, a loss value is obtained based on the first recognition result, the second recognition result and the third recognition result, and the image recognition model is trained.
[0110] In the embodiments of the present application, the first recognition result, the second recognition result and the third recognition result are input into a preset loss function for calculation to obtain a loss value, and the image recognition model is trained based on the loss value. Optionally, the first recognition result, the second recognition result and the third recognition result are input into one preset loss function to obtain a corresponding loss value, and the image recognition model is trained based on the loss value. Optionally, the first recognition result, the second recognition result and the third recognition result are respectively input into three different preset loss functions. That is, the first recognition result is input into a preset loss function to obtain a first loss value; the second recognition result is input into a preset loss function to obtain a second loss value; the third recognition result is input into a preset loss function to obtain a third loss value; finally, the loss value is determined based on the first loss value, the second loss value and the third loss value, and the image recognition model is trained based on the loss value.
[0111] The image recognition model comprises model parameters, and the model parameters are adjusted according to the loss value to achieve the purpose of training the image recognition model. Illustratively, the feature extractor in the image recognition model is trained. The feature extractor corresponds to feature extraction parameters, and the feature extraction parameters are adjusted based on the loss value, that is, the feature extractor is updated, and the image recognition model with the updated feature extractor is used to re-identify and label the training image. The above training process is repeated until the image recognition model converges, and the training process ends, and the image recognition model for identifying the content of the target image is obtained.
[0112] Please refer to Figure 3 which shows the structure diagram of the image recognition model in the training process. The training image A 301 and the training image B 302 are input into the feature extractor 303 for feature extraction to obtain the first feature and the second feature. The first feature corresponding to the training image A 301 is input into the classifier FC1 304 to obtain the first recognition result. The second feature corresponding to the training image B 302 is input into the classifier FC2 305 to obtain the second recognition result. The first feature and the second feature are input into the feature fusion module 306 to obtain the fusion feature, and the fusion feature is input into the classifier FC3 307 and the classifier FC4 308 respectively to obtain the first comparison recognition result and the second comparison recognition result. The loss value obtained based on the first recognition result, the second recognition result, the first comparison recognition result and the second comparison recognition result is used to update the parameters of the feature extractor 303 to realize the training of the image recognition model.
[0113] In summary, the method provided by the embodiment, by identifying the first training image in the training image set to obtain the first recognition result, identifying the second training image to obtain the second recognition result, and fusing the features of the first training image and the second training image to obtain the third recognition result, training the image recognition model based on the loss value obtained from the first recognition result, the second recognition result and the third recognition result until the image recognition model converges. That is, by comparing and identifying the fused features, and updating the image recognition model through the recognition result, the difficulty of collecting data of the target image content sample is reduced, and the training efficiency of the image recognition model is improved.
[0114] Please refer to Figure 4 which shows the training image expansion method flowchart provided by the embodiment of the present application, and the method comprises:
[0115] Step 401, for the third training image labeled with the first label, the display area of the target image content is taken as the reference to segment to obtain at least two image regions.
[0116] In the embodiments of the present application, the training image set includes training images with target image content and training images without target image content, wherein the training images with target image content are labeled with a first label, that is, the training images in the training image set containing target image content are labeled with a first label.
[0117] Illustratively, the third training image labeled with the first label is segmented based on the display area of the target image content to obtain at least two image regions. Optionally, please refer to Figure 5 which shows a segmentation method. The third training image 500 contains target image content, and the display area of the target image content is framed by a detection frame 501, wherein the detection frame also records the coordinate values of the upper left corner and the lower right corner of the rectangular frame. The third training image 500 is subjected to a preset segmentation operation to obtain the segmented regions 502 (S1, S2, S3, S4, S5, S6, S7, S8) and the detection frame 501 region (annotated as X in the figure) as shown in Figure 5
[0118] Optionally, please refer to Figure 6 which shows another segmentation method. The third training image 600 contains target image content, and the display area of the target image content is framed by a detection frame 601. The third training image 600 is subjected to a random segmentation operation according to a preset segmentation number to obtain the segmented regions 602 and the detection frame 601 region as shown in Figure 6
[0119] Step 402, recombining the at least two image regions to obtain updated training images.
[0120] In the embodiments of the present application, the at least two image regions segmented by the preset segmentation operation in the above segmentation method are recombined to obtain at least one updated training image.
[0121] Illustratively, the segmented regions 502 and the detection frame 501 region in Figure 5 are recombined, for example, the upper, lower, left and right four blocks of the detection frame 501 region are combined with the detection frame 501 region to form image blocks, and their combination is: updated training image 1=S2+X; updated training image 2=S4+X; updated training image 3=S5+X; updated training image 4=S7+X. Then the four corners of the detection frame 501 region are combined with the image blocks formed by the detection frame 501 region, that is, the smallest rectangular blocks containing them, to form: updated training image 5=S1+S2+S4+X; updated training image 6=S2+S3+S5+X; updated training image 7=S4+S6+S7+X; updated training image 8=S5+S7+S8+X. That is, one third training image is segmented and recombined to obtain eight updated training images.
[0122] Step 403, add the updated training image to the training image set as a training image labeled with the first label.
[0123] The updated training image obtained by the segmentation and reorganization is added to the training image set as a training image labeled with the first label, and is also used to train the image recognition model.
[0124] In summary, the method provided by the embodiment increases the number of positive samples in contrast self-supervised learning by implementing image enhancement on the training image containing target image content through segmentation and reorganization, provides sufficient training images for the training of the image recognition model, and enables the image recognition model to be trained to obtain a higher layer expression for the target image content, thereby improving the training efficiency of the image recognition model and the recognition accuracy of the image recognition model for the target image content.
[0125] Figure 7 is a flowchart of a method for training an image recognition model provided by another exemplary embodiment of the present application, which comprises:
[0126] Step 701, train an initial image recognition model.
[0127] In the embodiment of the present application, before training the image recognition model, a part of images containing target image content and images not containing target image content are collected. Illustratively, the images containing target image content are set as image set T, and the images not containing target image content are set as image set N, wherein the number of images corresponding to image set T is less than the number of images corresponding to image set N. The position of the target image content in image set T is manually labeled by a rectangular frame, i.e., a rectangular frame is used to enclose the position of the target image content in the image, and the rectangular frame can be represented by the coordinates of the upper left corner and the lower right corner in the image. The number of image set T is small, and the process of manual labeling is not very complex.
[0128] Image set T and image set N are used as an initial training image set to train an initial image recognition model. Please refer to Figure 8 The initial image recognition model 800 comprises a feature extractor 801 and a detector 802. The feature extractor 801 is used to obtain the global features of an input image, and then input the global features into the detector 802 to estimate the coordinate values of the detection frame corresponding to the target image content by the detector 802.
[0129] Then, an expanded image set U803 is obtained. The expanded image set U is an image set without labels indicating whether target image content exists. The expanded images in the expanded image set are input into the initial image recognition model 800 to obtain recognition results. The expanded images are images without second labels indicating whether target image content exists in the test images. According to the recognition results, the second labels of the expanded images in the expanded image set are labeled. When the test images contain target image content, the second labels are set to correspond to the existence of target image content, and the positions of the target image content are labeled using a rectangular frame. When the test images do not contain target image content, the second labels are set to correspond to the non-existence of target image content. The expanded images are added to the initial training image set to obtain a training image set, that is, a training image set composed of the image set T, the image set N, and the expanded image set U.
[0130] In step 702, the training image set is expanded.
[0131] In the embodiments of the present application, the method of expanding the training image set can include at least one of the following methods:
[0132] First, the training images containing target image content in the training image set are segmented and recombined to obtain updated training images, and the updated training images are added to the training image set. This method is the same as the methods described in steps 301, 302, and 303, and will not be repeated here.
[0133] Second, the training images containing target image content in the training image set are horizontally flipped to obtain first updated training images, and the training images containing target image content in the training image set are rotated by a preset angle to obtain second updated training images. The first updated training images and the second updated training images are added to the training image set.
[0134] Third, noise is added to the training images containing target image content in the training image set to obtain updated training images. Illustratively, the added noise can be salt and pepper noise, Gaussian noise, Rayleigh noise, etc., which are not limited here. The training images with added noise are added to the training image set as updated training images.
[0135] Fourth, the training images in the training image set that exist target image content are modified in brightness or saturation, and the brightness of the training image is increased to a first brightness value to obtain a first updated training image, and the brightness of the same training image is reduced to a second brightness value to obtain a second updated training image; or, the saturation of the training image is increased to a first saturation value to obtain a first updated training image, and the saturation of the same training image is reduced to a second saturation value to obtain a second updated training image. The first updated training image and the second updated training image are added to the training image set.
[0136] Step 703, training the image recognition model based on the loss value obtained from the first recognition result, the second recognition result and the third recognition result until convergence.
[0137] In the embodiments of the present application, the method provided by the embodiments expands the initial image recognition model to obtain a model network structure as shown in Figure 3 The training image A and the training image B are randomly obtained from the training image set obtained by expansion, the training image A is input into the feature extractor to obtain the first feature, the first feature passes through the classifier FC1 to obtain the first recognition result; the training image B is input into the feature extractor to obtain the second feature, the second feature passes through the classifier FC2 to obtain the second recognition result; the first feature and the second feature are fused to obtain the fusion feature, and the fusion feature is input into the classifiers FC3 and FC4 respectively to obtain the first comparison recognition result and the second comparison recognition result, and the first comparison recognition result and the second comparison recognition result are determined as the third recognition result; the first recognition result, the second recognition result and the third recognition result are input into the preset loss function to obtain the loss value, and the loss value is used in the process of adjusting the model parameters of the image recognition model to realize the training of the image recognition model.
[0138] When the model parameters are updated by the recognition results of the training image pairs in the training image set, a new image recognition model for image content recognition is obtained, please refer to Figure 9 The image recognition model 900 includes a feature extractor 901 and a classifier FC1 902. The training images in the training image set 903 are input into the image recognition model 900 one by one, the target image content recognition of the training images in the training image set is performed again, and the second label is labeled, that is, the image set with target image content and the image set without target image content are re-determined, and the target image content position of the image set determined to exist target image content is labeled. The training images labeled as existing target image content are expanded as in step 702 to obtain a new training image set, and the new training image set is input into Figure 3The model network structure shown is retrained on the image recognition model by the loss value, wherein the feature extractor in the current corresponding model network structure is the feature extractor after corresponding parameter update. The above operation is repeatedly performed until the obtained loss value reaches a preset condition, that is, the trained image recognition model converges, the training is ended, and the feature extractor and the classifier FC1 in the final image recognition model are taken as the detector of the target image content.
[0139] Reference is made to Figure 10 which shows a flowchart of image recognition model training corresponding to the embodiments of the present application. First, training images are collected 1001 to obtain image set T, image set N and expanded image set U; then an initial image recognition model is trained 1002; the training image set is expanded, that is, the training image is enhanced 1003; a model based on contrast self-supervised learning is constructed 1004, that is, an image recognition model; the training image set is input into the above model, and the initial image recognition model is updated 1005; the above processes of 1002 to 1005 are repeated until the image recognition model converges.
[0140] In summary, the method provided in the embodiments expands the training image set, inputs the training images in the expanded training image set into the image recognition model, obtains the loss value, updates the image recognition model based on the loss value, re-labels the training images in the training image set by the updated image recognition model, and expands again. The above process is repeated for the new training image set, the image recognition model is continuously updated, and a model for image recognition processing of target image content is obtained. That is, more effective visual high-level expression of target image content is learned from limited training images, the data collection difficulty of target image content samples is reduced, and the training efficiency of the image recognition model is improved.
[0141] Figure 11 is a structural block diagram of an image content recognition device provided by an exemplary embodiment of the present application. The device comprises:
[0142] The input module 1110 is configured to input a target image into an image recognition model to obtain a target feature.
[0143] The output module 1120 is configured to input the target feature into a detector to obtain a target detection result, and the detector is configured to determine a target image content inclusion in the target image according to the target feature.
[0144] The training module 1130 is configured to train the image recognition model, wherein the image recognition model is obtained by comparing and recognizing the fused features, and updating the image recognition model according to the comparison and recognition result until the image recognition model converges.
[0145] In an optional embodiment, referring to Figure 12 The training module 1130 includes:
[0146] An acquisition unit 1131 configured to acquire a training image set, the training image set including a first training image and a second training image;
[0147] A feature extraction unit 1132 configured to extract a first feature of the first training image and a second feature of the second training image by using the image recognition model;
[0148] An identification unit 1133 configured to identify a first identification result of the first feature and a second identification result of the second feature;
[0149] The identification unit 1133 is configured to perform comparison identification on a fused feature obtained by fusing the first feature and the second feature, to obtain a third identification result;
[0150] A training unit 1134 configured to obtain a loss value based on the first identification result, the second identification result, and the third identification result, and train the image recognition model.
[0151] In an optional embodiment, the identification unit 1133 further includes:
[0152] An identification subunit 11331 configured to perform first comparison identification on the fused feature, to obtain a first comparison identification result, the first comparison identification result being used to represent a similarity of the target image content in the first training image and the second training image.
[0153] In an optional embodiment, the identification subunit 11331 is further configured to perform second comparison identification on the fused feature, to obtain a second comparison identification result, the second comparison identification result being used to represent a size relationship between a corresponding size of the target image content in the first training image and a corresponding size of the target image content in the second training image.
[0154] In an optional embodiment, the training unit 1134 further includes:
[0155] A determination subunit 11341 configured to input the first identification result, the second identification result, and the third identification result into a preset loss function, to obtain the loss value;
[0156] The training unit 1134 is further configured to train the image recognition model based on the loss value.
[0157] In an optional embodiment, the determining sub-unit 11341 is further configured to input the first recognition result into the preset loss function to obtain a first loss value.
[0158] The determining sub-unit 11341 is further configured to input the second recognition result into the preset loss function to obtain a second loss value.
[0159] The determining sub-unit 11341 is further configured to input the third recognition result into the preset loss function to obtain a third loss value.
[0160] The determining sub-unit 11341 is further configured to determine the loss value based on the first loss value, the second loss value, and the third loss value.
[0161] In an optional embodiment, the image recognition model includes model parameters.
[0162] The training unit 1134 is further configured to adjust the model parameters according to the loss value.
[0163] In an optional embodiment, the training image set contains training images of the target image content, and the training images are labeled with a first label.
[0164] The apparatus further includes:
[0165] An image segmentation unit 1135 is configured to segment a third training image labeled with the first label based on a display area of the target image content to obtain at least two image regions.
[0166] An image recombination unit 1136 is configured to recombine the at least two image regions to obtain an updated training image.
[0167] An image updating unit 1137 is configured to add the updated training image to the training image set as the training image labeled with the first label.
[0168] In an optional embodiment, the obtaining unit 1131 is further configured to obtain an expanded image set.
[0169] The recognition unit 1133 is further configured to input an expanded image in the expanded image set into the image recognition model to obtain a recognition result, the expanded image being an image not labeled with a second label, and the second label being used to indicate a containing condition of the target image content.
[0170] The training module 1130 further includes:
[0171] The labeling unit 1138 is configured to label the expanded image in the expanded image set with the second label according to the identification result.
[0172] The image updating unit 1137 is further configured to add the expanded image labeled with the second label to the training image set.
[0173] In summary, the device provided by the embodiments of the present application improves the identification efficiency and accuracy of the target image content identification by using the image identification model obtained by the training device of the image identification model to identify the target image content of the target image and determine whether the target image content exists in the target image.
[0174] Figure 13 is a structural block diagram of the training device of the image identification model provided by an exemplary embodiment of the present application. The device comprises:
[0175] The acquisition module 1310 is configured to acquire a training image set, wherein the training image set comprises a first training image and a second training image.
[0176] The feature extraction module 1320 is configured to extract a first feature of the first training image and a second feature of the second training image by using the image identification model.
[0177] The identification module 1330 is configured to identify a first identification result of the first feature and a second identification result of the second feature, and the image identification model is configured to identify target image content.
[0178] The identification module 1330 is further configured to compare and identify a fused feature obtained by fusing the first feature and the second feature to obtain a third identification result.
[0179] The training module 1340 is configured to obtain a loss value based on the first identification result, the second identification result and the third identification result, and train the image identification model.
[0180] In summary, the device provided by the embodiments of the present application reduces the data collection difficulty of the target image content sample, improves the training efficiency of the image identification model, and improves the identification efficiency and accuracy of the target image content identification by comparing and identifying the fused feature, and updating the image identification model by using the identification result.
[0181] The application further provides a computer device, comprising a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to implement the training method of the image recognition model provided in each of the above method embodiments, or implement the image content recognition method provided in the embodiments of the application. It should be noted that the computer device can be as follows Figure 13 The provided computer device.
[0182] Please refer to Figure 14 which shows a structural schematic diagram of the computer device provided in an exemplary embodiment of the application. Specifically, the computer device 1400 comprises a central processing unit (CPU) 1401, a system memory 1404 comprising a random access memory (RAM) 1402 and a read only memory (ROM) 1403, and a system bus 1405 connecting the system memory 1404 and the central processing unit 1401. The computer device 1400 further comprises a basic input / output system 1406 helping to transmit information between various devices in the computer, and a mass storage device 1407 for storing an operating system 1413, application programs 1414 and other program modules 1415.
[0183] The basic input / output system 1406 comprises a display 1408 for displaying information and an input device 1409 such as a mouse, a keyboard or the like for inputting information by a user. The display 1408 and the input device 1409 are both connected to the central processing unit 1401 through an input / output controller 1410 connected to the system bus 1405. The basic input / output system 1406 can further comprise the input / output controller 1410 for receiving and processing inputs from a keyboard, a mouse, or an electronic stylus and the like. Similarly, the input / output controller 1410 also provides outputs to a display screen, a printer or other types of output devices.
[0184] The mass storage device 1407 is connected to the central processing unit 1401 through a mass storage controller (not shown) connected to the system bus 1405. The mass storage device 1407 and its associated computer readable storage medium provide non-volatile storage for the computer device 1400. That is, the mass storage device 1407 can comprise a computer readable storage medium (not shown) such as a hard disk or a CD-ROM drive.
[0185] Without loss of generality, the computer readable storage medium can include computer storage medium and communication medium. The computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. The computer storage medium includes RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid state storage technology, digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage device. Of course, those skilled in the art can know that the computer storage medium is not limited to the above several. The system memory 1404 and the mass storage device 1407 described above can be collectively referred to as memory.
[0186] The memory stores one or more programs configured to be executed by the one or more central processing units 1401, and the one or more programs contain instructions for implementing the label recommendation method described above, and the central processing unit 1401 executes the one or more programs to implement the image content recognition method provided by each method embodiment described above, or to implement the training method of the image recognition model provided by the embodiments of the present application.
[0187] According to various embodiments of the present application, the computer device 1400 can also be connected to a remote computer operating on a network through a network such as the Internet. That is, the computer device 1400 can be connected to the network 1412 through the network interface unit 1411 connected to the system bus 1405, or the network interface unit 1411 can also be used to connect to other types of networks or remote computer systems (not shown).
[0188] The memory also includes one or more programs stored in the memory, and the one or more programs contain steps executed by the computer device in the training method of the image recognition model provided by the embodiments of the present application.
[0189] The embodiment of the present application further provides a computer readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the image content identification method provided by the embodiment of the present application, or implement the training method of the image recognition model provided by the embodiment of the present application.
[0190] The present application further provides a computer program product or a computer program, which comprises computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the image content identification method described in any of the above embodiments, or implements the training method of the image recognition model as described in the above embodiments of the present application.
[0191] Those skilled in the art can understand that all or part of the steps in the above-mentioned various methods of the embodiments can be completed by instructing the relevant hardware through a program, which can be stored in a computer readable storage medium. The computer readable storage medium can be a computer readable storage medium contained in the memory in the above-mentioned embodiments, or can exist separately and not be assembled into the terminal. The computer readable storage medium stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the image content identification method provided by the embodiment of the present application, or implement the training method of the image recognition model provided by the embodiment of the present application.
[0192] Optionally, the computer readable storage medium can include a read only memory (ROM), a random access memory (RAM), a solid state disk (SSD) or an optical disk. The random access memory can include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0193] Those skilled in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or can be instructed by a program to complete the related hardware, and the program can be stored in a computer readable storage medium. The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0194] The above only describes optional embodiments of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method of recognizing image content, characterized by, The method comprises: inputting a target image into an image recognition model to obtain a target feature; inputting the target feature into a detector to obtain a target detection result, the detector being configured to determine a target image content inclusion in the target image according to the target feature; a training process of the image recognition model comprises: obtaining a training image set, the training image set comprising a first training image and a second training image; extracting a first feature of the first training image and a second feature of the second training image by the image recognition model; identifying a first identification result of the first feature and a second identification result of the second feature; performing comparison identification on a fused feature after fusion of the first feature and the second feature to obtain a third identification result, wherein the third identification result comprises at least one of a first comparison identification result and a second comparison identification result, the first comparison identification result being configured to represent a similarity of the target image content in the first training image and the second training image, and the second comparison identification result being configured to represent a size relationship between a corresponding size of the target image content in the first training image and a corresponding size of the target image content in the second training image; obtaining a loss value based on the first identification result, the second identification result and the third identification result, and training the image recognition model until the image recognition model converges.
2. The method of claim 1, wherein, The comparison identification on the fused feature after fusion of the first feature and the second feature to obtain a third identification result comprises: performing first comparison identification on the fused feature to obtain the first comparison identification result.
3. The method of claim 1, wherein, The comparison identification on the fused feature after fusion of the first feature and the second feature to obtain a third identification result comprises: performing second comparison identification on the fused feature to obtain the second comparison identification result.
4. The method according to any one of claims 1 to 3, characterized in that, The obtaining of a loss value based on the first identification result, the second identification result and the third identification result and the training of the image recognition model comprises: inputting the first identification result, the second identification result and the third identification result into a preset loss function to obtain the loss value; training the image recognition model based on the loss value.
5. The method of claim 4, wherein, The inputting of the first identification result, the second identification result and the third identification result into a preset loss function to obtain the loss value comprises: inputting the first identification result into the preset loss function to obtain a first loss value; inputting the second identification result into the preset loss function to obtain a second loss value; inputting the third identification result into the preset loss function to obtain a third loss value; determining the loss value based on the first loss value, the second loss value and the third loss value.
6. The method according to any one of claims 1 to 3, characterized in that, The image recognition model comprises model parameters; The obtaining of a loss value based on the first identification result, the second identification result and the third identification result and the training of the image recognition model comprises: adjusting the model parameters according to the loss value.
7. The method according to any one of claims 1 to 3, characterized in that, The training image set comprises a training image of the target image content, and a first label is labeled on the training image. The method further comprises: segmenting, for a third training image labeled with the first label, a display region of the target image content to obtain at least two image regions; recombining the at least two image regions to obtain an updated training image; adding the updated training image to the training image set as the training image labeled with the first label.
8. The method according to any one of claims 1 to 3, characterized in that, The method further comprises: obtaining an expanded image set; inputting an expanded image in the expanded image set into the image recognition model to obtain a recognition result, the expanded image being an image not labeled with a second label, the second label being used to indicate a containing condition of the target image content; labeling the expanded image in the expanded image set with the second label according to the recognition result; adding the expanded image labeled with the second label to the training image set. 9.A method for training an image recognition model, the image recognition model being configured to recognize a target image content, the method comprising: Applied to a computer device, the method comprises: obtaining a training image set, the training image set including a first training image and a second training image; extracting a first feature of the first training image and a second feature of the second training image through the image recognition model; recognizing a first recognition result of the first feature and a second recognition result of the second feature; comparing and recognizing a fused feature after fusing the first feature and the second feature to obtain a third recognition result; wherein the third recognition result includes at least one of a first comparison and recognition result and a second comparison and recognition result, the first comparison and recognition result being used to represent a similarity of the target image content in the first training image and the second training image, and the second comparison and recognition result being used to represent a size relationship between a corresponding size of the target image content in the first training image and a corresponding size of the target image content in the second training image; training the image recognition model based on the loss value obtained from the first recognition result, the second recognition result and the third recognition result until the image recognition model converges.
10. An apparatus for recognizing image content, characterized by comprising: The device comprises: an input module configured to input a target image into an image recognition model to obtain a target feature; an output module configured to input the target feature into a detector to obtain a target detection result, the detector being configured to determine a containing condition of target image content in the target image according to the target feature; a training module comprising: an acquisition unit configured to obtain a training image set, the training image set including a first training image and a second training image; a feature extraction unit configured to extract a first feature of the first training image and a second feature of the second training image through the image recognition model; The recognition unit is configured to identify a first recognition result of the first feature and a second recognition result of the second feature, and perform comparison recognition on a fused feature after the first feature and the second feature are fused to obtain a third recognition result; the third recognition result includes at least one of a first comparison recognition result and a second comparison recognition result; the first comparison recognition result is used to represent a similarity of the target image content in the first training image and the second training image; and the second comparison recognition result is used to represent a size relationship between a corresponding size of the target image content in the first training image and a corresponding size of the target image content in the second training image. The training unit is configured to obtain a loss value based on the first recognition result, the second recognition result and the third recognition result, and train the image recognition model until the image recognition model converges.
11. The apparatus of claim 10, wherein, The training unit further includes: A determination sub-unit configured to input the first recognition result, the second recognition result and the third recognition result into a preset loss function to obtain the loss value. The training unit is further configured to train the image recognition model based on the loss value.
12. A training device for an image recognition model, characterized in that, The apparatus is applied to a computer device, and the apparatus includes: An acquisition module configured to acquire a training image set, the training image set including a first training image and a second training image; A feature extraction module configured to extract a first feature of the first training image and a second feature of the second training image by using the image recognition model; An identification module configured to identify a first recognition result of the first feature and a second recognition result of the second feature, and identify target image content by using the image recognition model; The identification module is further configured to perform comparison recognition on a fused feature after the first feature and the second feature are fused to obtain a third recognition result; the third recognition result includes at least one of a first comparison recognition result and a second comparison recognition result; the first comparison recognition result is used to represent a similarity of the target image content in the first training image and the second training image; and the second comparison recognition result is used to represent a size relationship between a corresponding size of the target image content in the first training image and a corresponding size of the target image content in the second training image. A training module configured to obtain a loss value based on the first recognition result, the second recognition result and the third recognition result, and train the image recognition model.
13. A computer device, comprising: The computer device includes a processor and a memory; the memory stores at least one instruction, at least one program, a code set or an instruction set; the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the image content recognition method in any one of claims 1 to 8, or implement the image recognition model training method in claim 9.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores at least one program code, which is loaded and executed by the processor to implement the image content recognition method according to any one of claims 1 to 8, or implement the image recognition model training method according to claim 9.
15. A computer program product, characterised in that, The computer readable storage medium stores at least one program code, which is loaded and executed by the processor to implement the image content recognition method according to any one of claims 1 to 8, or implement the image recognition model training method according to claim 9.
Citation Information
Patent Citations
Image detection model training method and device and target detection method and device
CN111160379A
Method, apparatus, and storage medium for recognizing image object
US20200342253A1