Image sample processing method, device and equipment of target recognition model and computer readable storage medium

By determining the dynamic target area according to the training stage and different parts of the target object in the image sample, the problem of poor robustness caused by random erasure area fixation in the existing technology is solved, and the robustness and generalization ability of the target recognition model are achieved. promote.

CN118747835APending Publication Date: 2024-10-08UBTECH ROBOTICS CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410938820.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-12
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

In existing data enhancement technology based on region erasure, the number, size, and location of randomly erased regions are fixed, resulting in poor robustness and generalization ability of the model.

Method used

By dynamically determining the size and position of the target area according to the training stage of the target recognition model and the imaging area of ​​different parts of the target object in the image sample, the area of ​​the target area is gradually increased to improve the richness and diversity of data enhancement.

Benefits of technology

The robustness and generalization ability of the model are improved, accurate prediction can be achieved in the presence of interference, and target recognition performance is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747835A_ABST
    Figure CN118747835A_ABST
Patent Text Reader

Abstract

The invention provides an image sample processing method, device and equipment of a target recognition model and a computer readable storage medium. The method comprises the following steps: acquiring a first image sample, wherein the first image sample comprises a target object; based on at least one of a count value and an imaging area, a target area in a first image sample is determined, the count value represents a current training stage of the target recognition model, and the imaging area represents the size of the target object in the first image sample; the target area of the target area is in positive correlation with at least one of the count value and the imaging area; and the target region in the first image sample is shaded to obtain a second image sample, and the second image sample is used for training the target recognition model in the training stage corresponding to the count value. According to the invention, richness and generalization of the image samples can be realized, so that robustness and prediction performance of the target identification model are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to an image sample processing method, device, equipment and computer-readable storage medium for a target recognition model. Background Art

[0002] Data augmentation technology is to increase the amount of training data by generating training data under the same distribution. It has the effect of improving the robustness of the model and avoiding overfitting of the deep learning model. It is an indispensable step in the deep neural network training process. Among them, data augmentation technology based on region erasing represented by random erasing and cutout is a popular data augmentation strategy. In the random erasing scheme in the related technology, for the same image sample, the number, size and position of the erased area are fixed, which leads to poor robustness of the model. Summary of the invention

[0003] The embodiments of the present application provide an image sample processing method, apparatus, device and computer-readable storage medium for a target recognition model, which can improve the richness and flexibility of random erasure, thereby improving the robustness and generalization ability of the model.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present application provides an image sample processing method for a target recognition model, the method comprising:

[0006] Acquire a first image sample, where the first image sample includes a target object;

[0007] Determine a target region in the first image sample based on at least one of a count value and an imaging area, wherein the count value represents a current training stage of the target recognition model, the imaging area represents a size of the target object in the first image sample, and the target area of ​​the target region is positively correlated with at least one of the count value and the imaging area;

[0008] The target area in the first image sample is masked to obtain a second image sample, where the second image sample is used to train the target recognition model in the training phase corresponding to the count value.

[0009] The present application provides an image sample processing device of a target recognition model, including:

[0010] A first acquisition module is used to acquire a first image sample, wherein the first image sample includes a target object; a region determination module is used to determine a target region in the first image sample based on at least one of a count value and an imaging area, wherein the count value represents a current training stage of the target recognition model, and the imaging area represents a size of the target object in the first image sample, and a target area of ​​the target region is positively correlated with at least one of the count value and the imaging area;

[0011] The area masking module is used to mask the target area in the first image sample to obtain a second image sample, and the second image sample is used to train the target recognition model in the training stage corresponding to the count value.

[0012] An embodiment of the present application provides an electronic device, the electronic device comprising:

[0013] A memory for storing computer executable instructions;

[0014] The processor is used to implement the image sample processing method of the target recognition model provided in the embodiment of the present application when executing the computer executable instructions stored in the memory.

[0015] An embodiment of the present application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing an image sample processing method of a target recognition model provided by an embodiment of the present application when executed by a processor.

[0016] An embodiment of the present application provides a computer program product, including a computer program or computer executable instructions. When the computer program or computer executable instructions are executed by a processor, the image sample processing method of the target recognition model provided by the embodiment of the present application is implemented.

[0017] The embodiments of the present application have the following beneficial effects:

[0018] In the image sample processing method of the target recognition model provided in the embodiment of the present application, firstly, the count value and multiple first image samples of the training phase of the target recognition model are obtained, and the first image sample includes the target object, and then the target area in the first image sample is determined based on the count value and at least one of the imaging areas of different parts of the target object in the first image sample, and for each first image sample, the target area in the first image sample is masked to obtain a second image sample, and the second image sample is used to train the target recognition model in the training phase corresponding to the count value. That is, in the embodiment of the present application, the target area can be determined based on the count value of the training phase, and the target area of ​​the target area is positively correlated with the count value, that is, the target area of ​​the target area increases with the increase of the count value of the training phase, so as to achieve progressive data enhancement. In the early stage of model training, the target area of ​​the target area is small. At this time, masking a smaller target area can enable the target recognition model to learn the characteristics of the target object, and with the increase of the number of model training rounds and the count value of the training phase, a larger area of ​​the target area can be masked, so that the target recognition model can also achieve accurate prediction in the case of interference, thereby improving the robustness of machine learning. The target area can be determined by the imaging area and the target area of ​​the target area is positively correlated with the imaging area. In this way, multiple target areas can be determined in the first image sample, thereby realizing data enhancement based on multi-granularity, so that the target recognition model can learn the characteristics of the target object when it is masked in multiple places, and improve the recognition performance of the target recognition model. In addition, the target area can also be determined based on the count value in the training phase and the imaging area of ​​different parts of the target object. At this time, the target area of ​​the target area is positively correlated with the count value and the imaging area, thereby realizing progressive and multi-granular data enhancement, which can improve the robustness and prediction performance of the target recognition model while improving the richness of the image samples. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] Figure 1 It is a schematic diagram of data enhancement results in related technologies;

[0020] Figure 2 is a structural diagram of the image processing system architecture provided by an embodiment of the present application;

[0021] Figure 3 is a schematic diagram of the structure of the server 400 provided in an embodiment of the present application;

[0022] Figure 4 It is a first flow chart of the image sample processing method of the target recognition model provided in an embodiment of the present application;

[0023] Figure 5A This is a schematic diagram of a first implementation process of determining a target area provided in an embodiment of the present application;

[0024] Figure 5B is a schematic diagram of target areas at different training stages provided in an embodiment of the present application;

[0025] Figure 5C is a schematic diagram of a second implementation flow of determining a target area provided in an embodiment of the present application;

[0026] Figure 5D is a schematic diagram of a third implementation flow of determining a target area provided in an embodiment of the present application;

[0027] Fig. 6A This is a schematic diagram of a first implementation flow of determining a target area of ​​a local image provided by an embodiment of the present application;

[0028] Figure 6B is a schematic diagram of a second implementation flow of determining a target area of ​​a local image provided by an embodiment of the present application;

[0029] Figure 6C It is a second flow chart of the image sample processing method of the target recognition model provided in an embodiment of the present application;

[0030] Fig. 7A It is a schematic diagram of the results of the data enhancement method based on region erasing in the related art at different training stages of the model;

[0031] Figure 7B It is a schematic diagram of the results of the data enhancement method based on region erasing provided in an embodiment of the present application at different stages of model training;

[0032] Figure 8 It is a schematic diagram of image segmentation provided in an embodiment of the present application.

[0033] It should be pointed out that the above-mentioned "first", "second" and "third" are only used to distinguish different solutions, and do not represent the degree of superiority or inferiority of the solutions or the priority in the implementation process. DETAILED DESCRIPTION

[0034] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0035] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it can be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0036] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0037] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0038] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0039] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant national laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.

