A method for constructing a large language model for intelligent traditional Chinese medicine system

By constructing a tongue diagnosis evaluation coefficient and text consultation model, the problems of inefficiency and poor accuracy of tongue diagnosis and text consultation in intelligent traditional Chinese medicine system are solved, and more efficient and accurate diagnosis and treatment suggestions are achieved.

CN119252469BActive Publication Date: 2025-04-08SHENZHEN WENZHI TCM HEALTH TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411767318.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-04-08
Estimated Expiration
2044-12-04

AI Technical Summary

Technical Problem

The existing large language model for intelligent traditional Chinese medicine systems has problems of inefficiency and poor accuracy in tongue diagnosis and text consultation, and it is difficult to provide targeted treatment methods.

Method used

By obtaining the hospital's historical tongue diagnosis and treatment data, the tongue diagnosis evaluation coefficient is calculated, and the tongue diagnosis images are marked and trained based on this to build a tongue diagnosis and treatment model; at the same time, a text consultation model is constructed using historical medical record data to improve the efficiency and accuracy of tongue diagnosis and text consultation.

Benefits of technology

It has achieved improved efficiency and accuracy of tongue diagnosis, can provide more targeted treatment suggestions, and improve the interaction efficiency between patients and language models.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119252469B_ABST
    Figure CN119252469B_ABST
Patent Text Reader

Abstract

The invention discloses a method for constructing a large language model for an intelligent traditional Chinese medicine system, relates to the field of traditional Chinese medicine, solves the problem of poor application effect of the large language model for the intelligent traditional Chinese medicine system, comprises step S1: respectively acquiring tongue diagnosis image marking data and historical medical record data to obtain hospital historical reception data, step S2: dividing the tongue diagnosis image marking data into a tongue diagnosis training set and a tongue diagnosis test set according to the hospital historical reception data, training and testing an image recognition model by using the tongue diagnosis training set and the tongue diagnosis test set to obtain a tongue diagnosis inquiry model, step S3: dividing a number of historical medical records into a question-and-answer text test set and a question-and-answer text training set according to the hospital historical reception data, training and testing a language interaction model by using the question-and-answer text test set and the question-and-answer text training set to obtain a text inquiry model, and the invention can improve the practicality and accuracy of the large language model of traditional Chinese medicine.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of traditional Chinese medicine and relates to a large language model technology, and specifically is a method for constructing a large language model for an intelligent traditional Chinese medicine system. Background Art

[0002] The existing large language model construction method for intelligent TCM system has the following specific defects during construction:

[0003] 1. Existing large language models often interact with textual languages. In the field of TCM tongue diagnosis, patients can only use text to describe tongue features. They need to organize their language to conduct large model consultations on tongue diagnosis, which results in low consultation efficiency and poor accuracy.

[0004] 2. The large language model of the existing TCM system usually only has the function of popularizing symptoms based on existing TCM literature, and it is difficult to provide real and targeted treatment methods for patients' specific symptoms;

[0005] To this end, we propose a method for constructing a large language model for intelligent TCM systems. Summary of the invention

[0006] In view of the deficiencies in the prior art, the present invention aims to provide a method for constructing a large language model for an intelligent traditional Chinese medicine system. The present invention is based on obtaining the hospital's historical tongue diagnosis reception data, obtaining multiple patients' historical tongue diagnosis images according to the hospital's historical tongue diagnosis reception data, respectively obtaining the tongue color deviation value, the left and right area difference of the tongue, and the tongue coating area ratio corresponding to each tongue diagnosis image to calculate the tongue diagnosis evaluation coefficient, obtaining the tongue diagnosis evaluation coefficient threshold and the tongue diagnosis evaluation coefficient for numerical comparison, marking the patient's historical tongue diagnosis image as a first type of tongue diagnosis image and a second type of tongue diagnosis image according to the numerical comparison result, obtaining tongue diagnosis image marking data, and obtaining multiple copies of the tongue diagnosis image according to the hospital's historical reception data. Historical medical records, obtain historical medical record data, define historical medical record data and tongue diagnosis image marking data as hospital historical reception data, obtain tongue diagnosis image marking data according to the hospital historical reception data, divide the tongue diagnosis image marking data into tongue diagnosis training set and tongue diagnosis test set according to the tongue diagnosis training test ratio, train and test the image recognition model with the tongue diagnosis training set and the tongue diagnosis test set to obtain a tongue diagnosis inquiry model, obtain several historical medical records according to the hospital historical reception data, divide the several historical medical records into a question and answer text test set and a question and answer text training set, use the question and answer text test set and the question and answer text training set to train and test the language interaction model to obtain a text inquiry model.

[0007] In order to achieve the above-mentioned purpose, the present invention adopts the following technical solution: a method for constructing a large language model for an intelligent TCM system, comprising the following specific steps:

[0008] Step S1: obtaining the hospital's historical tongue diagnosis reception data, obtaining a plurality of patients' historical tongue diagnosis images according to the hospital's historical tongue diagnosis reception data, respectively obtaining the tongue color deviation value, the left and right area difference of the tongue, and the tongue coating area ratio corresponding to each tongue diagnosis image to calculate the tongue diagnosis evaluation coefficient, obtaining the tongue diagnosis evaluation coefficient threshold and performing numerical comparison with the tongue diagnosis evaluation coefficient, marking the patient's historical tongue diagnosis image as a first type of tongue diagnosis image and a second type of tongue diagnosis image according to the numerical comparison result, obtaining tongue diagnosis image marking data, obtaining a plurality of historical medical records according to the hospital's historical reception data, obtaining historical medical record data, and defining the historical medical record data and the tongue diagnosis image marking data as the hospital's historical reception data;

[0009] Step S2: Obtain tongue diagnosis image labeling data based on the hospital's historical admission data, divide the tongue diagnosis image labeling data into a tongue diagnosis training set and a tongue diagnosis test set according to the tongue diagnosis training test ratio, train and test the image recognition model using the tongue diagnosis training set and the tongue diagnosis test set, and obtain a tongue diagnosis inquiry model;

