A model training method, device, apparatus and medium

The MSER algorithm is used to determine the region of the target in the image, and then cropping, scaling and denoising are performed. Combined with the VIT model to train the target recognition model, the problem of insufficient discrimination ability of deep learning algorithms in image recognition is solved, and the learning efficiency and recognition accuracy of the model are improved.

CN116757267BActive Publication Date: 2026-05-29新奥新智科技有限公司

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
新奥新智科技有限公司
Filing Date
2023-06-14
Publication Date
2026-05-29

AI Technical Summary

Technical Problem

Existing deep learning algorithms tend to treat images as a unified whole in image recognition, resulting in insufficient ability of the model to distinguish between positive and negative samples, which reduces the model's learning efficiency and recognition ability.

Method used

The Maximum Stable Extreme Region (MSER) ​​algorithm is used to determine the region of the target in the image. After cropping, scaling and denoising, the target recognition model is trained on images containing and not containing the target. The Visual Transformation (VIT) model is used for feature extraction.

Benefits of technology

It improves the target recognition model's ability to distinguish between positive and negative samples, enhances the model's learning efficiency and recognition capabilities, and improves the accuracy and efficiency of target recognition, especially in office and transportation scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116757267B_ABST
    Figure CN116757267B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a model training method and device, equipment and medium, which are used to solve the problem of poor learning efficiency and recognition ability of related technology models. In the embodiments of the present application, the electronic device first determines the region where the recognition target is located in each to-be-trained image containing the recognition target, thereby distinguishing the foreground and the background, and trains the target recognition model for other to-be-trained images not containing the recognition target based on the sub-image of the region where the recognition target is located. Therefore, the distinguishing ability of the target recognition model for positive and negative samples can be improved, and the learning efficiency and recognition ability of the target recognition model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of model training technology, and in particular to a model training method, apparatus, device and medium. Background Technology

[0002] Deep learning algorithms have achieved great success in computer vision, but deep learning requires a huge number of labels for model training. To reduce the cost of label annotation, many laboratories have begun to focus on few-shot learning research, among which contrastive self-supervised learning algorithms have achieved one of the best results. In contrastive learning, the model obtains positive and negative sample pairs of images through image augmentation and other algorithms to train the feature extraction network, thereby completing self-supervised learning. However, one of the significant problems with this algorithm is that it treats the image as a unified whole, while in reality, an image has foreground and background. For example, an image containing a computer usually includes a mouse. During training, the model may mistakenly identify the computer and mouse as a whole. When an image containing only a computer is input into the model, the model may easily identify it as a non-computer image. In other words, the simple model extraction of overall image features in related technologies reduces the model's ability to distinguish between positive and negative sample pairs, reducing the model's learning efficiency and recognition ability. Summary of the Invention

[0003] This application provides a model training method, apparatus, device, and medium to address the problems of poor learning efficiency and recognition ability of related technical models.

[0004] In a first aspect, embodiments of this application provide a model training method, the method comprising:

[0005] Receive each training image containing the target to be identified;

[0006] For each image to be trained, determine the region where the target to be identified is located in that image;

[0007] The target recognition model is trained using a sub-image containing the target to be recognized in each training image, and other training images that do not contain the target to be recognized.

[0008] Further, determining the region where the target is located in the image to be trained includes:

[0009] The Maximum Stable Extremal Regions (MSER) ​​algorithm is used to determine the region where the target to be identified is located in the image to be trained.

[0010] Furthermore, the sub-images containing the target to be identified in the training image are determined in the following way:

[0011] For each image to be trained, the region where the target is located in the image is cropped to obtain a sub-image containing the target.

[0012] Furthermore, after determining the region where the target is located in the image to be trained, and before training the target recognition model based on sub-images containing the target in each image to be trained and other images not containing the target, the method further includes:

[0013] Each training image containing a target image is scaled to a first preset number of pixels in the horizontal direction and a second preset number of pixels in the vertical direction. For the scaled sub-images, the subsequent step of training the target recognition model is performed based on the sub-images containing the target image and other training images that do not contain the target image.

[0014] Furthermore, before training the target recognition model based on sub-images containing the target to be recognized in each training image and other training images that do not contain the target to be recognized, the method further includes:

