Skin fungus detection method, system and equipment and storage medium
Through neural network technology training prediction models and object detection models, the existing skin fungus detection methods are solved, and fast and accurate skin fungus detection is achieved.
Patent Information
- Application Number
- CN202411936136.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-12-26
AI Technical Summary
The existing skin fungus detection methods are slow to detect due to cumbersome operation and long time consumption, and the detection efficiency is not high.
Using neural network technology, we use skin sample pictures, segment and randomly combine refinement areas, smoothing, grayscale processing and binary assignment, generate feature point descriptors, train prediction models and target detection models, and use them to quickly detect skin fungi.
By training prediction models and target detection models for a large number of samples, we can quickly determine whether there is fungal in the skin sample and locate the target position, significantly reducing detection time and improving detection efficiency.
Smart Images

Figure CN119784727A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of fungus detection, and in particular to a method, system, device and storage medium for skin fungus detection. Background Art
[0002] Skin fungal infection refers to a large class of infectious diseases caused by pathogenic fungi that infect the skin, appendages, subcutaneous tissues, and mucous membranes. It is one of the most common skin diseases. With the development of fungal detection technology, more and more methods can be applied to the detection and identification of fungi. Currently, the commonly used methods for fungal detection include wet mount microscopy, Gram staining, fungal culture, and fluorescence detection.
[0003] The wet mount method is simple, but has high requirements for inspectors, and very professional inspectors are needed to ensure the detection rate; Gram staining is cumbersome and time-consuming, and is easily affected by many factors such as the quality of the stain and the level of the inspectors; the culture method is time-consuming; although fluorescent staining significantly improves the sensitivity of fungal microscopy, it takes a long time to scan the entire sample, and the collected sample is thick, resulting in many targets being unable to be captured or only a small number of targets being captured.
[0004] At present, the existing commonly used fungus detection methods are slow and inefficient in skin fungus detection due to cumbersome operations and long time consumption. Summary of the invention
[0005] In order to improve the efficiency of skin fungus detection, the present application provides a skin fungus detection method, system, device and storage medium.
[0006] In the first aspect, the present application provides a method for detecting skin fungi, which adopts the following technical solution:
[0007] Receiving a number of skin sample images, and recording fungal information of the skin sample images;
[0008] Segmenting the skin sample image into a number of refined regions, randomly combining the several refined regions into a number of groups of sample regions and recording the combination information;
[0009] performing smoothing, grayscale processing and binary assignment on the plurality of the refined regions in sequence to obtain a plurality of feature point descriptors, and obtaining a plurality of sets of training data according to the plurality of the feature point descriptors and the combination information;
[0010] Training a first neural network according to several groups of the training data and the fungus information to obtain a prediction model;
[0011] Training a second neural network according to the plurality of skin sample images, the prediction model and the fungus information to obtain a target detection model;
[0012] When a skin sample to be detected is received, skin fungus detection is performed on the skin sample using the prediction model and the target detection model.
[0013] Through the above technical scheme, a large number of samples are used to train the prediction model to determine whether skin fungi exist, and the target detection model is trained to determine the target position of skin fungi. When actually performing skin fungi detection, the prediction model and the target detection model are used to reduce the detection time and improve the detection efficiency.
[0014] In a specific implementation scheme, the step of segmenting the skin sample image into a plurality of refined regions, randomly combining the plurality of refined regions into a plurality of groups of sample regions, and recording the combination information comprises:
[0015] Evenly dividing the skin sample image into a number of refined areas;
[0016] A random number generator is used to randomly combine a number of the thinned areas that do not pass through a diagonal line of the skin sample image to obtain a number of groups of sample areas and record the combination information.
[0017] Through the above technical solution, the skin sample images are segmented and randomly grouped, and calculations are performed on a group basis and put into training, which reduces computing power and improves efficiency.
[0018] In a specific embodiment, the step of training a first neural network according to several groups of the training data and the fungus information to obtain a prediction model comprises:
[0019] Encoding a plurality of groups of the training data to obtain a plurality of groups of encoded training data;
[0020] Importing several groups of the encoded training data into the multi-head attention mechanism layer of the first neural network to obtain several groups of attention data;
[0021] Superimposing several groups of the encoded training data and several groups of the attention data, and then performing regularization processing to obtain regularized data;
[0022] Processing the regularized data sequentially through the convolution layer, the nonlinear transformation layer, the upsampling layer, and the fully connected layer of the first neural network to obtain detection results of several groups of the skin sample images;
[0023] A prediction model is obtained according to the fungal information, the detection result and the first neural network.
[0024] Through the above technical solution, the data processing layer of the neural network is preset, and the neural network is repeatedly trained according to the standard to obtain the parameters of the neural network that meet the requirements, which facilitates the further generation of the prediction model.
[0025] In a specific implementation manner, obtaining a prediction model based on the fungal information, the detection results and the first neural network includes:
[0026] Calculating a loss value by using a first loss function according to the fungus information and the detection result;
[0027] Determine whether the loss value is less than a preset value;
[0028] If the loss value is less than a preset value, the training is stopped and a prediction model that can be put into use is obtained based on the trained first neural network;
[0029] If the loss value is not less than a preset value, the first neural network is optimized using a stochastic gradient descent optimization method and training is continued.
[0030] Through the above technical solution, by calculating the loss value and setting the standard of the loss value, it is determined when the neural network training is completed, which facilitates the further generation of the prediction model.
[0031] In a specific implementation scheme, the skin sample image also includes a correction sample image, and the skin sample image also includes a correction sample image. The prediction model that can be put into use based on the trained first neural network includes:
[0032] Obtaining the corrected fungus information of the corrected sample image;
[0033] Determining whether the corrected fungal information is consistent with the detection result;
[0034] If the corrected fungal information is consistent with the detection result, a prediction model that can be put into use is obtained based on the trained first neural network.
[0035] Through the above technical solution, after the loss value meets the standard, each sample retains a corrected sample image for correction when collecting samples. By comparing the fungal information of the corrected sample image with the test results, further corrections are made to make the prediction model more accurate.
[0036] In a specific implementation manner, the training of a second neural network according to the plurality of skin sample images, the prediction model and the fungus information to obtain a target detection model comprises:
[0037] Screening the skin sample images through the prediction model to obtain a number of positive skin sample images with fungi, and recording the prediction model data;
[0038] Processing the plurality of positive skin sample images by sequentially passing the prediction model data through the first convolution layer, the second convolution layer, the nonlinear transformation layer, the hidden layer, the first upsampling layer, the first upsampling layer and the fully connected layer of the second neural network to obtain a plurality of prediction images;
[0039] A target detection model is obtained according to the plurality of predicted images, the fungus information and the second neural network.
[0040] Through the above technical solution, the data processing layer of the neural network is preset, and the neural network is repeatedly trained according to the standard to obtain the parameters of the neural network that meet the requirements, which facilitates the further generation of the target detection model.
[0041] In a specific implementation scheme, the predicted image includes predicted target information, the fungus information includes manually annotated target information, and the target detection model obtained according to the predicted images, the fungus information and the second neural network includes:
[0042] Calculating a second loss value through a second loss function according to the manually annotated target information and the predicted target information;
[0043] Determining whether the second loss value is less than a second preset value;
[0044] If the second loss value is less than a second preset value, the training is stopped, and a usable target detection model is obtained according to the trained second neural network;
[0045] If the second loss value is not less than a second preset value, the second neural network is optimized using a stochastic gradient descent optimization method and then training is continued.
[0046] Through the above technical solution, by calculating the loss value and setting the standard of the loss value, it is determined when the neural network training is completed, which facilitates the further generation of the target detection model.
[0047] In a second aspect, the present application provides a skin fungus detection system, which adopts the following technical solution: the system comprises:
[0048] A skin sample picture receiving module, used for receiving a number of skin sample pictures and recording fungal information of the skin sample pictures;
[0049] An image segmentation and combination module is used to segment the skin sample image into a number of refined areas, randomly combine the several refined areas into a number of groups of sample areas and record the combination information;
[0050] A training data generation module, used for sequentially performing smoothing, grayscale processing and binary assignment on a plurality of the refined areas to obtain a plurality of feature point descriptors, and obtaining a plurality of sets of training data according to the plurality of feature point descriptors and the combination information;
[0051] A prediction model generation module, used for training a first neural network to obtain a prediction model according to a plurality of groups of the training data and the fungus information;
[0052] A target detection model generation module, used for training a second neural network according to the skin sample images, the prediction model and the fungus information to obtain a target detection model;
[0053] The skin fungus detection module is used to perform skin fungus detection on the skin sample by using the prediction model and the target detection model when receiving the skin sample to be detected.
[0054] In a third aspect, the present application provides a computer device, which adopts the following technical solution: it includes a memory and a processor, and the memory stores a computer program that can be loaded by the processor and executes a skin fungus detection method such as the above-mentioned one.
[0055] In a fourth aspect, the present application provides a computer-readable storage medium, which adopts the following technical solution: storing a computer program that can be loaded by a processor and execute the above-mentioned skin fungus detection method.
[0056] In summary, this application has the following beneficial technical effects:
[0057] (1) An optimized artificial intelligence model is proposed, which can detect fungi after taking a small number of pictures. The computing power required by the model is extremely low, so the artificial intelligence model can be deployed without burden even in community hospitals.
[0058] (2) Artificial intelligence models include prediction models and target detection models. The prediction model is trained with a large number of samples to determine whether skin fungi exist, and the target detection model is trained to determine the target of skin fungi. When actually performing skin fungus detection, the prediction model and target detection model are used to reduce detection time and improve detection efficiency.
[0059] (3) Different neural networks are designed based on the prediction model and target detection model, and the sample data are used to train the neural network to generate a prediction model and target detection model that can accurately detect skin fungi, thereby ensuring the accuracy of skin fungi detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 Flow chart of the method for detecting skin fungi in the embodiment of the present application.
[0061] Figure 2 It is a schematic diagram of the segmentation and combination of skin sample images.
[0062] Figure 3 It is the first neural network data training flow chart.
[0063] Figure 4 This is the second neural network data training flow chart.
[0064] Figure 5 is the output image where the prediction result is negative.
[0065] Figure 6 is the probability of a picture with a positive prediction result, in which the target is annotated and the possibility of the target is postulated.
[0066] Figure 7 It is a structural block diagram of the skin fungus detection method in the embodiment of the present application.
[0067] Attached figure numerals: 701, skin sample image receiving module; 702, image segmentation and combination module; 703, training data generation module; 704, prediction model generation module; 705, target detection model generation module; 706, skin fungus detection module. DETAILED DESCRIPTION
[0068] The following is combined with Figure 1-Figure 7 This application is described in further detail.
[0069] The embodiment of the present application discloses a method for detecting skin fungi, which is used to improve the efficiency of skin fungi detection.
[0070] Skin fungal infection refers to a large class of infectious diseases caused by pathogenic fungi that infect the skin, appendages, subcutaneous tissues, and mucous membranes. It is one of the most common skin diseases. With the development of fungal detection technology, more and more methods can be applied to the detection and identification of fungi. Currently, the commonly used methods for fungal detection include wet mount microscopy, Gram staining, fungal culture, and fluorescence detection.
[0071] The wet mount method is simple, but it has high requirements for inspectors, and very professional inspectors are needed to ensure the detection rate; Gram staining is cumbersome and time-consuming, and is easily affected by many factors such as the quality of the dye solution and the level of the inspectors; the culture method is time-consuming.
[0072] Although fluorescent staining has significantly improved the sensitivity of fungal microscopy, there are still some problems with fluorescent staining that have not been solved. First, because skin sample collection is relatively complicated, it takes a long time to scan the entire sample, which cannot meet the testing needs of hundreds of cases per day in many hospitals. Secondly, due to thickness, many targets can only be partially photographed. For example, core targets such as hyphae may only be photographed one-tenth of the original in some samples, and most of the rest cannot be photographed normally due to sample thickness, not being on the same plane, and excessive fluorescence intensity.
[0073] At present, the existing commonly used fungus detection methods are slow and inefficient in skin fungus detection due to cumbersome operations and long time consumption.
[0074] Therefore, the present application proposes a skin fungus detection method, which is used to improve the efficiency of skin fungus detection.
[0075] like Figure 1 As shown, the method includes:
[0076] S10, receiving a plurality of skin sample images, and recording fungal information of the skin sample images.
[0077] Specifically, a skin sample with fungi is a positive skin sample, and a skin sample without fungi is a negative skin sample. This application will collect positive skin samples and negative skin samples in a certain ratio, and each skin sample will take a number of skin sample pictures. The skin sample pictures taken by each sample will be distributed as training skin sample pictures and test correction sample pictures in a certain ratio. For example, in actual operation, about one hundred samples are used for training, where the ratio of negative to positive is 1:1. For a sample after fluorescent staining of the skin, we need to take about one hundred pictures. The pictures taken by each sample are randomly distributed in a ratio of 8:2, where the larger part is used for training and the smaller part is used for test correction. At the same time, the fungal information of each skin sample picture should be recorded, mainly including whether the skin sample picture includes fungi (that is, whether the skin sample picture is negative or positive). When the skin sample picture contains fungi, the manually annotated target information should also be recorded.
[0078] S20, dividing the skin sample image into a number of refined regions, randomly combining the several refined regions into a number of groups of sample regions and recording the combination information.
[0079] Specifically, in actual operation, taking a picture as an example, first, the resolution of the skin sample picture taken is 1200*1200, and the picture is evenly cut into 8*8 small squares. These small squares are randomly combined into several groups of sample areas, and the combination information is recorded, such as the sample area to which a small square belongs.
[0080] S30, performing smoothing processing, grayscale processing and binary assignment on the plurality of refined regions in sequence to obtain a plurality of feature point descriptors, and obtaining a plurality of sets of training data according to the plurality of feature point descriptors and the combination information.
[0081] Specifically, several refined areas, i.e., each small square, are smoothed using an existing convolution kernel, and the small squares are grayed after smoothing. Then, binary assignments are performed on the pixels in each small square to obtain assignment data. The assignment data of each pixel can be combined to obtain the feature point descriptor of each small square, and several feature point descriptors are combined according to the combined information to obtain several groups of training data.
[0082] S40, training a first neural network according to several groups of training data and fungal information to obtain a prediction model.
[0083] Specifically, several sets of training data of skin sample images are put into the first neural network, where the first neural network is set up with layers to generate a prediction model, which is used to determine whether the skin sample image is positive. The training is based on the actual fungal information, and the loss function is set at the same time. After obtaining a more accurate first neural network, a prediction model is generated.
[0084] S50, training a second neural network according to the plurality of skin sample images, the prediction model and the fungus information to obtain a target detection model.
[0085] Specifically, several skin sample images are imported into the second neural network, where the second neural network is set up with layers to generate a target detection model, which is used to obtain a predicted image containing predicted target information, and the second neural network is used to determine the target information in the positive skin sample image. The predicted target information and the manually annotated target information are used to calculate the loss value through the loss function, and a more accurate second neural network is obtained to generate a target detection model.
[0086] S60, when a skin sample to be tested is received, skin fungus detection is performed on the skin sample using the prediction model and the target detection model.
[0087] Specifically, after obtaining a more accurate prediction model and target detection model, when you come into contact with a skin sample that needs to be tested, first take a small number of pictures of the skin samples, and then use the prediction model and target detection model to analyze the pictures to get the test results.
[0088] This application uses a large number of samples to train a prediction model to determine whether skin fungi are present, and trains a target detection model to determine the target of skin fungi. When actually performing skin fungi detection, the use of the prediction model and the target detection model can reduce detection time and improve detection efficiency.
[0089] In one embodiment, in order to improve the efficiency of skin fungus detection, the step of dividing the skin sample image into a number of refined areas, randomly combining the several refined areas into a number of groups of sample areas and recording the combination information can be specifically performed as follows:
[0090] First, the skin sample image is evenly divided into several refined areas. Specifically, in actual operation, taking a picture as an example, the resolution of the skin sample image is generally 1200*1200. The picture is evenly cut into 8*8 small squares, and the small squares are the refined areas.
[0091] Next, use a random number generator to randomly combine several refined areas of the diagonal that do not pass through the skin sample image to obtain several groups of sample areas and record the combination information. Specifically, in actual operation, the skin sample image has a diagonal line from the upper left to the lower right. Except for the small squares passing through the diagonal, the other small squares are divided into small blocks of different categories using two random number generators. The first time is to randomly select how many colors of small blocks to be divided into, and the range is 5 to 15. The second random number specifies the category to which each small block belongs. Assuming that the range that comes out randomly for the first time is 9, then when the random number is used for the second time, each small block will be divided into categories 1 to 9. The figure below uses color to indicate the type of each small square after randomization. In this way, we can obtain several groups of sample areas and record the combination information, such as the sample area to which a small square belongs.
[0092] This application segments the skin sample images and randomly groups them, performs calculations and puts them into training according to the groups, which reduces computing power and improves efficiency.
[0093] It should be noted that Figure 2 For example, the skin sample image is randomly divided into 15 groups of sample areas using the grouping method explained above, and each small square is randomly divided into these 15 groups. On this basis, several refined areas are smoothed, grayed, and binary assigned in sequence to obtain several feature point descriptors. According to several feature point descriptors and combined information, several groups of training data are obtained. This step can be specifically performed as follows:
[0094] We extract features from each small square. Taking one of the small squares as an example, we first smooth the square. Because the skin fluorescence image will have a lot of noise interference, we adopt a more centralized smoothing strategy. After a lot of experiments, the smoothing convolution kernel customized for skin images is:
[0095]
[0096] Use the convolution kernel to smooth the pixels in each small square. If the point where the square is located is at the edge and cannot make up a 3*3 matrix, the missing part is filled with the value 0; then the image is grayed out; then each pixel in the small square is assigned a binary value. Take one of the points as an example, assuming that the point is P. We take P as the center and take a 17*17 area. In this area, we grab 128 groups of points other than the center point, randomly match them in pairs, form 128 groups of data, and perform binary assignment. Assuming that we randomly get two points x and y, use the following formula for assignment:
[0097]
[0098] Among them, p(x) and p(y) represent the grayscale values of the randomly selected points x and y.
[0099] Since we have 128 sets of data, the value of the i-th set of data can be expressed as:
[0100] b i =τ(p;x i ,y i )
[0101] In this way we get a feature point descriptor:
[0102] B=b0b1…b i …b 128
[0103] Each small square gets a feature point descriptor, and the skin sample image is evenly cut into 8*8 small squares, so that 64 feature point descriptors can be generated. According to the recorded combination information (the sample area to which a small square belongs), the 64 feature point descriptors are distributed to 15 groups of sample areas to obtain 15 groups of training data.
[0104] The data is processed to highly concentrate the effective information of the image, eliminate noise interference, reduce invalid calculations, and reduce dependence on computing power. In addition, the key information is connected in series through the white part of the middle diagonal line to ensure that there is always a part of information that runs through the entire image during feature extraction. It is ensured that at least one set of feature points covers the entire image during feature extraction and global information can be extracted. At the same time, other random blocks are used to allow the feature extraction network to avoid path dependence of feature extraction in a random way, maintaining better interactivity with distant blocks.
[0105] In one embodiment, in order to improve the efficiency of skin fungus detection, Figure 3 To illustrate, the step of training the first neural network to obtain a prediction model based on several sets of training data and fungal information can be specifically performed as follows:
[0106] like Figure 3 , the first neural network includes the following layers: multi-head attention mechanism layer, convolution layer, nonlinear transformation layer, upsampling layer and fully connected layer. The multi-head attention mechanism has a very large perception field, and because of the multi-head, it can extract multi-dimensional feature information, so that the entire model can better understand the data from multiple dimensions; convolution layer, nonlinear transformation layer and upsampling layer are used to process data, and only one layer is set because the data processing before this is relatively clean and the data volume is small; the fully connected layer is used to output the detection results.
[0107] Based on the first neural network, the establishment of the prediction model includes the following steps:
[0108] First, encode several groups of training data to obtain several groups of encoded training data, and then import the several groups of encoded training data into the multi-head attention mechanism layer of the first neural network. Specifically, the multi-head attention mechanism layer extracts multi-dimensional feature information to obtain several groups of attention data, so that the entire model can better understand the data from multiple dimensions. At the same time, the multi-head attention mechanism layer is calculated in parallel, which conforms to the current mainstream hardware architecture and saves computing resources.
[0109] Next, several groups of encoded training data and several groups of attention data are superimposed and regularized to obtain regularized data. Specifically, because it is found through actual operation that data enhancement needs to be performed by superimposing once, the data that has passed the attention mechanism layer and the data that has not passed through it are superimposed. In order to suppress the risk of overfitting, the superimposed and enhanced data is regularized. By increasing the deviation to reduce the variance, the accuracy of the model can be improved.
[0110] Furthermore, the regularized data is processed in sequence through the convolution layer, nonlinear transformation layer, upsampling layer and fully connected layer of the first neural network to obtain detection results of several groups of skin sample images, and a prediction model is obtained based on the fungal information, the detection results and the first neural network. Specifically, the data is input into the convolution layer, the nonlinear transformation layer and the upsampling layer, and the detection result is output after passing through the fully connected layer. The output result is whether the image is positive. The detection result also includes the probability that the category of the skin sample predicted by the first neural network is positive. Finally, a prediction model is constructed based on the fungal information of the skin sample (whether it is positive), the detection result (whether the sample detected by the first neural network is positive) and the first neural network.
[0111] The data processing steps of the neural network are preset, and the neural network is repeatedly trained according to the standards to obtain the parameters of the neural network that meet the requirements, so as to facilitate the further generation of the prediction model.
[0112] In one embodiment, in order to improve the efficiency of skin fungus detection, the step of obtaining a prediction model according to fungus information, detection results and the first neural network can be specifically performed as follows:
[0113] First, the loss value is calculated by the first loss function according to the fungal information and the detection results. Specifically, during the training process, we use the following formula as the loss function:
[0114]
[0115] Where N is the total number of samples we put into training, and y i It represents the category of the i-th sample. If it is positive, y i The value is 1, if it is negative, y i The value of p is 0, i It represents the probability that the category of the i-th sample predicted by our neural network is positive.
[0116] Then, determine whether the loss value is less than the preset value; if the loss value is less than the preset value, stop training and obtain a prediction model that can be put into use based on the trained first neural network; if the loss value is not less than the preset value, use the stochastic gradient descent optimization method to optimize the first neural network and continue training. Specifically, first set the parameters of the training cycle, for example, the training cycle epochs is 2000, the batch size is 128, the initial learning rate is 0.05, and the learning rate decay strategy is to multiply the original learning rate by 0.1 when the epoch is 100 and 1000, that is, at the 100th and 1000th epochs, the learning rates are 0.005 and 0.0005 respectively.
[0117] The Loss value, i.e., the value of the loss function, is calculated during the training process. For example, in actual applications, the preset value is 0.5. If the Loss value is less than 0.5, we stop training and believe that the first neural network can generate fluorescent images with clear textures and edges, and a prediction model that can be put into use is obtained based on the trained first neural network. If it is greater than 0.5, the stochastic gradient descent optimization method is used to optimize the first neural network and then continue training until the epoch reaches two thousand.
[0118] By calculating the loss value and setting the loss value standard, we can determine when the neural network training is completed, which facilitates the further generation of the prediction model.
[0119] In one embodiment, in order to improve the efficiency of skin fungus detection, the step of obtaining a usable prediction model based on the trained first neural network can be specifically performed as follows:
[0120] After the loss function loss value is less than the preset value, it is necessary to test and correct it.
[0121] First, obtain the corrected fungal information of the corrected sample image. Specifically, for a sample after skin fluorescent staining, we need to take about one hundred pictures. The pictures taken of each sample are randomly distributed in an 8:2 ratio, with the larger part used for training and the smaller part used for test correction. When the training data of the same sample is completed and the loss value is less than the preset value, it is also necessary to call the fungal information of the test-corrected skin sample of the sample (whether it is positive).
[0122] Then, determine whether the corrected fungal information is consistent with the detection result; if the corrected fungal information is consistent with the detection result, a prediction model that can be put into use is obtained based on the trained first neural network. Specifically, for the same sample, whether the detection result (whether it is positive) obtained by the first neural network of the sample image used for training is consistent with the fungal information of the skin sample used for testing and correction (whether it is positive); if they are consistent, the verification is passed, and a prediction model that can be put into use is obtained based on the trained first neural network; if they are inconsistent, the stochastic gradient descent optimization method is used to optimize the first neural network and then continue training.
[0123] After the loss value meets the standard, a corrected sample image is retained for each sample when the sample is collected. The fungal information of the corrected sample image is compared with the test results, and further corrections are made to make the prediction model more accurate.
[0124] In one embodiment, in order to improve the efficiency of skin fungus detection, Figure 4 To illustrate, the step of training the second neural network to obtain the target detection model based on a number of skin sample images, prediction models and fungal information can be specifically performed as follows:
[0125] like Figure 4 , the first neural network includes the following layers: the first convolution layer, the second convolution layer, the nonlinear transformation layer, the hidden layer, the first sampling layer, the second sampling layer and the fully connected layer. The convolution layer is used to perform local perception and feature extraction on the input data, the nonlinear transformation enables the neural network to fit and express complex nonlinear relationships, the hidden layer is used to map the input data to a higher-level feature space, thereby capturing the complex patterns and relationships in the input data, and the upsampling is to gradually restore the data to images based on the previous data, and the fully connected layer is used to output the results.
[0126] First, a number of skin sample images are screened through a prediction model to obtain a number of positive skin sample images with fungi, and the prediction model data is recorded. Specifically, the number of skin sample images include positive skin samples and negative skin samples. The skin sample images are tested by the prediction model to screen out positive skin samples, i.e., skin sample images with fungi. The skin sample images are processed through the prediction model, i.e., through the first neural network, and the prediction model data is recorded, such as the prediction model convolution layer data, the prediction model nonlinear transformation data, the prediction model upsampling layer data, and the prediction model fully connected layer data. If the input image is negative, the prediction result is directly output as a negative image, such as Figure 5 .
[0127] Then, the prediction model data is used to process several positive skin sample images in sequence through the first convolution layer, the second convolution layer, the nonlinear transformation layer, the hidden layer, the first upsampling layer, the first upsampling layer and the fully connected layer of the second neural network to obtain several prediction images. Specifically, taking an image with an image size of 1200*1200*3 as an example, after the first convolution, the data size is 600*600*6. After inputting the prediction model convolution layer data, the data size becomes 602*602*6. After the second convolution, the data size generated is 301*301*12. After adding the prediction model convolution layer data, it becomes 302*302*12. The data is then processed. After performing nonlinear transformation and adding the data of the nonlinear transformation of the prediction model, the data dimension becomes 303*303*12. Then the data is put into the hidden layer, and the data dimension does not change. Then, the first upsampling is started, and the upsampling layer data of the balance model is fused. After sampling, the data size is 150*150*24. The first upsampled data and the data of the third convolutional layer are added, and the second upsampling is performed. The upsampling layer data of the prediction model is also fused to obtain a data size of 300*300*12. Then the data is put into the fully connected layer and the fully connected layer data of the prediction model is fused. Finally, a prediction picture with a size of 1200*1200*3 is obtained as shown in the figure. Figure 6 , which includes predicted targets.
[0128] Finally, a target detection model is obtained based on several predicted images, fungal information and the second neural network. Specifically, the target detection model is constructed based on the fungal information of the skin sample (manually labeled target information), the predicted images (predicted target information) and the second neural network.
[0129] Set up the data processing steps of the neural network, repeatedly train the neural network according to the standards to obtain the parameters of the neural network that meet the requirements, and facilitate the further generation of the target detection model. In this process, the prediction model data is integrated to reduce the amount of calculation of the subsequent model, ensuring the accuracy of the results while saving computing power.
[0130] In one embodiment, in order to improve the efficiency of skin fungus detection, the step of obtaining a target detection model according to a number of predicted images, fungus information and a second neural network can be specifically performed as follows:
[0131] First, the second loss value is calculated by the second loss function based on the manually annotated target information and the predicted target information. Specifically, assuming that M targets are manually annotated in one of the predicted images, the results of the M targets predicted by artificial intelligence and the results of manual prediction are used to calculate the loss. The loss consists of three loss functions. The first is the center position of the predicted target:
[0132]
[0133] x j and z j It represents the horizontal and vertical coordinates of the center position of the jth predicted target, x j and z j It represents the horizontal and vertical coordinates of the center position of the jth manually labeled target.
[0134] The second is to predict the length and width of the target box, calculated as follows:
[0135]
[0136] where w j and h j It represents the length and width of the box of the j-th predicted target, w j and h j It represents the length and width of the box of the jth manually labeled target.
[0137] Finally, the probability of predicting whether the target type is correct is calculated using the following formula:
[0138]
[0139] where p j It represents the probability that the neural network predicts that the jth target is the correct target. is the correct target manually marked, and its value is 1 for any j.
[0140] After calculating the above three loss functions, add the three loss functions together to get the loss function of a single image:
[0141] Loss 总 =Loss pos +Loss W&H +Loss cate
[0142] This loss function is the loss function of a single image, and the final overall loss function is the average of the loss functions of all images.
[0143] Then, determine whether the second loss value is less than the second preset value; if the second loss value is less than the second preset value, stop training, and obtain a target detection model that can be put into use based on the trained second neural network; if the second loss value is not less than the second preset value, use the stochastic gradient descent optimization method to optimize the second neural network and continue training. Specifically, first set the parameters of the training cycle, the training cycle epochs is 2000, the batch size is 32, the initial learning rate is 0.01, and the learning rate decay strategy is to multiply the original learning rate by 0.1 when the epoch is 100 and 1000, that is, at the 100th and 1000th epochs, the learning rates are 0.001 and 0.0001 respectively. During the training process, we calculate the value of Loss.
[0144] During the training process, the average value of the loss function, i.e., the second loss value, is calculated. For example, in actual application, the second preset value is 3. If the Loss value is less than 3, we stop training and believe that the model can generate fluorescent images with clear textures and edges. Based on the trained second neural network, we obtain a target detection model that can be put into use. If it is greater than 3, we use the stochastic gradient descent optimization method to optimize the first neural network and continue training until the epoch reaches two thousand.
[0145] By calculating the loss value and setting the loss value standard, we can determine when the neural network training is completed, which facilitates the further generation of the target detection model.
[0146] Based on the above method, the present application also discloses an embodiment. Figure 7 The system includes the following modules:
[0147] The skin sample picture receiving module 701 is used to receive a number of skin sample pictures and record fungal information of the skin sample pictures;
[0148] The image segmentation and combination module 702 segments the skin sample image into a number of refined regions, randomly combines the several refined regions into a number of groups of sample regions and records the combination information;
[0149] The training data generating module 703 is used to sequentially perform smoothing, grayscale processing and binary assignment on a number of refined areas to obtain a number of feature point descriptors, and obtain a number of sets of training data according to the number of feature point descriptors and the combination information;
[0150] A prediction model generation module 704 is used to train a first neural network according to a plurality of sets of training data and fungal information to obtain a prediction model;
[0151] The target detection model generation module 705 is used to train the second neural network according to a number of skin sample images, the prediction model and the fungus information to obtain a target detection model;
[0152] The skin fungus detection module 706 is used to perform skin fungus detection on the skin sample by using the prediction model and the target detection model when receiving the skin sample to be detected.
[0153] In one embodiment, the image segmentation and combination module 702 is specifically used to evenly segment the skin sample image into a number of refined areas; use a random number generator to randomly combine a number of refined areas that do not pass through the diagonal of the skin sample image to obtain a number of groups of sample areas and record the combination information.
[0154] In one embodiment, the prediction model generation module 704 is specifically used to encode several groups of training data to obtain several groups of encoded training data; import the several groups of encoded training data into the multi-head attention mechanism layer of the first neural network to obtain several groups of attention data; superimpose several groups of encoded training data and several groups of attention data and perform regularization processing to obtain regularized data; process the regularized data through the convolution layer, nonlinear transformation layer, upsampling layer and fully connected layer of the first neural network in sequence to obtain several groups of skin sample image detection results; and obtain a prediction model based on the fungal information, the detection results and the first neural network.
[0155] In one embodiment, the prediction model generation module 704 is specifically used to calculate the loss value through the first loss function according to the fungal information and the detection results; determine whether the loss value is less than a preset value; if the loss value is less than the preset value, stop training and obtain a prediction model that can be put into use based on the trained first neural network; if the loss value is not less than the preset value, use the stochastic gradient descent optimization method to optimize the first neural network and then continue training.
[0156] In one embodiment, the prediction model generation module 704 is specifically used to obtain the corrected fungus information of the corrected sample image; determine whether the corrected fungus information is consistent with the detection result; if the corrected fungus information is consistent with the detection result, obtain a usable prediction model based on the trained first neural network.
[0157] In one embodiment, the target detection model generation module 705 is specifically used to screen a number of skin sample images through a prediction model to obtain a number of positive skin sample images with fungi, and record the prediction model data; use the prediction model data to sequentially process the number of positive skin sample images through the first convolution layer, the second convolution layer, the nonlinear transformation layer, the hidden layer, the first upsampling layer, the first upsampling layer and the fully connected layer of the second neural network to obtain a number of prediction images; obtain the target detection model according to the number of prediction images, fungal information and the second neural network.
[0158] In one embodiment, the target detection model generation module 705 is specifically used to calculate a second loss value through a second loss function based on manually labeled target information and predicted target information; determine whether the second loss value is less than a second preset value; if the second loss value is less than the second preset value, stop training, and obtain a target detection model that can be put into use based on the trained second neural network; if the second loss value is not less than the second preset value, use the stochastic gradient descent optimization method to optimize the second neural network and then continue training.
[0159] The embodiment of the present application also discloses a computer device.
[0160] Specifically, the computer device includes a memory and a processor, and the memory stores a computer program that can be loaded by the processor and execute the above-mentioned skin fungus detection method.
[0161] The embodiment of the present application also discloses a computer-readable storage medium.
[0162] Specifically, the computer-readable storage medium stores a computer program that can be loaded by a processor and execute a skin fungus detection method such as the above-mentioned one. The computer-readable storage medium includes, for example: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.
[0163] This specific embodiment is merely an explanation of the present invention and is not a limitation of the present invention. After reading this specification, those skilled in the art may make non-creative modifications to the present embodiment as needed. However, as long as they are within the scope of the claims of the present invention, they are protected by the patent law.
Claims
1. A method for detecting skin fungi, characterized in that: The method comprises: Receiving a number of skin sample images, and recording fungal information of the skin sample images; Segmenting the skin sample image into a number of refined regions, randomly combining the several refined regions into a number of groups of sample regions and recording the combination information; performing smoothing, grayscale processing and binary assignment on the plurality of the refined regions in sequence to obtain a plurality of feature point descriptors, and obtaining a plurality of sets of training data according to the plurality of the feature point descriptors and the combination information; Training a first neural network according to several groups of the training data and the fungus information to obtain a prediction model; Training a second neural network according to the plurality of skin sample images, the prediction model and the fungus information to obtain a target detection model; When a skin sample to be detected is received, skin fungus detection is performed on the skin sample using the prediction model and the target detection model.
2. The method according to claim 1, characterized in that: The step of dividing the skin sample image into a plurality of refined regions, randomly combining the plurality of refined regions into a plurality of groups of sample regions and recording the combination information comprises: Evenly dividing the skin sample image into a number of refined areas; A random number generator is used to randomly combine a number of the refined areas that do not pass through a diagonal line of the skin sample image to obtain a number of groups of sample areas and record the combination information.
3. The method according to claim 1, characterized in that: The step of training the first neural network according to the plurality of sets of the training data and the fungus information to obtain a prediction model comprises: Encoding a plurality of groups of the training data to obtain a plurality of groups of encoded training data; Importing several groups of the encoded training data into the multi-head attention mechanism layer of the first neural network to obtain several groups of attention data; Superimposing several groups of the encoded training data and several groups of the attention data, and then performing regularization processing to obtain regularized data; Processing the regularized data sequentially through the convolution layer, the nonlinear transformation layer, the upsampling layer, and the fully connected layer of the first neural network to obtain detection results of several groups of the skin sample images; A prediction model is obtained according to the fungal information, the detection result and the first neural network.
4. The method according to claim 3, characterized in that: The prediction model obtained according to the fungus information, the detection result and the first neural network includes: Calculating a loss value by using a first loss function according to the fungus information and the detection result; Determine whether the loss value is less than a preset value; If the loss value is less than a preset value, the training is stopped and a prediction model that can be put into use is obtained based on the trained first neural network; If the loss value is not less than a preset value, the first neural network is optimized using a stochastic gradient descent optimization method and training is continued.
5. The method according to claim 4, characterized in that: The skin sample image also includes a modified sample image, and the prediction model that can be put into use based on the trained first neural network includes: Obtaining the corrected fungus information of the corrected sample image; Determining whether the corrected fungal information is consistent with the detection result; If the corrected fungal information is consistent with the detection result, a prediction model that can be put into use is obtained based on the trained first neural network.
6. The method according to claim 1, characterized in that: The training of a second neural network according to the plurality of skin sample images, the prediction model and the fungus information to obtain a target detection model comprises: Screening the skin sample images through the prediction model to obtain a number of positive skin sample images with fungi, and recording the prediction model data; Processing the plurality of positive skin sample images by sequentially passing the prediction model data through the first convolution layer, the second convolution layer, the nonlinear transformation layer, the hidden layer, the first upsampling layer, the first upsampling layer and the fully connected layer of the second neural network to obtain a plurality of prediction images; A target detection model is obtained according to the plurality of predicted images, the fungus information and the second neural network.
7. The method according to claim 6, characterized in that: The predicted image includes predicted target information, the fungus information includes manually annotated target information, and the target detection model obtained according to the predicted images, the fungus information and the second neural network includes: Calculating a second loss value through a second loss function according to the manually annotated target information and the predicted target information; Determining whether the second loss value is less than a second preset value; If the second loss value is less than a second preset value, the training is stopped, and a usable target detection model is obtained according to the trained second neural network; If the second loss value is not less than a second preset value, the second neural network is optimized using a stochastic gradient descent optimization method and then training is continued.
8. A skin fungus detection system, characterized in that: The system comprises: A skin sample picture receiving module (701), used for receiving a number of skin sample pictures and recording fungal information of the skin sample pictures; An image segmentation and combination module (702) is configured to segment the skin sample image into a plurality of refined regions, randomly combine the plurality of refined regions into a plurality of groups of sample regions and record combination information; A training data generation module (703) is used to sequentially perform smoothing, grayscale processing and binary assignment on a number of the thinned areas to obtain a number of feature point descriptors, and obtain a number of sets of training data according to the feature point descriptors and the combination information; A prediction model generation module (704), used to train a first neural network according to a plurality of sets of training data and the fungus information to obtain a prediction model; A target detection model generation module (705), used for training a second neural network according to the plurality of skin sample images, the prediction model and the fungus information to obtain a target detection model; The skin fungus detection module (706) is used to perform skin fungus detection on the skin sample by using the prediction model and the target detection model when receiving the skin sample to be detected.
9. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program which can be loaded by the processor and executes the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: A computer program is stored which can be loaded by a processor and execute the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Convolutional neural network-based fungal keratitis detection method and system
CN109829901A
Skin automatic detection method based on integrated learning
CN110008925A
Skin target area automatic detection method based on deep learning
CN110009630A
Yolov5-based dermatological non-prescription medicine selling method
CN113299363A
Model training method and device, image description generation method and device and storage medium
CN114821271A