[0040] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0041] 1) Data augmentation is a technique that increases data diversity and representativeness through certain means, with the aim of improving the generalization ability of the target recognition model during training.

[0042] 2) Random erasing: During the training process, a rectangular area in the image is randomly selected and its pixels are erased with random values ​​to generate image samples with different occlusion levels.

[0043] 3) Feature distribution variance is used to measure the degree of dispersion of a set of feature data, that is, the degree of difference between feature data. The larger the feature distribution variance, the higher the degree of difference between feature data, and vice versa.

[0044] 4) The target area refers to the area in the image sample that needs to be masked.

[0045] 5) Imaging area: It is used to characterize the size of the target object in the image sample. The imaging area of ​​a part of the target object refers to the area of ​​the bounding box corresponding to the part in the image sample. The imaging area is determined by the width and height represented by the number of pixels.

[0046] 6) The number of training rounds refers to the number of times the model completely traverses the entire training data set during the model training process. Each time the model completely traverses the entire training data set, the number of training rounds increases by 1.

[0047] 7) Training stage: It is used to characterize the training progress of the model. The training process of the model can be divided into at least two training stages according to the total number of training rounds of the model. For example, the total number of training rounds of the model is 60, and the training process of the model can be divided into two training stages, wherein the 1st to 30th training rounds belong to training stage one, and the 31st to 60th training rounds belong to training stage two.

[0048] 8) Target recognition model is a computer vision model whose purpose is to identify specific targets or objects in images or videos. These targets can be any type of objects such as people, vehicles, animals, objects, etc.

[0049] The image sample processing method of the target recognition model provided in the embodiment of the present application can be applied to computer vision scenarios. Exemplarily, it can be applied to autonomous driving scenarios, security monitoring scenarios, smart home scenarios, etc. In the security monitoring scenario, the image sample processing method of the target recognition model provided in the embodiment of the present application can be used to perform data enhancement on the image sample to obtain a new image sample, and the target recognition model is trained using the new image sample to obtain a trained target recognition model. The trained target recognition model obtains the video data collected by the monitoring device, and based on the reference image, performs target recognition on each video frame in the video data to determine whether the video frame includes the object to be recognized in the reference image. In the smart home scenario, the server can use the image sample processing method of the target recognition model provided in the embodiment of the present application to perform data enhancement on the image sample to obtain a new image sample, and the target recognition model is trained using the new image sample to obtain a trained target recognition model, and then the trained target recognition model is sent to the smart home device. Exemplarily, the smart home device can be a sweeping robot. The sweeping robot can use the trained target recognition model to identify obstacles, and automatically plan obstacle avoidance paths based on the identified obstacles. It can also identify the ground type and enable different cleaning modes according to the identified ground type. Since the training of the neural network model requires a sufficient number of accurately labeled training data sets, it is necessary to obtain a sufficient amount of training data through data enhancement technology when the training data is insufficient. In order to better understand the image sample processing method of the target recognition model provided in the embodiment of the present application, the image sample processing method of the target recognition model in the related art and the shortcomings thereof are first described.

[0050] In the related technology, data enhancement technology based on region erasing represented by random erasing and cropping is a popular data enhancement strategy. Figure 1 It is a schematic diagram of data enhancement results in related technologies.

[0051] When implementing the Cutout data enhancement strategy, we first generate a square box of fixed size and fill it with 0 values, such as Figure 1 As shown in the first image 001 and the third image 003 in , then for all images, the square frame is randomly pasted on the random area of ​​the original image, and the square frame is allowed to exceed the scope of the original image. At this time, the part of the square frame that exceeds the scope of the original image is removed, as shown in Figure 1 As shown in the second image 002 and the fourth image 004.

[0052] When implementing the random erasing data augmentation strategy, for each image, a random rectangular box is generated (the size of the rectangular box is within a preset range, for example, the length and width are in the range of 0.1 to 0.3 of the length and width of the original image), and then a random number is used to fill the rectangular box area (the random number range is (0, 255), the same random number is used for the rectangular box area of ​​the same image, and the random numbers of different images are likely to be different). Figure 1 In the four images 005 , 006 , 007 and 008 shown, a rectangular box with a random size and a random position is included in each image.

[0053] In the above two data augmentation strategies, for the same image sample, the number, size and position of the erased areas are fixed, so the richness of the area erasure is poor, which is not conducive to the model learning robust image features, resulting in poor generalization ability and robustness of the model.

[0054] Based on this, the embodiments of the present application provide an image sample processing method, device, equipment and computer-readable storage medium for a target recognition model, which performs area erasure of different sizes at different training stages of model training, and can improve the richness of area erasure, thereby improving the generalization ability and robustness of the model. The following describes an exemplary application of the electronic device provided by the embodiments of the present application. The electronic device provided by the embodiments of the present application can be implemented as various types of terminals such as laptops, tablet computers, desktop computers, set-top boxes, smart phones, smart speakers, smart watches, smart TVs, and vehicle-mounted terminals, and can also be implemented as servers. Below, an exemplary application when the device is implemented as a server will be described.

[0055] See also Figure 2 , Figure 2 is a schematic diagram of the architecture of the image processing system 100 provided in an embodiment of the present application, such as Figure 2 As shown, the image processing system 100 includes a terminal 200, a network 300 and a server 400. To support a data processing application, the terminal 200 is connected to the server 400 via the network 300. The network 300 may be a wide area network or a local area network, or a combination of the two.

[0056] The terminal 200 is used to display data on the graphical interface 210. In the embodiment of the present application, the graphical interface 210 is used to display the recognition result as an example for explanation. The terminal 200 is used to display the recognition result output by the target recognition model. The server 400 obtains multiple original images, and performs target recognition on the multiple original images respectively to obtain recognition result images, and then scales each recognition result image according to a preset reference size to obtain a first image sample, wherein the first image sample includes the target object. During the process of training the target recognition model, the server 400 obtains the count value and multiple first image samples of the training phase of the target recognition model, wherein the first image sample includes the target object; based on the count value and at least one of the imaging areas of different parts of the target object in the first image sample, the target area in the first image sample is determined, and the target area of ​​the target area is positively correlated with at least one of the count value and the imaging area; for each first image sample, the target area in the first image sample is masked to obtain a second image sample, and the second image sample is used to train the target recognition model in the training phase corresponding to the count value, and finally a trained target recognition model is obtained, so that progressive and multi-granularity data enhancement can be achieved, which can not only improve the richness of the training data, but also improve the robustness and prediction performance of the machine training model.

[0057] In the embodiment of the present application, the trained target recognition model can be applied to target recognition scenarios, for example, it can be applied to pedestrian re-identification scenarios, vehicle re-identification scenarios, and smart home robot scenarios. After obtaining the trained target recognition model, the server 400 obtains the video to be processed sent by the terminal 200, and decodes the video to be processed to obtain multiple video image frames, and then determines multiple images to be recognized from the video image frames, and uses the trained target recognition model to perform target re-identification on the multiple images to be recognized based on the reference image to obtain a recognition result, which indicates whether the video to be processed includes the object included in the reference image and the target recognition image including the object, and sends the recognition result to the terminal 200.

[0058] In some embodiments, after obtaining the trained target recognition model, the server 400 may also send the trained target recognition model to the terminal 200, and the terminal 200 may use the trained target recognition model to realize target recognition. For example, the terminal 200 may be an intelligent sweeping robot, which collects images during movement, and uses the trained target recognition model to identify whether the collected images include obstacles such as walls and furniture, obtains recognition results, and automatically plans an obstacle avoidance path based on the recognition results to avoid collisions with obstacles, thereby ensuring the continuity and safety of cleaning.