[0010] Step S3: Obtain several historical medical records based on the hospital's historical admission data, divide the several historical medical records into a question-and-answer text test set and a question-and-answer text training set, use the question-and-answer text test set and the question-and-answer text training set to train and test the language interaction model, and obtain a text consultation model.

[0011] Furthermore, the step S1 includes the following specific steps:

[0012] Step S11: Acquire the hospital's historical consultation data, and acquire a number of patients' historical tongue diagnosis images based on the hospital's historical tongue diagnosis data;

[0013] Step S12: randomly selecting one of several historical tongue diagnosis images of the patient as a feature sample tongue diagnosis image;

[0014] Step S13: obtaining the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image;

[0015] Step S14: acquiring tongue diagnosis evaluation coefficients for each patient's historical tongue diagnosis image, and obtaining a plurality of tongue diagnosis evaluation coefficients;

[0016] Step S15: obtaining a tongue diagnosis evaluation coefficient threshold, numerically comparing a plurality of tongue diagnosis evaluation coefficients with the tongue diagnosis evaluation coefficient threshold, and dividing the patient's historical tongue diagnosis images into a first type of tongue diagnosis image and a second type of tongue diagnosis image according to the numerical comparison result;

[0017] Step S16: Acquire several historical medical records according to the hospital's historical medical admission data to obtain historical medical record data;

[0018] Step S17: define the historical medical record data and tongue diagnosis image marking data as the hospital's historical consultation data.

[0019] Step S131: obtaining the left and right area difference of the tongue corresponding to the characteristic tongue diagnosis image;

[0020] Step S132: obtaining the tongue color deviation value corresponding to the characteristic tongue diagnosis image;

[0021] Step S133: obtaining the tongue coating area ratio corresponding to the characteristic tongue diagnosis image;

[0022] Step S134: respectively obtaining the tongue coating reference area ratio, the tongue body color reference deviation, and the tongue body left and right reference area difference;

[0023] Step S135: Calculate the tongue color deviation value, the left and right area difference of the tongue, the tongue coating area ratio, the tongue coating reference area ratio, the tongue color reference deviation and the left and right reference area difference of the tongue to obtain the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image;

[0024] The tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image is calculated. The specific formula is as follows:

[0025] ;

[0026] Among them, Spx is the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image, Scp is the tongue color deviation value, Scj is the tongue color reference deviation, Mjc is the left and right area difference of the tongue, Mjj is the left and right reference area difference of the tongue, Stb is the tongue coating area ratio, and Stj is the tongue coating reference area ratio.

[0027] Furthermore, the step S131 further includes the following specific steps:

[0028] Step S1311: acquiring the first monitored tongue area and the second monitored tongue area;

[0029] Step S1312: in the characteristic tongue diagnosis image, a tongue area pixel block of a unit area is set, and the first monitoring tongue area is filled with pixels using the tongue area pixel block, and the number of the tongue area pixel blocks filled in the first monitoring tongue area is counted to obtain the number value of the first filled pixel blocks, and the number of the tongue area pixel blocks filled in the second monitoring tongue area is counted to obtain the number value of the second filled pixel blocks;

[0030] Step S1313: Calculate the difference between the number of the first filling pixel blocks and the number of the second filling pixel blocks, and take the absolute value of the difference to obtain the left and right area difference of the tongue.

[0031] Furthermore, the step S1311 further includes the following specific steps:

[0032] Step S13111: Mark a tongue positioning point on each side edge of the tongue in the characteristic tongue diagnosis image, name the positioning point on the left side of the tongue as the first tongue positioning point, name the positioning point on the right side of the tongue as the second tongue positioning point, and keep the first tongue positioning point and the second tongue positioning point parallel, connect the first tongue positioning point and the second tongue positioning point to obtain a first tongue positioning straight line;

[0033] Step S13112: Mark the midpoint of the tongue positioning line to obtain a third tongue positioning point, mark the tongue tip in the characteristic tongue diagnosis image as a fourth tongue positioning point, and connect the third tongue positioning point and the fourth tongue positioning point to obtain a second tongue positioning line;

[0034] Step S13113: Divide the tongue in the characteristic tongue diagnosis image into a left tongue image and a right tongue image through the second tongue positioning straight line, and mark the left tongue image as the first monitoring tongue area and the right tongue image as the second monitoring tongue area in the characteristic tongue diagnosis image.

[0035] Further, step S1321: dividing the tongue area in the characteristic tongue diagnosis image into a plurality of tongue sub-areas of the same area, and randomly selecting a tongue sub-area from the plurality of tongue sub-areas as a characteristic tongue sub-area;

[0036] Step S1322: randomly selecting a number of characteristic pixel points in the characteristic tongue body sub-region, respectively obtaining the color RGB value corresponding to each characteristic pixel point, obtaining a plurality of color RGB values, and averaging the obtained plurality of color RGB values ​​to obtain the color RGB average value corresponding to the characteristic tongue body sub-region;

[0037] Step S1323: Obtain the color RGB average value corresponding to each tongue sub-region respectively to obtain multiple color RGB average values, compare the numerical values ​​of the multiple color RGB average values ​​obtained, name the color RGB average value with the largest value as the peak color RGB value, name the color RGB average value with the smallest value as the valley color RGB value, calculate the difference between the peak color RGB value and the valley color RGB value, take the absolute value of the obtained difference, and obtain the tongue color deviation value.

[0038] Furthermore, the step S133 further includes the following specific steps:

[0039] Step S1331: marking the tongue body region in the characteristic tongue diagnosis image as a first part characteristic region, and marking the tongue coating region in the characteristic tongue diagnosis image as a second part characteristic region;

[0040] Step S1332: acquiring the area of ​​the first part characteristic region to obtain a first characteristic area value;

[0041] Step S1333: acquiring the area of ​​the second part characteristic region to obtain a second characteristic area value;

[0042] Step S1334: Calculate the ratio of the second characteristic area value to the first characteristic area value to obtain the tongue coating area ratio.