[0015] For each sub-image and other training images that do not contain the target to be identified, denoising processing is performed. For each denoised sub-image and other training images, the subsequent step of training the target recognition model based on the sub-images containing the target to be identified and the other training images that do not contain the target to be identified is performed.

[0016] Furthermore, the target recognition model is based on the Vision Transformer (VIT) model.

[0017] Furthermore, the model training method can be applied to office scenarios, traffic scenarios, or other scenarios where the target being identified appears in pairs with other targets.

[0018] Secondly, embodiments of this application also provide a model training apparatus, the apparatus comprising:

[0019] The receiving module is used to receive each training image containing the target to be identified;

[0020] The determination module is used to determine the region where the target to be identified is located in each training image;

[0021] The processing module is used to train the target recognition model based on sub-images containing the target to be recognized in each training image, and other training images that do not contain the target to be recognized.

[0022] Furthermore, the determining module is specifically used to use the MSER algorithm to determine the region where the target to be identified is located in the image to be trained.

[0023] Furthermore, the processing module is specifically used to extract the region where the target is located in each training image to obtain a sub-image containing the target in the training image.

[0024] Furthermore, the processing module is also used to scale the sub-images containing the target in each training image, scaling the sub-images to a first preset number of pixels in the horizontal direction and a second preset number of pixels in the vertical direction, respectively. For the scaled sub-images, the module then performs the subsequent step of training the target recognition model based on the sub-images containing the target in each training image and other training images that do not contain the target.

[0025] Furthermore, the processing module is also used to perform denoising processing on each sub-image and other training images that do not contain the target to be identified, and to perform subsequent steps of training the target recognition model based on the sub-images containing the target to be identified and the other training images that do not contain the target to be identified for each denoised sub-image and other training images.

[0026] Thirdly, embodiments of this application also provide an electronic device, which includes at least a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the steps of the model training method as described in any of the preceding claims.

[0027] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the model training method as described in any of the preceding claims.

[0028] In this embodiment, the electronic device receives each training image containing the target to be identified, and for each training image, determines the region where the target is located in that image. The target recognition model is trained based on sub-images containing the target and other training images not containing the target. Because in this embodiment, the electronic device first determines the region where the target is located in each training image containing the target, thereby distinguishing between foreground and background, and then trains the target recognition model using sub-images of the target's region that are other training images not containing the target, the ability of the target recognition model to distinguish between positive and negative samples can be improved, thus enhancing the learning efficiency and recognition capability of the target recognition model. Attached Figure Description

[0029] To more clearly illustrate the technical solutions of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 A schematic diagram of a model training process provided in an embodiment of this application;

[0031] Figure 2 A detailed schematic diagram illustrating a model training process provided in an embodiment of this application;

[0032] Figure 3 This is a schematic diagram of a model training device provided in an embodiment of this application;

[0033] Figure 4 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art are within the scope of protection of this application.

[0035] To improve the learning efficiency and recognition ability of the model, embodiments of this application provide a model training method, apparatus, device, and medium.

[0036] The model training method includes: receiving each training image containing the target to be identified; determining the region where the target is located in each training image; and training the target recognition model based on the sub-images containing the target and other training images that do not contain the target, thereby improving the model's learning efficiency and recognition ability.

[0037] Example 1:

[0038] Figure 1 This application provides a schematic diagram of a model training process, which includes the following steps:

[0039] S101: Receive each training image containing the target to be identified.

[0040] The model training method provided in this application is applied to an electronic device, which can be a smart device such as a PC or a server.

[0041] To train the model, the electronic device can first receive each training image containing the target to be recognized. The training image may contain one or more targets to be recognized, such as a computer, mouse, vehicle, traffic light, etc.

[0042] Specifically, this could be a preset page on a device used by the business personnel or a preset device. This preset page is used to submit training images containing the target to be identified. The business personnel select the storage path of the training images and click a preset button, such as the "Submit" button. The device used by the business personnel or the preset device can then obtain each training image in the storage path. After obtaining each training image, the obtained training image can be sent to the electronic device, which can then receive each training image containing the target to be identified.

[0043] It should be noted that this model training method is applicable to office scenarios, traffic scenarios, or other scenarios where the identified target appears in pairs with other targets. In these scenarios, the identified target is usually extracted from a complex background, such as a computer or mouse in an office scenario, or a car or pedestrian in a traffic scenario.