[0059] In some embodiments, the server 400 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0060] See also Figure 3 , Figure 3 is a schematic diagram of the structure of the server 400 provided in an embodiment of the present application, Figure 3 The server 400 shown includes: at least one processor 410, a memory 440, and at least one network interface 420. The various components in the server 400 are coupled together via a bus system 430. It is understood that the bus system 430 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 430 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 430 is not described in detail. Figure 3 Various buses are labeled as bus system 430 .

[0061] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0062] The memory 440 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, etc. The memory 440 may optionally include one or more storage devices that are physically remote from the processor 410.

[0063] The memory 440 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 440 described in the embodiments of the present application is intended to include any suitable type of memory.

[0064] In some embodiments, memory 440 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0065] Operating system 441, including system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0066] A network communication module 442, used to reach other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 include: Bluetooth, Wireless Compatibility Authentication (WiFi), and Universal Serial Bus (USB), etc.;

[0067] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 3 The image sample processing device 443 of the target recognition model stored in the memory 440 is shown, which can be software in the form of a program and a plug-in, including the following software modules: a first acquisition module 4431, a region determination module 4432, and a region mask module 4433. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.

[0068] In other embodiments, the device provided in the embodiments of the present application can be implemented in hardware. As an example, the device provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the image sample processing method of the target recognition model provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (Application Specific Integrated Circuit, ASIC), digital signal processors (Digital Signal Processor, DSP), programmable logic devices (Programmable Logic Device, PLD), complex programmable logic devices (Complex Programmable Logic Device, CPLD), field programmable gate arrays (Field-Programmable Gate Array, FPGA) or other electronic components.

[0069] The image sample processing method of the target recognition model provided in the embodiment of the present application will be explained in combination with the exemplary application and implementation of the server provided in the embodiment of the present application.

[0070] The following describes the image sample processing method of the target recognition model provided in the embodiment of the present application. As mentioned above, the electronic device that implements the image sample processing method of the target recognition model in the embodiment of the present application can be a terminal, a server, or a combination of the two. Therefore, the execution subject of each step will not be repeatedly described below.

[0071] It should be noted that in the example of image sample processing of the target recognition model below, the first image sample is taken as a person image as an example. Based on their understanding of the following text, those skilled in the art can apply the image sample processing method of the target recognition model provided in the embodiment of the present application to the enhanced processing of vehicle images and animal images.

[0072] See also Figure 4 , Figure 4 is a first flow chart of the image sample processing method of the target recognition model provided in the embodiment of the present application, which will be combined with Figure 4 The steps shown are explained, Figure 4 The body of the step is the server.

[0073] In step 101, a first image sample is acquired.

[0074] The first image sample includes a target object, which may be a pedestrian, a vehicle, an animal, etc. The first image sample may include one target object, or may include multiple target objects. It should be noted that the types of target objects in multiple first image samples are the same, for example, the first image samples are all first image samples where the target objects are pedestrians, and the target recognition model can be used to achieve pedestrian re-identification. Alternatively, the first training object may be a first training object where the target objects are all vehicles, and the target recognition model can be used to achieve vehicle re-identification.

[0075] In step 102, a target area in a first image sample is determined based on at least one of a count value and an imaging area.

[0076] The count value represents the current training stage of the target recognition model, the imaging area represents the size of the target object in the first image sample, and the target area of ​​the target region is positively correlated with at least one of the count value and the imaging area.

[0077] In some embodiments, the total number of training rounds can be pre-set before training the target recognition model. The total number of training rounds refers to the number of times the entire training data set is completely traversed during the target recognition model training process. Exemplarily, the training data set includes 1000 first image samples, so after the target recognition model traverses 1000 first image samples, the number of training rounds increases by 1. Assuming that the total number of training rounds is 90, it is necessary to traverse the 1000 first image samples 90 times to complete the training of the machine model. In an embodiment of the present application, the training process of the target recognition model can be evenly divided into N training stages, where N is an integer greater than 1. Exemplarily, N can be 3, and the count value of the training stage can be 1, 2, ..., N.

[0078] When determining the count value of the training stage, first obtain the current training round number, the preset total number of training rounds, and the preset total number of training stages of the target recognition model; then determine the count value of the training stage of the target recognition model based on the total number of training rounds, the current number of training rounds, and the total number of training stages. When implemented, the training round number range corresponding to the count value of each training stage can be determined based on the total number of training stages and the total number of training rounds, and then determine the target training round number range where the current training round number is located, and the count value corresponding to the target round number range is also the count value of the training stage of the current training round number.

[0079] Assume that the total number of training rounds is S epoch , then the number of training rounds corresponding to the first training stage (that is, the training stage with a count value of 1) is The range of training rounds corresponding to the second training phase (i.e., the training phase with a count value of 2) is ..., the number of training rounds corresponding to the Nth training stage (i.e. the training stage with a count value of N) is

[0080] For example, if Sepoch is 90 and N is 3, the count value of the training stage can be 1, 2, or 3. The range of training rounds for a training stage with a count value of 1 is [1, 30], the range of training rounds for a training stage with a count value of 1 is [1, 30], the range of training rounds for a training stage with a count value of 2 is [31, 60], and the range of training rounds for a training stage with a count value of 3 is [61, 90].

[0081] The above step 102 can be implemented in three ways: 1. Determine the target area in the first image sample based only on the count value in the training stage. In this case, the target area of ​​the target area is positively correlated with the count value in the training stage, that is, the larger the count value, the larger the target area; 2. Determine the area in the first image sample based only on the imaging area of ​​different parts of the target object in the first image sample. In this case, the target area of ​​the target area is positively correlated with the imaging area of ​​different parts in the first image sample, that is, the larger the imaging area, the larger the target area; 3. Determine the target area in the first image sample based on the count value and imaging area in the training stage. In this case, the first image sample includes at least two target areas, and the area of ​​each target area is positively correlated with the imaging area of ​​the training stage and different parts. The following three implementation methods are described below.

[0082] See also Figure 5A The first implementation method in the above step 102 can be implemented through steps 1021A to 1023A. Figure 5A Provide explanation.

[0083] In step 1021A, a target area is determined based on the count value.

[0084] Wherein, the target area is positively correlated with the count value. In some embodiments, when step 1021A is implemented, firstly, a preset first maximum area and a first minimum area for the target area are obtained, and the total number of training stages is obtained, and then an area weight is determined based on the count value and the total number of training stages, and the area weight is positively correlated with the count value, and then a first area difference between the first maximum area and the first minimum area is determined, and the product of the area weight and the first area difference is determined as a first supplementary area, and finally the sum of the first minimum area and the first supplementary area is determined as the target area.

[0085] In some embodiments, the first maximum area and the first minimum area of ​​the target area are pre-set according to the size information of the first image sample. For example, the first maximum area may be one-fourth of the sample area of ​​the first image sample, and the first minimum area may be one-tenth of the sample area. The total number of training stages is set before model training and is an integer greater than or equal to 2. The area weight may be Where N is the total number of training stages, and n is the count value of the training stage. It can be seen that the area weight is positively correlated with the count value. The target area can be achieved by the following formula (1):

[0086] S Mn =S min1 +w n *ΔS1 (1);

[0087] Among them, S Mn is the target area of ​​the target region corresponding to the count value n, S min1 is the first minimum area, w n is the area weight, and ΔS1 is the first area difference. Since in formula (1), S min1 and ΔS1 is fixed, w n Positively correlated with the count value, so the target area is positively correlated with the count value.

[0088] Through the above formula (1), on the basis of ensuring that the target area is positively correlated with the count value, the value of the target area can also be made between the first minimum area and the first maximum area, thereby ensuring that a target area with a moderate area can be obtained, providing a reasonable data basis for subsequent model training.

[0089] In step 1022A, a first center point is determined from the first image sample.