[0043] Furthermore, the step S15 further includes the following specific steps:

[0044] Step S151: when the tongue diagnosis evaluation coefficient is less than the tongue diagnosis evaluation coefficient threshold, the corresponding patient's historical tongue diagnosis image is classified as a first type of tongue diagnosis image;

[0045] Step S152: when the tongue diagnosis evaluation coefficient is greater than or equal to the tongue diagnosis evaluation coefficient threshold, the corresponding patient's historical tongue diagnosis image is classified as a second type of tongue diagnosis image.

[0046] Furthermore, the step S2 further includes the following specific steps:

[0047] Step S21: Acquire the hospital's historical consultation data, and acquire tongue diagnosis image marking data according to the hospital's historical consultation data;

[0048] Step S22: dividing the tongue diagnosis image labeled data into a tongue diagnosis training set and a tongue diagnosis test set according to the tongue diagnosis training test ratio;

[0049] Step S23: creating an image recognition model through an existing artificial intelligence platform, and training the image recognition model using a tongue diagnosis training set;

[0050] Step S24: After the training is completed, the image recognition model is tested using the tongue diagnosis test set, and the test pass rate is obtained;

[0051] Step S25: Obtain the calibration test pass rate. When the test pass rate is greater than or equal to the calibration test pass rate, the image recognition model training is completed and the tongue diagnosis and consultation model is obtained. When the test pass rate is less than the calibration test pass rate, continue to use the tongue diagnosis training set to train the image recognition model until the test pass rate is greater than or equal to the calibration test pass rate.

[0052] Furthermore, the step S3 further includes the following specific steps:

[0053] Step S31: Obtain the hospital's historical medical records, and obtain a number of historical medical records based on the hospital's historical medical records;

[0054] Step S32: using a text recognition algorithm to mark the clinical symptoms of patients in the historical medical records as question texts, mark the clinical diagnoses made by doctors in the historical medical records as question-answer texts, and mark the question texts and question-answer texts in the same historical medical record as a set of question-answer pairs, thereby obtaining multiple sets of question-answer pairs;

[0055] Step S33: dividing the multiple groups of question-answer pairs into a question-answer text test set and a question-answer text training set according to a preset text test-training ratio;

[0056] Step S34: establishing a language interaction model through an existing artificial intelligence platform, and training the language interaction model using the question-answer text training set until each question-answer pair in the question-answer text training set has completed one training;

[0057] Step S35: performing a question-and-answer test on the language interaction model using a question-and-answer text test set, and obtaining the question-and-answer accuracy rate to obtain the test question-and-answer accuracy rate;

[0058] Step S36: Obtain the preset question and answer accuracy rate, and compare the test question and answer accuracy rate with the preset question and answer accuracy rate;

[0059] The step S36 further includes the following specific steps:

[0060] Step S361: When the test question and answer accuracy is greater than or equal to the preset question and answer accuracy, the language interaction model training is completed and a text question diagnosis model is obtained;

[0061] Step S362: When the test question and answer accuracy rate is less than the preset question and answer accuracy rate, continue to train the language interaction model using the question and answer text training set until the test question and answer accuracy rate is greater than or equal to the preset question and answer accuracy rate.

[0062] In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are:

[0063] 1. The present invention obtains the hospital's historical tongue diagnosis reception data, obtains multiple patients' historical tongue diagnosis images according to the hospital's historical tongue diagnosis reception data, and divides the patients' historical tongue diagnosis images according to the left and right tongue area difference, tongue color deviation value, and tongue color deviation value. According to the division results, the image recognition model is trained and tested to obtain a tongue diagnosis inquiry model. The tongue diagnosis inquiry model can directly recognize the patient's tongue image in language interaction, further improving the efficiency and accuracy of tongue diagnosis;

[0064] 2. The present invention constructs a text language inquiry model by acquiring historical medical record data as test training samples, so that the text language inquiry model can directly provide targeted treatment suggestions based on the patient's symptoms, thereby ensuring the interaction efficiency between the patient and the language model. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to facilitate understanding by those skilled in the art, the present invention is further described below with reference to the accompanying drawings.

[0066] Figure 1 It is a diagram of the implementation steps of the present invention;

[0067] Figure 2 This is a schematic diagram of the tongue positioning points in the present invention;

[0068] Figure 3 Schematic diagram of the tongue sub-region in the present invention. DETAILED DESCRIPTION

[0069] The technical solution of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0070] Embodiment 1

[0071] See also Figure 1 The present invention provides a technical solution: a method for constructing a large language model for an intelligent traditional Chinese medicine system, comprising the following specific steps:

[0072] Step S1: obtaining the hospital's historical tongue diagnosis reception data, obtaining a plurality of patients' historical tongue diagnosis images according to the hospital's historical tongue diagnosis reception data, respectively obtaining the tongue color deviation value, the left and right area difference of the tongue, and the tongue coating area ratio corresponding to each tongue diagnosis image to calculate the tongue diagnosis evaluation coefficient, obtaining the tongue diagnosis evaluation coefficient threshold and performing numerical comparison with the tongue diagnosis evaluation coefficient, marking the patient's historical tongue diagnosis image as a first type of tongue diagnosis image and a second type of tongue diagnosis image according to the numerical comparison result, obtaining tongue diagnosis image marking data, obtaining a plurality of historical medical records according to the hospital's historical reception data, obtaining historical medical record data, and defining the historical medical record data and the tongue diagnosis image marking data as the hospital's historical reception data;

[0073] Step S11: Acquire the hospital's historical consultation data, and acquire a number of patients' historical tongue diagnosis images based on the hospital's historical tongue diagnosis data;

[0074] Step S12: randomly selecting one of several historical tongue diagnosis images of the patient as a feature sample tongue diagnosis image;

[0075] Step S13: obtaining the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image;

[0076] The step S13 further includes the following specific steps:

[0077] Step S131: obtaining the left and right area difference of the tongue corresponding to the characteristic tongue diagnosis image;

