Acne detection method, acne detection model training method and related devices
By updating and extracting the overlapping box set in the acne detection model, the problem of low acne detection accuracy in the existing technology is solved, and higher acne detection accuracy is achieved.
Patent Information
- Application Number
- CN202011012179.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-22
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2040-09-22
AI Technical Summary
Existing acne detection methods are prone to missed detections, resulting in low detection accuracy and inability to accurately determine the severity of skin diseases.
By obtaining the acne face image to be detected and inputting it into the acne detection model, the bounding box detection values in the overlapping box set are determined and updated, and the optimal target bounding box is extracted to form a target bounding box set, which is used to improve the accuracy of acne detection. sex.
It effectively avoids missed detections, improves the accuracy of acne detection, and ensures accurate representation and detection results of acne areas.
Smart Images

Figure CN112364685B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to an acne detection method, an acne detection model training method and related devices. Background Art
[0002] Accurately judging the severity of skin diseases plays an important role in the medical field. Among them, acne is the most common skin disease, with the highest incidence in adolescence. About 80% of teenagers suffer from acne, and this symptom persists in adulthood to 3% of males and 12% of females. Acne may leave scars and pigmentation problems, and often leads to lower mood and depression. Therefore, acne patients are in urgent need of treatment. In view of this situation, many users hope to use the application to analyze the specific situation of facial acne first. However, the current method of detecting acne is prone to missed detection, resulting in low accuracy of acne detection. Summary of the invention
[0003] The main purpose of the present invention is to provide an acne detection method, an acne detection model training method and related devices, which can effectively avoid missed detection and improve the accuracy of acne detection.
[0004] To achieve the above object, the present invention provides a method for detecting acne in a first aspect, the method comprising:
[0005] Obtain a face image of a person to be tested for acne;
[0006] Inputting the face image into an acne detection model to obtain an acne detection set of the face image, wherein the acne detection set includes a detected bounding box and a detection value of the bounding box, wherein the detection value is used to indicate the possibility of detecting acne in the bounding box;
[0007] Determine an overlapping frame set in the acne detection set, and update the detection value of the bounding box in the overlapping frame set, determine a target bounding box according to the updated overlapping frame set, extract the target bounding box from the acne detection set, and add the target bounding box to the target bounding box set, wherein the overlapping frame set includes at least two bounding boxes identifying the same acne area, and the target bounding box is an optimal bounding box that can represent the acne area;
[0008] An acne detection result of the face image is determined according to the target bounding box set.
[0009] To achieve the above-mentioned object, the second aspect of the present invention provides an acne detection model training method, the device comprising:
[0010] Acquire an acne sample data set, wherein the acne sample data set includes acne sample images and actual bounding boxes indicating locations of acnes that are annotated on the acne sample images;
[0011] Inputting the acne sample image into an acne detection model to obtain a prediction set of the acne sample image, wherein the prediction set includes a prediction bounding box and a prediction value of the prediction bounding box, wherein the prediction value is used to indicate the possibility of the existence of acne in the prediction bounding box;
[0012] Determining whether the acne detection model converges according to the prediction set and the actual bounding box of the acne sample image;
[0013] If converged, determining that the acne detection model at the time of convergence is the trained acne detection model, and the trained acne detection model is applied to the acne detection method as described in the first aspect;
[0014] If not, the process returns to the step of inputting the acne sample image into the acne detection model.
[0015] To achieve the above object, the third aspect of the present invention provides an acne detection device, comprising:
[0016] An acquisition module, used for acquiring a face image of a person to be tested for acne;
[0017] An input acquisition module, used to input the face image into the acne detection model, and obtain an acne detection set of the face image, wherein the acne detection set includes a detected bounding box, a detection value of the bounding box, and a detected acne type, wherein the detection value is used to indicate the possibility that the bounding box is the detected acne type;
[0018] An update selection module, configured to iteratively update the detection value of the bounding box according to the overlap ratio between the bounding boxes in the acne detection set, and select a target bounding box that meets the preset requirements from the acne detection set during the iterative update process to obtain a target bounding box set;
[0019] A determination module is used to determine the acne detection result of the face image according to the target bounding box set.
[0020] To achieve the above objectives, the fourth aspect of the present invention provides an acne detection model training device, comprising:
[0021] A data acquisition module, configured to acquire an acne sample data set, wherein the acne sample data set includes an acne sample image, a first bounding box indicating a location of the acne annotated on the acne sample image, and an acne type of the acne within the first bounding box;
[0022] A training module, used for inputting the acne sample image into an acne detection model to obtain a prediction set of the acne sample image, wherein the prediction set includes a prediction bounding box, a prediction value of the prediction bounding box, and a predicted acne type, wherein the prediction value is used to indicate the possibility that the predicted acne type is within the prediction bounding box;
[0023] a convergence determination module, configured to determine whether the acne detection model converges according to the prediction set, the first bounding box of the acne sample image, and the acne type within the first bounding box;
[0024] a model determination module, configured to determine, if converged, that the acne detection model at the time of convergence is a trained acne detection model, and the trained acne detection model is applied to the acne detection device according to claim 8;
[0025] The return module is used to return to execute the training module if convergence does not occur.
[0026] To achieve the above-mentioned objectives, the fifth aspect of the present invention provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor executes each step of the acne detection method as described in the first aspect, or executes each step of the acne detection model training method as described in the second aspect.
[0027] The embodiments of the present invention have the following beneficial effects:
[0028] The present invention provides an acne detection method. After a face image of acne to be detected is input into an acne detection model, an acne detection set of the face image is obtained, and an overlapping frame set in the acne detection set is determined, and the detection value of the boundary frame in the overlapping frame set is updated, and a target boundary frame is determined according to the updated overlapping frame set, and the target boundary frame is extracted from the acne detection set, and the target boundary frame is added to the target boundary frame set, and the acne detection result of the face image is determined according to the target boundary frame set. Since the overlapping frame set contains at least two boundary frames that identify the same acne area, the optimal boundary frame that can represent the acne area can be determined from the at least two boundary frames. By extracting the optimal boundary frame of the acne area from the acne detection set and adding it to the target boundary frame set, all the optimal boundary frames that can represent the acne area can be extracted from the acne detection set, thereby improving the accuracy of acne detection, and further, by updating the detection value of the boundary frame in the overlapping frame set and determining the target boundary frame according to the updated overlapping frame set, the accuracy of target boundary box selection can be improved, thereby improving the accuracy of acne detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0030] in:
[0031] Figure 1 Schematic diagram of the process of acne detection method in an embodiment of the present invention;
[0032] Figure 2 For the present invention Figure 1 A schematic flow chart of the detailed steps of step 103 in the illustrated embodiment;
[0033] Figure 3 This is a schematic diagram of the structure of an acne detection model in an embodiment of the present invention;
[0034] Figure 4 Schematic diagram of the process of the acne detection model training method in an embodiment of the present invention;
[0035] Figure 5 This is a schematic diagram of the structure of an acne detection device in an embodiment of the present invention;
[0036] Figure 6 Schematic diagram of the structure of the acne detection model training device in an embodiment of the present invention. DETAILED DESCRIPTION
[0037] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0038] See also Figure 1 , is a schematic diagram of a process of an acne detection method according to an embodiment of the present invention, the method comprising:
[0039] Step 101, obtaining a face image of acne to be detected;
[0040] Step 102: input the face image into the acne detection model to obtain an acne detection set of the face image, where the acne detection set includes a detected bounding box and a detection value of the bounding box;
[0041] In an embodiment of the present invention, the above-mentioned acne detection method is implemented by an acne detection device, which is a program module stored in a readable storage medium of a computer device. A processor in the computer device can read and run the acne detection device from the readable storage medium to implement the above-mentioned acne detection method.
[0042] Among them, a facial image of the acne to be detected can be obtained. The facial image can be obtained by starting the camera to take the photo, or it can be a facial image uploaded by the user from the photo album, or it can be a facial image received from other devices. The facial image can be an image containing the entire face of the user, or it can be an image of a partial area of the face, for example, it can be an acne image of the forehead, an acne image of the cheek, an acne image of the chin, etc.
[0043] The above-mentioned face image is input into the acne detection model. The acne detection module can be a model based on the yolov3 framework, which has three branches, and each branch will output a feature map. The acne detection set of the face image can be obtained according to the output feature map, wherein the acne detection set includes a detected bounding box and a detection value of the bounding box, wherein the detection value is used to indicate the possibility of detecting acne in the bounding box. For example, if a bounding box A has a detection value of 0.35, it means that the probability of detecting acne in the bounding box is 0.35.
[0044] The bounding box is a bounding box determined in the face image, and the area enclosed by the bounding box is an area where acne may exist.
[0045] Step 103: determining an overlapping frame set in the acne detection set, and updating detection values of bounding boxes in the overlapping frame set, determining a target bounding box according to the updated overlapping frame set, extracting the target bounding box from the acne detection set, and adding the target bounding box to the target bounding box set;
[0046] Step 104: Determine an acne detection result of the face image according to the target bounding box set.
[0047] In the embodiments of the present invention, the bounding boxes are all bounding boxes determined in the face image where acne may exist. When the acne detection model is used to detect acne, there may be multiple bounding boxes for the same acne area, and the multiple bounding boxes may overlap. The overlap means that the area enclosed by one bounding box and the area enclosed by another bounding box overlap partially or completely. The size of the overlap can be described by an overlap ratio, and the overlap ratio can specifically be the size of the intersection of the areas enclosed by the two bounding boxes in the entire area of one of the bounding boxes. In order to remove the redundancy of the bounding boxes, an optimal bounding box that can represent the acne area is determined for each acne area. The optimal bounding box can be called a target bounding box. For each acne area, an overlapping box set of the acne area can be obtained, and the overlapping box set contains at least two bounding boxes that identify the same acne area. The above-mentioned target bounding box needs to determine a target bounding box based on the overlapping box set.
[0048] In the embodiment of the present invention, considering the acne detection set obtained based on the acne detection model, for the same acne area, there may be multiple bounding boxes, and there is redundancy in the multiple bounding boxes. In order to better determine the acne detection result, it is necessary to select the optimal bounding box that can represent the acne area from the multiple bounding boxes. However, considering that when acne grows on a person's face, acne is usually prone to appear densely, so that the two bounding boxes of two adjacent acne areas overlap. If the same acne area is considered and the bounding box identifying another acne area is selected, it will lead to the wrong selection of the bounding box, resulting in missed detection of acne, and further leading to the problem of low accuracy of the acne detection result. In order to be able to select a more consistent bounding box, In order to select a bounding box that is suitable for the actual acne situation and avoid the situation where the acne is missed due to the wrong selection of the bounding box, the overlapping box set in the acne detection set can be first determined, and the detection value of the bounding box in the overlapping box set can be updated, and the target bounding box can be determined by using the updated overlapping box set, so that the target bounding box can be extracted from the acne detection set. Among them, by updating the detection value of the overlapping box set and determining the target bounding box by using the updated overlapping box set, the problem of wrongly selecting the bounding box can be effectively avoided, and the accuracy of the target bounding box can be effectively improved. The target bounding box is added to the target bounding box set and the acne detection result of the face image is determined according to the target bounding box set, which can effectively improve the accuracy of the acne detection result.
[0049] Among them, the bounding box included in the target bounding box set can be used as the detected bounding box that determines the existence of acne, that is, the acne detection result.
[0050] In the embodiment of the present invention, since the above-mentioned overlapping frame set includes at least two bounding boxes identifying the same acne area, the optimal bounding box that can represent the above-mentioned acne area can be determined from the at least two bounding boxes. By extracting the optimal bounding box of the above-mentioned acne area from the acne detection set and adding it to the target bounding box set, all optimal bounding boxes that can represent the acne area can be extracted from the acne detection set, thereby improving the accuracy of acne detection. Furthermore, by updating the detection values of the bounding boxes in the overlapping frame set and determining the target bounding box according to the updated overlapping frame set, the accuracy of target bounding box selection can be improved, thereby improving the accuracy of acne detection.
[0051] To better understand the technical solutions in the embodiments of the present invention, please refer to Figure 2 , for the present invention Figure 1 The schematic flow chart of the detailed steps of step 103 in the illustrated embodiment includes:
[0052] Step 201, calculating the overlap ratio between the first bounding box and other bounding boxes in the acne detection set, and determining the overlapping box set based on the overlap ratio;
[0053] Step 202: updating the detection values of the other target bounding boxes in the overlapping frame set according to the overlapping ratio between the other target bounding boxes and the first bounding box, to obtain an updated overlapping frame set;
[0054] Step 203: extracting a bounding box with a maximum detection value in the updated overlapping box set from the acne detection set as a target bounding box, and adding it to the target bounding box set;
[0055] Step 204 , returning to the step of calculating the overlap ratio between the first bounding box and other bounding boxes in the acne detection set, and determining the overlapping frame set based on the overlap ratio, until the number of other target bounding boxes in the overlapping frame set is zero.
[0056] In the embodiment of the present invention, i is set to be the number of times the target bounding box is extracted, and the initial value of i is 0, and i is a positive integer. It can be understood that the 0th acne detection set is the initial acne detection set obtained after the face image is input into the acne detection model, and the 1st acne detection set is the set after a target bounding box is extracted from the 0th acne detection set.
[0057] Taking the i-th acne detection set as an example, first determine the first bounding box and other bounding boxes in the i-th acne detection set, wherein the first bounding box is the bounding box with the largest detection value in the i-th acne detection set, and the other bounding boxes are any other bounding boxes in the i-th acne detection set except the first bounding box.
[0058] The overlap ratio between the first bounding box and the other bounding boxes is calculated, specifically, the size of the overlapping area where the first bounding box and the other bounding boxes overlap is first determined, and the ratio of the overlapping area to the size of the area where the first bounding box is located is calculated, and the ratio is the overlap ratio between the first bounding box and the other bounding box. For example, if the size of the overlapping area between the first bounding box and the other bounding box A is a1, and the area size of the first bounding box is B, then the value of a1 / B is calculated, and the value is used as the overlap ratio between the first bounding box and the other bounding box A. When a1 / B is 0, it indicates that the first bounding box does not overlap with the other bounding box A. When a1 / B is 1, it indicates that the first bounding box completely overlaps with the other bounding box. When a1 / B is any value between 0 and 1, it indicates that the first bounding box partially overlaps with the other bounding box.
[0059] By the above method, the overlap ratio between the first bounding box and all other bounding boxes can be obtained, and the overlapping box set is determined based on the overlapping ratio, wherein the overlapping box set includes the first bounding box and other target bounding boxes whose overlap ratio with the first bounding box is greater than or equal to the first preset ratio value. For example, if there are 100 bounding boxes in the acne detection set, the bounding box with the largest detection value is the first bounding box, and the remaining 99 bounding boxes are other bounding boxes. If, among the remaining 99 bounding boxes, there are 5 bounding boxes A, B, C, D, E whose overlap ratio with the first bounding box is greater than or equal to the first preset ratio value, then the obtained overlapping box set includes the first bounding box, and the bounding boxes A, B, C, D, E.
[0060] It can be understood that the overlapping frame set includes at least two bounding boxes identifying the same acne area, and the bounding boxes of the same acne area usually overlap, and the overlapping ratio is non-zero. In the embodiment of the present invention, considering that the larger the detection value, the greater the possibility of the existence of acne, therefore, the bounding box with the maximum detection value in the acne detection set is determined to be the first bounding box, so that other target bounding boxes that identify the same acne area as the first bounding box can be determined based on the overlapping ratio, and considering that the larger the overlapping ratio, the greater the probability that the first bounding box identifies the same acne area, therefore, the first preset ratio value is set so that other target bounding boxes that identify the same acne area as the first bounding box can be determined.
[0061] After obtaining the overlapping frame set, the detection values of the other target bounding boxes will be updated according to the overlap ratio between the other target bounding boxes in the overlapping frame set and the first bounding box. The updating method is as follows:
[0062] When the overlap ratio of the other target bounding box to the first bounding box is greater than or equal to a first preset ratio value and less than a second preset ratio value, taking the sum of the logarithm of the predicted value of the other target bounding box and the preset standard value as the updated predicted value of the other target bounding box;
[0063] When the overlap ratio of the other target bounding box to the first bounding box is greater than or equal to a second preset ratio value, the absolute value of the difference between the overlap ratio of the other target bounding box to the first bounding box and the preset standard value is calculated, and the product of the absolute value and the predicted value of the other target bounding box is used as the updated predicted value of the other target bounding box.
[0064] In the embodiment of the present invention, the above method can effectively implement the update of the detection value of other bounding boxes of the target, and in order to better understand the above update method, the following formula can be referred to, which is a feasible formula for updating the detection value of other bounding boxes:
[0065]
[0066] Among them, bi represents the other bounding boxes of the target, M i represents the first bounding box, S i Represents the detection value of other bounding boxes bi of the target, S i+1 Represents the updated detection value of other detection boxes of the target, IoU(b i ,M i ) represents the overlap ratio between the first bounding box and other bounding boxes of the target, 0.4 is the first preset ratio value, 0.75 is the second preset ratio value, and 1 is the preset standard value.
[0067] It should be noted that, for other target bounding boxes in the overlapping box set, the greater the overlap ratio with the first bounding box, the greater the probability that the other target bounding boxes and the first bounding box identify the same acne area. At this time, the target bounding box may also be the bounding box of another acne area adjacent to the above acne area. In order to avoid misselecting the target bounding box, the detection value of the other target bounding box is adjusted by the above method to reduce the probability of misselecting the target bounding box.
[0068] After completing the update of the detection values of all other target bounding boxes in the overlapping frame set, the updated overlapping frame set can be obtained, and the bounding box with the maximum detection value in the overlapping frame set can be determined as the target bounding box, and the target bounding box is extracted from the acne detection set and added to the target bounding box set. The extracted acne detection set is used as the i+1th acne detection set, and i=i+1 is set, and the above steps are returned to execute until the number of other target bounding boxes in the determined overlapping frame set is zero.
[0069] It can be understood that the above-mentioned update of the detection value is to update the detection value of the bounding box in the overlapping box set, and the detection value of the bounding box in the acne detection set is not updated. The detection value of each bounding box in the acne detection set is always the detection value of the bounding box in the initial acne detection set, and the difference between the i+1th acne detection set and the i-th acne detection set is that there is one less target bounding box, while the other bounding boxes are still retained and the detection values remain unchanged.
[0070] It can be understood that if the number of other target bounding boxes in the above overlapping frame set is zero, it means that the overlapping frame set only includes the first bounding box, and there are no other bounding boxes in the acne detection set whose overlapping ratio with the first bounding box is greater than or equal to the first preset ratio value. At this time, considering that the first bounding box is probably a scattered bounding box, there is no need to use the overlapping frame set to determine the target bounding box, and further, it can be indicated that the extraction of the target bounding box has been completed.
[0071] In the embodiment of the present invention, through the above method, the detection values of other target bounding boxes in the overlapping box set can be updated and then the target bounding box can be selected, thereby avoiding the situation of missed acne detection caused by wrong selection of the target bounding box, and the acne detection result can be determined by selecting the target bounding box, thereby improving the accuracy of acne detection.
[0072] Further, the above-mentioned acne detection model may include a yolov3 model and three spatial pyramid pooling layers, and the three spatial pyramid pooling layers are respectively connected to the ends of the three output branches of the yolov3 model. Among them, the yolov3 model is the third version of the target detection algorithm of the yolo system, which is suitable for the detection of small targets, especially for the detection of small targets such as acne, with high precision. In the yolov3 model, there are three output branches, each of which will output a feature map, and the sizes of the feature maps output by different output branches are different. In an embodiment of the present invention, by connecting the spatial pyramid pooling (Spatial Pyramid Pooling, SPP) layer at the ends of the three output branches of the yolov3 model, it is possible to use the SPP layer to fuse the feature information of different receptive fields, thereby improving the detection capability for acne.
[0073] In a feasible implementation, the above yolov3 model can use the DBM module to replace the original DBL module, where the DBL module is Darknetconv2d_BN_Leaky in the code, which is the basic component of the yolov3 model, that is, convolution layer + BN layer + Leaky relu, where Leaky relu represents the activation function, and the difference between the DBM model and the DBL module lies in the activation function used. The activation function used in the DBM module is the Mish activation function. Using the Mish activation function can effectively improve the detection accuracy compared with the Leaky relu activation function.
[0074] To better understand the technical solutions in the embodiments of the present invention, please refer to Figure 3 , which is a structural diagram of a feasible implementation method of the acne detection model in an embodiment of the present invention, wherein the face image represents the face image of the acne to be detected, SPP represents the SPP layer set at the end of the three output branches of the yolov3 model, the structure between the SPP layer and the face image represents the yolov3 model, and y1, y2, and y3 represent the feature maps of the final output.
[0075] Among them, DBM is the above-mentioned DBM module, Up_S represents the upsampling module, Conv represents the convolutional layer, Res_1, Res_2, Res_4, and Res_8 represent the feature extraction modules.
[0076] In a feasible implementation, the above step 102 may specifically be: inputting the above face image into an acne detection model, obtaining a target feature map output by the acne detection model, and obtaining an acne detection set of the face image according to the target feature map and a preset anchor point frame.
[0077] Among them, the above-mentioned acne detection model is obtained by training using an acne sample data set, and the acne sample data set contains acne sample images, and the actual bounding box indicating the location of the acne in the acne sample image has been annotated. The above-mentioned anchor point frame is obtained based on the acne sample data set, and can be specifically obtained according to a preset multiple value, the first maximum value and the first minimum value of the actual bounding box length determined based on the actual bounding box in the acne sample data set, and the second maximum value and the second minimum value of the width. And it should be noted that the anchor point frame used to detect acne using the acne detection model is the same anchor point frame used to train the acne detection model. It should be noted that the specific method for training the acne detection model will be described in detail in the subsequent embodiments, and the specific details can be referred to the subsequent embodiments, which will not be repeated here.
[0078] In an embodiment of the present invention, when using an acne detection model to detect acne, an acne detection set is determined by using the same anchor point frame as that used in the training process of the acne detection model. The same anchor point frame can enhance the accuracy of acne detection and avoid the error problem caused by using different anchor point frames.
[0079] It is understandable that the above description is a method for acne detection using an acne detection model. The following will describe a training method for the acne detection model used in the above method. Figure 4 , is a flow chart of the acne detection model training method in an embodiment of the present invention, comprising:
[0080] Step 401: Acquire an acne sample dataset, where the acne sample dataset includes acne sample images and actual bounding boxes of acne locations marked on the acne sample images;
[0081] Step 402: Input the acne sample image into the acne detection model to obtain a prediction set of the acne sample image, where the prediction set includes a prediction bounding box and a prediction value of the prediction bounding box, where the prediction value is used to indicate the possibility of the existence of acne in the prediction bounding box;
[0082] Step 403: Determine whether the acne detection model converges according to the prediction set and the actual bounding box of the acne sample image;
[0083] Step 403: if converged, determining the acne detection model at the time of convergence as the trained acne detection model;
[0084] Step 404: If not converged, return to the step of inputting the acne sample image into the acne detection model.
[0085] In the implementation of the present invention, upon convergence, the determined trained acne detection model can be applied to the above-mentioned acne detection method to improve the accuracy of acne detection.
[0086] In one possible implementation, Figure 4 The acne detection module in the illustrated embodiment may be the acne detection model described in the above-mentioned acne detection method related embodiments, which will not be described in detail here.
[0087] It should be noted that, in an embodiment of the present invention, the acne sample data set includes acne sample images and actual bounding boxes of the acne sample images. The actual bounding boxes may be manually annotated bounding boxes with high accuracy. In addition, the acne sample images have the same size and meet the requirements for sample images when training the acne detection model.
[0088] In the embodiment of the present invention, before executing the above step 402, the data in the acne sample data set may be enhanced to achieve expansion of the sample data.
[0089] Specifically, the above-mentioned enhancement processing includes:
[0090] Step a1: obtaining a preset number of target acne sample images with the same image size from the acne sample dataset, and splicing the target acne sample images to obtain a spliced image, wherein the target acne sample image is any image in the acne sample dataset;
[0091] Step a2: performing an image size reduction operation on the stitched image until the image size of the stitched image is consistent with the target acne sample image, thereby obtaining a target image;
[0092] Step a3: According to the actual bounding box of the target acne sample image, determine the actual bounding box of the target image, and add the target image as the acne sample image to the acne sample dataset.
[0093] In the embodiment of the present invention, the preset number may be 4, 16, etc., and since the sizes of the acne sample images in the acne sample data set are the same, a preset number of target acne sample images may be randomly acquired, and the preset number of target acne sample images may be spliced to obtain a spliced image. Furthermore, in order to avoid reducing the number of acne sample images, the target acne sample images may be obtained by duplication.
[0094] Since the image stitching method will increase the size of the image, making it different from the acne sample image in the acne sample dataset, it is necessary to reduce the size of the stitched image until the size of the stitched image is consistent with the target acne sample to obtain the target image. At the same time, considering that each target acne sample image used for stitching contains an actual bounding box, and after the stitching and size reduction operations, the position of the actual bounding box in the target image is different from the position of the actual bounding box in the original target acne sample image, at this time, it is necessary to determine the actual bounding box of the target image based on the actual bounding box of the target acne sample image, and add the target image as an acne sample image to the acne sample dataset.
[0095] In a feasible implementation, the actual bounding box of the target image can be obtained in the following manner. Specifically, after a preset number of target acne sample images are stitched together to obtain a stitched image, the position information of the actual bounding box of the target acne sample image in the stitched image can be updated based on the position of the target acne sample image in the stitched image, so that the position information of the actual bounding box in the stitched image can be determined. Furthermore, after the stitched image is reduced in size to obtain the target image, the position information of the actual bounding box in the stitched image is processed according to the reduction parameters to obtain the position information of the actual bounding box in the target image.
[0096] For better understanding, taking the target acne sample image containing four images ABCD as an example, they can be first stitched into a stitched image in order from top to bottom. The upper left corner of the stitched image is image A, the upper right corner is image B, the lower left corner is image C, and the lower right corner is image D. When the stitched image is in the standard two-dimensional coordinate system, the lower left corner vertex of the lower left image C is used as the origin of the two-dimensional coordinate system. At this time, the position information of the C image does not need to be updated, but the position information of the ABD images needs to be updated. For the A image, the width of the actual bounding box in the A image can be added to the width of the A image to obtain the updated position information of the actual bounding box in the A image. For the B image, the length of the actual bounding box in the B image can be added to the length of the A image, and the width can be added to the width of the B image to obtain the updated position information of the actual bounding box in the B image. For the D image, the length of the actual bounding box in the D image can be added to the length of the A image to obtain the position information of the actual bounding box in the D image. In the above manner, the position information of the actual bounding box in the stitched image can be effectively determined. When the stitched image is reduced, it is reduced according to a preset size, which means that the size of the actual bounding box in the stitched image in the target image also needs to be reduced accordingly. By reducing the position information of the bounding box, the position information of the actual bounding box in the target image can be effectively determined.
[0097] In an embodiment of the present invention, by splicing, reducing and determining the actual bounding box of multiple target acne sample images, the obtained target image has more actual bounding boxes, and the acne detection model is trained using the target image, which helps to improve the detection ability of the trained acne detection model for dense acne and improve the accuracy of acne detection.
[0098] In the implementation of the present invention, the size of the anchor point frame may be further set according to the characteristics of the acne annotation, so that the anchor point frame that is more suitable for the acne detection scenario can be set.
[0099] Specifically, before executing step 402, the anchor point frame may be set in the following manner, including:
[0100] Step b1: obtaining a first maximum value and a first minimum value of the length of the actual bounding box in the acne sample data set, and a second maximum value and a second minimum value of the width of the actual bounding box;
[0101] Step b2: according to the first maximum value, the first minimum value, the second maximum value, the second minimum value and the preset multiple value, an anchor point frame corresponding to the multiple value is set.
[0102] In an embodiment of the present invention, the length values and width values of the actual bounding boxes of all acne sample images in the acne sample data set can be counted to obtain a length value set and a width value set, and a first maximum value and a first minimum value of the length are selected from the length value set, and a second maximum value and a second minimum value of the width are selected from the width value set, so that an anchor point box corresponding to the multiple value can be set according to the first maximum value, the first minimum value, the second maximum value, the second minimum value and the preset multiple value.
[0103] For example, if the first maximum value is Lmax, the first minimum value is Lmin, the second maximum value is Wmax, the second minimum value is Wmin, and the preset multiple values are 8 times, 16 times, and 32 times, then it can be determined that the anchor point box includes: (Lmax / 8, Wmax / 8), (Lmax / 16, Wmax / 16), (Lmax / 32, Wmax / 32), (Lmin / 8, Wmin / 8), (Lmin / 16, Wmin / 16), (Lmin / 32, Wmin / 32), (Lmax / 32, Wmin / 32), (Lmax / 16, Wmin / 16) and (Lmin / 8, Wmax / 8).
[0104] And through the above Figure 3 The yolov3 model of the acne detection model shown will output three feature maps of different sizes: 52*52, 26*26, and 13*13. Among them, acne is more concentrated in the 52*52 feature map, and the 13*13 feature map represents a high degree of semantic features. Therefore, the SPP layer in the acne detection model will fuse the features of different receptive fields to improve the learning of different features by the acne detection model.
[0105] It is understandable that, for the feature map output by the acne detection model, a predicted bounding box and a predicted value of the predicted bounding box can be generated according to the above-mentioned anchor point box and feature map to obtain a predicted set of acne sample images.
[0106] Among them, for any pixel point in the feature map output by the acne detection model, it is necessary to map it to the acne sample image, and based on the above-mentioned anchor point box, predict the predicted bounding box of the pixel point in the acne sample image and the detection value of the predicted bounding box, and for each pixel point, three predicted bounding boxes can be obtained.
[0107] It is understandable that, in the acne detection method, the above-mentioned anchor point frame can also be used to obtain the acne detection set.
[0108] In the embodiment of the present invention, by setting the SPP layer in the acne detection model, it is possible to fuse feature maps of different sizes and enhance the learning of different features. Since the first maximum value, the second maximum value, the first minimum value and the second minimum value can reflect the size characteristics of acne, the anchor point frame is set based on the first maximum value, the second maximum value, the first minimum value and the second minimum value of the actual bounding box, so that the set anchor point frame is more matched with the size of the acne, so as to further improve the accuracy of acne detection and avoid the problem of low acne detection accuracy caused by the set anchor point frame size being too large or too small. In addition, data enhancement can be performed by splicing, reducing and adjusting the actual bounding box, so that more acne sample images for training can be set.
[0109] See also Figure 5 , is a schematic diagram of the structure of an acne detection device in an embodiment of the present invention, the device comprises:
[0110] An acquisition module 501 is used to acquire a face image of a person with acne to be detected;
[0111] An input acquisition module 502 is used to input a face image into an acne detection model to acquire an acne detection set of the face image, wherein the acne detection set includes a detected bounding box, a detection value of the bounding box, and a detected acne type, wherein the detection value is used to indicate the possibility that the bounding box is the detected acne type;
[0112] An update selection module 503 is used to iteratively update the detection value of the bounding box according to the overlap ratio between the bounding boxes in the acne detection set, and select a target bounding box that meets the preset requirements from the acne detection set during the iterative update process to obtain a target bounding box set;
[0113] The determination module 504 is used to determine the acne detection result of the face image according to the target bounding box set.
[0114] In the embodiment of the present invention, the contents of the relevant modules of the above acne detection device are similar to the contents described in the above method embodiment. For details, please refer to the contents in the above acne detection method embodiment, which will not be repeated here.
[0115] In the embodiment of the present invention, since the above-mentioned overlapping frame set includes at least two bounding boxes identifying the same acne area, the optimal bounding box that can represent the above-mentioned acne area can be determined from the at least two bounding boxes. By extracting the optimal bounding box of the above-mentioned acne area from the acne detection set and adding it to the target bounding box set, all optimal bounding boxes that can represent the acne area can be extracted from the acne detection set, thereby improving the accuracy of acne detection. Furthermore, by updating the detection values of the bounding boxes in the overlapping frame set and determining the target bounding box according to the updated overlapping frame set, the accuracy of target bounding box selection can be improved, thereby improving the accuracy of acne detection.
[0116] See also Figure 6 , is a schematic diagram of the structure of an acne detection model training device in an embodiment of the present invention, the training device comprises:
[0117] The data acquisition module 601 is used to acquire an acne sample data set, where the acne sample data set includes an acne sample image, a first bounding box indicating the location of the acne that is annotated on the acne sample image, and an acne type of the acne in the first bounding box;
[0118] The training module 602 is used to input the acne sample image into the acne detection model to obtain a prediction set of the acne sample image, wherein the prediction set includes a prediction bounding box, a prediction value of the prediction bounding box, and a predicted acne type, wherein the prediction value is used to indicate the possibility that the predicted acne type is within the prediction bounding box;
[0119] A convergence determination module 603 is used to determine whether the acne detection model converges according to the prediction set, the first bounding box of the acne sample image, and the acne type within the first bounding box;
[0120] A model determination module 604, for determining that the acne detection model at the time of convergence is the trained acne detection model if converged, and the trained acne detection model is applied to the acne detection device according to claim 8;
[0121] Return module 605 is used to return to execute training module 602 if convergence does not occur.
[0122] In the embodiment of the present invention, the contents of the relevant modules of the above-mentioned acne detection model training device are similar to the contents described in the above-mentioned method embodiment of the acne detection model training method. For details, please refer to the contents in the above-mentioned method embodiment of the acne detection model training method, which will not be repeated here.
[0123] In the embodiment of the present invention, by setting the SPP layer in the acne detection model, it is possible to fuse feature maps of different sizes, enhance the learning of different features, and by setting the anchor box based on the first maximum value, the second maximum value, the first minimum value and the second minimum value of the actual bounding box, the setting of the anchor box can be applicable to the acne detection scenario. In addition, data enhancement can be performed by splicing, reducing and adjusting the actual bounding box, so that more acne sample images for training can be set.
[0124] In one embodiment, a computer device is proposed, including a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes each step in the above-mentioned acne detection method related embodiment, or executes each step in the above-mentioned acne detection model training method related embodiment.
[0125] In one embodiment, a computer-readable storage medium is provided, storing a computer program. When the computer program is executed by a processor, the processor executes each step in the above-mentioned acne detection method related embodiment, or executes each step in the above-mentioned acne detection model training method related embodiment.
[0126] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium. When the 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 used in the embodiments provided in this application can 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. As an 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 (DDRSDRAM), 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).
[0127] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0128] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for detecting acne, characterized in that: The method comprises: Obtain a face image of a person to be tested for acne; Inputting the face image into an acne detection model to obtain an acne detection set of the face image, wherein the acne detection set includes a detected bounding box and a detection value of the bounding box, wherein the detection value is used to indicate the possibility of detecting acne in the bounding box; Determine an overlapping frame set in the acne detection set, and update the detection value of the bounding box in the overlapping frame set, determine a target bounding box according to the updated overlapping frame set, extract the target bounding box from the acne detection set, and add the target bounding box to the target bounding box set, wherein the overlapping frame set includes at least two bounding boxes identifying the same acne area, and the target bounding box is an optimal bounding box that can represent the acne area; Determining an acne detection result of the face image according to the target bounding box set; The step of determining an overlapping frame set in the acne detection set, updating a detection value of a bounding box in the overlapping frame set, determining a target bounding box according to the updated overlapping frame set, extracting the target bounding box from the acne detection set, and adding the target bounding box to the target bounding box set includes: Calculating the overlap ratio between the first bounding box and other bounding boxes in the acne detection set, and determining the overlapping box set based on the overlap ratio; the first bounding box is the bounding box with the largest detection value in the acne detection set, the other bounding boxes are any other bounding boxes in the acne detection set except the first bounding box, and the overlapping box set includes the first bounding box and other target bounding boxes whose overlap ratio with the first bounding box is greater than or equal to a first preset ratio value; updating the detection values of the other target bounding boxes in the overlapping frame set according to the overlapping ratio between the other target bounding boxes and the first bounding box, to obtain an updated overlapping frame set; Extracting a bounding box with a maximum detection value in the updated overlapping box set from the acne detection set as a target bounding box, and adding it to the target bounding box set; Returning to the step of calculating the overlap ratio between the first bounding box and other bounding boxes in the acne detection set, and determining the overlapping frame set based on the overlap ratio, until the number of the target other bounding boxes in the overlapping frame set is zero; The updating of the detection values of the other target bounding boxes in the overlapping frame set according to the overlap ratio between the other target bounding boxes and the first bounding box includes: When the overlap ratio of the other target bounding box to the first bounding box is greater than or equal to the first preset ratio value and less than a second preset ratio value, taking the sum of the logarithm of the predicted value of the other target bounding box and the preset standard value as the updated predicted value of the other target bounding box; When the overlap ratio of the other target bounding box to the first bounding box is greater than or equal to the second preset ratio value, the absolute value of the difference between the overlap ratio of the other target bounding box to the first bounding box and the preset standard value is calculated, and the product of the absolute value and the predicted value of the other target bounding box is used as the updated predicted value of the other target bounding box.
2. The method according to claim 1, characterized in that The acne detection model includes a yolov3 model and three spatial pyramid pooling layers, and the three spatial pyramid pooling layers are respectively connected to the ends of three output branches of the yolov3 model.
3. The method according to claim 1, characterized in that: The step of inputting the face image into an acne detection model to obtain an acne detection set of the face image includes: Inputting the face image into the acne detection model to obtain a target feature map output by the acne detection model; According to the target feature map and the preset anchor box, an acne detection set of the face image is obtained, wherein the anchor box is obtained according to a preset multiple value, a first maximum value and a first minimum value of the length of the actual bounding box determined based on the actual bounding box in the acne sample data set, and a second maximum value and a second minimum value of the width, wherein the acne sample data set is data used to train the acne detection model, and the acne sample data set includes an acne sample image, and the actual bounding box that indicates the location of the acne and is annotated in the acne sample image.
4. A method for detecting acne, characterized in that: The method comprises: Acquire an acne sample data set, wherein the acne sample data set includes acne sample images and actual bounding boxes indicating locations of acnes that are annotated on the acne sample images; Inputting the acne sample image into an acne detection model to obtain a prediction set of the acne sample image, wherein the prediction set includes a prediction bounding box and a prediction value of the prediction bounding box, wherein the prediction value is used to indicate the possibility of the existence of acne in the prediction bounding box; Determining whether the acne detection model converges according to the prediction set and the actual bounding box of the acne sample image; If converged, determining that the acne detection model at the time of convergence is the trained acne detection model, and the trained acne detection model is applied to the acne detection method according to any one of claims 1 to 3; If not, the process returns to the step of inputting the acne sample image into the acne detection model.
5. The method according to claim 4, characterized in that The step of inputting the acne sample image into an acne detection model to obtain a prediction set of the acne sample image may also include: Acquire a preset number of target acne sample images with the same image size from the acne sample data set, and splice the target acne sample images to obtain a spliced image, wherein the target acne sample image is any image in the acne sample data set; Performing an image size reduction operation on the stitched image until the image size of the stitched image is consistent with the target acne sample image, thereby obtaining a target image; According to the actual bounding box of the target acne sample image, the actual bounding box of the target image is determined, and the target image is added to the acne sample dataset as an acne sample image.
6. The method according to claim 4 or 5, characterized in that: The step of inputting the acne sample image into the acne detection model to obtain a prediction set of the acne sample image further includes: Obtaining a first maximum value and a first minimum value of the length of the actual bounding box in the acne sample data set, and a second maximum value and a second minimum value of the width of the actual bounding box; According to the first maximum value, the first minimum value, the second maximum value, the second minimum value and the preset multiple value, setting an anchor point frame corresponding to the multiple value; The step of inputting the acne sample image into an acne detection model to obtain a prediction set of the acne sample image includes: Inputting the acne sample image into an acne detection model to obtain a feature map output by the acne detection model; The prediction set of the acne sample image is obtained according to the feature map and the anchor point frame.
7. An acne detection device, characterized in that: The device comprises: An acquisition module, used for acquiring a face image of a person to be tested for acne; An input acquisition module, used to input the face image into the acne detection model, and obtain an acne detection set of the face image, wherein the acne detection set includes a detected bounding box, a detection value of the bounding box, and a detected acne type, wherein the detection value is used to indicate the possibility that the bounding box is the detected acne type; An update selection module, configured to iteratively update the detection value of the bounding box according to the overlap ratio between the bounding boxes in the acne detection set, and select a target bounding box that meets the preset requirements from the acne detection set during the iterative update process to obtain a target bounding box set; a determination module, configured to determine an acne detection result of the face image according to the target bounding box set; The update selection module is specifically used to: calculate the overlap ratio between the first bounding box and other bounding boxes in the acne detection set, and determine the overlapping box set based on the overlap ratio; the first bounding box is the bounding box with the largest detection value in the acne detection set, and the other bounding box is any other bounding box in the acne detection set except the first bounding box, and the overlapping box set includes the first bounding box and target other bounding boxes whose overlap ratio with the first bounding box is greater than or equal to a first preset ratio value; according to the overlap ratio between the target other bounding box and the first bounding box, update the detection value of the target other bounding box in the overlapping box set to obtain an updated overlapping box set; extract the bounding box with the largest detection value in the updated overlapping box set from the acne detection set as the target bounding box, and add it to the target bounding box set; return to execute the steps of calculating the overlap ratio between the first bounding box and other bounding boxes in the acne detection set, and determining the overlapping box set based on the overlap ratio, until the number of the target other bounding boxes in the overlapping box set is zero; Wherein, updating the detection value of the other target bounding box in the overlapping box set according to the overlap ratio of the other target bounding box to the first bounding box includes: when the overlap ratio of the other target bounding box to the first bounding box is greater than or equal to the first preset ratio value and less than the second preset ratio value, taking the sum of the logarithm of the predicted value of the other target bounding box and the preset standard value as the updated predicted value of the other target bounding box; when the overlap ratio of the other target bounding box to the first bounding box is greater than or equal to the second preset ratio value, calculating the absolute value of the difference between the overlap ratio of the other target bounding box to the first bounding box and the preset standard value, and taking the product of the absolute value and the predicted value of the other target bounding box as the updated predicted value of the other target bounding box.
8. An acne detection device, characterized in that: The device comprises: A data acquisition module, configured to acquire an acne sample data set, wherein the acne sample data set includes an acne sample image, a first bounding box indicating a location of the acne annotated on the acne sample image, and an acne type of the acne within the first bounding box; A training module, used for inputting the acne sample image into an acne detection model to obtain a prediction set of the acne sample image, wherein the prediction set includes a prediction bounding box, a prediction value of the prediction bounding box, and a predicted acne type, wherein the prediction value is used to indicate the possibility that the predicted acne type is within the prediction bounding box; a convergence determination module, configured to determine whether the acne detection model converges according to the prediction set, the first bounding box of the acne sample image, and the acne type within the first bounding box; a model determination module, configured to determine, if converged, that the acne detection model at the time of convergence is a trained acne detection model, and the trained acne detection model is applied to the acne detection device according to claim 7; The return module is used to return to execute the training module if convergence does not occur.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the processor executes the steps of the acne detection method according to any one of claims 1 to 3, or executes the steps of the acne detection method according to any one of claims 5 to 6.
Citation Information
Patent Citations
Remote sensing image aircraft target detection method based on bounding box correction algorithm
CN110765951A
Method and apparatus for training object detection model
US20200066036A1