[0090] The first center point is the center point of the target area. In step 1022, the center point of the target object or the first image sample may be determined as the first center point. In some embodiments, different parts of the target object may not be identified, and the first center point may be randomly determined from the first image sample, that is, the first center point may be located at any position of the first image sample.

[0091] In step 1023A, a target region in the first image sample is determined based on the first center point and the target area.

[0092] In some embodiments, if the first center point is the center point of the first image sample, the target area determined at this time is located at the center position of the first image sample, so that the integrity of the target area can be guaranteed. If the first center point is randomly determined, the target area is not necessarily located at the center of the first image sample, but can be located at a random position of the first image sample, and the position of the first center point can be different in different training stages, and the position of the target area is also different. Figure 5B As shown, the target area 501 in the first image sample in the training stage 1, the target area 502 in the first image sample in the training stage 2, and the target area 503 in the first image sample in the training stage 3 are located in different positions, which can improve the richness and diversity of data enhancement.

[0093] In some embodiments, see Figure 5C , step 1023A can be implemented through the following steps 231A to 235A, which are described in detail below.

[0094] In step 231A, a candidate region is constructed based on the first center point and the target area.

[0095] In some embodiments, the candidate area may be a rectangular area, a square area, a circular area, etc. If the candidate area is a circular area, the area radius may be determined based on the target area, and then the first center point may be determined as the center of the circular area, and the candidate area may be constructed based on the area radius. If the candidate area is a rectangular area, the aspect ratio of the rectangular area may be determined, and the length and width of the rectangular area may be determined based on the aspect ratio and the target area, so that the candidate area may be determined based on the first center point, the length and the width. If the candidate area is a square area, the side length of the square may be determined based on the target area, and then the candidate area may be constructed based on the first center point and the side length of the square.

[0096] In step 232A, it is determined whether the first image sample includes a candidate region.

[0097] Among them, judging whether the first image sample contains the candidate area refers to judging whether the candidate area is completely located within the first image sample. When the candidate area is a rectangular area or a square area, the vertex coordinates corresponding to the multiple vertices of the candidate area can be obtained, and then based on the multiple vertex coordinates, it is judged whether the multiple vertices of the candidate area are all located within the first image sample. If the multiple vertices of the candidate area are all located within the first image sample, it is determined that the first image sample contains the candidate area, and step 233A is entered at this time. If at least one vertex among the multiple vertices of the candidate area is located outside the first image sample, it is determined that the first image sample does not contain the candidate area, and step 234A or 235A is entered at this time.

[0098] In step 233A, the candidate region is determined as the target region in the first image sample.

[0099] In some embodiments, if the first image sample includes a candidate region, it means that there is no region outside the first image sample in the candidate region. In this case, the candidate region can be determined as the target region in the first image sample.

[0100] In step 234A, a second center point is determined from the first image sample, and a target area in the first image sample is determined based on the second center point and the target area.

[0101] In some embodiments, if the first image sample does not include the candidate area, that is, there is a part of the candidate area outside the first image sample, then the second center point can be determined from the first image sample, and the second center point is different from the first center point. The second center point can be randomly obtained from the first image sample, or can be obtained by moving the first center point according to preset offset information. The implementation process of determining the target area in the first image sample based on the second center point and the target area is similar to the implementation process of step 1023A, and the implementation process of step 1023A can be referred to during implementation.

[0102] In step 235A, the overlapping area between the candidate area and the first image sample is determined, and the overlapping area is determined as the target area in the first image sample.

[0103] In some embodiments, even if the first image sample does not contain the candidate area, since the center point of the candidate area is located within the first image sample, there is an overlapping area between the candidate area and the first image sample. At this time, the overlapping area between the candidate area and the first image sample can be determined, that is, the area in the candidate area located within the first image sample. Then the overlapping area can be directly determined as the target area in the first image sample. In some embodiments, the area ratio of the overlapping area in the candidate area can also be determined. The area ratio is a real number greater than 0 and less than 1. For example, the area of ​​the overlapping area is 10 and the area of ​​the candidate area is 20. Then the area ratio of the overlapping area in the candidate area is 0.5. If the area ratio is greater than the preset ratio threshold, the overlapping area can be determined as the target area in the first image sample. If the area ratio is less than the ratio threshold, the fourth center point can be determined again from the first image sample, the candidate area is reconstructed, and the target area in the first image sample is determined based on the candidate area.

[0104] It should be noted that, when the first image sample does not include the candidate region, any one of step 234A and step 235A may be selected for execution according to actual needs.

[0105] In the above embodiment, a candidate area is first constructed based on the first center point and the target area. If the first image sample contains the candidate area, the candidate area is directly determined as the target area. If the first image sample does not contain the candidate area, a new second center point can be determined, and the target area is determined based on the second center point and the target area, so as to ensure that the complete target area is determined. If the first image sample does not contain the candidate area, the overlapping area of ​​the candidate area and the first image sample can be further determined. If the area ratio of the overlapping area to the candidate area is greater than the ratio threshold, it means that most of the candidate area is located within the first image sample. At this time, the overlapping area can be determined as the target area, which can improve the determination efficiency of the target area, thereby improving the data enhancement efficiency. If the area ratio of the overlapping area to the candidate area is less than or equal to the ratio threshold, the fourth center point is re-determined, and the target area is determined based on the fourth center point and the target area, so as to ensure that an accurate and complete target area is obtained.

[0106] Through the above steps 1021A to 1023A, the target area can be determined based on the count value of the training stage of the target recognition model. Since the count value is positively correlated with the target area, that is, the larger the count value, the larger the target area. Therefore, in the early stage of model training, the target area of ​​the target region is small. At this time, masking the smaller target area can enable the target recognition model to learn the characteristics of the target object. As the number of model training rounds and the count value of the training stage increase, a larger target area can be masked to achieve progressive data enhancement, so that the target recognition model can also achieve accurate prediction in the presence of interference, thereby improving the robustness of machine learning.

[0107] In some embodiments, see Figure 5D The second implementation and the third implementation in step 102 can be implemented through steps 1021B to 1024B. Figure 5D Provide explanation.

[0108] In step 1021B, at least two partial images corresponding to at least two parts of the target object are determined from the first image sample.

[0109] In some embodiments, when step 1021B is implemented, the prediction task type of the target recognition model can be first obtained, and the image segmentation information corresponding to the prediction task type can be obtained, and then based on the image segmentation information, at least two local images corresponding to at least two parts of the target object can be determined from the first image sample. The image segmentation information can be a priori feature of the target object corresponding to the reference prediction task type, which is preset. For example, when the target object is a pedestrian, the priori feature of the pedestrian is standing vertically, and is divided into the head, upper limbs, and lower limbs; when the target object is a vehicle, the priori feature of the vehicle is horizontal placement, and is divided into three parts: the front of the vehicle, the body of the vehicle, and the parking space. The image segmentation information may include edge information of at least two local images, such as vertex coordinates of at least two local images. Exemplarily, the four vertex coordinates of the first image sample are (0,0), (0,100), (600,0), and (600,100), and the image segmentation information may be {(0,0), (0,100), (100,0), (100,100)}, {(100,0), (100,100), (300,0), (300,100)}, {(300,0), (300,100), (600,0), (600,100)}. The above image segmentation information can be used to segment the first image sample into three local images: upper, middle, and lower.

[0110] In step 1022B, based on the imaging areas of at least two partial images, the target area corresponding to each partial image is determined.

[0111] Wherein, the target area is positively correlated with the imaging area. In some embodiments, see Fig. 6A , step 1022B can be implemented through the following steps 221B to 222B, which are described in detail below.

[0112] In step 221B, a reference area for the target area is obtained.