[0078] The step S131 further includes the following specific steps:

[0079] Step S1311: acquiring the first monitored tongue area and the second monitored tongue area;

[0080] The step S1311 further includes the following specific steps:

[0081] Step S13111: Please refer to Figure 2 , mark a tongue positioning point on each side edge of the tongue in the characteristic tongue diagnosis image, name the positioning point on the left side of the tongue as the first tongue positioning point, name the positioning point on the right side of the tongue as the second tongue positioning point, and keep the first tongue positioning point and the second tongue positioning point parallel, connect the first tongue positioning point and the second tongue positioning point to obtain a first tongue positioning straight line;

[0082] Step S13112: Mark the midpoint of the tongue positioning line to obtain a third tongue positioning point, mark the tongue tip in the characteristic tongue diagnosis image as a fourth tongue positioning point, and connect the third tongue positioning point and the fourth tongue positioning point to obtain a second tongue positioning line;

[0083] Step S13113: dividing the tongue in the characteristic tongue diagnosis image into a left tongue image and a right tongue image by the second tongue positioning straight line, and marking the left tongue image as a first monitoring tongue area and the right tongue image as a second monitoring tongue area in the characteristic tongue diagnosis image;

[0084] Step S1312: in the characteristic tongue diagnosis image, a tongue area pixel block of a unit area is set, and the first monitoring tongue area is filled with pixels using the tongue area pixel block, and the number of the tongue area pixel blocks filled in the first monitoring tongue area is counted to obtain the number value of the first filled pixel blocks, and the number of the tongue area pixel blocks filled in the second monitoring tongue area is counted to obtain the number value of the second filled pixel blocks;

[0085] Step S1313: Calculate the difference between the number of the first filling pixel blocks and the number of the second filling pixel blocks, and take the absolute value of the obtained difference to obtain the left and right area difference of the tongue;

[0086] Step S132: obtaining the tongue color deviation value corresponding to the characteristic tongue diagnosis image;

[0087] The step S132 further includes the following specific steps:

[0088] Step S1321: Please refer to Figure 3, dividing the tongue area in the characteristic tongue diagnosis image into a number of tongue sub-areas of the same area, and randomly selecting a tongue sub-area from the several tongue sub-areas as a characteristic tongue sub-area;

[0089] Step S1322: randomly selecting a number of characteristic pixel points in the characteristic tongue body sub-region, respectively obtaining the color RGB value corresponding to each characteristic pixel point, obtaining a plurality of color RGB values, and averaging the obtained plurality of color RGB values ​​to obtain the color RGB average value corresponding to the characteristic tongue body sub-region;

[0090] Step S1323: Obtain the color RGB average value corresponding to each tongue body sub-region respectively to obtain multiple color RGB average values, compare the values ​​of the obtained multiple color RGB average values, name the color RGB average value with the largest value as the peak color RGB value, name the color RGB average value with the smallest value as the valley color RGB value, calculate the difference between the peak color RGB value and the valley color RGB value, and take the absolute value of the obtained difference to obtain the tongue body color deviation value;

[0091] Step S133: obtaining the tongue coating area ratio corresponding to the characteristic tongue diagnosis image;

[0092] The step S133 further includes the following specific steps:

[0093] Step S1331: marking the tongue body region in the characteristic tongue diagnosis image as a first part characteristic region, and marking the tongue coating region in the characteristic tongue diagnosis image as a second part characteristic region;

[0094] Step S1332: acquiring the area of ​​the first part characteristic region to obtain a first characteristic area value;

[0095] Step S1333: acquiring the area of ​​the second part characteristic region to obtain a second characteristic area value;

[0096] Step S1334: calculating the ratio of the second characteristic area value to the first characteristic area value to obtain the tongue coating area ratio;

[0097] Step S134: respectively obtaining the tongue coating reference area ratio, the tongue body color reference deviation, and the tongue body left and right reference area difference;

[0098] Step S135: Calculate the tongue color deviation value, the left and right area difference of the tongue, the tongue coating area ratio, the tongue coating reference area ratio, the tongue color reference deviation and the left and right reference area difference of the tongue to obtain the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image;

[0099] The tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image is calculated. The specific formula is as follows:

[0100] ;

[0101] Among them, Spx is the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image, Scp is the tongue color deviation value, Scj is the tongue color reference deviation, Mjc is the left and right area difference of the tongue, Mjj is the left and right reference area difference of the tongue, Stb is the tongue coating area ratio, and Stj is the tongue coating reference area ratio;

[0102] Step S14: acquiring tongue diagnosis evaluation coefficients for each patient's historical tongue diagnosis image, and obtaining a plurality of tongue diagnosis evaluation coefficients;

[0103] Step S15: obtaining a tongue diagnosis evaluation coefficient threshold, and comparing the multiple tongue diagnosis evaluation coefficients with the tongue diagnosis evaluation coefficient threshold respectively;

[0104] The step S15 further includes the following specific steps:

[0105] Step S151: when the tongue diagnosis evaluation coefficient is less than the tongue diagnosis evaluation coefficient threshold, the corresponding patient's historical tongue diagnosis image is classified as a first type of tongue diagnosis image;

[0106] Step S152: when the tongue diagnosis evaluation coefficient is greater than or equal to the tongue diagnosis evaluation coefficient threshold, the corresponding patient's historical tongue diagnosis image is classified as a second type of tongue diagnosis image;

[0107] Step S16: Acquire several historical medical records according to the hospital's historical medical admission data to obtain historical medical record data;

[0108] Step S17: defining the historical medical record data and tongue diagnosis image marking data as the hospital's historical consultation data;

[0109] Step S2: Create a tongue diagnosis model based on the hospital's historical consultation data;

[0110] Step S21: Acquire the hospital's historical consultation data, and acquire tongue diagnosis image marking data according to the hospital's historical consultation data;

[0111] Step S22: dividing the tongue diagnosis image labeled data into a tongue diagnosis training set and a tongue diagnosis test set according to the tongue diagnosis training test ratio;

[0112] Step S23: creating an image recognition model through an existing artificial intelligence platform, and training the image recognition model using a tongue diagnosis training set;

[0113] Step S24: After the training is completed, the image recognition model is tested using the tongue diagnosis test set, and the test pass rate is obtained;

[0114] Step S25: obtaining the calibration test pass rate. When the test pass rate is greater than or equal to the calibration test pass rate, the image recognition model training is completed and the tongue diagnosis and inquiry model is obtained. When the test pass rate is less than the calibration test pass rate, the image recognition model is continuously trained using the tongue diagnosis training set until the test pass rate is greater than or equal to the calibration test pass rate.

[0115] Step S3: Create a text consultation model based on the hospital's historical consultation data;

[0116] Step S31: Obtain the hospital's historical medical records, and obtain a number of historical medical records based on the hospital's historical medical records;

[0117] Step S32: using a text recognition algorithm to mark the clinical symptoms of patients in the historical medical records as question texts, mark the clinical diagnoses made by doctors in the historical medical records as question-answer texts, and mark the question texts and question-answer texts in the same historical medical record as a set of question-answer pairs, thereby obtaining multiple sets of question-answer pairs;

[0118] Step S33: dividing the multiple groups of question-answer pairs into a question-answer text test set and a question-answer text training set according to a preset text test-training ratio;

[0119] Step S34: establishing a language interaction model through an existing artificial intelligence platform, and training the language interaction model using the question-answer text training set until each question-answer pair in the question-answer text training set has completed one training;

[0120] Step S35: performing a question-and-answer test on the language interaction model using a question-and-answer text test set, and obtaining the question-and-answer accuracy rate to obtain the test question-and-answer accuracy rate;

[0121] Step S36: Obtain the preset question and answer accuracy rate, and compare the test question and answer accuracy rate with the preset question and answer accuracy rate;

[0122] The step S36 further includes the following specific steps:

[0123] Step S361: When the test question and answer accuracy is greater than or equal to the preset question and answer accuracy, the language interaction model training is completed and a text question diagnosis model is obtained;

[0124] Step S362: When the test question and answer accuracy is less than the preset question and answer accuracy, continue to train the language interaction model using the question and answer text training set until the test question and answer accuracy is greater than or equal to the preset question and answer accuracy;

[0125] In this application, if corresponding calculation formulas appear, the above calculation formulas are all dimensionless and take their numerical calculations. The weight coefficients, proportional coefficients and other coefficients in the formulas are set to a result value obtained by quantifying each parameter. The size of the weight coefficient and the proportional coefficient can be determined as long as it does not affect the proportional relationship between the parameter and the result value.

[0126] Embodiment 2

[0127] Based on another concept of the same invention, a system for constructing a large language model for an intelligent TCM system is proposed, which is applied to a method for constructing a large language model for an intelligent TCM system. The system comprises a data acquisition module, a tongue diagnosis model module, a dialogue model module and a server. The data acquisition module, the tongue diagnosis model module and the dialogue model module are respectively connected to the server, and the server controls the data acquisition module, the tongue diagnosis model module and the dialogue model module respectively.

[0128] The data acquisition module acquires the hospital's historical tongue diagnosis reception data, acquires multiple patients' historical tongue diagnosis images according to the hospital's historical tongue diagnosis reception data, respectively acquires the tongue color deviation value, the left and right area difference of the tongue, and the tongue coating area ratio corresponding to each tongue diagnosis image to calculate the tongue diagnosis evaluation coefficient, acquires the tongue diagnosis evaluation coefficient threshold and performs numerical comparison with the tongue diagnosis evaluation coefficient, marks the patient's historical tongue diagnosis image as a first type of tongue diagnosis image and a second type of tongue diagnosis image according to the numerical comparison result, and obtains tongue diagnosis image marking data, acquires several historical medical records according to the hospital's historical reception data, obtains historical medical record data, and defines the historical medical record data and the tongue diagnosis image marking data as the hospital's historical reception data;

[0129] Obtain the hospital's historical admission data, obtain several patients' historical tongue diagnosis images based on the hospital's historical tongue diagnosis data, and randomly select one of the several patients' historical tongue diagnosis images as a feature sample tongue diagnosis image;

[0130] Marking the characteristic tongue diagnosis image as a first type of tongue diagnosis image and a second type of tongue diagnosis image to obtain tongue diagnosis image marking data;

[0131] It should be noted here that:

[0132] In the present application, the first type of tongue diagnosis image referred to herein is the tongue diagnosis image corresponding to a normal patient, and the second type of tongue diagnosis image is the tongue diagnosis image corresponding to an abnormal patient;

[0133] The details are as follows:

[0134] Obtain the left and right area difference of the tongue corresponding to the characteristic tongue diagnosis image;

[0135] A tongue positioning point is marked on each side edge of the tongue in the characteristic tongue diagnosis image, the positioning point on the left side of the tongue is named the first tongue positioning point, and the positioning point on the right side of the tongue is named the second tongue positioning point, and the first tongue positioning point and the second tongue positioning point are kept parallel, and the first tongue positioning point and the second tongue positioning point are connected to obtain a first tongue positioning straight line;

[0136] Mark the midpoint of the tongue positioning straight line to obtain a third tongue positioning point, mark the tongue tip in the characteristic tongue diagnosis image as a fourth tongue positioning point, and connect the third tongue positioning point and the fourth tongue positioning point to obtain a second tongue positioning straight line;

[0137] Dividing the tongue in the characteristic tongue diagnosis image into a left tongue image and a right tongue image by a second tongue positioning straight line, and marking the left tongue image as a first monitoring tongue area and the right tongue image as a second monitoring tongue area in the characteristic tongue diagnosis image;

[0138] In the characteristic tongue diagnosis image, a tongue area pixel block of a unit area is set, and the tongue area pixel block is used to fill the first monitoring tongue area with pixels, and the number of the tongue area pixel blocks filled in the first monitoring tongue area is counted to obtain the number value of the first filled pixel blocks, and the number of the tongue area pixel blocks filled in the second monitoring tongue area is counted to obtain the number value of the second filled pixel blocks;