[0044] In office settings, the model can be used for tasks such as computer or mouse recognition to improve processing efficiency and accuracy. In transportation scenarios, it can be used for autonomous driving and traffic monitoring to enhance the safety and efficiency of transportation systems. In other scenarios where targets appear in pairs with other targets, this model training method can be used for object recognition, face recognition, and action recognition to improve recognition accuracy and efficiency.

[0045] S102: For each image to be trained, determine the region where the target to be identified is located in the image to be trained.

[0046] To improve the accuracy of the model, during the training process, the electronic device can use image processing technology to accurately locate the region where the target is located in each received training image, so that the model can better learn to extract recognition features.

[0047] Electronic devices can use feature extraction and matching methods to obtain the region where the target is located. Specifically, electronic devices can use feature extraction algorithms, such as Scale-Invariant Feature Transform (SIFT) and Speeded-Up Robust Features (SURF), to extract features of the target, such as a computer, from an image. Then, matching techniques, such as Fast Library for Approximate Nearest Neighbors (FLANN) and Random Sample Consensus (RANSAC), are used to match the extracted features with known templates to obtain the region where the target is located in the image.

[0048] S103: Train the target recognition model based on the sub-images containing the target to be recognized in each training image and other training images that do not contain the target to be recognized.

[0049] For each image to be trained, after determining the region where the target is located in that image, the electronic device can crop a sub-image of that region from the training image, which serves as the basis for training the target recognition model. In this way, the target recognition model can gradually learn and improve its judgment of the target, thereby increasing the recognition accuracy.

[0050] After acquiring each sub-image, the electronic device can train the target recognition model based on each sub-image and other training images that do not contain the target to be recognized. Specifically, this can be done on a preset page of a user's device or a preset device. This preset page is used to submit other training images that do not contain the target to be recognized. The user selects the storage path for the training images and clicks a preset button, such as the "Submit" button. The user's device or the preset device can then acquire the other training images that do not contain the target to be recognized from the storage path. After acquiring these other training images, they can be sent to the electronic device, which will then receive them, facilitating subsequent training of the target recognition model.

[0051] It's important to note that during training, each sub-image containing the target is treated as a positive sample, while other training images that do not contain the target are treated as negative samples. Specifically, the target recognition model distinguishes between positive and negative samples. Through this method, the target recognition model can learn the features of the region containing the target, i.e., learn the characteristics of the target, and be able to distinguish between images containing and not containing the target. This method is often used in supervised learning of target recognition models; by providing the model with sufficient pairs of positive and negative samples, the recognition accuracy can be improved.

[0052] In this embodiment, the electronic device first determines the region where the target is located in each training image containing the target, thereby distinguishing between the foreground and the background. The target recognition model is then trained on the sub-images of the region where the target is located, which are other training images that do not contain the target. This improves the target recognition model's ability to distinguish between positive and negative samples, thereby improving the learning efficiency and recognition ability of the target recognition model.

[0053] Example 2:

[0054] To accurately determine the region where the target is located in the image to be trained, based on the above embodiments, in this embodiment, determining the region where the target is located in the image to be trained includes:

[0055] The MSER algorithm is used to determine the region where the target to be identified is located in the image to be trained.

[0056] To accurately determine the region where the target is located in a training image, electronic devices can employ the MSER algorithm for salient region extraction. This algorithm can quickly and efficiently detect salient regions in the training image, unaffected by factors such as lighting and color. The specific details of how the MSER algorithm is used to determine the region of a target in an image are existing technologies and will not be elaborated upon here.

[0057] It's important to note that the MSER algorithm is essentially an edge detection algorithm. It extracts salient, stable regions from an image; these regions typically exhibit minimal changes in features such as brightness and color. For example, in an image containing a computer and a mouse, the target is identified as the computer. Because the computer and mouse differ in shape, texture, size, and other features, different MSER parameters can be set to distinguish between them, thus determining the region where the target is located.

[0058] Existing image contrast self-supervised learning algorithms simply treat the image as a unified whole, lacking the ability to distinguish between foreground, background, and different objects within the image. This leads to confusion between positive and negative samples during the training of the feature extraction network (target recognition model), resulting in low training efficiency. To acquire more prior knowledge, this application employs the MSER algorithm to identify regions containing the target in the image to be trained, thus focusing on the main body region of the image. The target recognition model then extracts features from the corresponding sub-images within this region, acquiring more prior knowledge about the image and avoiding confusion between foreground, background, and different targets, thereby improving the training efficiency and recognition performance of the target recognition model. The method used in this application essentially provides an image contrast self-supervised learning algorithm based on a salient region detection algorithm, thereby improving the learning ability of the target recognition model.

[0059] Example 3:

[0060] In order to accurately train the target recognition model, based on the above embodiments, in this embodiment, each sub-image containing the region where the target is located in the image to be trained is determined in the following way:

[0061] For each image to be trained, the region where the target is located in the image is cropped to obtain a sub-image containing the target.

[0062] For each training image, the electronic device can first obtain the region where the target is located in the training image. The region where the target is located can be the coordinate information of a rectangle that completely contains the recognition model. Specifically, it can be the coordinate information of the upper left and lower right corners of the rectangle. After obtaining the region where the target is located in the training image, the electronic device can crop the region where the target is located in the training image to obtain a sub-image containing the target in the cropped training image.

[0063] It should be noted that after receiving each image to be trained, the bounding box corresponding to the region where the target is located in each image can be determined. Before training the target recognition model, the bounding box corresponding to the region where the target is located in each image is loaded, and the region where the target is located is cropped to obtain the corresponding sub-image.

[0064] Example 4:

[0065] To accurately train the target recognition model, based on the above embodiments, in this embodiment, after determining the region where the target is located in the image to be trained, and before training the target recognition model based on sub-images containing the target and other images not containing the target in each image to be trained, the method further includes:

[0066] Each training image containing a target image is scaled to a first preset number of pixels in the horizontal direction and a second preset number of pixels in the vertical direction. For the scaled sub-images, the subsequent step of training the target recognition model is performed based on the sub-images containing the target image and other training images that do not contain the target image.

[0067] Since the target recognition model can only recognize images of a preset size, the images input to the model need to be scaled. To train the target recognition model, after acquiring a sub-image, the electronic device can perform preprocessing operations such as scaling to transform it into a sub-image with a first preset number of pixels horizontally and a second preset number of pixels vertically. In other words, the adjusted sub-image is made suitable for the input during the target recognition model training process. The first and second preset pixel values ​​vary in different application scenarios; therefore, they are typically set according to the specific application scenario and requirements.

[0068] Specifically, to adjust the sub-image to fit the input image of the target recognition model, the electronic device can first read the image to be scaled, i.e., the sub-image, and obtain its first horizontal pixel count and second vertical pixel count. Based on the first pixel count, second pixel count, first preset pixel count, and second preset pixel value, the scaling ratios in the horizontal and vertical directions are calculated respectively. For example, if the input of the target recognition model is an image with 200 horizontal and 300 vertical pixels, while the sub-image has 100 horizontal and 100 vertical pixels, since 200 / 100 = 2 and 300 / 100 = 3, the sub-image is magnified by a factor of 2 horizontally and a factor of 3 vertically during scaling.

[0069] If a non-uniform scaling method is used when scaling a sub-image, the features of the target object in the scaled sub-image may be affected. Therefore, the electronic device uses uniform scaling when adjusting the sub-image. If the number of pixels in the horizontal and vertical directions of the scaled sub-image does not meet the first and second preset pixel values, the electronic device can use nearest neighbor interpolation or bilinear interpolation to interpolate the scaled image. Interpolation algorithms can smooth the image's transformation process, making the scaled image smoother and more detailed. Nearest neighbor interpolation is more suitable for image edges, while bilinear interpolation provides a smoother transition. Furthermore, the electronic device can add a single-color border (white, black, or other colors) around the scaled sub-image to maintain the image's aspect ratio and ensure the image size meets preset requirements.

[0070] Considering that the scaling process may affect the image features and recognition results, parameter optimization can be performed during scaling, such as adjusting the scaling method and image quality, to ensure the reliability and consistency of the scaled image quality and feature information.

[0071] Figure 2 A detailed schematic diagram illustrating a model training process provided in this application embodiment includes the following steps:

[0072] Figure 2 The example given is that the system simultaneously receives each training image containing the target to be identified and other training images that do not contain the target to be identified.

[0073] S201: Receive each training image containing the target to be identified and other training images that do not contain the target to be identified.