[0113] In some embodiments, when the reference area for the target area is a preset value, the target area of ​​the target area is only positively correlated with the imaging area of ​​the local image. At this time, steps 1021B to 1024B can be used to determine the target area based only on the imaging area.

[0114] In some embodiments, when the reference area for the target area is determined based on the count value, and the reference area is positively correlated with the count value, then the area value of the target area is positively correlated with the count value and the imaging area. At this time, the third method of determining the target area can be achieved through steps 1021B to 1023B.

[0115] In some embodiments, when determining the reference area based on the count value, first obtain the preset second maximum area and second minimum area for the target area, and determine the area weight based on the count value and the total number of training stages, the area weight is positively correlated with the count value, and then determine the second area difference between the second maximum area and the second minimum area, and determine the product of the area weight and the second area difference as the second supplementary area, and finally determine the sum of the second minimum area and the second supplementary area as the reference area. That is, the reference area can be implemented by the following formula (2):

[0116] S Cn =S min2 +w n *ΔS2 (2);

[0117] Among them, S Cn is the reference area of ​​the target area corresponding to the count value n, S min2 is the second smallest area, w n is the area weight, and ΔS2 is the second area difference. Since in formula (2), S min2 and ΔS2 is fixed, w n Positively correlated with the count value, so the target area is positively correlated with the count value.

[0118] It should be noted that the implementation process of determining the reference area based on the count value is similar to the implementation process of step 1021A, except that the first maximum area and the second maximum area may be different, and the first minimum area and the second minimum area may be different. When implementing, the implementation process of step 1021A may be referred to.

[0119] In step 222B, the target area corresponding to each partial image is determined based on the reference area and the imaging areas of the at least two partial images.

[0120] In some embodiments, for each partial image, the imaging area of ​​the partial image may be determined based on the vertex coordinates of the partial image, and then the first area ratio between at least two partial images may be determined.

[0121] Exemplarily, the vertex coordinates of local image one are (0,0), (0,100), (100,0), and (100,100), and it can be determined that the width of local image one is 100, the length is 100, and the imaging area is 10000. The vertex coordinates of local image two are (100,0), (100,100), (300,0), and (300,100), and it can be determined that the width of local image two is 100, the length is 200, and the imaging area is 20000. The vertex coordinates of local image three are (300,0), (300,100), (600,0), and (600,100), and it can be determined that the width of local image three is 100, the length is 300, and the area is 30000.

[0122] In some embodiments, see Figure 6B , step 222B can be implemented through the following steps 2221B to 2229B, which are described in detail below.

[0123] In step 2221B, a second maximum area for the target area is obtained, and a minimum imaging area is obtained from at least two imaging areas.

[0124] In some embodiments, after determining the local images of different parts of the first image sample, the target area is determined in each local image. At this time, when setting the second maximum area for the target area, the size information of each local image needs to be considered. Exemplarily, the second maximum area can be set to be smaller than the minimum imaging area, and the second maximum area can also be set to be smaller than half of the maximum imaging area, etc. The second maximum area is set according to actual needs, and the second maximum area is generally smaller than the first maximum area in the aforementioned embodiment.

[0125] The minimum imaging area can be obtained from the at least two imaging areas by sorting the at least two imaging areas through a sorting algorithm to obtain the minimum imaging area. For example, the minimum imaging area can be 10,000.

[0126] In step 2222B, determine whether the second maximum area is smaller than the minimum imaging area.

[0127] When the second maximum area is smaller than the minimum imaging area, the process goes to step 2223B; and when the second maximum area is greater than or equal to the minimum imaging area, the process goes to step 2226B.

[0128] In step 2223B, the reference area is determined as the target area of ​​the first target partial image corresponding to the minimum imaging area.

[0129] The first target local image corresponding to the minimum imaging area is the minimum local image of at least two local images. Since the reference area is the second maximum area in the last training stage, when the second maximum area is smaller than the minimum imaging area, the reference area is determined as the target area of ​​the first target local image corresponding to the minimum imaging area, which can ensure that the target area of ​​the minimum local image will not be larger than the minimum local image in the last training stage.

[0130] Exemplarily, the reference area is 4000, the second maximum area is 8000, and the imaging area (10000) of the local image one is the minimum imaging area, then the local image one is the first target local image, and the target area of ​​the local image one is 4000.

[0131] In step 2224B, for each partial image except the first target partial image, a first area ratio between the imaging area of ​​the partial object and the imaging area of ​​the first target partial image is determined.

[0132] Assume that the reference area is 4000, the second maximum area is 8000, and the imaging area of ​​partial image 1 (10000) is the minimum imaging area. Continuing with the above example, the first target partial image is partial image 1, and the imaging area is 10000. The imaging area of ​​partial image 2 is 20000, so the first area ratio between partial image 2 and the first target partial image is 2; the imaging area of ​​partial image 3 is 30000, so the first area ratio between partial image 3 and the first target partial image is 3.

[0133] In step 2225B, the product of the first area ratio and the reference area is determined as the target area of ​​the partial image.

[0134] Continuing with the above example, the first area ratio between local image two and the first target local image is 2, and the reference area is 4000, then the target area corresponding to local image two is 8000, and the first area ratio between local image three and the first target local image is 3, and the reference area is 4000, then the target area corresponding to local image three is 12000.

[0135] In step 2226B, a target imaging area is determined from at least two imaging areas.

[0136] The target imaging area is the minimum value of the at least two imaging areas that is greater than the second maximum area. In implementation, at least one candidate imaging area that is greater than the second maximum area can be first determined from the at least two imaging areas, and then the minimum value of the at least one candidate imaging area can be determined as the target imaging area.

[0137] Exemplarily, the reference area is 5000, the second maximum area is 15000, the imaging area of ​​local image one is 10000, the imaging area of ​​local image two is 20000, and the imaging area of ​​local image three is 30000. Then the candidate imaging areas are 20000 and 30000, and the minimum value between 20000 and 30000 is 20000, so the target imaging area is 20000.

[0138] In step 2227B, the reference area is determined as the target area of ​​the second target partial image corresponding to the target imaging area.

[0139] Continuing with the above example, the second target partial image is partial image 2, that is, the reference area of ​​partial image 2 is 5000.

[0140] In step 2228B, for each partial image except the second target partial image, a second area ratio between the imaging area of ​​the partial image and the imaging area of ​​the second target partial image is determined.

[0141] Continuing with the above example, the second target partial image is partial image 2, and the imaging area is 20000. The imaging area of ​​partial image 1 is 10000, so the second area ratio between partial image 1 and the second target partial image is 0.5; the imaging area of ​​partial image 3 is 30000, so the first area ratio between partial image 3 and the second target partial image is 1.5.

[0142] In step 2229B, the product of the second area ratio and the reference area is determined as the target area of ​​the partial image.

[0143] Continuing with the above example, if the reference area is 5000, the target area of ​​partial image 1 is 2500, and the target area of ​​partial image 3 is 7500. Obviously, the ratio of the target areas of partial image 1, partial image 2 and partial image 3 is 1:2:3, and the ratio of the imaging areas of partial image 1, partial image 2 and partial image 3 is also 1:2:3, that is, the target area of ​​the target region of the partial image is positively correlated with the imaging area of ​​the partial image.

[0144] In the above steps 2221B to 2229B, if the second maximum area is smaller than the minimum imaging area, then the target area of ​​the first target local image corresponding to the minimum imaging area can be determined as the reference area, and then the target area of ​​each local image is determined based on the first area ratio of the imaging areas of other local images to the imaging area of ​​the first target local image. If the second maximum area is greater than or equal to the minimum imaging area, then the target area of ​​the second target local image corresponding to the minimum of at least two imaging areas greater than the second maximum area is determined as the reference area, and then the respective target areas are determined based on the area ratio between different local images. This ensures that even in the last training stage, the target area of ​​the target area in each local image is smaller than the imaging area, avoiding the masking of the entire local image in subsequent steps, and ensuring that the target recognition model can learn the characteristics of the target object from each local image.

