CN116029597A - Identification method and device for quality grade of traditional Chinese medicine decoction pieces and storage medium - Google Patents
Identification method and device for quality grade of traditional Chinese medicine decoction pieces and storage medium Download PDFInfo
- Publication number
- CN116029597A CN116029597A CN202310029237.1A CN202310029237A CN116029597A CN 116029597 A CN116029597 A CN 116029597A CN 202310029237 A CN202310029237 A CN 202310029237A CN 116029597 A CN116029597 A CN 116029597A
- Authority
- CN
- China
- Prior art keywords
- chinese medicine
- traditional chinese
- image
- target
- quality
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Medical Preparation Storing Or Oral Administration Devices (AREA)
Abstract
The invention discloses a method, a device and a storage medium for identifying quality grades of Chinese medicinal decoction pieces, which are configured with a Chinese medicinal decoction piece quality standard database, wherein standard appearance parameters of Chinese medicinal products and standard images of Chinese medicinal decoction pieces with different quality grades are stored in the database; therefore, the quality recognition of the traditional Chinese medicine product to be detected can be realized based on the data as the basis of machine recognition and by combining the images of the traditional Chinese medicine decoction pieces in the traditional Chinese medicine product to be detected; based on the method, compared with manual classification, the method not only improves the efficiency, reduces the input of manpower, but also improves the judgment accuracy; meanwhile, the invention can intuitively display the quality and price comparison result of the traditional Chinese medicine products of the enterprises and competing enterprises, thereby facilitating the competition analysis of users; thereby, the convenience of use is improved.
Description
Technical Field
The invention belongs to the technical field of data processing, and particularly relates to a method and a device for identifying quality grades of traditional Chinese medicine decoction pieces and a storage medium.
Background
At present, the sizes of the traditional Chinese medicine decoction pieces circulated in the market have a certain size span, and the execution standards of different enterprises are different, so that the traditional Chinese medicine decoction pieces circulated in the market have various grade specifications; meanwhile, with the continuous saturation of the market, each enterprise is also paying more attention to price analysis of a competitor, and the common practice is to purchase a traditional Chinese medicine decoction piece product of the competitor and then compare the quality of the traditional Chinese medicine decoction piece product of the competitor with the quality of the enterprise according to the quality of the traditional Chinese medicine decoction piece product of the competitor, so that a comparison result of the quality and the price of the competitor and the enterprise is obtained, and then the sales or pricing strategy is adjusted according to the comparison result.
In the actual competition analysis process, the quality grade is classified by manually using parameters such as the size, the color, the chipping rate and the like of decoction pieces, but most of traditional Chinese medicine decoction piece products are bagged or boxed, so that when the quality grade is classified, the package is required to be opened, and the quality grade is determined according to the parameters such as the size, the color and the like of all the traditional Chinese medicine decoction pieces in the package; therefore, the quality is distinguished manually, the requirement on accumulation of experience knowledge of personnel is high, the operation is inconvenient, time and labor are consumed, meanwhile, the accuracy of naked eye judgment is limited, and errors are easy to judge; therefore, how to provide a quality recognition method for Chinese herbal pieces with high efficiency and high judgment accuracy has become a problem to be solved.
Disclosure of Invention
The invention aims to provide a method, a device and a storage medium for identifying quality grades of Chinese medicinal decoction pieces, which are used for solving the problems of low efficiency, time and labor consumption and low judgment accuracy in the prior art of manually grading the quality grades of the Chinese medicinal decoction pieces.
In order to achieve the above purpose, the present invention adopts the following technical scheme:
in a first aspect, a method for identifying quality grades of Chinese herbal pieces is provided, comprising:
acquiring an image to be identified, wherein the image to be identified contains a plurality of target traditional Chinese medicine decoction pieces, and the plurality of target traditional Chinese medicine decoction pieces belong to traditional Chinese medicine decoction pieces in a traditional Chinese medicine product to be detected;
performing image recognition on the image to be recognized to obtain appearance parameters of all the target Chinese herbal pieces in the image to be recognized, wherein the appearance parameters of any one target Chinese herbal piece comprise size data and color data of any one target Chinese herbal piece;
obtaining a quality standard database of traditional Chinese medicine decoction pieces, wherein the quality standard database of traditional Chinese medicine decoction pieces comprises standard appearance parameters of traditional Chinese medicine products and a plurality of standard images of the traditional Chinese medicine decoction pieces in the traditional Chinese medicine products, and the quality grades corresponding to each standard image are different;
Performing appearance matching in the quality standard database of the traditional Chinese medicine decoction pieces according to appearance parameters of each target traditional Chinese medicine decoction piece so as to obtain a first quality grade of the traditional Chinese medicine product to be detected after appearance matching;
performing image matching on the image to be identified and each standard image in the quality standard database of the traditional Chinese medicine decoction pieces to obtain a second quality grade of the traditional Chinese medicine product to be detected after the image matching;
and obtaining the actual quality grade of the traditional Chinese medicine product to be detected according to the first quality grade and the second quality grade.
Based on the above disclosure, the invention constructs a quality standard database of Chinese medicinal decoction pieces, wherein the database stores standard appearance parameters of Chinese medicinal products and standard images of Chinese medicinal decoction pieces with different quality grades, so that the quality classification machine identification of the Chinese medicinal decoction pieces can be realized based on the database; specifically, the method comprises the steps of firstly collecting images of Chinese medicinal decoction pieces in a Chinese medicinal product to be detected as images to be identified; then, carrying out image recognition on the image to be recognized to obtain appearance parameters of each target Chinese herbal piece in the image to be recognized (namely, the color and the size of each target Chinese herbal piece in the Chinese herbal product to be detected); then, in the database, appearance parameters of all the target Chinese herbal pieces are subjected to appearance matching, and a first quality grade of the Chinese herbal product to be detected can be obtained based on the appearance parameter matching result of all the target Chinese herbal pieces; then, carrying out image matching on the image to be identified and each standard image in the database, so as to obtain a second quality grade of the traditional Chinese medicine product to be detected according to an image matching result; and finally, obtaining the actual quality grade of the traditional Chinese medicine product to be detected according to the first quality grade and the second quality grade.
Through the design, the quality grade identification is carried out on the traditional Chinese medicine decoction pieces in the traditional Chinese medicine products to be detected in a machine identification mode, so that compared with manual classification, the efficiency is improved, the input of manpower is reduced, the judgment accuracy is improved, and the method is suitable for large-scale application and popularization in the quality classification field of the traditional Chinese medicine decoction pieces.
In one possible design, performing image recognition on the image to be recognized to obtain appearance parameters of each target decoction piece in the image to be recognized, including:
performing target recognition on the image to be recognized to obtain detection frame coordinates of each target traditional Chinese medicine decoction piece;
obtaining the size data of each target Chinese herbal piece according to the detection frame coordinates of each target Chinese herbal piece;
based on the detection frame coordinates of each target Chinese herbal piece, performing image segmentation on the image to be identified to obtain an image area of each target Chinese herbal piece;
performing color recognition on the image area of each target Chinese herbal piece to obtain color data of each target Chinese herbal piece;
and for any one target Chinese medicinal decoction piece, utilizing the color data and the size data of the any one target Chinese medicinal decoction piece to form the appearance parameters of the any one target Chinese medicinal decoction piece.
In one possible design, performing color recognition on the image area of each target decoction piece of Chinese medicine to obtain color data of each target decoction piece of Chinese medicine, including:
for any one of the target Chinese herbal pieces, acquiring RGB values of each pixel point in an image area of the any one of the target Chinese herbal pieces;
based on the RGB value of each pixel point, the brightness, color saturation and tone of each pixel point are obtained;
acquiring a chromaticity diagram based on a polar coordinate system, and determining the color of each pixel point according to the chromaticity diagram and the brightness, the color saturation and the color tone of each pixel point, wherein the radial coordinate of the chromaticity diagram is the color saturation, and the circumferential coordinate is the color tone;
counting the number of the pixels with the same color, and taking the color corresponding to the pixel with the largest number as the color data of any target Chinese herbal pieces.
In one possible design, the standard appearance parameters of the traditional Chinese medicine product include quality scores corresponding to standard appearance parameters of different quality grades, color scores corresponding to respective standard color ranges of the traditional Chinese medicine product, and size scores corresponding to respective standard size uniformity of the traditional Chinese medicine product;
Correspondingly, according to appearance parameters of each target traditional Chinese medicine decoction piece, appearance matching is carried out in the traditional Chinese medicine decoction piece quality standard database, so that after appearance matching, a first quality grade of the traditional Chinese medicine product to be detected is obtained, and the method comprises the following steps:
based on the size data in the appearance parameters of each target traditional Chinese medicine decoction piece, calculating the duty ratio of the target traditional Chinese medicine decoction piece corresponding to each size data in the traditional Chinese medicine product to be detected, and determining the size uniformity of the traditional Chinese medicine product to be detected based on the duty ratio of the target traditional Chinese medicine decoction piece of each size data in the traditional Chinese medicine product to be detected;
determining the color data of the traditional Chinese medicine products to be detected according to the color data in the appearance parameters of each target traditional Chinese medicine decoction piece;
determining the size score of the traditional Chinese medicine product to be detected in the standard appearance parameters according to the size uniformity of the traditional Chinese medicine product to be detected, and determining the color score of the traditional Chinese medicine product to be detected in the standard appearance parameters according to the color data of the traditional Chinese medicine product to be detected;
acquiring size weights and color weights, and obtaining quality evaluation scores of the traditional Chinese medicine products to be detected based on the size weights, the color weights, the size scores of the traditional Chinese medicine products to be detected and the color scores of the traditional Chinese medicine products to be detected;
And matching quality scores corresponding to the quality evaluation in the standard appearance parameters according to the quality evaluation scores of the traditional Chinese medicine products to be detected, so as to obtain a first quality grade of the traditional Chinese medicine products to be detected according to the matched quality scores.
In one possible design, the image to be identified is matched with each standard image in the quality standard database of the traditional Chinese medicine decoction pieces, so as to obtain a second quality grade of the traditional Chinese medicine product to be detected after the image is matched, which comprises the following steps:
image segmentation is carried out on the image to be identified, and image areas of all target traditional Chinese medicine decoction pieces in the image to be identified are segmented, so that a plurality of target image areas are obtained;
for an ith target image area in the plurality of target image areas, performing image contraction processing on the ith target image area and a jth standard image in the plurality of standard images to obtain a first contracted image and a second contracted image respectively;
converting the first contracted image and the second contracted image into 64-level gray scale images respectively to obtain a first gray scale image and a second gray scale image;
calculating the gray average value of all pixel points in the first gray map and the second gray map to respectively obtain a first gray average value and a second gray average value;
Gray scale comparison is carried out on the gray scale value of each pixel point of the first gray scale image and the first gray scale average value, and gray scale value adjustment is carried out according to a gray scale comparison result, so that an adjusted first gray scale image is obtained after adjustment;
gray scale comparison is carried out on the gray scale value of each pixel point of the second gray scale image and the second gray scale average value, and gray scale value adjustment is carried out according to a gray scale comparison result, so that an adjusted second gray scale image is obtained after adjustment;
calculating hash values of the adjusted first gray-scale image and the adjusted second gray-scale image to obtain the similarity between the ith target image area and the jth standard image based on the hash values of the adjusted first gray-scale image and the adjusted second gray-scale image;
adding 1 to j until j is equal to k, obtaining the similarity between the ith target image area and each standard image, and taking the quality grade corresponding to the standard image with the highest similarity as the quality grade of the target traditional Chinese medicine decoction pieces corresponding to the ith target image area;
adding 1 to i until i is equal to k, and obtaining the quality grade of the corresponding target traditional Chinese medicine decoction pieces of each target image area, wherein the initial value of i and j is 1, k is the total number of standard images, and n is the total number of target image areas;
And obtaining a second quality grade of the traditional Chinese medicine product to be detected according to the quality grade of the corresponding target traditional Chinese medicine decoction pieces of each target image area.
In one possible design, the obtaining the actual quality level of the to-be-detected traditional Chinese medicine product according to the first quality level and the second quality level includes:
judging whether the first quality grade and the second quality grade are the same or not;
if yes, the first quality grade or the second quality grade is used as the actual quality grade of the traditional Chinese medicine product to be detected, otherwise, the first quality grade, the second quality grade and the image to be identified are sent to an auditing terminal, so that the auditing terminal obtains the actual quality grade of the traditional Chinese medicine product to be detected based on the first quality grade, the second quality grade and the image to be identified.
In one possible design, after deriving the actual quality level of the chinese medicinal product to be tested, the method further comprises:
acquiring at least one first selling price of the traditional Chinese medicine product to be detected and a second selling price of the traditional Chinese medicine product to be detected, wherein any one of the at least one first selling price is a selling price of the traditional Chinese medicine product to be detected on a selling merchant or a selling platform, the second selling price is a selling price of the traditional Chinese medicine product to be detected at a target merchant, and the target merchant is different from the selling merchant and the selling platform;
Performing association processing on the actual quality grade of the traditional Chinese medicine product to be detected, the second sales price and the at least one first sales price to obtain a quality grade and price mapping diagram of the traditional Chinese medicine product to be detected;
and sending the quality grade and price mapping diagram to a user terminal so as to carry out visual display based on the user terminal.
Based on the above disclosure, after obtaining the actual quality grade of the traditional Chinese medicine product to be detected, the invention also obtains the first sales prices of the traditional Chinese medicine product to be detected at different sales platforms or merchants, and associates the sales prices and the first sales prices of the enterprises with the traditional Chinese medicine product to be detected, thereby obtaining a quality grade and price mapping table; therefore, the quality and price comparison result of the traditional Chinese medicine products of the enterprises and the competing enterprises can be intuitively displayed, and the users can conveniently conduct competition analysis; thereby, the convenience of use is improved.
In a second aspect, there is provided an identification device for quality grade of decoction pieces of Chinese medicine, comprising:
the image acquisition unit is used for acquiring an image to be identified, wherein the image to be identified contains a plurality of target traditional Chinese medicine decoction pieces, and the plurality of target traditional Chinese medicine decoction pieces belong to traditional Chinese medicine decoction pieces in a traditional Chinese medicine product to be detected;
The image recognition unit is used for carrying out image recognition on the image to be recognized to obtain appearance parameters of all the target Chinese herbal pieces in the image to be recognized, wherein the appearance parameters of any one target Chinese herbal piece comprise size data and color data of any one target Chinese herbal piece;
the data acquisition unit is used for acquiring a quality standard database of the traditional Chinese medicine decoction pieces, wherein the quality standard database of the traditional Chinese medicine decoction pieces comprises standard appearance parameters of the traditional Chinese medicine products and a plurality of standard images of the traditional Chinese medicine decoction pieces in the traditional Chinese medicine products, and the quality grades corresponding to each standard image are different;
the quality identification unit is used for carrying out appearance matching in the quality standard database of the traditional Chinese medicine decoction pieces according to appearance parameters of each target traditional Chinese medicine decoction piece so as to obtain a first quality grade of the traditional Chinese medicine product to be detected after appearance matching;
the quality recognition unit is used for performing image matching on the image to be recognized and each standard image in the traditional Chinese medicine decoction piece quality standard database so as to obtain a second quality grade of the traditional Chinese medicine product to be detected after the image matching;
and the quality identification unit is used for obtaining the actual quality grade of the traditional Chinese medicine product to be detected according to the first quality grade and the second quality grade.
In a third aspect, another apparatus for identifying quality level of decoction pieces of Chinese medicine is provided, taking the apparatus as an example of an electronic device, and the apparatus includes a memory, a processor and a transceiver, which are sequentially connected in communication, where the memory is used to store a computer program, the transceiver is used to send and receive a message, and the processor is used to read the computer program, and execute the method for identifying quality level of decoction pieces of Chinese medicine as in the first aspect or any one of the first aspect.
In a fourth aspect, there is provided a storage medium having instructions stored thereon which, when executed on a computer, perform the method of identifying quality levels of decoction pieces of chinese medicine as may be devised in the first aspect or any one of the first aspects.
In a fifth aspect, there is provided a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of identifying a quality grade of a piece of herbal medicine as in the first aspect or any one of the possible designs of the first aspect.
The beneficial effects are that:
(1) The quality grade identification method adopts the machine identification mode to identify the quality grade of the Chinese medicinal decoction pieces in the Chinese medicinal products to be detected, so that compared with manual classification, the quality grade identification method not only improves the efficiency, reduces the input of manpower, but also improves the judgment accuracy, thereby being suitable for large-scale application and popularization in the field of quality classification of the Chinese medicinal decoction pieces.
(2) The invention can intuitively display the quality and price comparison result of the traditional Chinese medicine products of the enterprises and the competing enterprises, thereby facilitating the competition analysis of users; thereby, the convenience of use is improved.
Drawings
Fig. 1 is a schematic flow chart of steps of a method for identifying quality grades of decoction pieces of traditional Chinese medicine according to an embodiment of the invention;
fig. 2 is a schematic structural diagram of an identification device for quality grade of decoction pieces of traditional Chinese medicine according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be briefly described below with reference to the accompanying drawings and the description of the embodiments or the prior art, and it is obvious that the following description of the structure of the drawings is only some embodiments of the present invention, and other drawings can be obtained according to these drawings without inventive effort to a person skilled in the art. It should be noted that the description of these examples is for aiding in understanding the present invention, but is not intended to limit the present invention.
It will be understood that, although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, a first element could be termed a second element, and, similarly, a second element could be termed a first element, without departing from the scope of example embodiments of the present invention.
It should be understood that for the term "and/or" that may appear herein, it is merely one association relationship that describes an associated object, meaning that there may be three relationships, e.g., a and/or B, may represent: a alone, B alone, and both a and B; for the term "/and" that may appear herein, which is descriptive of another associative object relationship, it means that there may be two relationships, e.g., a/and B, it may be expressed that: a alone, a alone and B alone; in addition, for the character "/" that may appear herein, it is generally indicated that the context associated object is an "or" relationship.
Examples:
referring to fig. 1, the method for identifying quality grades of decoction pieces of Chinese medicine provided in this embodiment is configured with a database of quality standards of decoction pieces of Chinese medicine, wherein the database stores standard appearance parameters of Chinese medicine products and standard images of decoction pieces of Chinese medicine with different quality grades; therefore, the quality recognition of the traditional Chinese medicine product to be detected can be realized based on the data as the basis of machine recognition and by combining the images of the traditional Chinese medicine decoction pieces in the traditional Chinese medicine product to be detected; based on the method, compared with manual classification, the method not only improves the efficiency and reduces the input of manpower, but also improves the judgment accuracy, and is suitable for large-scale application and popularization; in this embodiment, the method may be, but not limited to, running on the quality recognition end, where, for example, the quality recognition end may be, but not limited to, a personal computer (personal computer, PC), a tablet computer or a smart phone, and it is understood that the foregoing execution subject does not constitute limitation of the embodiment of the present application, and accordingly, the running steps of the method may be, but not limited to, as shown in the following steps S1 to S6.
S1, acquiring an image to be identified, wherein the image to be identified contains a plurality of target traditional Chinese medicine decoction pieces, and the plurality of target traditional Chinese medicine decoction pieces belong to traditional Chinese medicine decoction pieces in a traditional Chinese medicine product to be detected; in specific application, the method can be used for but not limited to spreading the Chinese medicinal decoction pieces in the Chinese medicinal product to be detected on a pure white background carrier for photographing, so as to obtain the image to be identified; of course, a video shooting mode can be adopted to obtain a video stream; and finally, processing the video stream frame by frame to obtain the image to be identified.
After the image to be identified is obtained, image identification can be carried out, so that the size, the color and other data of each target traditional Chinese medicine decoction piece in the image to be identified are identified, and the appearance parameters of each target traditional Chinese medicine decoction piece are obtained; the image recognition process may be, but is not limited to, as shown in step S2 below.
S2, carrying out image recognition on the image to be recognized to obtain appearance parameters of all the target Chinese herbal pieces in the image to be recognized, wherein the appearance parameters of any one target Chinese herbal piece comprise size data and color data of the any one target Chinese herbal piece; in specific application, the method comprises the steps of firstly identifying the size of each target Chinese herbal piece in an image to be identified, then carrying out image segmentation to segment an image area where each target Chinese herbal piece is located, and finally carrying out color identification on the image area to obtain color data of each target Chinese herbal piece; alternatively, the foregoing process may be, but is not limited to, as shown in the following steps S21 to S25.
S21, carrying out target recognition on the image to be recognized to obtain detection frame coordinates of each target traditional Chinese medicine decoction piece; in a specific application, the method can be used for target detection by using, but not limited to, a yolov4 model (yolov model is a neural network model structure proposed by Joseph redson et al in 2015, yolov4 is version 4), namely, inputting an image to be identified into the yolov4 model so as to output detection frame coordinates of each target herbal piece in the image to be identified; of course, the yolov4 model is a trained model, that is, a sample image in a training data set (the sample image also includes a plurality of sample Chinese herbal pieces) is taken as input, the detection frame coordinates of each sample Chinese herbal piece in each sample image are taken as output, the yolov4 model is trained, and after training, the detection frame coordinates of each target Chinese herbal piece in the image to be identified can be directly identified.
In this embodiment, the detection frame of each target decoction piece of Chinese medicine is essentially an anchor frame in the image, which is used to determine the detection area of each target decoction piece of Chinese medicine, so that the size of the corresponding decoction piece of Chinese medicine can be determined based on the coordinates of the detection frame of each decoction piece of Chinese medicine, as shown in step S22 below.
S22, obtaining size data of each target traditional Chinese medicine decoction piece according to the detection frame coordinates of each target traditional Chinese medicine decoction piece; in specific application, the detection frame coordinates of any target traditional Chinese medicine decoction pieces can be used for obtaining the diameter of any target traditional Chinese medicine decoction pieces based on the detection frame coordinates; after the diameter of any one of the target pieces of herbal medicine is obtained, color recognition may be performed, and the recognition process may be, but is not limited to, as shown in step S23 and step S24 described below.
S23, performing image segmentation on the image to be identified based on the detection frame coordinates of each target traditional Chinese medicine decoction piece so as to obtain an image area of each target traditional Chinese medicine decoction piece; in specific application, the area determined by the detection frame coordinates is an image area where each target traditional Chinese medicine decoction piece is located; thus, after the image areas of the target decoction pieces are obtained, color recognition can be performed on each image area, so as to obtain color data of each target decoction piece, as shown in step S24 below.
S24, carrying out color recognition on the image area of each target traditional Chinese medicine decoction piece to obtain color data of each target traditional Chinese medicine decoction piece; in particular applications, the image area of each target decoction piece of traditional Chinese medicine may be converted from RGB space to HLS space, so as to determine the color of each image area based on (hue) component, L (brightness) component and S (color saturation) component; alternatively, since the identification process of each image area is the same, the following specific explanation will be given by taking the color identification process of the image area corresponding to any one of the target decoction pieces as an example, and the identification process may be, but is not limited to, those shown in the following steps S24a to S24 d.
S24a, for any one of the target Chinese herbal pieces, acquiring RGB values of each pixel point in an image area of the any one of the target Chinese herbal pieces; in this embodiment, because the image is segmented from the image to be identified based on the coordinates of the detection frame, the segmented image is an RGB image, and each pixel point in the image has a corresponding RGB value; thus, after the RGB values of the respective pixels are obtained, color space conversion can be performed to obtain HLS components of the respective pixels, as shown in step S24b below.
S24b, obtaining brightness, color saturation and color tone of each pixel point based on RGB values of each pixel point; in particular, for the x-th pixel point in the image area of any target decoction piece of traditional Chinese medicine, the calculation formulas of brightness, color saturation and color tone can be, but not limited to, the following formulas (1), (2) and (3).
L x =(R x +G x +B x )3 (1)
In the above formula (1), L x Represents the brightness of the x-th pixel point, R x 、G x And B x Sequentially representing a red component value, a green component value and a blue component value of an xth pixel point; in the above formula (2), H x Tone representing brightness of the x-th pixel, S x The color saturation of the x-th pixel point is represented, and x=1, 2, 3.
Thus, based on the foregoing formula, the HLS component of each pixel point in the image area of the any target decoction piece can be obtained, and then, the color of each pixel point can be determined according to the HLS component of each pixel point, as shown in the following steps S24c and S24 d.
S24c, acquiring a chromaticity diagram based on a polar coordinate system, and determining the color of each pixel point according to the chromaticity diagram and the brightness, the color saturation and the color tone of each pixel point, wherein the radial coordinate of the chromaticity diagram is the color saturation, and the circumferential coordinate is the color tone; when the color saturation is 0, no color is represented, and at the moment, whether black or white can be determined according to the brightness; furthermore, the tone map is a common tool for color matching at present, and the principle thereof is not repeated.
After the color of each pixel point is obtained based on the tone map, the color of the image area of any one of the target decoction pieces of traditional Chinese medicine can be determined by using statistics, so as to obtain the color of any one of the target decoction pieces of traditional Chinese medicine, as shown in the following step S24 d.
S24d, counting the number of the pixel points with the same color, and taking the color corresponding to the pixel point with the largest number as the color data of any one target traditional Chinese medicine decoction piece; in specific application, the color with the largest duty ratio is used as the color of any target traditional Chinese medicine decoction piece, if 640 pixel points exist in the corresponding image area, wherein 100 pixel points are brown-white, 500 pixel points are brown, and 40 pixel points are white, then the color of any target traditional Chinese medicine decoction piece is brown; of course, the color recognition process of each of the other target decoction pieces is the same as that of any one of the target decoction pieces, and will not be described again here.
After the size and color of each target decoction piece of traditional Chinese medicine are obtained, the appearance parameters of each target decoction piece of traditional Chinese medicine can be composed, as shown in step S25 below.
S25, for any one target traditional Chinese medicine decoction piece, using the color data and the size data of the any one target traditional Chinese medicine decoction piece to form the appearance parameters of the any one target traditional Chinese medicine decoction piece.
Through the design, the appearance parameters of each target traditional Chinese medicine decoction piece in the traditional Chinese medicine product to be detected can be obtained by utilizing an image recognition technology, so that a data basis is provided for subsequent quality recognition.
In this embodiment, after appearance parameters of each target decoction piece of traditional Chinese medicine are obtained, a pre-constructed quality standard database of decoction pieces of traditional Chinese medicine can be obtained, so that the identified appearance parameters are compared with the quality standard database of decoction pieces of traditional Chinese medicine to obtain a first quality grade corresponding to the appearance parameters; the database acquisition process is shown in the following step S3.
S3, obtaining a quality standard database of the traditional Chinese medicine decoction pieces, wherein the quality standard database of the traditional Chinese medicine decoction pieces comprises standard appearance parameters of traditional Chinese medicine products and a plurality of standard images of the traditional Chinese medicine decoction pieces in the traditional Chinese medicine products, and the quality grades corresponding to each standard image are different; in specific application, the quality standard database of the traditional Chinese medicine decoction pieces is constructed by enterprise personnel according to the quality standard of the enterprise, and of course, the quality standard database can also be constructed according to the industry standard and is arranged at the quality identification terminal side; still further, for example, the standard appearance parameters of the traditional Chinese medicine product may include, but are not limited to, quality scores corresponding to standard appearance parameters of different quality grades, color scores corresponding to respective standard color ranges of the traditional Chinese medicine product, and size scores corresponding to respective standard size uniformity of the traditional Chinese medicine product, where, if it is assumed that the quality score corresponding to the quality grade a is (8.10) score, the quality score corresponding to the quality grade B is [6.8 ] score, the quality score corresponding to the quality grade C is [4,6 ] score, and the standard color ranges include brown (5 score), brown (4 score), black brown (3 score), brown (2 score), white (1 score), and the standard size uniformity includes: scores of 5 points between [1.5cm,2cm ] in diameter, 3 points between [1cm,1.5 cm) in diameter, 1 point between [0.5cm,1 cm) in diameter, and so on; of course, the standard appearance parameters of one type of decoction pieces are exemplified herein, and the principles of scoring the dimensions and the colors of the rest types of decoction pieces are also the same, so that the description is omitted here; after the quality standard database of the decoction pieces of traditional Chinese medicine is obtained, appearance matching can be performed as shown in the following step S4.
S4, performing appearance matching in the quality standard database of the traditional Chinese medicine decoction pieces according to appearance parameters of each target traditional Chinese medicine decoction piece so as to obtain a first quality grade of the traditional Chinese medicine product to be detected after appearance matching; in particular applications, the process of performing the appearance matching may be, but is not limited to, as shown in the following steps S41 to S45.
S41, counting the ratio of the target Chinese herbal pieces corresponding to each piece of size data in the Chinese herbal product to be detected based on the size data in the appearance parameters of each piece of target Chinese herbal pieces, and determining the size uniformity of the Chinese herbal product to be detected based on the ratio of the target Chinese herbal pieces of each piece of size data in the Chinese herbal product to be detected; in specific application, statistics is performed on target Chinese herbal pieces corresponding to different size data, for example, assuming that 100 Chinese herbal pieces (i.e., target Chinese herbal pieces) in a Chinese herbal product to be detected are total, wherein 50 target Chinese herbal pieces with a diameter of 1.6cm are provided, 30 target Chinese herbal pieces with a diameter of 1.5cm are provided, and 20 target Chinese herbal pieces with a diameter of 1.45cm are provided, and then the ratio of the three size data in the Chinese herbal product to be detected is respectively: 1/2, 3/10 and 1/5, wherein at this time, the size data corresponding to the target Chinese herbal pieces with the largest ratio is taken as the size uniformity of the Chinese herbal product to be detected, namely, taking the foregoing as an example, the size uniformity of the Chinese herbal product to be detected is 1.6; in addition, in this embodiment, according to the types of the to-be-detected traditional Chinese medicine products, standard appearance parameters of corresponding types are selected from the quality standard database of the traditional Chinese medicine decoction pieces.
After the uniformity of the size of the Chinese medicinal product to be detected is obtained, the color of the Chinese medicinal product to be detected can be determined based on the color data of each target Chinese medicinal decoction piece, as shown in step S42 below.
S42, determining color data of the traditional Chinese medicine products to be detected according to the color data in the appearance parameters of each target traditional Chinese medicine decoction piece; in specific application, the principle of the step S42 is the same as that of the step S41, and the statistical principle is adopted, namely, color data corresponding to the target traditional Chinese medicine decoction pieces with the largest proportion are used as the colors of the traditional Chinese medicine products to be detected; if the target decoction pieces of Chinese medicine with brown color have 56 pieces, the target decoction pieces of Chinese medicine with brown color have 35 pieces, and the target decoction pieces of Chinese medicine with white color have 9 pieces, the ratio of brown is the largest, so that the color data of the Chinese medicine product to be detected is brown; of course, the color recognition of the other different types of Chinese medicinal products to be detected can be realized according to the principle, and the description is omitted here.
After determining the color data of the Chinese medicinal product to be detected, the quality can be evaluated in the quality standard database of the Chinese medicinal decoction pieces in combination with the uniformity of the size, as shown in the following steps S43, S44 and S45.
S43, determining the size score of the traditional Chinese medicine product to be detected in the standard appearance parameters according to the size uniformity of the traditional Chinese medicine product to be detected, and determining the color score of the traditional Chinese medicine product to be detected in the standard appearance parameters according to the color data of the traditional Chinese medicine product to be detected; in specific application, the standard appearance parameters in the database already described include quality scores corresponding to different quality grades, color scores corresponding to each standard color range and size scores corresponding to each standard size uniformity, so that matching is performed in the database according to the color data and the size uniformity obtained in step S42 and step S43; the description is still based on the foregoing examples, wherein the size score of the Chinese medicinal product to be tested is 5 points, and the color score is also 5 points; meanwhile, the present embodiment also introduces size and color weights to improve the rationality of quality assessment, as shown in step S44 below.
S44, acquiring size weights and color weights, and obtaining quality evaluation scores of the traditional Chinese medicine products to be detected based on the size weights, the color weights, the size scores of the traditional Chinese medicine products to be detected and the color scores of the traditional Chinese medicine products to be detected; in specific application, the example color weight and the size weight can be realized by adopting a 1-9 scale method and constructing a judgment matrix, which is a common technology for weight calculation, and the principle is not repeated; and after the size weight and the color weight are obtained, the weights and the scores can be multiplied correspondingly and summed to obtain the quality evaluation score of the traditional Chinese medicine product to be detected, and finally, the quality evaluation score is matched with the quality scores in the database according to the quality evaluation score to obtain the first quality grade of the traditional Chinese medicine product to be detected, as shown in the following step S45.
S45, matching a quality score corresponding to the quality evaluation in the standard appearance parameters according to the quality evaluation score of the traditional Chinese medicine product to be detected, so as to obtain a first quality grade of the traditional Chinese medicine product to be detected according to the matched quality score; in particular, the quality scores according to the different quality grades are shown as quality grade A when the quality score is within (8.10), quality grade B when the quality score is within [6.8 ], and quality grade C when the quality score is within [4,6 ].
Thus, through the steps S41 to S45, the first quality grade of the traditional Chinese medicine decoction pieces to be detected can be matched from the traditional Chinese medicine decoction piece quality standard database according to the appearance parameters of each target traditional Chinese medicine decoction piece; after the first quality level is obtained, the secondary quality recognition is performed according to the similarity between the image to be recognized and each standard image, as shown in the following step S5.
S5, performing image matching on the image to be identified and each standard image in the quality standard database of the traditional Chinese medicine decoction pieces so as to obtain a second quality grade of the traditional Chinese medicine product to be detected after the image matching; in particular applications, the process of determining the second quality level may be, but is not limited to, as shown in steps S50-S59 below.
S51, performing image segmentation on the image to be identified, and segmenting out image areas of all target traditional Chinese medicine decoction pieces in the image to be identified so as to obtain a plurality of target image areas; in particular, the image segmentation process in step S51 can be seen from the foregoing steps S21 and S23, and will not be described herein.
After obtaining the image areas of each target decoction piece of traditional Chinese medicine, the similarity between each image area and each standard image can be calculated, and the similarity calculation process is shown in the following steps S51-S58.
S51, performing image contraction processing on an ith target image area in the plurality of target image areas and a jth standard image in the plurality of standard images to obtain a first contracted image and a second contracted image respectively; in specific application, the image contraction processing is performed, so that the information of the structure, brightness and the like of the image can be kept, the similarity calculation can be performed according to the information, and meanwhile, the i target image area and the j standard image can be contracted to be 8 x 8 by way of example and not limitation; after the image contraction processing is completed, gray-scale conversion may be performed as shown in step S52 below.
S52, converting the first shrinkage image and the second shrinkage image into 64-level gray scale images respectively to obtain a first gray scale image and a second gray scale image; in specific application, the 64-level gray scale image refers to that all pixel points in the image can only represent 64 colors in total; after the first gray scale image and the second gray scale image are obtained, the gray scale average value may be calculated as shown in step S53 below.
S53, calculating gray average values of all pixel points in the first gray map and the second gray map to obtain a first gray average value and a second gray average value respectively; in this embodiment, after the average gray values of all the pixels in the first gray scale map and the second gray scale map are calculated, the gray values of the pixels in the corresponding gray scale map can be adjusted by using the respective average gray values, as shown in step S54 and step S55 below.
S54, comparing the gray value of each pixel point of the first gray level image with the first gray level average value, and adjusting the gray level value according to the gray level comparison result so as to obtain an adjusted first gray level image after adjustment.
S55, comparing the gray value of each pixel point of the second gray level image with the second gray level average value, and adjusting the gray level value according to the gray level comparison result so as to obtain an adjusted second gray level image after adjustment; in this embodiment, the gray value adjustment principle of the pixels in the first gray scale image and the second gray scale image is the same, and the first gray scale image is taken as an example for explanation, wherein if the gray value of any pixel in the first gray scale image is greater than or equal to the first gray average value, the gray value of any pixel is adjusted to be 1, and if the gray value of any pixel is less than the first gray average value, the gray value of any pixel is adjusted to be 0; thus, according to the method, the gray values of all the pixel points in the first gray scale image and the second gray scale image can be adjusted, so that the adjusted first gray scale image and the adjusted second gray scale image are obtained.
After the adjustment of the gray values of the pixel points in the two gray images is completed, the similarity calculation may be performed, where the calculation process is as follows in step S56.
S56, calculating hash values of the adjusted first gray level image and the adjusted second gray level image to obtain the similarity between the ith target image area and the jth standard image based on the hash values of the adjusted first gray level image and the adjusted second gray level image; when the method is specifically applied, a hash value is formed by using the gray values of all pixel points in the adjusted first gray level diagram (for example, the gray values of all pixel points in the adjusted second gray level diagram are arranged according to a row sequence or a column sequence), another hash value is formed by using the gray values of all pixel points in the adjusted second gray level diagram, then, the data of how many bits in the two hash values are different is counted, and finally, the similarity is obtained according to the counted number of different bits; specifically, the number of different bits is between [1,3 ], the similarity is 90%, the number of different bits is between (3, 5), the similarity is 80% -90%, the number of different bits is between (5, 7), the similarity is 60% -80%, the number of different bits is between (7, 10), the similarity is 40% -60%, the number of different bits is more than 10, the similarity is less than 40%, meanwhile, the largest integer in the similarity range can be taken as the similarity between the two, if the similarity is between 80% -90%, 89% is taken as the similarity, and based on the similarity, the similarity between any target image area and each standard image can be calculated by the method, as shown in the following step S57.
S57, adding 1 to j until j is equal to k, obtaining the similarity between the ith target image area and each standard image, and taking the quality grade corresponding to the standard image with the highest similarity as the quality grade of the target traditional Chinese medicine decoction pieces corresponding to the ith target image area; when the method is specifically applied, the quality grade corresponding to the standard image with highest similarity is taken as the quality grade of the target traditional Chinese medicine decoction pieces corresponding to the ith target image area; also, with the above method, the quality level of the corresponding target decoction pieces of the traditional Chinese medicine for each target image area can be calculated as shown in step S58 below.
S58, adding 1 to i until i is equal to k, and obtaining the quality grade of the target traditional Chinese medicine decoction pieces corresponding to each target image area, wherein the initial value of i and j is 1, k is the total number of standard images, and n is the total number of target image areas; after obtaining the quality grades of the target decoction pieces corresponding to the respective target image areas, a statistical method may also be used to determine a second quality grade of the to-be-detected Chinese medicinal product, as shown in step S59 below.
S59, obtaining a second quality grade of the traditional Chinese medicine product to be detected according to the quality grade of the corresponding target traditional Chinese medicine decoction pieces of each target image area; in specific application, the number of target Chinese medicinal decoction pieces corresponding to each quality grade is counted, so that the quality grade with the largest proportion is used as a second quality grade of the Chinese medicinal product to be detected.
After the second quality level of the to-be-detected traditional Chinese medicine product is obtained, the actual quality level of the to-be-detected traditional Chinese medicine product can be determined by combining the first quality level, as shown in the following step S6.
S6, obtaining the actual quality grade of the traditional Chinese medicine product to be detected according to the first quality grade and the second quality grade; when the method is specifically applied, whether the first quality grade and the second quality grade are the same or not is judged first, if yes, the first quality grade or the second quality grade is used as the actual quality grade of the traditional Chinese medicine product to be detected, otherwise, the first quality grade, the second quality grade and the image to be identified are sent to an auditing terminal, so that the auditing terminal obtains the actual quality grade of the traditional Chinese medicine product to be detected based on the first quality grade, the second quality grade and the image to be identified; optionally, under the condition that the first quality grade and the second quality grade are different, an auditing person at the auditing terminal is required to conduct manual auditing, and an auditing result is fed back to the quality recognition terminal through the auditing terminal.
In addition, in this embodiment, after obtaining the actual quality level of the to-be-detected traditional Chinese medicine product, the present embodiment may also perform price association, as shown in the following steps S7 to S8.
S7, obtaining at least one first selling price of the traditional Chinese medicine product to be detected and a second selling price of the traditional Chinese medicine product to be detected, wherein any one of the at least one first selling price is a selling price of the traditional Chinese medicine product to be detected on a selling merchant or a selling platform, the second selling price is a selling price of the traditional Chinese medicine product to be detected at a target merchant, and the target merchant is different from the selling merchant and the selling platform; in specific application, the selling prices of the to-be-detected traditional Chinese medicine products by the enterprises and the competing enterprises are obtained, namely the selling prices of the to-be-detected traditional Chinese medicine products at different selling platforms and selling merchants are obtained, so that the selling prices are used as first selling prices; then, the selling price of the traditional Chinese medicine products with the same quality grade in the enterprise is used as a second selling price; then, the price and the quality level of the to-be-detected traditional Chinese medicine product can be correlated, so as to form a quality level and price mapping chart, as shown in the following step S8.
S8, carrying out association processing on the actual quality grade of the traditional Chinese medicine product to be detected, the second selling price and the at least one first selling price to obtain a quality grade and price mapping diagram of the traditional Chinese medicine product to be detected; in specific implementation, the quality grade and price map may be, but is not limited to, centered on the traditional Chinese medicine product to be detected, respectively labeling the first sales prices of different sales platforms and sales merchants on both sides of the map, and then labeling the second sales prices of the enterprises of the map; of course, the specific labeling forms or patterns may be specifically set according to actual use, and are not limited to the foregoing examples.
After the quality grade and price map of the traditional Chinese medicine product to be detected is obtained, the quality grade and price map can be sent to a user terminal for visual display, as shown in the following step S9.
S9, sending the quality grade and price mapping diagram to a user terminal so as to carry out visual display based on the user terminal; in specific application, the user terminal may be, but not limited to, a terminal corresponding to a marketing team or a marketing planning team of an enterprise, so that a marketing person or a marketing planning person can adjust a marketing strategy and a price according to the quality level and the price map; of course, the terminals of the other departments in the enterprise are also possible, and are not particularly limited herein.
The invention is configured with a quality standard database of the Chinese medicinal decoction pieces, wherein the database stores standard appearance parameters of Chinese medicinal products and standard images of Chinese medicinal decoction pieces with different quality grades; therefore, the quality recognition of the traditional Chinese medicine product to be detected can be realized based on the data as the basis of machine recognition and by combining the images of the traditional Chinese medicine decoction pieces in the traditional Chinese medicine product to be detected; based on the method, compared with manual classification, the method not only improves the efficiency, reduces the input of manpower, but also improves the judgment accuracy; meanwhile, the invention can intuitively display the quality and price comparison result of the traditional Chinese medicine products of the enterprises and competing enterprises, thereby facilitating the competition analysis of users; thereby, the convenience of use is improved.
As shown in fig. 2, a second aspect of the present embodiment provides a hardware device for implementing the method for identifying quality grade of decoction pieces of traditional Chinese medicine according to the first aspect of the embodiment, including:
the image acquisition unit is used for acquiring an image to be identified, wherein the image to be identified contains a plurality of target traditional Chinese medicine decoction pieces, and the plurality of target traditional Chinese medicine decoction pieces belong to traditional Chinese medicine decoction pieces in a traditional Chinese medicine product to be detected.
The image recognition unit is used for carrying out image recognition on the image to be recognized to obtain appearance parameters of all the target Chinese herbal pieces in the image to be recognized, wherein the appearance parameters of any one target Chinese herbal piece comprise size data and color data of any one target Chinese herbal piece.
The data acquisition unit is used for acquiring a traditional Chinese medicine decoction piece quality standard database, wherein the traditional Chinese medicine decoction piece quality standard database comprises standard appearance parameters of a traditional Chinese medicine product and a plurality of standard images of traditional Chinese medicine decoction pieces in the traditional Chinese medicine product, and the quality grades corresponding to each standard image are different.
And the quality recognition unit is used for carrying out appearance matching in the quality standard database of the traditional Chinese medicine decoction pieces according to appearance parameters of each target traditional Chinese medicine decoction piece so as to obtain a first quality grade of the traditional Chinese medicine product to be detected after appearance matching.
And the quality recognition unit is used for performing image matching on the image to be recognized and each standard image in the traditional Chinese medicine decoction piece quality standard database so as to obtain a second quality grade of the traditional Chinese medicine product to be detected after the image matching.
And the quality identification unit is used for obtaining the actual quality grade of the traditional Chinese medicine product to be detected according to the first quality grade and the second quality grade.
The working process, working details and technical effects of the device provided in this embodiment may refer to the first aspect of the embodiment, and are not described herein again.
As shown in fig. 3, a third aspect of the present embodiment provides another apparatus for identifying quality level of decoction pieces of Chinese medicine, which takes an apparatus as an example of an electronic device, including: the device comprises a memory, a processor and a transceiver which are connected in sequence in communication, wherein the memory is used for storing a computer program, the transceiver is used for receiving and transmitting messages, and the processor is used for reading the computer program and executing the identification method of the quality grade of the traditional Chinese medicine decoction pieces according to the first aspect of the embodiment.
By way of specific example, the Memory may include, but is not limited to, random access Memory (random access Memory, RAM), read Only Memory (ROM), flash Memory (Flash Memory), first-in-first-out Memory (First Input First Output, FIFO) and/or first-in-last-out Memory (First In Last Out, FILO), etc.; in particular, the processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, or the like. The processor may be implemented in at least one hardware form of DSP (Digital Signal Processing ), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array ), and may also include a main processor and a coprocessor, where the main processor is a processor for processing data in an awake state, and is also called CPU (Central Processing Unit ); a coprocessor is a low-power processor for processing data in a standby state.
In some embodiments, the processor may be integrated with a GPU (Graphics Processing Unit, image processor) for taking charge of rendering and rendering of content required to be displayed by the display screen, for example, the processor may not be limited to a microprocessor employing a model number of STM32F105 family, a reduced instruction set computer (reduced instruction set computer, RISC) microprocessor, an X86 or other architecture processor, or a processor integrating an embedded neural network processor (neural-network processing units, NPU); the transceiver may be, but is not limited to, a wireless fidelity (WIFI) wireless transceiver, a bluetooth wireless transceiver, a general packet radio service technology (General Packet Radio Service, GPRS) wireless transceiver, a ZigBee protocol (low power local area network protocol based on the ieee802.15.4 standard), a 3G transceiver, a 4G transceiver, and/or a 5G transceiver, etc. In addition, the device may include, but is not limited to, a power module, a display screen, and other necessary components.
The working process, working details and technical effects of the electronic device provided in this embodiment may refer to the first aspect of the embodiment, and are not described herein again.
A fourth aspect of the present embodiment provides a storage medium storing instructions containing the method for identifying quality levels of decoction pieces of Chinese medicine according to the first aspect of the present embodiment, i.e. the storage medium has instructions stored thereon, which when executed on a computer, perform the method for identifying quality levels of decoction pieces of Chinese medicine according to the first aspect.
The storage medium refers to a carrier for storing data, and may include, but is not limited to, a floppy disk, an optical disk, a hard disk, a flash Memory, a flash disk, and/or a Memory Stick (Memory Stick), where the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable devices.
The working process, working details and technical effects of the storage medium provided in this embodiment may refer to the first aspect of the embodiment, and are not described herein again.
A fifth aspect of the present embodiment provides a computer program product comprising instructions which, when run on a computer, cause the computer to perform the method for identifying quality levels of decoction pieces of Chinese medicine according to the first aspect of the embodiment, wherein the computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus.
Finally, it should be noted that: the foregoing description is only of the preferred embodiments of the invention and is not intended to limit the scope of the invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. The method for identifying the quality grade of the traditional Chinese medicine decoction pieces is characterized by comprising the following steps of:
Acquiring an image to be identified, wherein the image to be identified contains a plurality of target traditional Chinese medicine decoction pieces, and the plurality of target traditional Chinese medicine decoction pieces belong to traditional Chinese medicine decoction pieces in a traditional Chinese medicine product to be detected;
performing image recognition on the image to be recognized to obtain appearance parameters of all the target Chinese herbal pieces in the image to be recognized, wherein the appearance parameters of any one target Chinese herbal piece comprise size data and color data of any one target Chinese herbal piece;
obtaining a quality standard database of traditional Chinese medicine decoction pieces, wherein the quality standard database of traditional Chinese medicine decoction pieces comprises standard appearance parameters of traditional Chinese medicine products and a plurality of standard images of the traditional Chinese medicine decoction pieces in the traditional Chinese medicine products, and the quality grades corresponding to each standard image are different;
performing appearance matching in the quality standard database of the traditional Chinese medicine decoction pieces according to appearance parameters of each target traditional Chinese medicine decoction piece so as to obtain a first quality grade of the traditional Chinese medicine product to be detected after appearance matching;
performing image matching on the image to be identified and each standard image in the quality standard database of the traditional Chinese medicine decoction pieces to obtain a second quality grade of the traditional Chinese medicine product to be detected after the image matching;
And obtaining the actual quality grade of the traditional Chinese medicine product to be detected according to the first quality grade and the second quality grade.
2. The method of claim 1, wherein performing image recognition on the image to be recognized to obtain appearance parameters of each target decoction piece in the image to be recognized comprises:
performing target recognition on the image to be recognized to obtain detection frame coordinates of each target traditional Chinese medicine decoction piece;
obtaining the size data of each target Chinese herbal piece according to the detection frame coordinates of each target Chinese herbal piece;
based on the detection frame coordinates of each target Chinese herbal piece, performing image segmentation on the image to be identified to obtain an image area of each target Chinese herbal piece;
performing color recognition on the image area of each target Chinese herbal piece to obtain color data of each target Chinese herbal piece;
and for any one target Chinese medicinal decoction piece, utilizing the color data and the size data of the any one target Chinese medicinal decoction piece to form the appearance parameters of the any one target Chinese medicinal decoction piece.
3. The method of claim 2, wherein color recognition is performed on the image area of each target decoction piece of traditional Chinese medicine to obtain color data of each target decoction piece of traditional Chinese medicine, comprising:
For any one of the target Chinese herbal pieces, acquiring RGB values of each pixel point in an image area of the any one of the target Chinese herbal pieces;
based on the RGB value of each pixel point, the brightness, color saturation and tone of each pixel point are obtained;
acquiring a chromaticity diagram based on a polar coordinate system, and determining the color of each pixel point according to the chromaticity diagram and the brightness, the color saturation and the color tone of each pixel point, wherein the radial coordinate of the chromaticity diagram is the color saturation, and the circumferential coordinate is the color tone;
counting the number of the pixels with the same color, and taking the color corresponding to the pixel with the largest number as the color data of any target Chinese herbal pieces.
4. The method of claim 1, wherein the standard appearance parameters of the chinese medicinal product comprise quality scores corresponding to standard appearance parameters of different quality grades, color scores corresponding to respective standard color ranges of the chinese medicinal product, and size scores corresponding to respective standard size uniformity of the chinese medicinal product;
correspondingly, according to appearance parameters of each target traditional Chinese medicine decoction piece, appearance matching is carried out in the traditional Chinese medicine decoction piece quality standard database, so that after appearance matching, a first quality grade of the traditional Chinese medicine product to be detected is obtained, and the method comprises the following steps:
Based on the size data in the appearance parameters of each target traditional Chinese medicine decoction piece, calculating the duty ratio of the target traditional Chinese medicine decoction piece corresponding to each size data in the traditional Chinese medicine product to be detected, and determining the size uniformity of the traditional Chinese medicine product to be detected based on the duty ratio of the target traditional Chinese medicine decoction piece of each size data in the traditional Chinese medicine product to be detected;
determining the color data of the traditional Chinese medicine products to be detected according to the color data in the appearance parameters of each target traditional Chinese medicine decoction piece;
determining the size score of the traditional Chinese medicine product to be detected in the standard appearance parameters according to the size uniformity of the traditional Chinese medicine product to be detected, and determining the color score of the traditional Chinese medicine product to be detected in the standard appearance parameters according to the color data of the traditional Chinese medicine product to be detected;
acquiring size weights and color weights, and obtaining quality evaluation scores of the traditional Chinese medicine products to be detected based on the size weights, the color weights, the size scores of the traditional Chinese medicine products to be detected and the color scores of the traditional Chinese medicine products to be detected;
and matching quality scores corresponding to the quality evaluation in the standard appearance parameters according to the quality evaluation scores of the traditional Chinese medicine products to be detected, so as to obtain a first quality grade of the traditional Chinese medicine products to be detected according to the matched quality scores.
5. The method of claim 1, wherein image matching the image to be identified with each standard image in the quality standard database of herbal pieces to obtain a second quality level of the herbal product to be detected after image matching, comprises:
image segmentation is carried out on the image to be identified, and image areas of all target traditional Chinese medicine decoction pieces in the image to be identified are segmented, so that a plurality of target image areas are obtained;
for an ith target image area in the plurality of target image areas, performing image contraction processing on the ith target image area and a jth standard image in the plurality of standard images to obtain a first contracted image and a second contracted image respectively;
converting the first contracted image and the second contracted image into 64-level gray scale images respectively to obtain a first gray scale image and a second gray scale image;
calculating the gray average value of all pixel points in the first gray map and the second gray map to respectively obtain a first gray average value and a second gray average value;
gray scale comparison is carried out on the gray scale value of each pixel point of the first gray scale image and the first gray scale average value, and gray scale value adjustment is carried out according to a gray scale comparison result, so that an adjusted first gray scale image is obtained after adjustment;
Gray scale comparison is carried out on the gray scale value of each pixel point of the second gray scale image and the second gray scale average value, and gray scale value adjustment is carried out according to a gray scale comparison result, so that an adjusted second gray scale image is obtained after adjustment;
calculating hash values of the adjusted first gray-scale image and the adjusted second gray-scale image to obtain the similarity between the ith target image area and the jth standard image based on the hash values of the adjusted first gray-scale image and the adjusted second gray-scale image;
adding 1 to j until j is equal to k, obtaining the similarity between the ith target image area and each standard image, and taking the quality grade corresponding to the standard image with the highest similarity as the quality grade of the target traditional Chinese medicine decoction pieces corresponding to the ith target image area;
adding 1 to i until i is equal to k, and obtaining the quality grade of the corresponding target traditional Chinese medicine decoction pieces of each target image area, wherein the initial value of i and j is 1, k is the total number of standard images, and n is the total number of target image areas;
and obtaining a second quality grade of the traditional Chinese medicine product to be detected according to the quality grade of the corresponding target traditional Chinese medicine decoction pieces of each target image area.
6. The method of claim 1, wherein deriving the actual quality level of the chinese medicinal product to be tested based on the first quality level and the second quality level comprises:
judging whether the first quality grade and the second quality grade are the same or not;
if yes, the first quality grade or the second quality grade is used as the actual quality grade of the traditional Chinese medicine product to be detected, otherwise, the first quality grade, the second quality grade and the image to be identified are sent to an auditing terminal, so that the auditing terminal obtains the actual quality grade of the traditional Chinese medicine product to be detected based on the first quality grade, the second quality grade and the image to be identified.
7. The method according to claim 1, wherein after deriving the actual quality level of the chinese medicinal product to be tested, the method further comprises:
acquiring at least one first selling price of the traditional Chinese medicine product to be detected and a second selling price of the traditional Chinese medicine product to be detected, wherein any one of the at least one first selling price is a selling price of the traditional Chinese medicine product to be detected on a selling merchant or a selling platform, the second selling price is a selling price of the traditional Chinese medicine product to be detected at a target merchant, and the target merchant is different from the selling merchant and the selling platform;
Performing association processing on the actual quality grade of the traditional Chinese medicine product to be detected, the second sales price and the at least one first sales price to obtain a quality grade and price mapping diagram of the traditional Chinese medicine product to be detected;
and sending the quality grade and price mapping diagram to a user terminal so as to carry out visual display based on the user terminal.
8. An identification device for quality grade of Chinese herbal pieces, comprising:
the image acquisition unit is used for acquiring an image to be identified, wherein the image to be identified contains a plurality of target traditional Chinese medicine decoction pieces, and the plurality of target traditional Chinese medicine decoction pieces belong to traditional Chinese medicine decoction pieces in a traditional Chinese medicine product to be detected;
the image recognition unit is used for carrying out image recognition on the image to be recognized to obtain appearance parameters of all the target Chinese herbal pieces in the image to be recognized, wherein the appearance parameters of any one target Chinese herbal piece comprise size data and color data of any one target Chinese herbal piece;
the data acquisition unit is used for acquiring a quality standard database of the traditional Chinese medicine decoction pieces, wherein the quality standard database of the traditional Chinese medicine decoction pieces comprises standard appearance parameters of the traditional Chinese medicine products and a plurality of standard images of the traditional Chinese medicine decoction pieces in the traditional Chinese medicine products, and the quality grades corresponding to each standard image are different;
The quality identification unit is used for carrying out appearance matching in the quality standard database of the traditional Chinese medicine decoction pieces according to appearance parameters of each target traditional Chinese medicine decoction piece so as to obtain a first quality grade of the traditional Chinese medicine product to be detected after appearance matching;
the quality recognition unit is used for performing image matching on the image to be recognized and each standard image in the traditional Chinese medicine decoction piece quality standard database so as to obtain a second quality grade of the traditional Chinese medicine product to be detected after the image matching;
and the quality identification unit is used for obtaining the actual quality grade of the traditional Chinese medicine product to be detected according to the first quality grade and the second quality grade.
9. An identification device for quality grade of Chinese herbal pieces, comprising: the device comprises a memory, a processor and a transceiver which are connected in sequence in communication, wherein the memory is used for storing a computer program, the transceiver is used for receiving and transmitting messages, and the processor is used for reading the computer program and executing the identification method of the quality grade of the traditional Chinese medicine decoction pieces according to any one of claims 1 to 7.
10. A storage medium having instructions stored thereon which, when executed on a computer, perform the method of identifying quality levels of decoction pieces of chinese medicine according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310029237.1A CN116029597A (en) | 2023-01-09 | 2023-01-09 | Identification method and device for quality grade of traditional Chinese medicine decoction pieces and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310029237.1A CN116029597A (en) | 2023-01-09 | 2023-01-09 | Identification method and device for quality grade of traditional Chinese medicine decoction pieces and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116029597A true CN116029597A (en) | 2023-04-28 |
Family
ID=86075608
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310029237.1A Pending CN116029597A (en) | 2023-01-09 | 2023-01-09 | Identification method and device for quality grade of traditional Chinese medicine decoction pieces and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116029597A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118045773A (en) * | 2024-04-03 | 2024-05-17 | 江苏传承中药有限公司 | Machine vision-based quality detection and analysis system and method for traditional Chinese medicine decoction pieces |
-
2023
- 2023-01-09 CN CN202310029237.1A patent/CN116029597A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118045773A (en) * | 2024-04-03 | 2024-05-17 | 江苏传承中药有限公司 | Machine vision-based quality detection and analysis system and method for traditional Chinese medicine decoction pieces |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109165645B (en) | Image processing method and device and related equipment | |
KR102102161B1 (en) | Method, apparatus and computer program for extracting representative feature of object in image | |
CN110263681B (en) | Facial expression recognition method and device, storage medium and electronic device | |
CN102930264B (en) | Based on commodity display information acquisition and analysis system and the method for image recognition technology | |
CN108765423B (en) | Convolutional neural network training method and device | |
CN110070101A (en) | Floristic recognition methods and device, storage medium, computer equipment | |
CN106469302A (en) | A kind of face skin quality detection method based on artificial neural network | |
CN106211804A (en) | The colour measurement to raw image data is utilized to carry out AWB | |
CN104052979B (en) | For device and the technology of image processing | |
CN110348322A (en) | Human face in-vivo detection method and equipment based on multi-feature fusion | |
CN107808358A (en) | Image watermark automatic testing method | |
CN108960382A (en) | A kind of colour barcode and its color calibration method | |
CN108596137A (en) | A kind of commodity scanning record method based on image recognition algorithm | |
US20150243014A1 (en) | Culture medium information registration system, colony detection device, program and sanitary management system | |
CN108830823A (en) | The full-reference image quality evaluating method of frequency-domain analysis is combined based on airspace | |
CN116029597A (en) | Identification method and device for quality grade of traditional Chinese medicine decoction pieces and storage medium | |
CN108734520A (en) | A kind of jade price evaluation method and device based on machine learning | |
CN107506738A (en) | Feature extracting method, image-recognizing method, device and electronic equipment | |
CN103793717A (en) | Methods for determining image-subject significance and training image-subject significance determining classifier and systems for same | |
CN110836717A (en) | Financial service-oriented intelligent fruit and vegetable identification and pricing system | |
CN105205503A (en) | Crowdsourcing-active-learning-based method for detecting abnormal picture | |
CN114120307A (en) | Display content identification method, device, equipment and storage medium | |
CN106779043A (en) | A kind of method of counting based on number of people detection | |
CN104376523B (en) | A kind of image code false-proof system composing method towards Google glass | |
CN117315369A (en) | Fundus disease classification method and device based on neural network |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |