Acne detection and nursing suggestion generation method based on visual model and large model
Through the method of acne detection and care recommendation generation based on visual models and large models, the problems of subjectivity of acne detection and insufficient personalized recommendations in the existing technology are solved, and the accurate capture of acne information and the generation of personalized care recommendations are achieved. , improving detection accuracy and user experience.
Patent Information
- Application Number
- CN202410852531.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-28
- Publication Date
- 2024-09-27
AI Technical Summary
Existing acne detection methods are highly subjective, low in efficiency, automated detection technology has limitations in accuracy and personalized care recommendations, high complexity, and incomplete image extraction information, making it impossible to provide personalized care recommendations for skin conditions.
Acne detection and nursing advice generation methods based on visual models and large models are used to identify and segment acne areas through the YoLoX target detection network and Unet++ image segmentation network, combined with professional nursing knowledge base to generate personalized care advice, using the Chat-GLM-6B model Fine-tuning is performed to improve the model's generative capabilities.
It achieves accurate capture and extraction of acne information, provides personalized care suggestions, reduces dependence on professional knowledge, improves detection accuracy and efficiency, and is suitable for ordinary users.
Smart Images

Figure CN118711745A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing and natural language processing, and in particular to a method for generating acne detection and nursing suggestions based on a visual model and a large model. Background Art
[0002] Acne is a common skin disease, especially prevalent among adolescents and young people. Traditional acne detection methods usually rely on visual inspection and experience judgment of dermatologists. Doctors identify and diagnose acne by observing the patient's skin condition with the naked eye, but this manual detection method has the problems of strong subjectivity and low efficiency. In addition, the doctor's experience and skill level have a great impact on the accuracy of the test results, which may lead to missed diagnosis or misdiagnosis.
[0003] With the development of image processing and deep learning technologies, some automated systems have begun to be applied to acne detection. Image processing-based algorithms can improve the efficiency and consistency of detection, but existing automated detection technologies still have limitations in terms of accuracy and personalized care recommendations: (a) Too high complexity. The existing automated detection systems use multiple deep neural network methods to identify various information such as the location, severity, number, and type of acne, which are highly complex. During the training phase, a large number of parameters requires a lot of computing and time costs, and the running speed during inference is also difficult to implement on each end side; (b) Image extraction information is not perfect. Although deep neural networks are trained on relatively clean data sets to make the target detection effect more objective, simple acne identification and location information is not very valuable information for ordinary users or even some dermatologists. Such target detection results lack relatively complete acne condition description information; (c) Lack of personalized care recommendations. Existing automated detection technologies usually cannot provide personalized care recommendations based on individual skin conditions, but only provide skin information obtained through image detection processing. Patients without relevant professional knowledge cannot come up with the most suitable skin care recommendations based on this information. They still need the help of professional doctors and cannot solve the problem of end-to-end process integration. Summary of the invention
[0004] In order to overcome the defects and shortcomings of the prior art, the present invention provides an acne detection and care suggestion generation method based on a visual model and a large model. The present invention can accurately capture and extract acne information from an input skin image and provide personalized care suggestions.
[0005] In order to achieve the above object, the present invention adopts the following technical solutions:
[0006] The present invention provides a method for acne detection and care suggestion generation based on a visual model and a large model, comprising the following steps:
[0007] Collect visible light images of faces with acne and mark the acne, expand and preprocess the data set to obtain a training data set;
[0008] Build the YoLoX target detection network based on the MBconv and Block Attention modules, and add the MBconv and Block Attention modules between adjacent layers of the CSPDarknet backbone network;
[0009] Build Unet++ image segmentation network based on Transformer Block;
[0010] The YoLoX target detection network and the Unet++ image segmentation network are trained based on the training data set. The trained YoLoX target detection network identifies the acne area in the visible light image of the face. The trained Unet++ image segmentation network performs regional segmentation on the visible light image of the face to obtain each face area.
[0011] Extracting acne feature information based on the acne area and each face area;
[0012] Build a vector database based on acne professional nursing knowledge, and obtain knowledge items retrieved from the vector database based on acne feature information;
[0013] Construct input prompt based on acne feature information and knowledge items retrieved from vector database;
[0014] Based on the Chat-GLM-6B model, a local large model is fine-tuned and deployed to generate personalized acne care recommendations.
[0015] As a preferred technical solution, visible light images of faces with acne are collected and the acne is annotated, and the data set is expanded and preprocessed, specifically including:
[0016] The dataset was expanded using image enhancement techniques, including mirroring the image, rotating the image at any angle, adjusting the color properties of the image, introducing random noise into the image, and blurring the image.
[0017] Preprocessing includes face location in the input image, scaling the located image based on a bilinear interpolation algorithm, and denoising.
[0018] As a preferred technical solution, the YoLoX target detection network based on MBconv and Block Attention modules specifically includes:
[0019] Insert the MBConv module into the middle layer of CSPDarknet, where the MBConv module includes layer-by-layer convolution, dilated convolution, and point-by-point convolution;
[0020] Add the Block Attention module to capture local features through the block-level self-attention mechanism.
[0021] As a preferred technical solution, Unet++ image segmentation network is built based on Transformer Block, which specifically includes:
[0022] In the encoder part, multi-layer convolution and pooling operations are used to downsample the input image step by step, and Batch Normalization layer and ReLU activation function are added after each convolution layer;
[0023] Introduce Transformer Block between the encoder and decoder, add Transformer Block at each skip connection, and capture global features through a multi-head self-attention mechanism;
[0024] Use depth-wise separable convolution to replace the ordinary convolution layer of UNet++.
[0025] As a preferred technical solution, the YoLoX target detection network and the Unet++ image segmentation network are trained based on the training data set, and the loss function is expressed as:
[0026] loss=_*loss_+_obj+loss_
[0027] loss_=1-IoU 2
[0028] loss_=-∑(y o *log(p o )(1-y o )*log(1- o ))
[0029] loss_=-∑(y c *log(p c )1- c )*log(1- c ))
[0030] Among them, loss represents the loss function, loss_ is the regression loss function, reg_weight is the weight corresponding to the regression loss function, loss_ is the judgment loss function, loss_ is the classification loss function, IoU is the ratio of the intersection and union of the box corresponding to the acne box coordinate value and the box corresponding to the acne box label, y oIndicates the true label for determining whether there is acne in the prediction box, p o Represents the probability of acne existing in the model prediction box, y c Represents the true label of the true acne category in the prediction box, p c Represents the probability that the model predicts that the category of acne in the box is the actual category;
[0031] Construct an Adam optimizer, extract some samples from the training data set based on the loss function and the Adam optimizer, and iteratively train the parameters of the YoLoX target detection network and the Unet++ image segmentation network until the set iteration stop condition is reached and the training is stopped.
[0032] As a preferred technical solution, acne feature information is extracted based on the acne area and each face area, specifically including:
[0033] According to the face area segmentation results, the location of each acne is recorded and the number is counted;
[0034] Perform pixel-level analysis on the identified acne area and estimate the area of acne by calculating the total number of pixels in the acne area;
[0035] Perform color space analysis on each acne area, and classify the acne by color according to the extracted RGB value of each acne area;
[0036] The shape analysis of the segmented acne area is performed based on the geometric transformation method, and the shape features of acne are extracted from the image to classify acne into different shape categories.
[0037] As a preferred technical solution, a vector database is built based on acne professional nursing knowledge, and knowledge items retrieved from the vector database are obtained based on acne feature information, specifically including:
[0038] Get professional data related to acne care;
[0039] Integrate and process the acquired professional data in blocks;
[0040] Use a pre-trained embedding model to convert each text entry into a fixed-length vector representation, store the vector representation in a vector database and build a vector index structure;
[0041] After embedding encoding, the detailed information of acne is obtained to obtain a query vector. The cosine similarity between the query vector and the entries in the vector database is calculated to find the top k pieces of knowledge as the knowledge entries retrieved from the vector database.
[0042] As a preferred technical solution, the acquired professional data will be integrated and processed in blocks, including data cleaning, classification and block division, and format standardization;
[0043] The data cleaning includes removing duplicate and invalid data;
[0044] The classification and blocking classifies and blocks the data according to different preset categories;
[0045] The format standardization converts data into a uniform format.
[0046] As a preferred technical solution, an input prompt is constructed based on acne feature information and knowledge items retrieved from a vector database, specifically including:
[0047] Construct a System-level prompt that defines the role of the big model and the background information of each response generation, including the role object prompt of the big model and the historical dialogue information prompt, wherein the historical dialogue information includes the user input and the big model answer;
[0048] Construct an input prompt that combines acne extraction information and retrieved knowledge items;
[0049] Integration design Input uses input = "The relevant knowledge items retrieved based on the user's input text are as follows: {Knowledge}##User input: {User}##Please combine the historical records and the retrieved knowledge to give an answer based on the user's input";
[0050] Among them, Knowledge represents the vector database retrieval information, and User represents the acne extraction information;
[0051] The integrated prompt is as follows: "##role {character}##history {history}##{input}";
[0052] Among them, character represents the large model character object, and history represents the historical dialogue information.
[0053] As a preferred technical solution, a local large model is fine-tuned and deployed based on the Chat-GLM-6B model to generate personalized acne care recommendations, including:
[0054] The Chat-GLM-6B model was fine-tuned using the LoRA fine-tuning method;
[0055] Optimize model inference speed based on mixed precision inference technology and deploy large models locally.
[0056] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0057] (1) In view of the problem that the current acne detection system algorithm is relatively complex, the present invention adopts an improved YoLoX target detection network, and can use a lightweight YoLoX-s version as the basic network for improvement, which has fewer parameters while achieving a certain accuracy.
[0058] (2) In view of the problem that current acne detection methods are not perfect in extracting acne information, the present invention further extracts visual information for each target detection frame based on acne target detection information and combines it with face area division information to obtain detailed information such as distribution area, number, color, area, shape, etc.
[0059] (3) In response to the problem that the current acne detection system lacks follow-up care recommendations, the present invention inputs the acne information extracted by the visual network into a locally deployed large model, and combines it with the designed prompt to guide the large model to generate personalized acne care recommendations based on the constructed acne care knowledge base and the input acne information. The combination of the large model expands the application scenarios of the entire system to ordinary users who do not have professional knowledge. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 Schematic diagram of the process of the acne detection and care suggestion generation method based on the visual model and the large model of the present invention;
[0061] Figure 2 A schematic diagram of the process of extracting detailed information of acne based on the results of the target detection network and the image segmentation network of the present invention;
[0062] Figure 3 The figure is a flow chart of constructing an input prompt based on acne feature information and knowledge items retrieved from a knowledge base in the present invention. DETAILED DESCRIPTION
[0063] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0064] Example
[0065] like Figure 1 As shown, this embodiment provides a method for acne detection and care suggestion generation based on a visual model and a large model, comprising the following steps:
[0066] S1: collect visible light images of human faces with acne and mark the acne, and use image enhancement technology to expand and preprocess the data set to obtain a training data set;
[0067] In this embodiment, image enhancement technology is used to expand the data set, which can be but not limited to the following: mirror flipping the image, rotating the image at any angle, adjusting the color properties of the image, introducing random noise into the image, and blurring the image. These transformations can be used alone or in combination to achieve the purpose of enhancing the diversity of image data and improving the generalization ability of the model.
[0068] Perform face location and denoising on the input image. Considering that the application scenarios of the system include consumer users, the camera and shooting method used in this scenario may not have high precision and accuracy. Therefore, before entering the deep neural network for reasoning, the original image needs to be preprocessed. The specific steps are as follows:
[0069] S11: Detect and locate the face area based on the Harr feature cascade classifier, and crop to ensure that the main part of the image (i.e., the front face area of the face that is not blocked) is located in the center of the image, so as to focus on the main part of the detection;
[0070] S12: Scale the positioning image based on the bilinear interpolation algorithm and unify it to the standard input size. Remove the scaled image noise based on local mean filtering and bilateral filtering while retaining the detail information;
[0071] S2: YoLoX target detection network built based on MBconv and Block Attention modules. Add MBconv and Block Attention modules to adjacent layers of the CSPDarknet backbone network. The specific operations are as follows:
[0072] S21: Build the Mobile Inverted Bottleneck Convolution (MBConv) module. The MBConv module includes layer-by-layer convolution, dilated convolution, and point-by-point convolution, and is combined with the SE (Squeeze-and-Excitation) module to enhance channel attention;
[0073] S22: Insert the MBConv module in the middle layer of CSPDarknet (such as between Layer 2 and Layer 3) to enhance the feature extraction capability;
[0074] S23: Add the Block Attention module to capture local features through the block-level self-attention mechanism, further improving the model's ability to capture details;
[0075] S3: Unet++ image segmentation network built based on Transformer Block. The specific operations are as follows:
[0076] S31: Build the Unet++ network structure and use the depth-wise separable convolution to replace the UNet++ ordinary convolution layer. Unet++ is an improvement on Unet, adding multi-hop connections and nested skip paths, which can better capture features of different scales and improve segmentation effects.
[0077] S32: In the encoder part, multi-layer convolution and pooling operations are used to downsample the input image step by step. At the same time, Batch Normalization layer and ReLU activation function are added after each convolution layer to stabilize the training process and accelerate convergence;
[0078] S33: Introduce Transformer Block between the encoder and decoder, add Transformer Block at each skip connection, capture global features through the multi-head self-attention mechanism, adaptively select important feature information, filter out irrelevant or interference information, and thus enhance the accuracy of the segmentation results;
[0079] S34: Introduce Depthwise Separable Convolution to reduce the amount of computation and parameters while retaining the segmentation capability of the model.
[0080] S4: Train and optimize the YoLoX target detection network and the Unet++ image segmentation network based on the training data set containing acne annotations to obtain the trained YoLoX target detection network and the Unet++ image segmentation network;
[0081] In this embodiment, the loss function is determined according to the regression loss function, judgment loss function, and classification loss function of the YoLoX target detection network and the Unet++ image segmentation network. The loss function expression is as follows:
[0082] loss=reg_weight*loss_iou+loss_obj+loss_cls
[0083] Among them, loss is the loss function; loss_iou is the regression loss function; reg_weight is the weight corresponding to the regression loss function; loss_obj is the judgment loss function; loss_cls is the classification loss function;
[0084] The regression loss function is calculated as follows;
[0085] loss_iou=1-IoU 2
[0086] Among them, IoU is the ratio of the intersection and union of the box corresponding to the acne box coordinate value and the box corresponding to the acne box label;
[0087] The calculation method of the judgment loss function is as follows;
[0088] loss_obj=-∑(y o *log(p o )+(1-y o )*log(1-p o ))
[0089] Among them, y o is the true label (0 or 1), indicating whether there is acne in the predicted box; p o is the probability of the existence of acne in the model prediction box, log represents the natural logarithm;
[0090] The classification loss function is calculated as follows;
[0091] loss_cls=-∑(y c *log(p c )+(1-y c )*log(1-p c ))
[0092] Among them, y c is the true label (0 or 1), indicating the true acne category in the predicted box, p c The model predicts the probability that the category of acne in the box is the actual category,
[0093] Construct the Adam optimizer, and its calculation formula is as follows;
[0094]
[0095] In one iteration, some samples are extracted from the training dataset based on the loss function and Adam optimizer to train the parameters of the YoLoX object detection network and the Unet++ image segmentation network.
[0096] After each iteration, the above training operation is repeated until the number of iterations reaches a certain number and the training ends.
[0097] Based on the trained YoLoX target detection network, target detection is performed on the visible light image of the face to identify the acne area.
[0098] Based on the trained Unet++ network, the visible light image of the face is segmented to obtain various facial regions, including: nose T-shaped area, forehead, cheeks, and chin;
[0099] S5: Extract detailed acne information (i.e. acne feature information) based on the results of the target detection network and the image segmentation network, including: distribution area, number, color, area, and shape;
[0100] Considering that the acne bounding box obtained by simple target detection can only provide the number and category information of acne, this information is not enough for a non-multimodal language model to have a more comprehensive understanding of the overall acne situation. Figure 2 As shown in the figure, the specific operations for further extracting detailed acne information based on target detection information and face area information are as follows:
[0101] S51: Based on the face region segmentation result, for each predefined region, including: nose T-zone, forehead, cheek, and chin; record the location of each acne and count the number;
[0102] S52: performing pixel-level analysis on the identified acne lesion area, and estimating the area of acne by calculating the total number of pixels in the lesion area;
[0103] S53: performing color space analysis on each acne lesion area, focusing on each component in the RGB color model, and providing feature data for color classification of acne by extracting the RGB value of each lesion area;
[0104] Using classification algorithms such as support vector machines (SVM), acne is classified by color based on the extracted RGB values. By training the SVM model, acne is classified into three main color categories: red, white, and black.
[0105] S54: Use geometric transformation methods such as Hough transform to perform shape analysis on the segmented acne area, extract the shape features of the acne from the image, and classify the acne into different shape categories such as round, elliptical, and irregular based on the extracted shape features.
[0106] S6: Build a vector database based on acne professional care knowledge; the professional knowledge base can effectively improve the professional knowledge capabilities of the local large model, and the easy update and expansion of the plug-in knowledge base method can also make the upper limit of the system higher. The specific operations of building an acne professional care knowledge base are as follows:
[0107] S61: Extensively collect professional data related to acne care; professional data can come from multiple channels, including medical literature, professional care guidelines, clinical records, online resources, and patient feedback. Review and collect the latest research papers and review articles on acne treatment and care, refer to care manuals and guidelines written by dermatologists and cosmetic experts, collect patient care records and doctor recommendations from actual clinical cases, use reliable medical websites and databases to obtain the latest care information, and collect patient feedback and experience after using different care methods to improve and verify the content of the knowledge base;
[0108] S62: Integrate and segment the collected data to facilitate system management and retrieval; the processing includes data cleaning, classification and segmentation, and format standardization;
[0109] Data cleaning includes removing duplicate and invalid data;
[0110] Classification and segmentation include classifying and segmenting data according to different categories such as care methods, recommended products, dietary recommendations, etc.;
[0111] In this embodiment, the divided data is embedded into a vector database, including: text vectorization, vector storage and vector indexing;
[0112] Among them, text vectorization uses the same embedding model as the pre-trained local deployment large model to convert each text entry into a fixed-length vector representation to capture the semantic information of the text;
[0113] Vector storage stores vector representations in vector databases (such as FAISS, Chroma, etc.) to support efficient similarity retrieval;
[0114] Vector index builds vector index structure, optimizes retrieval performance, and speeds up query response time;
[0115] In this embodiment, a retriever is set to support efficient semantic query, and the retriever setting includes query preprocessing, vector retrieval method setting and result sorting;
[0116] The query preprocessing includes normalizing the acne extraction information into a standard query text by natural language text formatting, and preprocessing the standard query text, including word segmentation, stop word removal, etc.;
[0117] The vector retrieval method is set to use the similarity_score method; the cosine similarity between the input query vector and the entries in the vector database is calculated, and the top 5 pieces of knowledge with a similarity_score threshold value are retained;
[0118] Result sorting Sort the search results according to the similarity score;
[0119] Format standardization includes converting data into a unified format (such as CSV and json); using existing language models to extract and summarize key information from long documents, generate concise entries, and attach reference links to the original documents;
[0120] S63: Use the pre-trained embedding model to convert each text entry into a fixed-length vector representation; store the vector representation in a vector database (such as FAISS, Chroma, etc.) and build a vector index structure;
[0121] S64: Retriever setting: using the similarity_score method, the input query vector is subjected to cosine similarity calculation with the entries in the vector database, and the top 5 pieces of knowledge with a similarity_score threshold value are retained. In this embodiment, the query vector is the detailed information of acne encoded by embedding.
[0122] S65: Result sorting: The search results are sorted according to the similarity scores.
[0123] S7: Construct input prompt based on detailed information of acne and knowledge items retrieved from knowledge base;
[0124] like Figure 3 As shown, the specific operations are as follows:
[0125] S71: Construct a System-level prompt that defines the large model role and background information each time a response is generated; the System includes the large model role object prompt and the historical dialogue information prompt;
[0126] In this embodiment, the large model role object prompt adopts character = "You are a dermatologist with many years of experience, specializing in the diagnosis and treatment of acne. You have the following abilities: 1. You have mastered the latest medical research results and professional care methods; 2. You have good communication skills and empathy; 3. Your task is to provide personalized and scientific care suggestions based on the acne information provided by the user and the content in the professional knowledge base, to help users effectively manage and treat acne problems.";
[0127] In this embodiment, the historical conversation information includes user input and big model answer. The user input is an acne information input question that does not contain knowledge base entries. This part of information can be combined with some information provided by the user through natural language when the big model generates exclusive care suggestions, such as the user's skin sensitivity, dryness and oiliness, etc., which are difficult to detect using visual networks; the specific format of historical information is history = "user: {user input}, AI: {answer generated by the big model}";
[0128] S72: construct an input prompt that combines the acne extraction information and the retrieved knowledge items;
[0129] In this embodiment, the acne extraction information example is User = "My facial acne information is as follows: {3} {red acne} are found in {nose T-shaped area}, with a shape of {circular} and an area of approximately {0.5 square centimeters}; {2} {white acne} are found in {cheek area}, with a shape of {oval} and an area of approximately {0.3 square centimeters}; {5} {red acne} are found in {forehead area}, with an {irregular shape} and an area of approximately {0.3 square centimeters}; {1} red acne is found in {chin area}, with a shape of {circular} and an area of approximately {0.5 square centimeters}. Please give me personalized care suggestions.";
[0130] In this embodiment, the knowledge base retrieval information is designed as follows: Knowledge = "1. {the knowledge item with the highest retrieval score}; 2. {the knowledge item with the second highest retrieval score}; 3. {the knowledge item with the third highest retrieval score}; 4. {the knowledge item with the fourth highest retrieval score}; 5. {the knowledge item with the fifth highest retrieval score};"
[0131] In this embodiment, the integrated design Input adopts input = "The relevant knowledge items retrieved according to the user's input text are as follows: {Knowledge}##User input: {User}##Please combine the historical records and the retrieved knowledge and give an answer according to the user's input";
[0132] In this embodiment, the integrated prompt is as follows: “##role {character}##history {history}##{input}”.
[0133] S8: Fine-tune and deploy a local large model based on the Chat-GLM-6B model to generate personalized acne care recommendations; the specific operations are as follows:
[0134] S81: Prepare medical care data in specific fields as fine-tuning datasets. These data come from medical literature, professional care guidelines, and actual clinical records to ensure the breadth and authority of the data. The data preparation process includes collection, organization, and cleaning to ensure that the data can accurately reflect the actual medical care situation and provide a reliable basis for model fine-tuning;
[0135] S82: Load and configure the pre-trained Chat-GLM-6B model. Chat-GLM-6B is an open source, Chinese-English bilingual conversational language model with powerful language understanding and generation capabilities;
[0136] S83: Fine-tune the Chat-GLM-6B model using LoRA (Low-Rank Adaptation). LoRA is an efficient fine-tuning technology that can quickly achieve model adaptation and domain migration by performing low-rank adaptive adjustments to some parameters of the pre-trained model;
[0137] S84: Use mixed precision (FP16) reasoning technology to optimize model reasoning speed and deploy large models locally; mixed precision reasoning technology improves model reasoning efficiency by reducing computational workload and memory usage.
[0138] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.
Claims
1. A method for acne detection and care suggestion generation based on visual model and large model, characterized in that: The steps include: Collect visible light images of faces with acne and mark the acne, expand and preprocess the data set to obtain a training data set; Build the YoLoX target detection network based on the MBconv and BlockAttention modules, and add the MBconv and BlockAttention modules between adjacent layers of the CSPDarknet backbone network; Build Unet++ image segmentation network based on Transformer Block; The YoLoX target detection network and the Unet++ image segmentation network are trained based on the training data set. The trained YoLoX target detection network identifies the acne area in the visible light image of the face. The trained Unet++ image segmentation network performs regional segmentation on the visible light image of the face to obtain each face area. Extracting acne feature information based on the acne area and each face area; Build a vector database based on acne professional nursing knowledge, and obtain knowledge items retrieved from the vector database based on acne feature information; Construct input prompt based on acne feature information and knowledge items retrieved from vector database; Based on the Chat-GLM-6B model, a local large model is fine-tuned and deployed to generate personalized acne care recommendations.
2. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: The data set is expanded and preprocessed, including: The dataset was expanded using image enhancement techniques, including mirroring the image, rotating the image at any angle, adjusting the color properties of the image, introducing random noise into the image, and blurring the image. Preprocessing includes face location in the input image, scaling the located image based on a bilinear interpolation algorithm, and denoising.
3. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: The YoLoX target detection network based on MBconv and Block Attention modules specifically includes: Inserting an MBConv module into the middle layer of CSPDarknet, wherein the MBConv module includes layer-by-layer convolution, dilated convolution, and point-by-point convolution; Add the Block Attention module to capture local features through the block-level self-attention mechanism.
4. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: Build a Unet++ image segmentation network based on Transformer Block, including: In the encoder part, multi-layer convolution and pooling operations are used to downsample the input image step by step, and Batch Normalization layer and ReLU activation function are added after each convolution layer; Introduce Transformer Block between the encoder and decoder, add TransformerBlock at each skip connection, and capture global features through the multi-head self-attention mechanism; Use depth-wise separable convolution to replace the ordinary convolution layer of UNet++.
5. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: The YoLoX target detection network and Unet++ image segmentation network are trained based on the training data set, and the loss function is expressed as: loss=reg_weight*loss_iou+loss_obj+loss_cls loss_iou=1-IoU 2 loss_obj=-∑(y o *log(p o )+(1-y o )*log(1-p o )) loss_cls=-∑(y c *log(p c )+(1-y c )*log(1-p c )) Among them, loss represents the loss function, loss_iou is the regression loss function, reg_weight is the weight corresponding to the regression loss function, loss_obj is the judgment loss function, loss_cls is the classification loss function, IoU is the ratio of the intersection and union of the box corresponding to the acne box coordinate value and the box corresponding to the acne box label, y o Indicates the true label for determining whether there is acne in the prediction box, p o Represents the probability of acne existing in the model prediction box, y c Represents the true label of the true acne category in the prediction box, p c Represents the probability that the model predicts that the category of acne in the box is the actual category; Construct an Adam optimizer, extract some samples from the training data set based on the loss function and the Adam optimizer, and iteratively train the parameters of the YoLoX target detection network and the Unet++ image segmentation network until the set iteration stop condition is reached and the training is stopped.
6. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: Based on the acne area and each face area, acne feature information is extracted, including: According to the face area segmentation results, the location of each acne is recorded and the number is counted; Perform pixel-level analysis on the identified acne area and estimate the area of acne by calculating the total number of pixels in the acne area; Perform color space analysis on each acne area, and classify the acne by color according to the extracted RGB value of each acne area; The shape analysis of the segmented acne area is performed based on the geometric transformation method, and the shape features of acne are extracted from the image to classify acne into different shape categories.
7. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: A vector database is built based on acne professional nursing knowledge, and knowledge items retrieved from the vector database are obtained based on acne feature information, including: Get professional data related to acne care; Integrate and process the acquired professional data in blocks; Use a pre-trained embedding model to convert each text entry into a fixed-length vector representation, store the vector representation in a vector database and build a vector index structure; After embedding encoding, the detailed information of acne is obtained to obtain a query vector. The cosine similarity between the query vector and the entries in the vector database is calculated to find the top k pieces of knowledge as the knowledge entries retrieved from the vector database.
8. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: Integrate and process the acquired professional data, including data cleaning, classification and format standardization; The data cleaning includes removing duplicate and invalid data; The classification and blocking classifies and blocks the data according to different preset categories; The format standardization converts data into a uniform format.
9. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: The input prompt is constructed based on the acne feature information and the knowledge items retrieved from the vector database, including: Construct a System-level prompt that defines the role of the big model and the background information of each response generation, including the role object prompt of the big model and the historical dialogue information prompt, wherein the historical dialogue information includes the user input and the big model answer; Construct an input prompt that combines acne extraction information and retrieved knowledge items; Integration design Input uses input = "The relevant knowledge items retrieved based on the user's input text are as follows: {Knowledge}##User input: {User}##Please combine the historical records and the retrieved knowledge to give an answer based on the user's input"; Among them, Knowledge represents the vector database retrieval information, and User represents the acne extraction information; The integrated prompt is as follows: "##role {character}##history {history}##{input}"; Among them, character represents the large model character object, and history represents the historical dialogue information.
10. The method for acne detection and care suggestion generation based on visual model and large model according to claim 1, characterized in that: Based on the Chat-GLM-6B model, a local large model is fine-tuned and deployed to generate personalized acne care recommendations, including: The Chat-GLM-6B model was fine-tuned using the LoRA fine-tuning method; Optimize model inference speed based on mixed precision inference technology and deploy large models locally.
Citation Information
Cited By
Orthognathic surgery treatment suggestion generation system, method, equipment and medium
CN119207715A
Acne grading model migration method based on large model
CN119599993A