[0145] In step 1023B, for each partial image, a third center point is determined from the partial image.

[0146] In step 1024B, based on the third center point and the target area corresponding to the local image, the target area in the local image is determined.

[0147] When implementing step 102, an area that meets the target area can be determined from the local image as the target area. Steps 1021B to 1024B can be used as an implementation embodiment of step 102 to determine the third center point from each local image, and then determine the target area based on the third center point and the target area. It should be noted that the implementation process of steps 1023B and 1024B is similar to the implementation process of steps 1022A and 1023A. When implementing steps 1023B and 1024B, reference can be made to the implementation process of steps 1022A and 1023A. The difference is that in steps 1022A and 1023A, the first center point is within the first image sample, while the third center point in the above steps 1023B and 1024B is within the local image, and each local image corresponds to a third center point, that is, each local image includes a target area. The third center point corresponding to the layout image can be randomly determined, so the coordinates of the third center point in different local images are different.

[0148] In the above steps 1021B to 1024B, at least two local images corresponding to at least two parts of the target object are first determined from the first image sample, and then the target area is determined for each local image based on the imaging area and the reference area of ​​each local image, that is, at least two target areas are determined from the first image sample, and the target area of ​​the target area is positively correlated with the imaging area of ​​the local image, thereby realizing multi-granularity data enhancement. When the reference area used to determine the target area is determined based on the count value of the training stage representing the target recognition model, the reference area is positively correlated with the count value. At this time, not only the target area of ​​the target area of ​​different local images is positively correlated with the imaging area, but also the target area of ​​the target area of ​​the same local image at different training stages is positively correlated with the count value of the training stage, and the third center point of the target area of ​​the same local image at different stages can be different. For example, for the same head image, the target area in the first training stage corresponds to the forehead area, and the target area in the second training stage corresponds to the nose area. In this way, on the basis of realizing multi-granularity data enhancement, progressive data enhancement is also realized, which can further improve the richness of image samples.

[0149] See below for more information Figure 4 , proceed to step 102 for description.

[0150] In step 103, the target area in the first image sample is masked to obtain a second image sample.

[0151] Among them, when masking the target area in the first image sample, the pixel value of each pixel in the target area can be set to the same preset pixel value to obtain a second image sample. Exemplarily, the preset pixel value can be 0. The second image sample is used to train the target recognition model in the training stage corresponding to the count value. Masking the target area in the first image sample is equivalent to covering the image corresponding to the target area, so that when the target recognition model is trained using the obtained second image sample, it can help the target recognition model learn to ignore the information of these areas, thereby enhancing the robustness of the target recognition model.

[0152] It should be noted that the above steps 101 to 103 may be a data enhancement process performed on any one of the multiple first image samples before the start of the current training phase. After the target area is determined by step 102, the location information of the target area may be recorded (for example, the center point and radius of the target area, or the vertex coordinates of the diagonal vertices of the target area, etc.). For other first image samples, the location information of the target area may be directly used to mask the target areas in other first image samples, without the need to repeatedly calculate the target area. This can reduce the amount of calculation for data enhancement, improve the efficiency of data enhancement and model training, and achieve online data enhancement.

[0153] In the image sample processing method of the target recognition model provided in the embodiment of the present application, firstly, the count value and multiple first image samples of the training phase of the target recognition model are obtained, and the first image sample includes the target object, and then the target area in the first image sample is determined based on the count value and at least one of the imaging areas of different parts of the target object in the first image sample, and for each first image sample, the target area in the first image sample is masked to obtain a second image sample, and the second image sample is used to train the target recognition model in the training phase corresponding to the count value. That is, in the embodiment of the present application, the target area can be determined based on the count value of the training phase, and the target area of ​​the target area is positively correlated with the count value, that is, the target area of ​​the target area increases with the increase of the count value of the training phase, so as to achieve progressive data enhancement. In the early stage of model training, the target area of ​​the target area is small. At this time, masking a smaller target area can enable the target recognition model to learn the characteristics of the target object, and with the increase of the number of model training rounds and the count value of the training phase, a larger area of ​​the target area can be masked, so that the target recognition model can also achieve accurate prediction in the case of interference, thereby improving the robustness of machine learning. The target area can be determined by the imaging area and the target area of ​​the target area is positively correlated with the imaging area. In this way, multiple target areas can be determined in the first image sample, thereby realizing data enhancement based on multi-granularity, so that the target recognition model can learn the characteristics of the target object when it is masked in multiple places, and improve the recognition performance of the target recognition model. In addition, the target area can also be determined based on the count value in the training phase and the imaging area of ​​different parts of the target object. At this time, the target area of ​​the target area is positively correlated with the count value and the imaging area, thereby realizing progressive and multi-granular data enhancement, which can improve the robustness and prediction performance of the target recognition model while improving the richness of the image samples.

[0154] In some embodiments, see Figure 6CBefore step 101, the first image sample can also be obtained through the following steps 001 to 004. Figure 6C Specific instructions.

[0155] In step 001, an original image and a preset reference size are obtained.

[0156] In some embodiments, the original image may be an image captured by an image capture device, or may be a video image frame decoded from video data. The reference size may include a reference length and a reference width, which are used to define the size of the image sample. For example, the reference size may be 100*600.

[0157] In step 002, target recognition is performed on the original image to obtain third position information of the recognition result image in the original image.

[0158] In some embodiments, a preset target recognition algorithm may be used to perform target recognition on the original image, thereby obtaining third position information of the recognition result image in the original image, wherein the third position information includes vertex coordinates of diagonal vertices of the recognition result image. Exemplarily, the third position information may be (10, 100), (100, 300).

[0159] In step 003, based on the third position information, a recognition result image is cropped from the original image.

[0160] In some embodiments, the coordinates of four vertices of the recognition result image may be determined based on the third position information, and then the recognition result image may be cropped from the original image.

[0161] In step 004, the recognition result image is scaled based on the reference size to obtain a first image sample.

[0162] In some embodiments, when scaling the recognition image based on the reference size, the scaling ratio is first determined, which can be accomplished by calculating the ratio between the reference size and the original size of the recognition result image. For example, if the image is to be scaled to a size of 100*600 pixels, and the size of the original image is 300*1000 pixels, then the scaling ratio X is 100 / 300 and the scaling ratio Y is 600 / 1000. New coordinates are then calculated, and based on the scaling ratio, the new coordinates of each pixel in the recognition result image in the scaled image are calculated. This can be accomplished by multiplying the original coordinates by the scaling ratio. For example, the new coordinates of the point (100,50) in the recognition result image in the scaled image will be (100*scaling ratio X, 50*scaling ratio Y).

[0163] In some embodiments, the image scaling function in the image processing library may be used to scale the recognition result image to a reference size to obtain a first image sample.

[0164] Through the above steps 001 to 004, the recognition result image is cropped from the original image, thereby reducing the interference of irrelevant content in the original image on the model training, and the recognition result image is scaled to the reference size to obtain a first image sample with consistent size. Then, when data enhancement is performed on multiple first image samples using the target area at the same position, there is no need to repeatedly calculate the position of the target area, thereby improving the processing efficiency of data enhancement.

[0165] The following is an explanation of an exemplary application of an embodiment of the present application in a practical application scenario.

[0166] In order to solve the limitation of poor erasure richness of the data enhancement strategy based on regional erasure in the related art, the embodiment of the present application provides a multi-granularity, progressive online data enhancement strategy.