[0139] It should be noted here that:

[0140] The unit area involved here is specifically 0.01mm 2 ;

[0141] Calculate the difference between the number of the first filling pixel block and the number of the second filling pixel block, and take the absolute value of the obtained difference to obtain the difference in area between the left and right sides of the tongue;

[0142] The tongue area in the characteristic tongue diagnosis image is divided into a number of tongue sub-areas of the same area, and a tongue sub-area is randomly selected from the several tongue sub-areas as a characteristic tongue sub-area;

[0143] A number of characteristic pixel points are randomly selected in the characteristic tongue body sub-region, and the color RGB value corresponding to each characteristic pixel point is obtained respectively to obtain a plurality of color RGB values, and the obtained plurality of color RGB values ​​are averaged to obtain the color RGB average value corresponding to the characteristic tongue body sub-region;

[0144] Repeat the process of obtaining the color RGB average value corresponding to the characteristic tongue body sub-region, obtain the color RGB average value corresponding to each tongue body sub-region respectively, obtain multiple color RGB average values, compare the numerical values ​​of the obtained multiple color RGB average values, name the color RGB average value with the largest value as the peak color RGB value, name the color RGB average value with the smallest value as the valley color RGB value, calculate the difference between the peak color RGB value and the valley color RGB value, and take the absolute value of the obtained difference to obtain the tongue body color deviation value;

[0145] Marking the tongue body region in the characteristic tongue diagnosis image as the first part characteristic region, marking the tongue coating region in the characteristic tongue diagnosis image as the second part characteristic region, acquiring the area of ​​the first part characteristic region to obtain a first characteristic area value, acquiring the area of ​​the second part characteristic region to obtain a second characteristic area value, calculating the ratio of the second characteristic area value to the first characteristic area value to obtain a tongue coating area ratio;

[0146] Obtain the tongue coating reference area ratio, tongue body color reference deviation, and tongue body left and right reference area difference respectively;

[0147] It should be noted here that:

[0148] The tongue coating reference area ratio, tongue body color reference deviation, and tongue body left and right reference area difference involved here are the tongue body color deviation value, tongue body left and right area difference, and tongue coating area ratio corresponding to patients with normal tongue diagnosis;

[0149] The tongue color deviation value, the left and right area difference of the tongue, the tongue coating area ratio, the tongue coating reference area ratio, the tongue color reference deviation and the left and right reference area difference of the tongue are calculated to obtain the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image;

[0150] The tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image is calculated. The specific formula is as follows:

[0151] ;

[0152] Among them, Spx is the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image, Scp is the tongue color deviation value, Scj is the tongue color reference deviation, Mjc is the left and right area difference of the tongue, Mjj is the left and right reference area difference of the tongue, Stb is the tongue coating area ratio, and Stj is the tongue coating reference area ratio;

[0153] Obtaining tongue diagnosis evaluation coefficients for each patient's historical tongue diagnosis image, and obtaining multiple tongue diagnosis evaluation coefficients;

[0154] Obtaining a tongue diagnosis evaluation coefficient threshold, and numerically comparing multiple tongue diagnosis evaluation coefficients with the tongue diagnosis evaluation coefficient threshold respectively;

[0155] When the tongue diagnosis evaluation coefficient is less than the tongue diagnosis evaluation coefficient threshold, the corresponding patient's historical tongue diagnosis image is classified as a first type of tongue diagnosis image;

[0156] When the tongue diagnosis evaluation coefficient is greater than or equal to the tongue diagnosis evaluation coefficient threshold, the corresponding patient's historical tongue diagnosis image is classified as a second type of tongue diagnosis image;

[0157] Acquire several historical medical records according to the hospital's historical admission data to obtain historical medical record data;

[0158] The historical medical record data and tongue diagnosis image marking data are defined as the hospital's historical admission data;

[0159] The data acquisition module acquires the hospital's historical patient data and transmits it to the tongue diagnosis model module and the dialogue model module;

[0160] The tongue diagnosis model module creates a tongue diagnosis model based on the hospital's historical admission data;

[0161] Obtain the hospital's historical consultation data, and obtain tongue diagnosis image marking data based on the hospital's historical consultation data;

[0162] The tongue diagnosis image labeled data is divided into a tongue diagnosis training set and a tongue diagnosis test set according to the tongue diagnosis training test ratio;

[0163] It should be noted here that:

[0164] In the present application, the tongue diagnosis training test ratio involved here is specifically 7:3, that is, the ratio of the number of images in the tongue diagnosis training set and the tongue diagnosis test set is 7:3;

[0165] Create an image recognition model through the existing artificial intelligence platform and train the image recognition model using the tongue diagnosis training set;

[0166] After the training is completed, the image recognition model is tested using the tongue diagnosis test set, and the test pass rate is obtained;

[0167] It should be noted here that:

[0168] The training completion mentioned here specifically means that each image in the tongue diagnosis training set has completed at least one training;

[0169] Obtain the calibration test pass rate. When the test pass rate is greater than or equal to the calibration test pass rate, the image recognition model training is completed and the tongue diagnosis and inquiry model is obtained. When the test pass rate is less than the calibration test pass rate, continue to use the tongue diagnosis training set to train the image recognition model until the test pass rate is greater than or equal to the calibration test pass rate.

[0170] The dialogue model module creates a text consultation model based on the hospital's historical consultation data;

[0171] Obtain the hospital's historical admission data, and obtain several historical medical records based on the hospital's historical admission data;

[0172] Using a text recognition algorithm, the clinical symptoms of patients in historical medical records are marked as question texts, the clinical diagnoses made by doctors in historical medical records are marked as question-answer texts, and the question texts and question-answer texts in the same historical medical record are marked as a set of question-answer pairs, thereby obtaining multiple sets of question-answer pairs;

[0173] Dividing multiple groups of question-answer pairs into a question-answer text test set and a question-answer text training set according to a preset text test-training ratio;