[0074] S202: Use the MSER algorithm to determine the region where the target is located in each training image.

[0075] S203: Extract the region where the target is located in each training image to obtain a sub-image containing the target.

[0076] S204: Scale the sub-image to make it conform to the requirements of the target recognition model.

[0077] S205: Train the target recognition model based on each sub-image and other images to be trained.

[0078] Example 5:

[0079] To improve the recognition capability of the target recognition model, based on the above embodiments, in this embodiment, before training the target recognition model based on sub-images containing the target to be recognized and other training images that do not contain the target to be recognized in each training image, the method further includes:

[0080] For each sub-image and other training images that do not contain the target to be identified, denoising processing is performed. For each denoised sub-image and other training images, the subsequent step of training the target recognition model based on the sub-images containing the target to be identified and the other training images that do not contain the target to be identified is performed.

[0081] To improve the recognition capability of the target recognition model, before training the target recognition model, electronic devices can perform denoising processing on each training image containing the target and other training images that do not contain the target. Specifically, algorithms such as median filtering, Gaussian filtering, and wavelet processing can be used to eliminate noise in the image. Then, for each denoised sub-image and other training images, the subsequent step of training the target recognition model based on the sub-image containing the target and other training images that do not contain the target is executed, thereby accurately training the target recognition model and improving its recognition capability.

[0082] It should be noted that parameter tuning is required during denoising. Different image processing algorithms have different parameter settings, which should be adjusted according to the specific application scenario to obtain the best processing results.

[0083] After denoising, electronic devices can perform subsequent processing on the denoised image, such as resampling and brightness equalization. These processing steps can improve the sharpness and brightness of each sub-image and other training images, thereby helping to improve the accuracy of the target recognition model.

[0084] This denoising method effectively eliminates noise and interference in each sub-image and other training images, improving the accuracy and robustness of the target recognition model, thus making the target recognition model more reliable and practical in real-world applications.

[0085] It should be noted that the electronic device can also perform noise reduction processing on the training images and other training images after receiving each training image containing the target to be identified and other training images that do not contain the target to be identified.

[0086] Example 6:

[0087] In order to improve the recognition capability of the target recognition model, based on the above embodiments, the target recognition model in this application embodiment is the VIT model.

[0088] The target recognition model in this application embodiment can be the VIT model.

[0089] The VIT model is a visual model based on the Transformer architecture. Compared to traditional Convolutional Neural Networks (CNNs), it offers several advantages: 1. Efficiently captures long-range dependencies: The VIT model utilizes the Transformer's self-attention mechanism to efficiently capture long-range pixel relationships in an image. This avoids the width / depth limitations often encountered by CNNs, improving performance and generalization ability. 2. Adapts well to image data: The VIT model can process image data in the same way as Natural Language Processing (NLP), adapting well to images of various sizes and shapes. This allows for better utilization of existing large-scale image data, reducing training time and data requirements. 3. Higher interpretability: Through image segmentation and feature extraction, the VIT model gradually deepens its understanding of the image, providing better interpretability and accurate target region localization, reducing the accuracy requirements of CNNs that often require multiple iterations. 4. Facilitates cross-modal transfer learning: Since the VIT model has a similar structure to the NLP model, knowledge transfer and cross-modal learning can be easily carried out between VIT and NLP, thus leveraging the advantages and value of the model in a wider range of applications.

[0090] The main reason for using the VIT model in this application embodiment is its excellent image representation capability and effective attention mechanism, which can better capture the features in the image.

[0091] Example 7:

[0092] Figure 3 This is a schematic diagram of a model training device provided in an embodiment of this application. The device includes:

[0093] The receiving module 301 is used to receive each training image containing the target to be identified;

[0094] The determining module 302 is used to determine the region where the target to be identified is located in each training image;

[0095] The processing module 303 is used to train the target recognition model based on the sub-images containing the target to be recognized in each training image and other training images that do not contain the target to be recognized.

[0096] In one possible implementation, the determining module 302 is specifically used to use the MSER algorithm to determine the region where the target to be identified is located in the image to be trained.

[0097] In one possible implementation, the processing module 303 is specifically used to crop the region where the target is located in each training image to obtain a sub-image containing the target.