[0167] Fig. 7A This is a schematic diagram of the results of the data enhancement method based on region erasing in the related technology at different stages of model training, such as Fig. 7A As shown in the figure, for the same image sample, the location and size of the erased area in training stage 1, training stage 2, and training stage N are fixed and do not change with the stage of model training. In addition, only one place is erased in each image, so the richness of the erasure is insufficient.

[0168] A reasonable erasure mechanism should meet the following two conditions:

[0169] First, the size of the erased area should be related to the stage of model training. Specifically, in the early stage of model training, the erased area should be small because the model's ability to represent images is insufficient. As model training progresses, the model's ability to represent images gradually increases, and the area of ​​the erased area should be increased accordingly, which helps the model learn more robust image features.

[0170] Second, the number of model erasure regions should be consistent with the semantic features of the image object. Taking pedestrian images as an example, a reasonable erasure strategy should be to erase based on the prior information of the human body structure. Specifically, the head, upper body, and lower body should all be erased. As the size of the head, upper body, and lower body gradually increases, the size of the erased region should also gradually increase.

[0171] According to the above two requirements, the erasure strategy in the related art is improved. For requirement one, the gradualness of erasure is introduced, and for requirement two, the multi-granularity is introduced. Thus, the embodiment of the present application proposes a multi-granularity, progressive online data enhancement strategy. Figure 7B As shown, in the image sample processing method of the target recognition model provided in the embodiment of the present application, for the same image sample, the size of the erased area is different in different training stages, and the same image sample includes multiple erased areas, so it has multi-granularity and progressiveness.

[0172] The image sample processing method of the target recognition model provided in the embodiment of the present application can achieve multi-granularity by following the steps below:

[0173] In the first step, for an image sample I, the training image I is divided into three regions F1, F2, and F3 according to the prior information, as follows: Figure 8 As shown, F1 is recorded as the first region 801, which represents the head of the human body, F2 is recorded as the second region 802, which represents the upper body of the human body, and F3 is recorded as the third region 803, which represents the lower body of the human body.

[0174] In the second step, erasure areas are randomly generated in the first area, the second area, and the third area respectively.

[0175] In the embodiment of the present application, the generation rule of the erased area is: the ratio of the erased area areas corresponding to the first area, the second area, and the third area is 1:2:3, such as Figure 7B As shown, the black erased areas corresponding to the three regions of the image samples in each training stage gradually increase.

[0176] After satisfying the multi-granularity of erasure, the gradualness of erasure is introduced, that is, the area of ​​the same erasure region increases as the model training stage deepens. When implementing the gradualness of erasure:

[0177] The first step is to divide the model training process into N training stages according to the pre-set number of training rounds for model training. For example, assuming that the number of training rounds (epochs) is 90, divided into 3 training stages, the first 30 epochs are stage one, the 31st to 60th epochs are stage two, and the 61st to 90th epochs are stage three.

[0178] The second step is to set the minimum and maximum areas to be erased, with the minimum area being S min , the maximum area is S max ; According to the number of training stages n, the erasure area corresponding to each training stage is calculated by formula (3):

[0179]

[0180] In the third step, the erasure area is randomly generated according to the erasure area corresponding to each training stage, and applied to the model training in each stage.

[0181] It should be noted that in order to better combine multi-granularity and progressiveness, the size of the erased area at each stage can be calculated according to the rules in progressiveness, and then multi-granularity can be introduced. Specifically, for example, the size of the erased area at a certain stage is S n , then in this stage, the erasure sizes corresponding to the first area, the second area, and the third area are 0.5*S respectively n , S n and 1.5*S n , ensuring the proportional relationship of the erasing area among the first area, the second area and the third area.

[0182] In order to improve the shortcomings of the traditional data enhancement strategy based on region erasing, the embodiment of the present application proposes a multi-granularity, progressive online data enhancement strategy, which can dynamically adjust the size of the erased area with the model training stage, and set multi-granularity erasing areas at the same time, thereby enabling the deep neural network to learn more robust and more representative image features. Therefore, the multi-granularity, progressive online data enhancement strategy proposed in the embodiment of the present application can be widely used in various visual tasks, effectively improving the robustness and discrimination ability of visual features.

[0183] It is understandable that in the embodiments of the present application, user information is involved, such as image samples, video data and other related data. When the embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards.

[0184] The following is a description of an exemplary structure of the image sample processing device 443 of the target recognition model provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 3 As shown, the software modules stored in the image sample processing device 443 of the target recognition model in the memory 440 may include:

[0185] A first acquisition module 4431 is used to acquire a first image sample, where the first image sample includes a target object;

[0186] A region determination module 4432 is used to determine a target region in the first image sample based on at least one of a count value and an imaging area, wherein the count value represents a current training stage of the target recognition model, the imaging area represents a size of the target object in the first image sample, and the target area of ​​the target region is positively correlated with at least one of the count value and the imaging area;

[0187] The area masking module 4433 is used to mask the target area in the first image sample to obtain a second image sample, and the second image sample is used to train the target recognition model in the training stage corresponding to the count value.

[0188] In some embodiments, the area determination module 4432 is also used to determine the target area based on the count value, and the target area is positively correlated with the count value; determine a first center point from the first image sample; and determine the target area in the first image sample based on the first center point and the target area.

[0189] In some embodiments, the area determination module 4432 is also used to obtain a preset first maximum area and a first minimum area for the target area, and obtain the total number of training stages; determine an area weight based on the count value and the total number of training stages, and the area weight is positively correlated with the count value; determine a first area difference between the first maximum area and the first minimum area, and determine the product of the area weight and the first area difference as a first supplementary area; determine the sum of the first minimum area and the first supplementary area as the target area.

[0190] In some embodiments, the region determination module 4432 is further used to construct a candidate region based on the first center point and the target area; when the first image sample contains the candidate region, the candidate region is determined as the target region in the first image sample.

[0191] In some embodiments, the region determination module 4432 is also used to determine a second center point from the first image sample when the first image sample does not contain the candidate region, and determine the target region in the first image sample based on the second center point and the target area; or, determine the overlapping region between the candidate region and the first image sample, and determine the overlapping region as the target region in the first image sample.

[0192] In some embodiments, the area determination module 4432 is also used to determine at least two local images corresponding to at least two parts of the target object from the first image sample; based on the imaging areas of the at least two local images, determine the target area corresponding to each of the local images, and the target area is positively correlated with the imaging area; for each of the local images, determine a third center point from the local image; based on the third center point and the target area corresponding to the local image, determine the target area in the local image.

[0193] In some embodiments, the area determination module 4432 is further used to obtain a reference area for the target area; and determine the target area corresponding to each local image based on the reference area and the imaging areas of the at least two local images.

[0194] In some embodiments, the area determination module 4432 is also used to obtain a preset second maximum area and second minimum area for the target area, and determine an area weight based on the count value and the total number of training stages, wherein the area weight is positively correlated with the count value; determine a second area difference between the second maximum area and the second minimum area, and determine the product of the area weight and the second area difference as a supplementary area; and determine the sum of the second minimum area and the second supplementary area as a reference area.

[0195] In some embodiments, the area determination module 4432 is also used to obtain a second maximum area for the target area and obtain a minimum imaging area from at least two imaging areas; when the second maximum area is smaller than the minimum imaging area, the reference area is determined as the target area of ​​the first target local image corresponding to the minimum imaging area; for each of the local images except the first target local image, a first area ratio between the imaging area of ​​the local object and the imaging area of ​​the first target local image is determined; and the product of the first area ratio and the reference area is determined as the target area of ​​the local image.

[0196] In some embodiments, the area determination module 4432 is further configured to, when the second maximum area is greater than or equal to the minimum imaging area, determine a target imaging area from the at least two imaging areas, the target imaging area being the minimum value of the at least two imaging areas that is greater than the second maximum area; determine the reference area as the target area of ​​the second target partial image corresponding to the target imaging area; and determine, for each of the partial images except the second target partial image, a second area ratio between the imaging area of ​​the partial image and the imaging area of ​​the second target partial image;