[0174] It should be noted here that:

[0175] In this application, the preset text test-training ratio is specifically 3:7, that is, the number of question-answer pairs in the question-answer text test set and the question-answer text training set is 3:7;

[0176] Establish a language interaction model through the existing artificial intelligence platform, and use the question-answer text training set to train the language interaction model until each question-answer pair in the question-answer text training set has completed one training;

[0177] The language interaction model is tested on the question-and-answer text test set, and the question-and-answer accuracy rate is obtained to obtain the test question-and-answer accuracy rate;

[0178] Obtain the preset question-answering accuracy rate, and compare the test question-answering accuracy rate with the preset question-answering accuracy rate;

[0179] It should be noted here that:

[0180] In this application, the default question-answer accuracy is specifically set to 95%;

[0181] When the test question-answering accuracy is greater than or equal to the preset question-answering accuracy, the language interaction model training is completed and a text question diagnosis model is obtained;

[0182] When the test question-answering accuracy rate is lower than the preset question-answering accuracy rate, the language interaction model is trained using the question-answering text training set until the test question-answering accuracy rate is greater than or equal to the preset question-answering accuracy rate.

[0183] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only specific implementation methods. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.

Claims

1. A method for constructing a large language model for an intelligent traditional Chinese medicine system, characterized in that: include: Step S1: obtaining the hospital's historical tongue diagnosis reception data, obtaining a plurality of patients' historical tongue diagnosis images according to the hospital's historical tongue diagnosis reception data, respectively obtaining the tongue color deviation value, the left and right area difference of the tongue, and the tongue coating area ratio corresponding to each tongue diagnosis image to calculate the tongue diagnosis evaluation coefficient, obtaining the tongue diagnosis evaluation coefficient threshold and performing numerical comparison with the tongue diagnosis evaluation coefficient, marking the patient's historical tongue diagnosis image as a first type of tongue diagnosis image and a second type of tongue diagnosis image according to the numerical comparison result, obtaining tongue diagnosis image marking data, obtaining a plurality of historical medical records according to the hospital's historical reception data, obtaining historical medical record data, and defining the historical medical record data and the tongue diagnosis image marking data as the hospital's historical reception data; Step S2: Obtain tongue diagnosis image labeling data based on the hospital's historical admission data, divide the tongue diagnosis image labeling data into a tongue diagnosis training set and a tongue diagnosis test set according to the tongue diagnosis training test ratio, train and test the image recognition model using the tongue diagnosis training set and the tongue diagnosis test set, and obtain a tongue diagnosis inquiry model; Step S3: obtaining a number of historical medical records based on the hospital's historical medical data, dividing the number of historical medical records into a question-and-answer text test set and a question-and-answer text training set, using the question-and-answer text test set and the question-and-answer text training set to train and test the language interaction model, and obtaining a text consultation model; The step S1 includes the following specific steps: Step S11: Acquire the hospital's historical consultation data, and acquire a number of patients' historical tongue diagnosis images based on the hospital's historical tongue diagnosis data; Step S12: randomly selecting one of several historical tongue diagnosis images of the patient as a feature sample tongue diagnosis image; Step S13: obtaining the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image; Step S14: acquiring tongue diagnosis evaluation coefficients for each patient's historical tongue diagnosis image, and obtaining a plurality of tongue diagnosis evaluation coefficients; Step S15: obtaining a tongue diagnosis evaluation coefficient threshold, numerically comparing a plurality of tongue diagnosis evaluation coefficients with the tongue diagnosis evaluation coefficient threshold, and dividing the patient's historical tongue diagnosis images into a first type of tongue diagnosis image and a second type of tongue diagnosis image according to the numerical comparison result; Step S16: Acquire several historical medical records according to the hospital's historical medical admission data to obtain historical medical record data; Step S17: defining the historical medical record data and tongue diagnosis image marking data as the hospital's historical consultation data; The step S13 further includes the following specific steps: Step S131: obtaining the left and right area difference of the tongue corresponding to the characteristic sample tongue diagnosis image; Step S132: obtaining the tongue color deviation value corresponding to the characteristic sample tongue diagnosis image; Step S133: obtaining the tongue coating area ratio corresponding to the characteristic sample tongue diagnosis image; Step S134: respectively obtaining the tongue coating reference area ratio, the tongue body color reference deviation, and the tongue body left and right reference area difference; Step S135: Calculate the tongue color deviation value, the left and right area difference of the tongue, the tongue coating area ratio, the tongue coating reference area ratio, the tongue color reference deviation and the left and right reference area difference of the tongue to obtain the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image; The tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image is calculated. The specific formula is as follows: ; Among them, Spx is the tongue diagnosis evaluation coefficient corresponding to the characteristic sample tongue diagnosis image, Scp is the tongue color deviation value, Scj is the tongue color reference deviation, Mjc is the left and right area difference of the tongue, Mjj is the left and right reference area difference of the tongue, Stb is the tongue coating area ratio, and Stj is the tongue coating reference area ratio.

2. The method for constructing a large language model for an intelligent TCM system according to claim 1, characterized in that: The step S131 further includes the following specific steps: Step S1311: acquiring the first monitored tongue area and the second monitored tongue area; Step S1312: in the characteristic sample tongue diagnosis image, a tongue area pixel block of a unit area is set, and the first monitoring tongue area is filled with pixels using the tongue area pixel block, and the number of the tongue area pixel blocks filled in the first monitoring tongue area is counted to obtain the number value of the first filled pixel blocks, and the number of the tongue area pixel blocks filled in the second monitoring tongue area is counted to obtain the number value of the second filled pixel blocks; Step S1313: Calculate the difference between the number of the first filling pixel blocks and the number of the second filling pixel blocks, and take the absolute value of the difference to obtain the left and right area difference of the tongue.