[0098] In one possible implementation, the processing module 303 is further configured to scale the sub-image containing the target in each training image, scaling the sub-image to a first preset number of pixels in the horizontal direction and a second preset number of pixels in the vertical direction, and then, for the scaled sub-image, to perform the subsequent step of training the target recognition model based on the sub-image containing the target in each training image and other training images that do not contain the target.

[0099] In one possible implementation, the processing module 303 is further configured to perform denoising processing on each sub-image and other training images that do not contain the target to be identified, and to perform subsequent steps of training the target recognition model based on the sub-images containing the target to be identified and other training images that do not contain the target to be identified for each denoised sub-image and other training images.

[0100] Example 8:

[0101] Figure 4 This application provides a schematic diagram of an electronic device structure based on an embodiment of the present application. In addition to the above embodiments, this application also provides an electronic device, such as... Figure 4 As shown, it includes: processor 401, communication interface 402, memory 403 and communication bus 404, wherein processor 401, communication interface 402 and memory 403 communicate with each other through communication bus 404.

[0102] The memory 403 stores a computer program, which, when executed by the processor 401, causes the processor 401 to perform the following steps:

[0103] Receive each training image containing the target to be identified;

[0104] For each image to be trained, determine the region where the target to be identified is located in that image;

[0105] The target recognition model is trained using a sub-image containing the target to be recognized in each training image, and other training images that do not contain the target to be recognized.

[0106] Furthermore, the processor 401 is specifically used to employ the MSER algorithm to determine the region where the target to be identified is located in the image to be trained.

[0107] Furthermore, the processor 401 is specifically configured to, for each training image, crop the region where the target is located in the training image to obtain a sub-image containing the target.

[0108] Furthermore, the processor 401 is also configured to scale the sub-image containing the target in each training image, scaling the sub-image to a first preset number of pixels in the horizontal direction and a second preset number of pixels in the vertical direction, and then, for the scaled sub-image, execute the subsequent step of training the target recognition model based on the sub-image containing the target in each training image and other training images that do not contain the target.

[0109] Furthermore, the processor 401 is also configured to perform denoising processing on each sub-image and other training images that do not contain the target to be identified, and to perform subsequent steps of training the target recognition model based on the sub-images containing the target to be identified and other training images that do not contain the target to be identified for each denoised sub-image and other training images.

[0110] The communication bus mentioned in the above server can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.

[0111] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0112] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0113] The processors mentioned above can be general-purpose processors, including central processing units, network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits, field-programmable gate arrays or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0114] Example 9:

[0115] Based on the above embodiments, this application also provides a computer-readable storage medium storing a computer program executable by an electronic device. When the program is run on the electronic device, the electronic device performs the following steps:

[0116] The memory stores a computer program that, when executed by the processor, causes the processor to perform the following steps:

[0117] Receive each training image containing the target to be identified;

[0118] For each image to be trained, determine the region where the target to be identified is located in that image;

[0119] The target recognition model is trained using a sub-image containing the target to be recognized in each training image, and other training images that do not contain the target to be recognized.

[0120] In one possible implementation, determining the region where the target to be identified is located in the image to be trained includes:

[0121] The Maximum Stable Extremal Regions (MSER) ​​algorithm is used to determine the region where the target to be identified is located in the image to be trained.

[0122] In one possible implementation, the sub-images containing the target to be identified in the training image are determined in the following way:

[0123] For each image to be trained, the region where the target is located in the image is cropped to obtain a sub-image containing the target.

[0124] In one possible implementation, after determining the region where the target is located in the image to be trained, and before training the target recognition model based on sub-images containing the target in each image to be trained and other images not containing the target, the method further includes:

[0125] Each training image containing a target image is scaled to a first preset number of pixels in the horizontal direction and a second preset number of pixels in the vertical direction. For the scaled sub-images, the subsequent step of training the target recognition model is performed based on the sub-images containing the target image and other training images that do not contain the target image.

[0126] In one possible implementation, before training the target recognition model based on sub-images containing the target to be recognized in each training image and other training images not containing the target to be recognized, the method further includes:

[0127] For each sub-image and other training images that do not contain the target to be identified, denoising processing is performed. For each denoised sub-image and other training images, the subsequent step of training the target recognition model based on the sub-images containing the target to be identified and the other training images that do not contain the target to be identified is performed.

[0128] In one possible implementation, the target recognition model is a VIT model.