[0197] The product of the second area ratio and the reference area is determined as the target area of ​​the partial image.

[0198] In some embodiments, the device also includes: a second acquisition module, used to acquire the original image and a preset reference size; a target recognition module, used to perform target recognition on the original image to obtain third position information of the recognition result image in the original image; an image cropping module, used to crop the recognition result image from the original image based on the third position information; an image scaling module, used to scale the recognition result image based on the reference size to obtain a first image sample.

[0199] In some embodiments, the device also includes: a third acquisition module, used to obtain the current number of training rounds, the preset total number of training rounds, and the preset total number of training stages of the target recognition model; a count value determination module, used to determine the count value of the training stage of the target recognition model based on the total number of training rounds, the current number of training rounds, and the total number of training stages.

[0200] The embodiment of the present application provides a computer program product, which includes a computer program or a computer executable instruction, and the computer program or the computer executable instruction is stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instruction from the computer-readable storage medium, and the processor executes the computer executable instruction, so that the electronic device executes the image sample processing method of the target recognition model described in the embodiment of the present application.

[0201] The present application embodiment provides a computer-readable storage medium in which computer executable instructions or computer programs are stored. When the computer executable instructions or computer programs are executed by a processor, the processor will be caused to execute the image sample processing method of the target recognition model provided by the present application embodiment, for example, Figure 4 , Figure 6C The image sample processing method of the target recognition model is shown.

[0202] In some embodiments, the computer-readable storage medium may be a memory such as RAM, ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or may be various devices including one or any combination of the above memories.

[0203] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0204] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0205] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0206] In summary, through the embodiments of the present application, the target area to be erased can be determined based on the progression of the training stage of the target recognition model and the size information of the local images corresponding to different parts of the target object in the image sample, thereby achieving progressive and multi-granular data enhancement, which can improve the diversity of training samples and the robustness of the model.

[0207] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. An image sample processing method for a target recognition model, characterized in that: The method comprises: Acquire a first image sample, where the first image sample includes a target object; Determine a target region in the first image sample based on at least one of a count value and an imaging area, wherein the count value represents a current training stage of the target recognition model, the imaging area represents a size of the target object in the first image sample, and the target area of ​​the target region is positively correlated with at least one of the count value and the imaging area; The target area in the first image sample is masked to obtain a second image sample, where the second image sample is used to train the target recognition model in the training phase corresponding to the count value.

2. The method according to claim 1, characterized in that The determining the target area in the first image sample based on at least one of the count value and the imaging area of ​​the target object in the first image sample comprises: determining a target area based on the count value, wherein the target area is positively correlated with the count value; determining a first center point from the first image sample; An object region in the first image sample is determined based on the first center point and the object area.

3. The method according to claim 2, characterized in that The determining the target area based on the count value comprises: Obtaining a preset first maximum area and a first minimum area for the target area, and obtaining a total number of training stages; Determine an area weight based on the count value and the total number of training stages, wherein the area weight is positively correlated with the count value; determining a first area difference between the first maximum area and the first minimum area, and determining a product of the area weight and the first area difference as a first supplementary area; A sum of the first minimum area and the first supplementary area is determined as a target area.

4. The method according to claim 2, characterized in that The determining the target area in the first image sample based on the first center point and the target area includes: Constructing a candidate area based on the first center point and the target area; When the first image sample includes the candidate region, the candidate region is determined as the target region in the first image sample.

5. The method according to claim 4, characterized in that The determining the target area in the first image sample based on the first center point and the target area includes: When the first image sample does not include the candidate area, determining a second center point from the first image sample, and determining the target area in the first image sample based on the second center point and the target area; or, An overlapping area between the candidate area and the first image sample is determined, and the overlapping area is determined as a target area in the first image sample.

6. The method according to claim 1, characterized in that The determining the target area in the first image sample based on at least one of the count value and the imaging area of ​​the target object in the first image sample comprises: Determine at least two partial images corresponding to at least two parts of the target object respectively from the first image sample; Based on the imaging areas of the at least two partial images, determining a target area corresponding to each of the partial images, wherein the target area is positively correlated with the imaging area; For each of the partial images, determining a third center point from the partial image; Based on the third center point and the target area corresponding to the partial image, a target area in the partial image is determined.

7. The method according to claim 6, characterized in that The determining, based on the imaging areas of the at least two partial images, a target area corresponding to each partial image comprises: Acquire a reference area for the target area; Based on the reference area and the imaging areas of the at least two partial images, a target area corresponding to each partial image is determined.

8. The method according to claim 7, characterized in that The obtaining of a reference area for the target area includes: Obtaining a preset second maximum area and a second minimum area for the target area, and determining an area weight based on the count value and the total number of training stages, wherein the area weight is positively correlated with the count value; determining a second area difference between the second maximum area and the second minimum area, and determining a product of the area weight and the second area difference as a supplementary area; A sum of the second minimum area and the second supplementary area is determined as a reference area.

9. The method according to claim 7 or 8, characterized in that: The determining, based on the reference area and the imaging areas of the at least two partial images, a target area corresponding to each partial image comprises: Acquire a second maximum area for the target area, and acquire a minimum imaging area from at least two imaging areas; When the second maximum area is smaller than the minimum imaging area, determining the reference area as the target area of ​​the first target partial image corresponding to the minimum imaging area; For each of the partial images except the first target partial image, determining a first area ratio between an imaging area of ​​the partial object and an imaging area of ​​the first target partial image; The product of the first area ratio and the reference area is determined as the target area of ​​the partial image.

10. The method according to claim 9, characterized in that The determining, based on the reference area and the imaging areas of the at least two partial images, a target area corresponding to each partial image comprises: When the second maximum area is greater than or equal to the minimum imaging area, determining a target imaging area from the at least two imaging areas, the target imaging area being a minimum value of the at least two imaging areas that is greater than the second maximum area; Determining the reference area as the target area of ​​the second target partial image corresponding to the target imaging area; For each of the partial images except the second target partial image, determining a second area ratio between an imaging area of ​​the partial image and an imaging area of ​​the second target partial image; The product of the second area ratio and the reference area is determined as the target area of ​​the partial image.

11. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Get the original image and the preset reference size; Performing target recognition on the original image to obtain third position information of the recognition result image in the original image; Based on the third position information, cropping the recognition result image from the original image; Based on the reference size, the recognition result image is scaled to obtain a first image sample.

12. The method according to any one of claims 1 to 7, characterized in that: The method further comprises: Obtaining the current number of training rounds, the preset total number of training rounds, and the preset total number of training stages of the target recognition model; Based on the total number of training rounds, the current number of training rounds and the total number of training stages, a count value of a training stage of the target recognition model is determined.

13. An image sample processing device for a target recognition model, characterized in that: The device comprises: A first acquisition module is used to acquire a first image sample, wherein the first image sample includes a target object; a region determination module is used to determine a target region in the first image sample based on at least one of a count value and an imaging area, wherein the count value represents a current training stage of the target recognition model, and the imaging area represents a size of the target object in the first image sample, and a target area of ​​the target region is positively correlated with at least one of the count value and the imaging area; The area masking module is used to mask the target area in the first image sample to obtain a second image sample, and the second image sample is used to train the target recognition model in the training stage corresponding to the count value.

14. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions or computer programs; A processor is used to implement the image sample processing method of the target recognition model described in any one of claims 1 to 12 when executing the computer executable instructions or computer programs stored in the memory.

15. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the image sample processing method of the target recognition model described in any one of claims 1 to 12 is implemented.