Data model training method, device, equipment and medium
By identifying and labeling target objects, establishing virtual coordinate systems and screening samples, the problems of inferiority and scarcity of deep learning training samples are solved, and the training efficiency and accuracy of the model are improved.
Patent Information
- Application Number
- CN202111088635.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-16
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2041-09-16
AI Technical Summary
In the prior art, deep learning training samples based on yolov3 have problems with scarcity of low-quality samples and samples, resulting in low model accuracy and high training complexity. The traditional processing method requires a lot of manpower and time, resulting in low model training efficiency.
A data model training method is proposed, including obtaining the initial picture set, identifying and annotating the target object, establishing a virtual coordinate system for coordinate alignment, training to obtain the initial data model, calculating the confidence parameter to filter the samples, obtaining supplementary training samples to increase the sample number and Diversity.
By improving the quality and quantity of training samples, the model's attention to the target object and background environment is improved, the training efficiency and accuracy of the model are improved, and the training complexity and poor training results are avoided due to poor quality samples.
Smart Images

Figure CN113762286B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a data model training method, device, equipment and medium. Background Art
[0002] In the deep learning training samples based on yolov3, some training samples may be of poor quality, such as ghosting, occlusion, unclearness, etc., or the scarcity of samples in some scenes may lead to insufficient training samples. These will lead to low accuracy of the trained model. At the same time, the introduction of poor-quality samples will also lead to excessive complexity during training.
[0003] In response to the poor quality of some training samples, the traditional approach is to manually review all sample images and screen out unqualified samples, and whether the images are qualified is also subjective; in response to the problem of sample scarcity, the main approach is to manually screen high-quality samples, use keras data enhancement methods, create more samples through tilting, mirroring, etc., or use public data sets, collect data online, etc. However, both of the above processing methods require a lot of manpower and time, resulting in low model training efficiency. Summary of the invention
[0004] The main purpose of this application is to provide a data model training method, device, medium and equipment, aiming to solve the technical problem of low model training efficiency in the prior art.
[0005] In order to achieve the above-mentioned invention object, the present application proposes a data model training method, the method comprising:
[0006] Acquire an initial picture set, wherein the initial picture set includes a plurality of initial picture samples;
[0007] Identify the target object in each of the initial image samples, and respectively mark the contours of the target objects to obtain target contours;
[0008] Establishing a virtual coordinate system in each of the initial image samples respectively, calculating the image midpoint of the initial image sample according to the virtual coordinate system, and aligning the center of the target contour with the image midpoint;
[0009] The initial image sample after the coordinates are aligned is used as a first training sample, and a first data model is obtained through training based on the first training sample;
[0010] Calculating confidence parameters of the first training samples respectively, taking the first training samples whose confidence parameters are greater than a preset confidence threshold as satisfactory samples, taking the first training samples whose confidence parameters are not greater than the confidence threshold as unsatisfactory samples, and removing the unsatisfactory samples;
[0011] In response to the sample supplement instruction, a supplementary training sample is acquired, and a second training sample is obtained according to the supplementary training sample and the satisfactory sample;
[0012] The first data model is trained using the second training sample to obtain a second data model.
[0013] Furthermore, the coordinate alignment of the center of the target contour and the midpoint of the image includes:
[0014] When there are a plurality of target contours in the initial image sample, copying the initial image sample to obtain a plurality of copy image samples;
[0015] A different target contour is selected from each of the copied image samples, and the contour center of the selected target contour is aligned with the image midpoint of the copied image sample.
[0016] Furthermore, the step of respectively labeling the target objects to obtain target contours includes:
[0017] Respectively identifying a first contour point and a second contour point on the outermost side of the target object in a first direction;
[0018] Respectively identifying the outermost third contour point and the outermost fourth contour point of the target object in the second direction, wherein the first direction is perpendicular to the second direction;
[0019] Draw a straight line parallel to the second direction through the first contour point and the second contour point, and draw a straight line parallel to the first direction through the third contour point and the fourth contour point;
[0020] The area enclosed by the straight lines is identified, and the frame of the area is used as the target contour.
[0021] Furthermore, the step of respectively labeling the target objects to obtain target contours includes:
[0022] Identifying the outer contour of the target object;
[0023] Along the outer contour, contour marking is performed on pixels adjacent to the outer side of the outer contour;
[0024] The labeled pixels are used as the target contour.
[0025] Furthermore, before aligning the center of the target contour with the midpoint of the image, the method further includes:
[0026] Calculate the area ratio of the target contour in the initial image sample;
[0027] If the area ratio is less than the preset area ratio, the target outline and the image inside the target outline are enlarged until the area ratio is not less than the preset area ratio.
[0028] Further, obtaining a second training sample according to the supplementary training sample and the satisfactory sample includes:
[0029] Performing a first enhancement process on the satisfactory samples to obtain a plurality of first enhanced samples, wherein the first enhancement process includes at least one of translation, rotation, and mirror flipping;
[0030] The supplementary training sample and the first enhanced sample are used as the second training sample.
[0031] Further, obtaining a second training sample according to the supplementary training sample and the satisfactory sample includes:
[0032] Performing a second enhancement process on the satisfactory samples to obtain a plurality of second enhanced samples, wherein the second enhancement process includes at least one of binarization, brightness adjustment, and contrast adjustment;
[0033] The supplementary training sample and the second enhanced sample are used as the second training sample.
[0034] This application also proposes a data model training device, including:
[0035] A picture set acquisition module, used to acquire an initial picture set, wherein the initial picture set includes a plurality of initial picture samples;
[0036] A contour recognition module, used to identify the target object in each of the initial image samples, and to mark the contours of the target objects to obtain the target contours;
[0037] A coordinate alignment module, used to establish a virtual coordinate system in each of the initial image samples, calculate the image midpoint of the initial image sample according to the virtual coordinate system, and coordinately align the contour center of the target contour with the image midpoint;
[0038] A first model training module, configured to use the initial image sample after coordinate alignment as a first training sample, and obtain a first data model based on the first training sample;
[0039] a sample screening module, configured to respectively calculate the confidence parameters of the first training samples, take the first training samples whose confidence parameters are greater than a preset confidence threshold as satisfactory samples, take the first training samples whose confidence parameters are not greater than the confidence threshold as unsatisfactory samples, and remove the unsatisfactory samples;
[0040] A sample supplement module, configured to obtain a supplementary training sample in response to a sample supplement instruction, and obtain a second training sample according to the supplementary training sample and the satisfactory sample;
[0041] The second model training module is used to train the first data model through the second training sample to obtain a second data model.
[0042] The present application also proposes a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements any of the above methods when executing the computer program.
[0043] The present application also proposes a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, any of the above-mentioned methods is implemented.
[0044] The data model training method, device, medium and equipment of the present application provide a learning basis for data model training by pre-preparing a number of different initial image samples; by identifying the target object in each of the initial image samples and annotating the contours of the target objects respectively, the training focus is improved to avoid the problem of low model accuracy due to other noise in the initial image samples; a virtual coordinate system is established, and the target contour and the midpoint of the image are aligned according to the virtual coordinate system to obtain a pixel portion that just includes the target object and a part of the background environment centered on the target object, thereby further improving the model's focus on the target object and its surrounding background environment; training is performed through the first training sample to obtain a first data model, so that after the data model is trained The invention can improve the ability to summarize the features of target objects in different background environments; by calculating the confidence parameters of each first training, it can distinguish high-quality samples, i.e., satisfactory samples, and remove low-quality samples, i.e., unsatisfactory samples, thereby realizing sample screening, avoiding the poor quality samples from participating in the training, which leads to the greatly increased complexity of subsequent training of the data model and the poor training effect such as underfitting; by obtaining supplementary training samples and obtaining the second training samples based on the supplementary training samples and the satisfactory samples, the number and diversity of samples are increased, and the training effect of the data model is improved; after obtaining the supplemented second training samples, the first data model can be retrained to avoid the secondary training process being affected by the unsatisfactory samples existing in the first training process. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A flowchart of a data model training method according to an embodiment of the present application;
[0046] Figure 2 A flowchart of a data model training method according to a specific embodiment of the present application;
[0047] Figure 3 This is a schematic block diagram of the structure of a data model training device according to an embodiment of the present application;
[0048] Figure 4 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.
[0049] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0051] Reference Figure 1 In order to achieve the above-mentioned invention object, the present application proposes a data model training method, the method comprising:
[0052] S1: Acquire an initial picture set, wherein the initial picture set includes a plurality of initial picture samples;
[0053] S2: Identify the target object in each of the initial image samples, and mark the contours of the target objects to obtain the target contours;
[0054] S3: establishing a virtual coordinate system in each of the initial image samples respectively, calculating the image midpoint of the initial image sample according to the virtual coordinate system, and aligning the center of the target contour with the image midpoint;
[0055] S4: taking the initial image sample after the coordinates are aligned as a first training sample, and obtaining a first data model through training based on the first training sample;
[0056] S5: Calculate the confidence parameters of the first training samples respectively, take the first training samples whose confidence parameters are greater than a preset confidence threshold as satisfactory samples, take the first training samples whose confidence parameters are not greater than the confidence threshold as unsatisfactory samples, and remove the unsatisfactory samples;
[0057] S6: In response to the sample supplement instruction, obtain a supplementary training sample, and obtain a second training sample according to the supplementary training sample and the satisfactory sample;
[0058] S7: Train the first data model using the second training sample to obtain a second data model.
[0059] This embodiment provides a learning basis for data model training by pre-preparing several different initial image samples; by identifying the target object in each of the initial image samples and annotating the contours of the target objects respectively, the training focus is improved to avoid the problem of low model accuracy due to other noise in the initial image samples; a virtual coordinate system is established, and the target contour and the midpoint of the image are aligned according to the virtual coordinate system to obtain a pixel portion that just includes the target object and a part of the background environment centered on the target object, thereby further improving the model's focus on the target object and its surrounding background environment; training is performed through the first training sample to obtain a first data model, so that the data model can improve the focus on different backgrounds after training. The ability to summarize the characteristics of target objects in the environment; by calculating the confidence parameters of each first training, the samples with higher quality, i.e., satisfactory samples, are distinguished, and the samples with lower quality, i.e., unsatisfactory samples, are removed, thereby realizing sample screening, avoiding the poor quality samples from participating in the training, which leads to the greatly increased complexity of subsequent training of the data model and the poor training effect such as underfitting; by obtaining supplementary training samples and obtaining the second training samples based on the supplementary training samples and the satisfactory samples, the number and diversity of samples are increased, and the training effect of the data model is improved; after obtaining the supplemented second training samples, the first data model can be retrained to avoid the secondary training process being affected by the unsatisfactory samples existing in the first training process.
[0060] For step S1, this embodiment can acquire and process relevant image data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Basic artificial intelligence technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. Artificial intelligence software technology mainly includes computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0061] Specifically, this embodiment is applied to the field of model training, especially deep learning training based on yolov3; generally speaking, in order to make the neural network model applicable to more environments, it is necessary to train the neural network model during the model building process so that the model can learn various environments according to different training samples. Therefore, when training the neural network model, it is necessary to obtain a certain number of training samples in advance. In a specific implementation, if the data model is used for vehicle license plate recognition, the initial picture samples to be obtained should include license plate pictures of several different colors, sizes, and environments; if the model is used for vehicle appearance recognition, the initial picture samples to be obtained should include vehicle pictures of different models and environments. This embodiment does not limit the initial picture samples. In this embodiment, a learning basis is provided for data model training by pre-preparing several different initial picture samples.
[0062] For step S2, in the process of training the data model, often not every detail in the initial image sample is an object that needs to be trained and learned. If the original initial image is directly used for data model training, it is likely to cause the model to learn unnecessary features, thereby resulting in the problem of low recognition accuracy of the final model. In a specific implementation, an initial image sample may generally include one or more target objects. For example, when the target object is a vehicle, there may be multiple vehicle images in an initial image sample. In order to increase the number and diversity of target objects, this embodiment identifies each target object in each initial image sample and annotates the contours of each of the above target objects, thereby increasing the focus of training and avoiding the problem of low model accuracy due to other noise in the initial image sample.
[0063] For step S3, due to different shooting angles and distances, the initial picture sample often has the problem that the target object is not in the center of the picture. If the target object picture within the target contour is directly used for training, it may cause the trained data model to be unable to conduct comprehensive analysis in combination with the background environment, that is, the data model is weakened to summarize the characteristics of the target object under different background environments. Therefore, this embodiment establishes a virtual coordinate system in the initial picture sample, calculates the coordinates of the midpoint of the picture of the initial picture sample according to the coordinate system, and calculates the center coordinates of the target contour, and finally makes the virtual coordinate system and the boundary of the initial picture sample stationary, moves the pixel part of the initial picture sample, so that the center coordinates of the target contour overlap with the coordinates of the midpoint of the picture. At this time, relative to the boundary of the initial picture sample, the target object is exactly in the center of the entire initial picture sample, and the part encircled by the boundary of the initial picture sample at this time just includes the target object and the part of the background environment centered on the target object. The present invention establishes a virtual coordinate system, and aligns the target contour and the midpoint of the picture according to the virtual coordinate system, so as to obtain the pixel part that just includes the target object and the part of the background environment centered on the target object, thereby further improving the model's attention to the target object and its surrounding background environment.
[0064] For step S4, through coordinate alignment, a pixel portion including the target object and a portion of the background environment centered on the target object is obtained, and the pixel portion is used as the first training sample. Training is performed through the first training sample to obtain a first data model, so that after the data model is trained, the ability to summarize the characteristics of the target object in different background environments can be improved.
[0065] For step S5, the above confidence parameter can be calculated by the mean average precision (mAP) algorithm; specifically, the first training sample is input into a preset confidence prediction model for confidence prediction, and the above confidence prediction model has a built-in mAP algorithm, and B_gt represents the actual bounding box (Ground Truth, GT) of the first training sample, and B_p represents the bounding box predicted by the first data model for the first training sample. The mAP is used to calculate the intersection-over-union (IOU) of the above two by the following formula:
[0066]
[0067] Taking IOU as the above confidence parameter, the first training sample whose IOU is greater than the confidence threshold max_iou is a satisfactory sample, which means that the actual bounding box of the sample is basically consistent with the predicted bounding box; the first training sample whose IOU is not greater than the confidence threshold max_iou is an unsatisfactory sample, which means that the actual bounding box of the sample is greatly different from the predicted bounding box; the present invention calculates the confidence parameters of each first training to distinguish samples with higher quality, i.e., satisfactory samples, and remove samples with lower quality, i.e., unsatisfactory samples, thereby realizing sample screening and avoiding the situation in which poor-quality samples participate in training, resulting in a greatly increased complexity of subsequent training of the data model and poor training effects such as underfitting of the training effect.
[0068] For step S6, since some unsatisfactory samples with poor quality are deleted in step S5, if the remaining satisfactory samples are directly used for subsequent training of the first data model, the problem of insufficient samples may lead to overfitting of the model. Therefore, it is necessary to supplement the training samples. In this embodiment, supplementary training samples are obtained by re-acquiring supplementary training samples, and supplementary training samples are obtained manually input according to sample supplementation instructions or supplementary training samples are automatically obtained from a database. The present invention obtains supplementary training samples and obtains second training samples based on the supplementary training samples and the satisfactory samples, thereby increasing the number and diversity of samples and improving the training effect of the data model.
[0069] For step S7, after obtaining the supplemented second training samples, the first data model can be re-trained to avoid the second training process being affected by the unsatisfactory samples existing in the first training process, thereby improving the accuracy of the second data model prediction; in a specific implementation, if the trainer is still not satisfied with the prediction result of the second data model, the above steps can be performed again, that is, the satisfactory samples and the unsatisfactory samples are sorted again by the mAP algorithm, and the supplemented training samples are obtained, and the next model is performed according to the satisfactory samples after the sorting again and the supplemented training samples again, until the model meets the requirements of the trainer.
[0070] In one embodiment, referring to Figure 2 The step of aligning the center of the target contour with the midpoint of the image in coordinates S3 includes:
[0071] S31: when there are a plurality of target contours in the initial image sample, copy the initial image sample to obtain a plurality of copy image samples;
[0072] S32: Select a different target contour from each of the copied image samples, and align the center of the selected target contour with the midpoint of the image of the copied image sample.
[0073] This embodiment improves the richness of samples and avoids the problem of material loss by copying and aligning multiple target contours in an initial image.
[0074] For step S31, an initial image sample may include one or more target objects. When multiple target objects are included, target contours that mark multiple target objects will appear. If only one of the target contours is selected for coordinate alignment, it will lead to the problem of missing training materials.
[0075] For step S32, in this embodiment, when an initial image sample contains N target contours, the initial image sample is copied N-1 times to obtain a total of N samples that are identical to the initial image sample. At this time, a different target contour is selected from each sample for coordinate alignment to obtain N training samples in which the target object is located at the center of the image, thereby improving the richness of the samples and avoiding the problem of material loss.
[0076] In one embodiment, the step of respectively labeling the target objects to obtain the target contour S2 includes:
[0077] S21: Respectively identifying a first contour point and a second contour point on the outermost side of the target object in the first direction;
[0078] S22: respectively identifying a third contour point and a fourth contour point on the outermost side of the target object in the second direction, wherein the first direction is perpendicular to the second direction;
[0079] S23: Draw a straight line parallel to the second direction through the first contour point and the second contour point, and draw a straight line parallel to the first direction through the third contour point and the fourth contour point;
[0080] S24: Identify the area enclosed by the straight lines, and use the border of the area as the target outline.
[0081] This embodiment obtains a target contour including the complete target object by identifying the outermost contour points of the target object in four mutually perpendicular directions and enclosing a rectangular area with the contour points, so as to facilitate locating the contour center.
[0082] For step S22, in order to facilitate the marking of the target object, this embodiment selects a total of four outermost points in two vertical directions as positioning points of the target contour, and draws straight lines through the outermost points in the two directions, so that the contour of the target object body can be enclosed in the area surrounded by the straight lines. Since the first direction and the second direction are perpendicular to each other, the above four straight lines ultimately form a rectangle, which means that the contour center of the target contour can be found quickly and easily.
[0083] In one embodiment, the step of respectively labeling the target objects to obtain the target contour S2 includes:
[0084] S25: Identify the outer contour of the target object;
[0085] S26: along the outer contour, contour marking is performed on pixels adjacent to the outer side of the outer contour;
[0086] S27: Using the labeled pixels as the target contour.
[0087] This embodiment improves the accuracy of positioning irregular objects by identifying external contours for labeling.
[0088] For step S27, in the specific implementation process, the target object is not necessarily a relatively round or relatively uniform pattern. Taking the target object as a fruit as an example, if the target object is an object such as a banana, if the rectangular outline marking method in the above S21-S24 is directly used, the center of the target outline will be far away from the center of the target object. Therefore, this embodiment can also use a direct tracing method to perform outline marking. This method can improve the accuracy of outline marking for target objects with more special shapes.
[0089] In one embodiment, before the coordinate alignment of the center of the target contour with the midpoint of the picture S3, the method further includes:
[0090] S301: Calculate the area ratio of the target contour in the initial image sample;
[0091] S302: If the area ratio is less than a preset area ratio, the target outline and the image inside the target outline are enlarged until the area ratio is not less than a preset area ratio.
[0092] This embodiment increases the attention of the data model to the target object by proportionally enlarging the target object with a smaller area, thereby improving the accuracy of training.
[0093] For step S302, in actual sample collection, there may be a problem that the target object is smaller in the entire picture due to the long shooting distance, and the small area of the target object will also lead to poor data model training effect. Therefore, this embodiment increases the data model's attention to the target object by proportionally enlarging the target object with a smaller area, thereby improving the accuracy of training.
[0094] In one embodiment, obtaining the second training sample S6 according to the supplementary training sample and the satisfactory sample includes:
[0095] S61: performing a first enhancement process on the satisfactory sample to obtain a plurality of first enhanced samples, wherein the first enhancement process includes at least one of translation, rotation, and mirror flipping;
[0096] S62: Use the supplementary training sample and the first enhanced sample as the second training sample.
[0097] This embodiment increases the quantity and richness of samples by performing translation, rotation, mirror flipping and other processing on satisfactory samples.
[0098] For step S61, in different implementations, there are some scenes with a small sample stock, which is difficult to collect, and the pictures found on the Internet do not meet the training requirements, which will lead to insufficient sample richness and overfitting of the model. At this time, the satisfactory samples are processed by data enhancement, that is, more relevant samples are created through some high-quality samples. In this embodiment, translation, rotation, mirror flipping, etc. can be used to solve the problem of too few samples and too low sample richness. Specifically, the above-mentioned translation, rotation, and mirror flipping can be used alone, or they can be combined in any number for enhancement processing to further improve the richness of the samples.
[0099] In one embodiment, obtaining the second training sample S6 according to the supplementary training sample and the satisfactory sample includes:
[0100] S63: performing a second enhancement process on the satisfactory samples to obtain a plurality of second enhanced samples, wherein the second enhancement process includes at least one of binarization, brightness adjustment, and contrast adjustment;
[0101] S64: Use the supplementary training sample and the second enhanced sample as the second training sample.
[0102] This embodiment increases the quantity and richness of samples by performing binarization, brightness adjustment, contrast adjustment and other processing on satisfactory samples, so that the samples can simulate a variety of light environments and weather environments, thereby improving the practical significance of the samples.
[0103] For step S63, the day and night can be simulated by adjusting the brightness value, and the rainy or foggy weather can be simulated by adjusting the contrast. The sensitivity of the model to the contour can be improved by binarizing the samples, thereby improving the practical significance of the samples and further improving the accuracy of the second data model in recognizing the real picture.
[0104] Reference Figure 3 , the present application also proposes a data model training device, comprising:
[0105] The picture set acquisition module 100 is used to acquire an initial picture set, wherein the initial picture set includes a plurality of initial picture samples;
[0106] The contour recognition module 200 is used to recognize the target object in each of the initial image samples and to mark the contours of the target objects to obtain the target contours;
[0107] A coordinate alignment module 300 is used to establish a virtual coordinate system in each of the initial image samples, calculate the image midpoint of the initial image sample according to the virtual coordinate system, and coordinately align the contour center of the target contour with the image midpoint;
[0108] A first model training module 400 is used to use the initial image sample after coordinate alignment as a first training sample, and obtain a first data model based on the first training sample;
[0109] A sample screening module 500, configured to respectively calculate the confidence parameters of the first training samples, take the first training samples whose confidence parameters are greater than a preset confidence threshold as satisfactory samples, take the first training samples whose confidence parameters are not greater than the confidence threshold as unsatisfactory samples, and remove the unsatisfactory samples;
[0110] A sample supplement module 600 is used to obtain a supplementary training sample in response to a sample supplement instruction, and obtain a second training sample according to the supplementary training sample and the satisfactory sample;
[0111] The second model training module 700 is used to train the first data model through the second training samples to obtain a second data model.
[0112] This embodiment provides a learning basis for data model training by pre-preparing several different initial image samples; by identifying the target object in each of the initial image samples and annotating the contours of the target objects respectively, the training focus is improved to avoid the problem of low model accuracy due to other noise in the initial image samples; a virtual coordinate system is established, and the target contour and the midpoint of the image are aligned according to the virtual coordinate system to obtain a pixel portion that just includes the target object and a part of the background environment centered on the target object, thereby further improving the model's focus on the target object and its surrounding background environment; training is performed through the first training sample to obtain a first data model, so that the data model can improve the focus on different backgrounds after training. The ability to summarize the characteristics of target objects in the environment; by calculating the confidence parameters of each first training, the samples with higher quality, i.e., satisfactory samples, are distinguished, and the samples with lower quality, i.e., unsatisfactory samples, are removed, thereby realizing sample screening, avoiding the poor quality samples from participating in the training, which leads to the greatly increased complexity of subsequent training of the data model and the poor training effect such as underfitting; by obtaining supplementary training samples and obtaining the second training samples based on the supplementary training samples and the satisfactory samples, the number and diversity of samples are increased, and the training effect of the data model is improved; after obtaining the supplemented second training samples, the first data model can be retrained to avoid the secondary training process being affected by the unsatisfactory samples existing in the first training process.
[0113] In one embodiment, the coordinate alignment module 300 is further used for:
[0114] When there are a plurality of target contours in the initial image sample, copying the initial image sample to obtain a plurality of copy image samples;
[0115] A different target contour is selected from each of the copied image samples, and the contour center of the selected target contour is aligned with the image midpoint of the copied image sample.
[0116] In one embodiment, the contour recognition module 200 is further used for:
[0117] Respectively identifying a first contour point and a second contour point on the outermost side of the target object in a first direction;
[0118] Respectively identifying the outermost third contour point and the outermost fourth contour point of the target object in the second direction, wherein the first direction is perpendicular to the second direction;
[0119] Draw a straight line parallel to the second direction through the first contour point and the second contour point, and draw a straight line parallel to the first direction through the third contour point and the fourth contour point;
[0120] The area enclosed by the straight lines is identified, and the frame of the area is used as the target contour.
[0121] In one embodiment, the contour recognition module 200 is further used to:
[0122] Identifying the outer contour of the target object;
[0123] Along the outer contour, contour marking is performed on pixels adjacent to the outer side of the outer contour;
[0124] The labeled pixels are used as the target contour.
[0125] In one embodiment, the coordinate alignment module 300 is further used for:
[0126] Calculate the area ratio of the target contour in the initial image sample;
[0127] If the area ratio is less than the preset area ratio, the target outline and the image inside the target outline are enlarged until the area ratio is not less than the preset area ratio.
[0128] In one embodiment, the sample supplement module 600 is further used to:
[0129] Performing a first enhancement process on the satisfactory samples to obtain a plurality of first enhanced samples, wherein the first enhancement process includes at least one of translation, rotation, and mirror flipping;
[0130] The supplementary training sample and the first enhanced sample are used as the second training sample.
[0131] In one embodiment, the sample supplement module 600 is further used to:
[0132] Performing a second enhancement process on the satisfactory samples to obtain a plurality of second enhanced samples, wherein the second enhancement process includes at least one of binarization, brightness adjustment, and contrast adjustment;
[0133] The supplementary training sample and the second enhanced sample are used as the second training sample.
[0134] Reference Figure 4 In an embodiment of the present application, a computer device is also provided. The computer device may be a server, and its internal structure may be as follows: Figure 4As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data such as a data model training method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a data model training method is implemented. The data model training method includes: obtaining an initial picture set, wherein the initial picture set includes a plurality of initial picture samples; identifying a target object in each of the initial picture samples, and respectively annotating the contours of the target objects to obtain a target contour; respectively establishing a virtual coordinate system in each of the initial picture samples, calculating the midpoint of the picture of the initial picture sample according to the virtual coordinate system, and aligning the contour center of the target contour with the midpoint of the picture; using the initial picture sample after the coordinate alignment as a first training sample, and obtaining a first data model based on the first training sample training; respectively calculating confidence parameters of the first training samples, using the first training samples whose confidence parameters are greater than a preset confidence threshold as satisfactory samples, using the first training samples whose confidence parameters are not greater than the confidence threshold as unsatisfactory samples, and removing the unsatisfactory samples; in response to a sample supplement instruction, obtaining a supplementary training sample, and obtaining a second training sample according to the supplementary training sample and the satisfactory sample; and training the first data model through the second training sample to obtain a second data model.
[0135] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, a data model training method is implemented, comprising the steps of: obtaining an initial picture set, wherein the initial picture set includes a plurality of initial picture samples; identifying a target object in each of the initial picture samples, and respectively annotating the contours of the target objects to obtain a target contour; establishing a virtual coordinate system in each of the initial picture samples, calculating the midpoint of the picture of the initial picture sample according to the virtual coordinate system, and aligning the contour center of the target contour with the midpoint of the picture; using the initial picture sample after the coordinate alignment as a first training sample, and obtaining a first data model based on the first training sample training; calculating the confidence parameters of the first training samples, respectively, taking the first training samples whose confidence parameters are greater than a preset confidence threshold as satisfactory samples, taking the first training samples whose confidence parameters are not greater than the confidence threshold as unsatisfactory samples, and removing the unsatisfactory samples; in response to a sample supplement instruction, obtaining a supplementary training sample, and obtaining a second training sample according to the supplementary training sample and the satisfactory sample; training the first data model through the second training sample to obtain a second data model.
[0136] The data model training method executed above, this embodiment provides a learning basis for data model training by pre-preparing several different initial image samples; by identifying the target object in each of the initial image samples and annotating the contours of the target objects respectively, the training focus is improved to avoid the problem of low model accuracy due to other noise in the initial image samples; a virtual coordinate system is established, and the target contour and the midpoint of the image are aligned according to the virtual coordinate system to obtain the pixel part that just includes the target object and the part of the background environment centered on the target object, thereby further improving the model's focus on the target object and its surrounding background environment; training is performed through the first training sample to obtain a first data model, so that the data model can be trained Improve the ability to summarize the features of target objects in different background environments; by calculating the confidence parameters of each first training, distinguish high-quality samples, i.e., satisfactory samples, and remove low-quality samples, i.e., unsatisfactory samples, thereby realizing sample screening, avoiding the participation of poor-quality samples in training, which leads to a greatly increased complexity of subsequent training of the data model and poor training effects such as underfitting of the training effect; by obtaining supplementary training samples and obtaining second training samples based on the supplementary training samples and the satisfactory samples, the number and diversity of samples are increased, and the training effect of the data model is improved; after obtaining the supplemented second training samples, the first data model can be retrained to avoid the secondary training process being affected by the unsatisfactory samples existing in the first training process.
[0137] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0138] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.
[0139] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data model training method, characterized in that: The method comprises: Acquire an initial picture set, wherein the initial picture set includes a plurality of initial picture samples; Identify the target object in each of the initial image samples, and respectively mark the contours of the target objects to obtain target contours; Establishing a virtual coordinate system in each of the initial image samples respectively, calculating the image midpoint of the initial image sample according to the virtual coordinate system, and aligning the center of the target contour with the image midpoint; The initial image sample after the coordinates are aligned is used as a first training sample, and a first data model is obtained through training based on the first training sample; Calculating confidence parameters of the first training samples respectively, taking the first training samples whose confidence parameters are greater than a preset confidence threshold as satisfactory samples, taking the first training samples whose confidence parameters are not greater than the confidence threshold as unsatisfactory samples, and removing the unsatisfactory samples; In response to the sample supplement instruction, a supplementary training sample is acquired, and a second training sample is obtained according to the supplementary training sample and the satisfactory sample; Training the first data model using the second training sample to obtain a second data model; The step of establishing a virtual coordinate system in each of the initial image samples, calculating the image midpoint of the initial image sample according to the virtual coordinate system, and aligning the contour center of the target contour with the image midpoint comprises: Establishing a virtual coordinate system in the initial image sample, calculating the image midpoint coordinates of the initial image sample according to the virtual coordinate system, and calculating the center coordinates of the target contour; Controlling the boundaries of the virtual coordinate system and the initial image sample to remain stationary, and moving the pixel portion of the initial image sample so that the center coordinates of the target contour overlap with the coordinates of the midpoint of the image; The step of respectively marking the contours of the target objects to obtain the target contours includes: Respectively identifying a first contour point and a second contour point on the outermost side of the target object in a first direction; Respectively identifying the outermost third contour point and the outermost fourth contour point of the target object in the second direction, wherein the first direction is perpendicular to the second direction; Draw a straight line parallel to the second direction through the first contour point and the second contour point, and draw a straight line parallel to the first direction through the third contour point and the fourth contour point; Identify the area enclosed by each of the straight lines, and use the border of the area as the target outline; Before aligning the center of the target contour with the midpoint of the picture, the method further includes: Calculate the area ratio of the target contour in the initial image sample; If the area ratio is less than the preset area ratio, the target outline and the image inside the target outline are enlarged until the area ratio is not less than the preset area ratio; the coordinate alignment of the center of the target outline with the midpoint of the image includes: When there are a plurality of target contours in the initial image sample, copying the initial image sample to obtain a plurality of copy image samples; A different target contour is selected from each of the copied image samples, and the contour center of the selected target contour is aligned with the image midpoint of the copied image sample.
2. The data model training method according to claim 1, characterized in that: The step of respectively marking the contours of the target objects to obtain the target contours includes: Identifying the outer contour of the target object; Along the outer contour, contour marking is performed on pixels adjacent to the outer side of the outer contour; The labeled pixels are used as the target contour.
3. The data model training method according to claim 1, characterized in that: The step of obtaining a second training sample according to the supplementary training sample and the satisfactory sample comprises: Performing a first enhancement process on the satisfactory samples to obtain a plurality of first enhanced samples, wherein the first enhancement process includes at least one of translation, rotation, and mirror flipping; The supplementary training sample and the first enhanced sample are used as the second training sample.
4. The data model training method according to claim 1, characterized in that: The step of obtaining a second training sample according to the supplementary training sample and the satisfactory sample comprises: Performing a second enhancement process on the satisfactory samples to obtain a plurality of second enhanced samples, wherein the second enhancement process includes at least one of binarization, brightness adjustment, and contrast adjustment; The supplementary training sample and the second enhanced sample are used as the second training sample.
5. A data model training device, used to implement the method according to any one of claims 1 to 4, characterized in that: include: A picture set acquisition module, used to acquire an initial picture set, wherein the initial picture set includes a plurality of initial picture samples; A contour recognition module, used to identify the target object in each of the initial image samples, and to mark the contours of the target objects to obtain the target contours; A coordinate alignment module, used to establish a virtual coordinate system in each of the initial image samples, calculate the image midpoint of the initial image sample according to the virtual coordinate system, and coordinately align the contour center of the target contour with the image midpoint; A first model training module, configured to use the initial image sample after coordinate alignment as a first training sample, and obtain a first data model based on the first training sample; a sample screening module, configured to respectively calculate the confidence parameters of the first training samples, take the first training samples whose confidence parameters are greater than a preset confidence threshold as satisfactory samples, take the first training samples whose confidence parameters are not greater than the confidence threshold as unsatisfactory samples, and remove the unsatisfactory samples; A sample supplement module, configured to obtain a supplementary training sample in response to a sample supplement instruction, and obtain a second training sample according to the supplementary training sample and the satisfactory sample; A second model training module, used for training the first data model through the second training sample to obtain a second data model; The step of establishing a virtual coordinate system in each of the initial image samples, calculating the image midpoint of the initial image sample according to the virtual coordinate system, and aligning the center of the target image contour with the image midpoint includes: Establishing a virtual coordinate system in the initial image sample, calculating the image midpoint coordinates of the initial image sample according to the virtual coordinate system, and calculating the center coordinates of the target contour; The virtual coordinate system and the boundary of the initial image sample are controlled to be stationary, and the pixel portion of the initial image sample is moved so that the center coordinates of the target contour overlap with the coordinates of the midpoint of the image.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Method and device for achieving automatic adjusting of images
CN104240180A
Model training method and device, computer equipment and storage medium
CN111210024A
Instance segmentation model sample screening method and device, computer equipment and medium
CN112163634A