3. The method for constructing a large language model for an intelligent TCM system according to claim 2, characterized in that: The step S1311 further includes the following specific steps: Step S13111: mark a tongue positioning point on each side edge of the tongue in the characteristic sample tongue diagnosis image, name the positioning point on the left side of the tongue as the first tongue positioning point, name the positioning point on the right side of the tongue as the second tongue positioning point, and keep the first tongue positioning point and the second tongue positioning point parallel, connect the first tongue positioning point and the second tongue positioning point to obtain a first tongue positioning straight line; Step S13112: Mark the midpoint of the first tongue positioning line to obtain a third tongue positioning point, mark the tip of the tongue in the characteristic sample tongue diagnosis image as a fourth tongue positioning point, and connect the third tongue positioning point and the fourth tongue positioning point to obtain a second tongue positioning line; Step S13113: Divide the tongue in the characteristic sample tongue diagnosis image into a left tongue image and a right tongue image through the second tongue positioning straight line, and mark the left tongue image as the first monitoring tongue area and the right tongue image as the second monitoring tongue area in the characteristic sample tongue diagnosis image.

4. The method for constructing a large language model for an intelligent TCM system according to claim 1, characterized in that: The step S132 further includes the following specific steps: Step S1321: dividing the tongue area in the characteristic sample tongue diagnosis image into a plurality of tongue sub-areas of the same area, and randomly selecting one tongue sub-area from the plurality of tongue sub-areas as a characteristic tongue sub-area; Step S1322: randomly selecting a number of characteristic pixel points in the characteristic tongue body sub-region, respectively obtaining the color RGB value corresponding to each characteristic pixel point, obtaining a plurality of color RGB values, and averaging the obtained plurality of color RGB values ​​to obtain the color RGB average value corresponding to the characteristic tongue body sub-region; Step S1323: Obtain the color RGB average value corresponding to each tongue sub-region respectively to obtain multiple color RGB average values, compare the numerical values ​​of the multiple color RGB average values ​​obtained, name the color RGB average value with the largest value as the peak color RGB value, name the color RGB average value with the smallest value as the valley color RGB value, calculate the difference between the peak color RGB value and the valley color RGB value, take the absolute value of the obtained difference, and obtain the tongue color deviation value.

5. The method for constructing a large language model for an intelligent TCM system according to claim 1, characterized in that: The step S133 further includes the following specific steps: Step S1331: marking the tongue body region in the characteristic sample tongue diagnosis image as the first part characteristic region, and marking the tongue coating region in the characteristic sample tongue diagnosis image as the second part characteristic region; Step S1332: acquiring the area of ​​the first part characteristic region to obtain a first characteristic area value; Step S1333: acquiring the area of ​​the second part characteristic region to obtain a second characteristic area value; Step S1334: Calculate the ratio of the second characteristic area value to the first characteristic area value to obtain the tongue coating area ratio.

6. The method for constructing a large language model for an intelligent TCM system according to claim 1, characterized in that: The step S15 further includes the following specific steps: Step S151: when the tongue diagnosis evaluation coefficient is less than the tongue diagnosis evaluation coefficient threshold, the corresponding patient's historical tongue diagnosis image is classified as a first type of tongue diagnosis image; Step S152: when the tongue diagnosis evaluation coefficient is greater than or equal to the tongue diagnosis evaluation coefficient threshold, the corresponding patient's historical tongue diagnosis image is classified as a second type of tongue diagnosis image.

7. The method for constructing a large language model for an intelligent TCM system according to claim 1, characterized in that: The step S2 further includes the following specific steps: Step S21: Acquire the hospital's historical consultation data, and acquire tongue diagnosis image marking data according to the hospital's historical consultation data; Step S22: dividing the tongue diagnosis image labeled data into a tongue diagnosis training set and a tongue diagnosis test set according to the tongue diagnosis training test ratio; Step S23: creating an image recognition model through an existing artificial intelligence platform, and training the image recognition model using a tongue diagnosis training set; Step S24: After the training is completed, the image recognition model is tested using the tongue diagnosis test set, and the test pass rate is obtained; Step S25: Obtain the calibration test pass rate. When the test pass rate is greater than or equal to the calibration test pass rate, the image recognition model training is completed and the tongue diagnosis and consultation model is obtained. When the test pass rate is less than the calibration test pass rate, continue to use the tongue diagnosis training set to train the image recognition model until the test pass rate is greater than or equal to the calibration test pass rate.

8. The method for constructing a large language model for an intelligent TCM system according to claim 1, characterized in that: The step S3 further includes the following specific steps: Step S31: Obtain the hospital's historical medical records, and obtain a number of historical medical records based on the hospital's historical medical records; Step S32: using a text recognition algorithm to mark the clinical symptoms of patients in the historical medical records as question texts, mark the clinical diagnoses made by doctors in the historical medical records as question-answer texts, and mark the question texts and question-answer texts in the same historical medical record as a set of question-answer pairs, thereby obtaining multiple sets of question-answer pairs; Step S33: dividing the multiple groups of question-answer pairs into a question-answer text test set and a question-answer text training set according to a preset text test-training ratio; Step S34: establishing a language interaction model through an existing artificial intelligence platform, and training the language interaction model using the question-answer text training set until each question-answer pair in the question-answer text training set has completed one training; Step S35: performing a question-and-answer test on the language interaction model using a question-and-answer text test set, and obtaining the question-and-answer accuracy rate to obtain the test question-and-answer accuracy rate; Step S36: Obtain the preset question and answer accuracy rate, and compare the test question and answer accuracy rate with the preset question and answer accuracy rate; The step S36 further includes the following specific steps: Step S361: When the test question and answer accuracy is greater than or equal to the preset question and answer accuracy, the language interaction model training is completed and a text question diagnosis model is obtained; Step S362: When the test question and answer accuracy rate is less than the preset question and answer accuracy rate, continue to train the language interaction model using the question and answer text training set until the test question and answer accuracy rate is greater than or equal to the preset question and answer accuracy rate.

Citation Information

Patent Citations

  • Method and device for evaluating health state of human body based on head image

    CN114334151A

  • Multi-modal large model-based traditional Chinese medicine tongue diagnosis analysis system and method

    CN118899077A