[0129] In one possible implementation, the model training method is applied to office scenarios, traffic scenarios, or other scenarios where the target being identified appears in pairs with other targets.

[0130] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0131] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0132] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0133] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0134] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A model training method, characterized in that, The method includes: Receive each training image containing the target to be identified; For each image to be trained, determine the region where the target to be identified is located in that image; The target recognition model is trained based on a sub-image containing the target to be identified in each training image and other training images that do not contain the target to be identified. In an office setting, the target recognition model is used to identify a computer or mouse. In a traffic setting, the target recognition model is used for autonomous driving and traffic monitoring. In other scenarios where the target to be identified appears in pairs with other targets, the target recognition model is used for object recognition, face recognition, and action recognition. Determining the region where the target object is located in the image to be trained includes: The scale-invariant feature transform and the accelerated robust feature algorithm are used to extract the features of the target from the image to be trained. The fast nearest neighbor search library algorithm and the random sampling consensus algorithm are used to match the extracted features with known templates to obtain the region where the target is located in the image to be trained. After determining the region where the target is located in the image to be trained, and before training the target recognition model based on sub-images containing the target in each image to be trained and other images not containing the target, the method further includes: For each training image containing the target object, the sub-image is scaled proportionally to a first preset number of pixels in the horizontal direction and a second preset number of pixels in the vertical direction. If the number of pixels in the horizontal direction and the number of pixels in the vertical direction of the scaled sub-image are not the first preset number of pixels and the second preset number of pixels, then nearest neighbor interpolation or bilinear interpolation is used to interpolate the scaled image. For the scaled sub-image, the subsequent step of training the target recognition model based on the sub-images containing the target object in each training image and other training images that do not contain the target object is performed.

2. The method according to claim 1, characterized in that, Determining the region where the target to be identified is located in the image to be trained includes: The Maximum Stable Extreme Region (MSER) ​​algorithm is used to determine the region where the target to be identified is located in the image to be trained.

3. The method according to claim 1, characterized in that, The sub-images containing the target to be identified in the training image are determined in the following way: For each image to be trained, the region where the target is located in the image is cropped to obtain a sub-image containing the target.

4. The method according to claim 1, characterized in that, Before training the target recognition model based on sub-images containing the target to be recognized in each training image and other training images that do not contain the target to be recognized, the method further includes: For each sub-image and other training images that do not contain the target to be identified, denoising processing is performed. For each denoised sub-image and other training images, the subsequent step of training the target recognition model based on the sub-images containing the target to be identified and the other training images that do not contain the target to be identified is performed.

5. The method according to claim 1, characterized in that, The target recognition model is based on the Visual Transformation (VIT) model.

6. A model training device, characterized in that, The device includes: The receiving module is used to receive each training image containing the target to be identified; The determination module is used to determine the region where the target to be identified is located in each training image; The processing module is used to train the target recognition model based on sub-images containing the target to be recognized in each training image and other training images that do not contain the target to be recognized; wherein, in an office scenario, the target recognition model is used to identify a computer or mouse; in a traffic scenario, the target recognition model is used for autonomous driving and traffic monitoring; in other scenarios where the target to be recognized appears in pairs with other targets, the target recognition model is used for object recognition, face recognition, and action recognition; The determining module is specifically used to extract the features of the target from the image to be trained by using scale-invariant feature transformation and accelerated robust feature algorithm, and to match the extracted features with known templates by using fast nearest neighbor search library algorithm and random sampling consensus algorithm to obtain the region where the target is located in the image to be trained. The processing module is further configured to scale the sub-images containing the target in each training image proportionally, scaling the sub-images to a first preset number of pixels in the horizontal direction and a second preset number of pixels in the vertical direction. If the number of pixels in the horizontal direction and the number of pixels in the vertical direction of the scaled sub-image are not the first preset number of pixels and the second preset number of pixels, then the scaled image is interpolated using nearest neighbor interpolation or bilinear interpolation. For the scaled sub-images, the subsequent step of training the target recognition model based on the sub-images containing the target in each training image and other training images that do not contain the target is executed.

7. An electronic device, characterized in that, The electronic device includes at least a processor and a memory, wherein the processor is used to execute a computer program stored in the memory to implement the steps of the model training method as described in any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed by a processor, implements the steps of the model training method as described in any one of claims 1-5.