Processing traceability method and system for traditional Chinese medicine decoction pieces and medium
By setting up RFID tags and video acquisition devices on Chinese herbal medicines, standardized analysis is carried out in combination with the traceability cloud platform, and processing data groups are generated, the traceability problem of the traditional Chinese herbal medicine processing is solved, the standardization of processing operations and processing of inferior Chinese herbal medicines is ensured, and efficient data storage and traceability are achieved.
Patent Information
- Application Number
- CN202510394891.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-07-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the prior art, the processing link of Chinese herbal medicine lacks an effective traceability mechanism, making it difficult to ensure whether the processing process operation is standardized and whether the inferior Chinese herbal medicines are processed in a standardized manner.
By setting up RFID tags on Chinese herbal medicines, collecting videos of the processing process with the video acquisition device, using the traceability cloud platform for standardized analysis, generating processing analysis results, and generating tag ID, video and analysis results into processing data groups for storage, realizing traceability of the processing link of Chinese herbal medicines.
It realizes effective traceability of the processing link of Chinese herbal medicines, ensures standardization of processing operations and standardization of poor quality Chinese herbal medicines, avoids the problem of small storage capacity of traditional tags, and provides efficient data storage and traceability solutions.
Smart Images

Figure CN120298006A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cloud data processing, and particularly to a processing traceability method, system and medium for traditional Chinese medicine decoction pieces. Background Art
[0002] Traditional Chinese medicine decoction pieces are preparation forms that can be directly used in prescriptions after processing, slicing or processing of traditional Chinese medicinal materials, and their quality directly affects clinical efficacy and the safety of patients' medication. Currently, in order to ensure the quality and safety of traditional Chinese medicine decoction pieces, corresponding traceability mechanisms are set for each link of traditional Chinese medicine decoction pieces, such as traceability in the planting link, traceability in the processing link, etc. Among them, for the traceability of the processing link, it mainly includes the traceability of basic information such as the type of processing technology, processing time, processing enterprise, and operating personnel. However, important information closely related to the quality of traditional Chinese medicine decoction pieces, such as whether the processing technology operation is standardized and whether the inferior traditional Chinese medicinal materials found during the processing are processed standardizedly, often lacks corresponding traceability mechanisms. Therefore, how to effectively trace the important information closely related to the quality in the processing link of traditional Chinese medicine decoction pieces is one of the technical problems that need to be solved currently. Summary of the Invention
[0003] The main purpose of the present invention is to provide a processing traceability method, system and medium for traditional Chinese medicine decoction pieces, aiming to solve the technical problem of how to effectively trace the important information closely related to the quality in the processing link of traditional Chinese medicine decoction pieces.
[0004] To achieve the above purpose, the present invention provides a processing traceability method for traditional Chinese medicine decoction pieces, which is applied to a processing traceability system. The processing traceability system includes a traceability cloud platform, a reader-writer and a video acquisition device that are communicatively connected to the traceability cloud platform. The processing traceability method for traditional Chinese medicine decoction pieces includes:
[0005] During the processing of traditional Chinese medicine decoction pieces, based on the reader-writer, read the label ID of the electronic label corresponding to the traditional Chinese medicine decoction piece, and based on the video acquisition device, collect the processing and processing video of the traditional Chinese medicine decoction piece;
[0006] Transmit the label ID and the processing and processing video to the traceability cloud platform, and based on the traceability cloud platform, perform a standardization analysis on the processing and processing video to generate a processing analysis result;
[0007] Based on the traceability cloud platform, generate a processing data group from the label ID, the processing and processing video and the processing analysis result for storage;
[0008] When the traceability cloud platform receives a processing traceability request, obtain the to-be-traced label ID of the to-be-traced traditional Chinese medicine decoction piece carried in the processing traceability request, and search for a target processing data group corresponding to the to-be-traced label ID;
[0009] Based on the traceability cloud platform, the target processing array is transmitted to the request terminal corresponding to the processing traceability request, and the processing traceability of the traditional Chinese medicine decoction pieces to be traced is completed.
[0010] Preferably, the step of performing a standardization analysis on the processing and preparation video based on the traceability cloud platform to generate a processing analysis result includes:
[0011] Based on the traceability cloud platform, obtain the text information corresponding to the processing and preparation video, and perform processing step recognition on the processing and preparation video based on each time point in the text information to obtain a plurality of processing and preparation sub-videos, where one processing and preparation sub-video corresponds to one processing step;
[0012] For each processing and preparation sub-video, determine the corresponding text step information from the text information, and obtain the reference text information corresponding to the processing and preparation sub-video;
[0013] Perform a text standardization analysis on the text step information based on the reference text information to generate a text analysis result, and when the text analysis result is a valid result, obtain the video parameters and duration corresponding to the processing and preparation sub-video;
[0014] Calculate the video parameters and the duration based on a first preset random number algorithm to generate a random number corresponding to the processing and preparation sub-video, and the calculation formula corresponding to the first preset random number algorithm is:
[0015]
[0016] where k represents the random number, f() represents a function for comparing sizes and taking the smaller value, t represents the duration, T represents a preset time interval parameter, R1 and R2 respectively represent the first pixel and the second pixel of the resolution in the video parameters, F represents the frame rate in the video parameters, B represents the bit rate in the video parameters, and γ represents an adjustment parameter corresponding to the frame rate and the bit rate;
[0017] Extract a plurality of image frames from the processing and preparation sub-video based on the random number, and determine the preset sub-module corresponding to the processing and preparation sub-video in the preset recognition model of the traceability cloud platform;
[0018] Perform an operation standardization analysis on the plurality of image frames based on the preset sub-module to generate an operation analysis result, and generate the processing analysis result by combining the text analysis result and the operation analysis result.
[0019] Preferably, after the step of performing an operation standardization analysis on the plurality of image frames based on the sub-module to generate an operation analysis result includes:
[0020] Determine whether the operation analysis result is a valid result. If it is a valid result, calculate the random number based on the second preset random number algorithm to generate a new random number. The second preset random number algorithm is as follows:
[0021]
[0022] where k represents the random number, g() represents the function of taking the smaller value, int represents taking the integer value, t represents the duration, mod represents the modulo value, and if represents the condition for establishment;
[0023] Based on the new random number, perform the step of extracting multiple image frames from the processed and prepared sub-video based on the random number to generate a new operation analysis result, and generate the processing analysis result according to the new operation analysis result;
[0024] If the operation analysis result is not a valid result, perform the step of generating the processing analysis result by combining the text analysis result and the operation analysis result, where the generated processing analysis result is an invalid result.
[0025] Preferably, the step of performing text standardization analysis on the text step information based on the reference text information to generate a text analysis result includes:
[0026] Divide the text step information into multiple keywords, and determine whether the number of the multiple keywords is consistent with the reference number corresponding to the reference text information;
[0027] If they are consistent, generate keyword vectors for each keyword based on the arrangement order of each keyword in the text step information, and calculate the text similarity value between the keyword vectors and the reference vectors corresponding to the reference text information;
[0028] Determine whether the text similarity value is greater than or equal to a preset similarity threshold. If it is greater than the preset similarity threshold, generate the text analysis result as a valid result;
[0029] If the text similarity value is less than the preset similarity threshold, determine the reference keywords corresponding to each keyword in the reference text information based on the arrangement order, and calculate the word similarity between each keyword and the reference keyword;
[0030] Generate the text analysis result according to each word similarity.
[0031] Preferably, the step of identifying processing steps for the processed and prepared video based on each time point in the text information to obtain multiple processed and prepared sub-videos includes:
[0032] Determine the corresponding text time points of each of the said time points in the processing and preparation video, and for each of the said text time points, extract at least four text frames from the processing and preparation video. The four text frames include a first text frame corresponding to the text time point, a second text frame earlier than the text time point, and a third text frame and a fourth text frame later than the text time point;
[0033] Perform grayscale conversion on the first text frame, the second text frame, the third text frame, and the fourth text frame to obtain a first grayscale image, a second grayscale image, a third grayscale image, and a fourth grayscale image;
[0034] Calculate a first similarity value between the first grayscale image and the second grayscale image, a second similarity value between the second grayscale image and the third grayscale image, and a third similarity value between the third grayscale image and the fourth grayscale image;
[0035] When both the first similarity value and the third similarity value are greater than a preset similarity threshold, and the second similarity value is less than the preset similarity threshold, take the text time point as the processing step recognition time point of the processing and preparation video, and divide the processing and preparation video into preparation sub-videos corresponding to different processing steps based on each of the processing step recognition time points.
[0036] Preferably, before the step of determining the preset sub-module corresponding to the preparation sub-video in the preset recognition model of the traceability cloud platform, it includes:
[0037] Obtain the standard sample image and the abnormal sample image corresponding to the Chinese herbal pieces and the preparation sub-video, and train the initial sub-module in the preset initial model based on the standard training images in the standard sample image and the abnormal training images in the abnormal sample image;
[0038] When the number of single training times of the initial sub-module reaches the preset number of times, verify the initial sub-module respectively based on the standard verification images in the standard sample image and the abnormal verification images in the abnormal sample image to generate a standard verification result and an abnormal verification result;
[0039] Calculate the standard verification result and the abnormal verification result respectively based on a preset calculation formula to obtain a standard loss value and an abnormal loss value, and perform an addition operation on the standard loss value and the abnormal loss value to generate a loss function value corresponding to the initial sub-module. The preset calculation formula is:
[0040]
[0041] Wherein, L represents the loss value, n represents the number of verification images, pi represents the image type result corresponding to the i-th verification image in the verification result, pi0 represents the reference image type result corresponding to the i-th verification image, X ni and Y ni respectively represent the minimum pixel coordinates of the recognition frame corresponding to the i-th verification image in the verification result, X ni0 and Y ni0 respectively represent the minimum pixel coordinates of the reference recognition frame corresponding to the i-th verification image, X fi and Y fi respectively represent the maximum pixel coordinates of the recognition frame corresponding to the i-th verification image in the verification result, X fi0 and Y fi0 respectively represent the maximum pixel coordinates of the reference recognition frame corresponding to the i-th verification image, wi and hi respectively represent the width and height of the recognition frame corresponding to the i-th verification image in the verification result, wi0 and hi0 respectively represent the width and height of the reference recognition frame corresponding to the i-th verification image, s represents the loss scale factor of the initial sub-module, m represents the loss parameter of the initial sub-module, θi represents the verification result corresponding to the i-th verification image in the verification result, and θi0 represents the reference verification result corresponding to the i-th verification image;
[0042] Judge whether both the standard loss value and the abnormal loss value are less than a first preset threshold, and whether the loss function value is less than a second preset threshold. If both the standard loss value and the abnormal loss value are less than the first preset threshold, and the loss function value is less than the second preset threshold, generate a change trend parameter corresponding to the preset function value, and generate the initial sub-module into a preset sub-module according to the change trend parameter;
[0043] Judge whether both the standard loss value and the abnormal loss value are less than a first preset threshold, and whether the loss function value is less than a second preset threshold. If both the standard loss value and the abnormal loss value are less than the first preset threshold, and the loss function value is less than the second preset threshold, generate a change trend parameter corresponding to the preset function value, and generate the initial sub-module into a preset sub-module according to the change trend parameter.
[0044] Preferably, the step of generating the label ID, the processing and preparation video, and the processing analysis result into a processing data group for storage based on the traceability cloud platform includes:
[0045] Generate a first key-value pair based on the traceability cloud platform with the label ID and the processing analysis result, wherein the label ID is generated as the first key of the first key-value pair, and the processing analysis result is generated as the first value corresponding to the first key in the first key-value pair;
[0046] Based on the traceability cloud platform, generate a second key-value pair with the label ID, the processing analysis result, and the processing and preparation video, wherein the label ID is generated as the second key of the second key-value pair, the processing analysis result is generated as the second value corresponding to the second key in the second key-value pair, and the processing and preparation video is generated as a subset corresponding to the second value in the second key-value pair;
[0047] Based on the traceability cloud platform, generate the first key-value pair and the second key-value pair into the processing data group for storage.
[0048] Preferably, the step of finding the target processing data group corresponding to the to-be-traced label ID includes:
[0049] Identify the request type of the processing traceability request. If the request type is a simple type, find the first type of processing data group corresponding to the to-be-traced label ID from each of the processing data groups, and use the first key-value pair in the first type of processing data group as the target processing data group;
[0050] If the request type is a complete type, find the second type of processing data group corresponding to the to-be-traced label ID from each of the processing data groups, and use the second key-value pair in the second type of processing data group as the target processing data group.
[0051] Furthermore, to achieve the above object, the present invention also provides a processing traceability system for traditional Chinese medicine decoction pieces. The processing traceability system includes a traceability cloud platform, a reader-writer, and a video acquisition device communicatively connected to the traceability cloud platform;
[0052] The processing traceability system further includes a memory, a processor, a communication bus, and a control program stored on the memory:
[0053] The communication bus is used to realize the connection communication between the processor and the memory;
[0054] The processor is used to execute the control program to realize the steps of the processing traceability method for traditional Chinese medicine decoction pieces as described above.
[0055] Furthermore, to achieve the above object, the present invention also provides a medium. The medium is a readable storage medium, and a control program is stored on the readable storage medium. When the control program is executed by a processor, the steps of the processing traceability method for traditional Chinese medicine decoction pieces as described above are realized.
[0056] Processing traceability method, processing traceability system and medium for traditional Chinese medicine decoction pieces of the present invention. Among them, the processing traceability system includes a traceability cloud platform, a reader-writer and a video acquisition device communicatively connected to the traceability cloud platform. During the processing of traditional Chinese medicine decoction pieces, the reader-writer reads the label ID of the electronic label corresponding to the traditional Chinese medicine decoction pieces, and the video acquisition device acquires the processing and preparation video of the traditional Chinese medicine decoction pieces; then the label ID and the preparation processing video are transmitted to the traceability cloud platform, and the traceability cloud platform performs a normative analysis on the preparation processing video to generate a processing analysis result, and combines the processing analysis result with the label ID and the preparation processing video to generate a processing data group for storage; when the traceability cloud platform receives a processing traceability request, it first obtains the to-be-traced label ID of the to-be-traced traditional Chinese medicine decoction pieces carried therein, then finds the target processing data group corresponding to the to-be-traced label ID, and transmits the found target processing data group to the request terminal corresponding to the processing traceability request, completing the requirement of the request terminal to perform processing traceability on the to-be-traced traditional Chinese medicine decoction pieces. In this way, by acquiring the processing and preparation video during the processing of traditional Chinese medicine decoction pieces and analyzing the processing and preparation video, it is generated whether the processing operation of the traditional Chinese medicine decoction pieces is standardized and whether the inferior traditional Chinese medicine materials found during the processing are properly processed, and then the analysis result is stored based on the cloud platform together with the original processing and preparation video and the label ID, which is convenient for subsequent processing traceability of traditional Chinese medicine decoction pieces according to the label ID, and at the same time avoids the problems of small storage capacity of traditional labels and difficulty in storing the original processing and preparation video, realizing effective traceability of important information closely related to the quality in the processing link of traditional Chinese medicine decoction pieces. Brief Description of the Drawings
[0057] Figure 1 It is a schematic flowchart of the first embodiment of the processing traceability method for traditional Chinese medicine decoction pieces of the present invention;
[0058] Figure 2 It is a schematic flowchart of the second embodiment of the processing traceability method for traditional Chinese medicine decoction pieces of the present invention;
[0059] Figure 3 It is a schematic flowchart of the third embodiment of the processing traceability method for traditional Chinese medicine decoction pieces of the present invention;
[0060] Figure 4 It is a schematic flowchart of the fourth embodiment of the processing traceability method for traditional Chinese medicine decoction pieces of the present invention;
[0061] Figure 5 It is a schematic structural diagram of the hardware operating environment involved in one embodiment of the processing traceability system for traditional Chinese medicine decoction pieces of the present invention.
[0062] The realization, functional features and advantages of the purpose of the present invention will be further described with reference to the embodiments and the accompanying drawings. Detailed Embodiments
[0063] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0064] The present invention provides a processing traceability method for traditional Chinese medicine decoction pieces. Please refer to Figure 1 , Figure 1 which is a schematic flowchart of the first embodiment of the processing traceability method for traditional Chinese medicine decoction pieces of the present invention.
[0065] The embodiments of the present invention provide an embodiment of the processing traceability method for traditional Chinese medicine decoction pieces. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than here. Specifically, the processing traceability method for traditional Chinese medicine decoction pieces in this embodiment includes:
[0066] Step S10, during the processing of traditional Chinese medicine decoction pieces, based on the reader to read the label ID of the electronic tag corresponding to the traditional Chinese medicine decoction piece, and based on the video acquisition device to acquire the processing and preparation video of the traditional Chinese medicine decoction piece.
[0067] The processing traceability method for traditional Chinese medicine decoction pieces in this embodiment is applied to a processing traceability system. The processing traceability system can be set to include a traceability cloud platform, as well as a reader and a video acquisition device that are communicatively connected to the traceability cloud platform. Among them, the reader can be an RFID reader, which is used in conjunction with an RFID tag. The RFID tag is set on the Chinese medicinal materials to be processed. The RDIF reader can read the data of the RFID tag to view the relevant information of the Chinese medicinal materials to be processed, and write data to the RFID tag to write the relevant information of the processing process of the Chinese medicinal materials to be processed into the RFID tag, facilitating reading and viewing in subsequent links. The video acquisition device is used to acquire the processing and preparation video during the processing of the Chinese medicinal materials to be processed. Since the storage capacity of the RFID tag is small, in this embodiment, by setting up a traceability cloud platform, the acquired processing and preparation video is stored in the traceability cloud platform.
[0068] In addition, it should be noted that since the Chinese medicinal materials to be processed are processed to obtain Chinese medicinal pieces, the processing process of Chinese medicinal pieces is the process of processing the Chinese medicinal materials to be processed. During the processing process of Chinese medicinal pieces, the label ID of the electronic label corresponding to the Chinese medicinal pieces is read by a reader. The electronic label corresponding to the Chinese medicinal pieces is the RFID label set on the Chinese medicinal materials to be processed. Each Chinese medicinal material to be processed is provided with a different RFID label, and each RFID label has a label ID representing its uniqueness. At the same time, the processing and preparation video of the Chinese medicinal pieces is collected by a video acquisition device. The video acquisition device can be multiple cameras set in the processing environment of the Chinese medicinal materials to be processed. Different Chinese medicinal materials to be processed have different processing and preparation methods. For example, the processing and preparation method of cooked Panax notoginseng slices is: first wash the Panax notoginseng to obtain clean Panax notoginseng, then steam the clean Panax notoginseng for a certain time, cut thick slices and dry; the processing and preparation method of Schefflera arboricola is: remove impurities, spray, moisten slightly, slice or cut into sections and then dry; the processing and preparation method of Rheum palmatum is: first wash the Rheum palmatum and slice it to obtain clean Rheum palmatum, and stir-fry it over low heat according to the method of stir-frying with vinegar. Controlling the various operation videos of the Chinese medicinal materials to be processed captured by the camera during the processing and preparation process is the processing and preparation video.
[0069] Step S20: Transmit the label ID and the processing and preparation video to the traceability cloud platform, and perform a normative analysis on the processing and preparation video based on the traceability cloud platform to generate a processing analysis result.
[0070] Step S30: Generate a processing data group based on the label ID, the processing and preparation video, and the processing analysis result on the traceability cloud platform for storage.
[0071] Furthermore, the reader transmits the label ID of the read electronic label to the traceability cloud platform, and the video acquisition device also transmits the collected processing and preparation video to the traceability cloud platform. The traceability cloud platform receives the label ID and the processing and preparation video, and establishes a unique association relationship between the two. At the same time, the traceability cloud platform performs a normative analysis on the processing and preparation video. This normative analysis includes at least two aspects. One is to analyze whether the processing and preparation process of the Chinese medicinal materials to be processed is standardized, whether a certain process is missing, and whether each process is processed according to relevant specifications. The other is to analyze whether inferior Chinese medicinal materials to be processed are found during the processing and preparation process, and whether the treatment method for the inferior Chinese medicinal materials to be processed is standardized. Through this normative analysis, relevant processing analysis results are generated. Then, the processing analysis results are added to the association relationship established between the label ID and the processing and preparation video to generate a processing data group for storage, so as to facilitate subsequent tracing of the processing and preparation process of Chinese medicinal pieces based on this processing data group.
[0072] Step S40, when the traceability cloud platform receives a processing traceability request, it obtains the traceability tag ID of the Chinese herbal medicine to be traced carried in the processing traceability request, and searches for the target processing data group corresponding to the traceability tag ID.
[0073] Step S50: Based on the traceability cloud platform, the target processing array is transmitted to a request terminal corresponding to the processing traceability request to complete the processing traceability of the Chinese herbal medicine slices to be traced.
[0074] Furthermore, when there is a need to trace the processing of Chinese herbal medicines, a processing traceability request is triggered to the traceability cloud platform through the RFID tag set on the Chinese herbal medicine. When the traceability cloud platform receives the processing traceability request, it identifies the traceability tag ID of the Chinese herbal medicine to be traced, and compares the identified traceability tag ID with the tag ID of each stored processing data group, determines the target tag ID corresponding to the traceability tag ID, and searches for the processing data group with the target tag ID in each processing data group as the target processing data group. Then, the terminal that initiates the processing traceability request is used as the request terminal, and the searched target processing data group is transmitted to the request terminal to complete the processing traceability of the Chinese herbal medicine to be traced.
[0075] The processing traceability method of Chinese herbal medicine slices implemented in this embodiment, during the processing of Chinese herbal medicine slices, the tag ID of the electronic tag corresponding to the Chinese herbal medicine slice is read by the reader / writer, and the processing video of the Chinese herbal medicine slice is collected by the video acquisition device; then the tag ID and the processing video are transmitted to the traceability cloud platform, and the traceability cloud platform performs normative analysis on the processing video to generate a processing analysis result, and the processing analysis result is combined with the tag ID and the processing video to generate a processing data group for storage; when the traceability cloud platform receives a processing traceability request, it first obtains the traceability tag ID of the Chinese herbal medicine slice to be traced, and then finds out the target processing data group corresponding to the tag ID to be traced, and transmits the found target processing data group to the request terminal corresponding to the processing traceability request, so as to complete the request terminal's need to perform processing traceability on the Chinese herbal medicine slice to be traced. Therefore, by collecting and analyzing the processing videos of Chinese herbal medicines during processing, we can generate analysis results on whether the processing operations of Chinese herbal medicines are standardized and whether the inferior Chinese medicinal materials found in the processing process are properly handled in a standardized manner. Then, we can store the analysis results together with the original processing videos and label IDs on a cloud platform to facilitate the subsequent processing traceability of Chinese herbal medicines based on the label IDs. At the same time, we can avoid the problem of storing traceability data in traditional labels with small storage capacity and difficulty in storing original processing videos, thereby achieving effective traceability of important information closely related to the quality of Chinese herbal medicines in the processing link.
[0076] For further information, please refer toFigure 2 , based on the first embodiment of the processing traceability method for traditional Chinese medicine cut pieces of the present invention, a second embodiment of the processing traceability method for traditional Chinese medicine cut pieces of the present invention is proposed.
[0077] The difference between the second embodiment of the processing traceability method for traditional Chinese medicine cut pieces and the first embodiment of the processing traceability method for traditional Chinese medicine cut pieces is that the step of generating a processing analysis result by performing a standardization analysis on the processing and preparation video based on the traceability cloud platform includes:
[0078] Step S21, obtaining text information corresponding to the processing and preparation video based on the traceability cloud platform, and performing processing step recognition on the processing and preparation video based on each time point in the text information to obtain a plurality of processing and preparation sub-videos, wherein one processing and preparation sub-video corresponds to one processing step;
[0079] Furthermore, there is corresponding text information for the processing and preparation video. This text information is the text related to the operation steps uploaded by the processing operator for each processing step during the processing of traditional Chinese medicine cut pieces, used to represent the specific operation steps for processing and preparing traditional Chinese medicine cut pieces. For example, information such as the steaming temperature, steaming start time, and steaming end time recorded during the steaming operation, and information such as the drying temperature, drying start time, and drying end time recorded during the drying operation. This type of information can be uploaded to the traceability cloud platform together with the processing and preparation video. The traceability cloud platform can divide the processing and preparation video according to this text information to facilitate the analysis of the standardization of each operation step. Specifically, the traceability cloud platform finds the corresponding text information from the uploaded processing and preparation video, and performs processing step recognition on the processing and preparation video based on each time point recorded in the text information. Identify the image frames corresponding to each time point in the processing and preparation video as text frames, and use the time points corresponding to each text frame as the segmentation points of the processing steps. Divide the processing and preparation video according to each segmentation point to obtain the video data between two adjacent text frames as the processing and preparation sub-video. Among them, the number of processing and preparation sub-videos obtained by segmentation is the same as the number of steps in the processing operation of traditional Chinese medicine cut pieces, and one processing and preparation sub-video corresponds to one processing step.
[0080] Furthermore, in order to ensure the accuracy of the division of each processing and preparation sub-video, multiple corresponding text frames can be extracted for each time point, and segmentation can be performed according to the similarity level between the text frames. Specifically, the step of performing processing step recognition on the processing and preparation video based on each time point in the text information to obtain a plurality of processing and preparation sub-videos includes:
[0081] Step S211: Determine the corresponding text time points of each of the said time points in the processing and preparation video, and for each of the said text time points, extract at least four text frames from the processing and preparation video. The four text frames include a first text frame corresponding to the text time point, a second text frame earlier than the text time point, and a third text frame and a fourth text frame later than the text time point.
[0082] Step S212: Perform grayscale conversion on the first text frame, the second text frame, the third text frame, and the fourth text frame to obtain a first grayscale image, a second grayscale image, a third grayscale image, and a fourth grayscale image.
[0083] Step S213: Calculate a first similarity value between the first grayscale image and the second grayscale image, a second similarity value between the second grayscale image and the third grayscale image, and a third similarity value between the third grayscale image and the fourth grayscale image.
[0084] Step S214: When both the first similarity value and the third similarity value are greater than a preset similarity threshold, and the second similarity value is less than the preset similarity threshold, use the text time point as the processing step identification time point of the processing and preparation video, and divide the processing and preparation video into preparation sub-videos corresponding to different processing steps based on each of the processing step identification time points.
[0085] Further, determine the corresponding text time points of each time point in the text information in the processing and preparation video, that is, identify the time points corresponding to each time point recorded in the processing and preparation video and the text information as the text time points. For example, if the text information records that drying is performed at 10:15 on March 21, 2023, and the acquisition start time of the processing and preparation video is 10:00 on March 21, 2023, then identify the position point at the 15-minute duration of the processing and preparation video as the text time point for the drying operation step. Then, around each text time point, extract at least four text frames from the processing and preparation video. This extraction around the text time point means extracting text frames near the text time point. The four extracted text frames include a first text frame at the position of the text time point, a second text frame at a position earlier than the text time point, and a third text frame and a fourth text frame at two positions later than the text time point. That is, in the order of time, the arrangement order of the four text frames is: the second text frame, the first text frame, the third text frame, and the fourth text frame.
[0086] Further, for the convenience of processing the similarity of the four text frames, the first text frame, the second text frame, the third text frame, and the fourth text frame are subjected to grayscale conversion to obtain the first grayscale image, the second grayscale image, the third grayscale image, and the fourth grayscale image. Furthermore, the similarity between the first grayscale image and the second grayscale image is calculated to obtain a first similarity value indicating the level of similarity between the two; the similarity between the second grayscale image and the third grayscale image is calculated to obtain a second similarity value indicating the level of similarity between the two; and the similarity between the third grayscale image and the fourth grayscale image is calculated to obtain a third similarity value indicating the level of similarity between the two. Moreover, in order to represent the level of similarity, a preset similarity threshold is set in advance, and the calculated first similarity value, second similarity value, and third similarity value are all compared with the preset similarity threshold to determine the size relationship between each of them and the preset similarity threshold.
[0087] Further, if both the first similarity value and the third similarity value are greater than the preset similarity threshold, and the second similarity value is less than the preset similarity threshold, it indicates that the similarity between the first text frame and the second text frame is high, the similarity between the third text frame and the fourth text frame is high, while the similarity between the first text frame and the third text frame is low, and the processing steps reflected in the video content before the first text frame directly corresponding to the text time point are different from those reflected in the video content after. At this time, the text time point corresponding to the first text frame constitutes the processing step recognition time point of the processed video, that is, the segmentation point of the processing step. After identifying all the processing step recognition time points in the processed video, the processed video can be divided according to each processing step recognition time point to obtain processed sub-videos corresponding to different processing steps.
[0088] Furthermore, if it is determined through comparison that the first similarity value is not greater than the preset similarity threshold, or the third similarity threshold is not greater than the preset similarity threshold, or the second similarity threshold is not less than the preset similarity threshold, it indicates that the video content before and after the text time point does not accurately reflect different processing steps, and the text time point is not the accurate segmentation point of the processing steps in the processed video. At this time, at least four new text frames need to be re-extracted around the text time point. Among them, the corresponding extraction time can be preset. For example, when extracting for the first time, based on the text time point, the time 2 seconds earlier than it, and the times 2 seconds and 4 seconds later than it are respectively used as the extraction points for the second text frame, the third text frame, and the fourth text frame. After determining that the text time point is not the accurate segmentation point, the time is increased or decreased based on the original extraction time point. For example, the extraction is performed by reducing or increasing the time by 1 second as a whole. This cycle of adjustment is carried out until the obtained first similarity value and third similarity value are greater than the preset similarity threshold, and the second similarity value is less than the preset similarity threshold, and the text time point is determined as the processing step recognition time point.
[0089] Step S22: For each of the processed and prepared sub-videos, determine the corresponding text step information from the text information, and obtain the reference text information corresponding to the processed and prepared sub-video.
[0090] Step S23: Based on the reference text information, perform text standardization analysis on the text step information to generate a text analysis result. When the text analysis result is a valid result, obtain the video parameters and duration corresponding to the processed and prepared sub-video.
[0091] Step S24: Calculate the video parameters and the duration based on the first preset random number algorithm to generate a random number corresponding to the processed and prepared sub-video.
[0092] Step S25: Extract multiple image frames from the processed and prepared sub-video based on the random number, and determine the preset sub-module corresponding to the processed and prepared sub-video in the preset recognition model of the traceability cloud platform.
[0093] Step S26: Based on the preset sub-module, perform operation standardization analysis on the multiple image frames to generate an operation analysis result, and generate the processing analysis result by combining the text analysis result and the operation analysis result.
[0094] Furthermore, in addition to the time points corresponding to the processing steps, the text information also has text step information indicating the specific processing methods of the processing steps. For each processed and prepared sub-video, the traceability server identifies the corresponding text step information from the text information, and at the same time obtains the reference text information corresponding to each processed and prepared sub-video. This reference text information reflects the reference processing methods that the processing steps corresponding to the processed and prepared sub-video should have. Then, based on this reference text information, text standardization analysis is performed on the text step information to generate relevant text analysis results, so as to determine whether the processing operator operates and processes according to the reference processing methods from the perspective of the standardization of the uploaded text. Among them, the text analysis results include two categories: valid results and invalid results. A valid result indicates that the uploaded text information reflects that the processing operator operates and processes according to the reference processing methods, and an invalid result indicates that the uploaded text information reflects that the processing operator does not operate and process according to the reference processing methods.
[0095] Furthermore, for the processed and prepared sub-video that is determined to be valid through text normalization analysis, it is necessary to continue with the operational normalization analysis of this processed and prepared sub-video. Specifically, the video parameters and duration corresponding to this processed and prepared sub-video are obtained. Among them, the obtained video parameters at least include pixels, frame rate, bit rate, etc., so as to generate a random number based on the video parameters and duration, and extract image frames from the processed and prepared sub-video according to this random number, so that the extracted image frames have a high degree of relevance to the video quality of the processed and prepared sub-video, and better reflect the processing operation process.
[0096] Specifically, a first preset random number algorithm is pre-set. The video parameters and duration are calculated through this first preset random number algorithm, and the calculation result is used as the random number corresponding to the processed and prepared video, so as to extract image frames from the processed and prepared video according to this random number. Among them, the specific calculation formula of the first preset random number algorithm can be seen in the following formula (1).
[0097]
[0098] Among them, k represents the random number, f() represents a function that compares sizes and takes the smaller value, t represents the duration, T represents the preset time interval parameter, R1 and R2 respectively represent the first pixel and the second pixel of the resolution in the video parameters, F represents the frame rate in the video parameters, B represents the bit rate in the video parameters, and γ represents the adjustment parameter corresponding to the frame rate and bit rate. By calculating the ratio between the duration of the processed and prepared sub-video and the preset time interval parameter, and the calculation result obtained by calculating based on the first pixel, second pixel, frame rate, and bit rate in the video parameters, and comparing the size relationship between the two by the comparison function, the smaller one is selected as the random number, so as to extract more image frames from the processed and prepared sub-video and better reflect the processing details of the processed and prepared sub-video. Among them, the first pixel and the second pixel can be directly taken from the resolution of the processed and prepared sub-video. For example, for a resolution of 1920*1200, the first pixel value is 1920 and the second pixel value is 1200. At the same time, the adjustment parameter corresponding to the frame rate and bit rate can be pre-set through experiments. Different adjustment parameters are set according to different frame rates and bit rates. Then, each adjustment parameter adjusts the bit rate and frame rate according to formula (1) to obtain different calculation results, and tests the influence of the random numbers generated by different calculation results on the extraction of image frames, and selects the adjustment parameter with the best extraction effect as the final adjustment parameter.
[0099] Further, after obtaining a random number through the first preset random number algorithm, multiple image frames of the processed sub-video can be extracted based on this random number. For example, if the random number is 5, an image frame is extracted from the processed sub-video every 5 seconds. A preset recognition model is pre-trained in the traceability cloud platform, and this preset recognition model is trained into different preset sub-modules according to different processing steps of traditional Chinese medicine decoction pieces. One preset sub-module corresponds to one processing step, and is trained by the sample data corresponding to this processing step and is dedicated to processing the data of this processing step, making the processing of the processing step more efficient and accurate. For the multiple image frames extracted from the processed sub-video, a preset sub-module corresponding to this processed sub-video is determined from the preset recognition model, and this preset sub-module performs an operation standardization analysis on each image frame to analyze whether the actual processing operation corresponding to the processed sub-video is a standard operation, and generates a corresponding operation analysis result. Furthermore, the text analysis result generated by the text standardization analysis and the operation analysis result generated by this operation standardization analysis are combined into a processing analysis result to reflect whether the text information uploaded by the processing operator corresponding to the processing step of the processed sub-video is standard, and whether the actual processing operation is standard.
[0100] Furthermore, the operation analysis results generated by the standard operation analysis also include two categories: valid results and invalid results. For valid results, in order to ensure the accuracy of the standard operation analysis, this embodiment generates a new random number and extracts new image frames based on this new random number to perform the operation standardization analysis again. Specifically, after the step of performing an operation standardization analysis on multiple said image frames based on the sub-module and generating an operation analysis result, the following steps are included:
[0101] Step S27, determine whether the operation analysis result is a valid result. If it is a valid result, calculate the random number based on the second preset random number algorithm to generate a new random number;
[0102] Step S28, based on the new random number, execute the step of extracting multiple image frames from the processed sub-video based on the random number to generate a new operation analysis result, and generate the processing analysis result according to the new operation analysis result;
[0103] Step S29, if the operation analysis result is not a valid result, execute the step of combining the text analysis result and the operation analysis result into the processing analysis result, where the generated processing analysis result is an invalid result.
[0104] Further, a second preset random number algorithm is preset. After generating the operation analysis result, the operation analysis result is judged to determine whether it is a valid result. If it is a valid result, the random number generated according to the first preset random number algorithm is updated and calculated by the second preset random number algorithm to generate a new random number for re-analysis. If it is an invalid result, the text analysis result and the operation result are directly generated into an invalid processing analysis result, indicating that the processing operator's actual processing operation corresponding to the processing step of the processing and processing sub-video is not standardized. Specifically, the calculation formula of the second preset random number algorithm can be seen in the following formula (2).
[0105]
[0106] Among them, k represents the random number, g() represents the function of taking the smaller value, int represents taking the integer value, t represents the duration, mod represents taking the modulus value, and if represents the establishment condition. The integer and modulus operations are performed on the duration of the processing and processing sub-video and the original random number, and the smaller value of the two is determined. The smaller value is compared with the original random number to judge whether it is less than the original random number. If it is less, the smaller value is used as the new random number. On the contrary, if the smaller value is greater than or equal to the original random number, half of the value of the original random number is used as the new random number. And if the original random number is odd, the new random number is preferably an integer less than and closest to half of its value. For example, if the original random number is 9, the new random number is 4. To extract as many image frames as possible from the processing and processing sub-video for analysis to make the analysis more accurate.
[0107] Furthermore, according to the new random number, multiple image frames are extracted from the processing and processing sub-video again for operation standardization analysis by the corresponding preset sub-module, a new operation analysis result is generated, and the new operation analysis result is combined with the text analysis result to generate a processing analysis result. Among them, if the new operation analysis result is still a valid result, it means that the processing operator's actual processing operation corresponding to the processing step of the processing and processing sub-video is standardized, and the generated processing analysis result is a valid result at this time. If the new operation analysis result is an invalid result, there is a difference between the first operation standardization analysis and the second operation standardization analysis, which may be a problem with the accuracy of the preset sub-module. At this time, the model parameters of the preset sub-module are updated according to the preset update mechanism, and the operation standardization analysis is performed again by the updated preset sub-module. If the two analysis results are still inconsistent, the operation analysis result is generated into an invalid result, so that the generated processing analysis result is an invalid result to ensure the operation standardization of each processing operation link of the Chinese herbal medicine pieces.
[0108] Among them, for the text normativity analysis, the steps of generating a text analysis result by performing text normativity analysis on the text step information based on the reference text information include:
[0109] Step S231, divide the text step information into multiple keywords, and determine whether the number of the multiple keywords is consistent with the reference quantity corresponding to the reference text information;
[0110] Step S232, if they are consistent, generate keyword vectors for each of the keywords based on the arrangement order of each keyword in the text step information, and calculate the text similarity value between the keyword vectors and the reference vectors corresponding to the reference text information;
[0111] Step S233, determine whether the text similarity value is greater than or equal to a preset similarity threshold. If it is greater than the preset similarity threshold, generate the text analysis result as a valid result;
[0112] Step S234, if the text similarity value is less than the preset similarity threshold, determine the reference keywords corresponding to each keyword in the reference text information based on the arrangement order, and calculate the word similarity between each keyword and the reference keyword;
[0113] Step S235, generate the text analysis result according to each word similarity.
[0114] Furthermore, the text step information is usually short text. For example, "Steam for 2 hours by the steaming method, then cut into slices with a thickness of 5 - 10 mm and dry for 1 h". When performing text normativity analysis on this type of text step information according to the reference text information, first perform word segmentation on the text step information, remove the words irrelevant to the processing steps, and obtain multiple keywords related to the processing steps. For example, for the above text step information of "Steam for 2 hours by the steaming method, then cut into slices with a thickness of 5 - 10 mm and dry for 1 h", the keywords obtained by division include the steaming method, steam for 2 hours, cut into slices with a thickness of 5 - 10 mm, and dry for 1 hour.
[0115] Further, the reference text information contains reference keywords corresponding to the processing steps. Count the number of the reference keywords as the reference quantity corresponding to the reference text information, and compare the number of the keywords obtained by dividing the text step information with this reference quantity to determine whether they are consistent. If they are consistent, it indicates that the processing information of the actual processing steps represented by the text step information has numerical identity with the processing information of the reference processing method. On the contrary, if they are inconsistent, it indicates that the actual processing steps lack some necessary information or add some unnecessary information. At this time, the text analysis result should be generated as an invalid result to indicate that there is an abnormality in the text step information uploaded by the operator along with the processing and preparation video.
[0116] Furthermore, for the case where the quantity is consistent with the reference, the word vectors corresponding to each keyword are obtained, and according to the arrangement order of each keyword in the text step information, the word vectors are combined to generate a keyword vector. For each reference keyword included in the reference text information, a corresponding reference vector can be preset. That is, according to the preset arrangement order of each reference keyword, the word vectors corresponding to each reference keyword are pre-combined to generate a reference vector corresponding to the reference text information. Among them, the arrangement order of each keyword in the text step information reflects the specific operation order of the processing operator in the processing steps, and the preset arrangement order of each reference keyword reflects the reference operation order that the traditional Chinese medicine cut pieces should have in this processing step.
[0117] Further, calculate the text similarity value between the keyword vector and the reference vector, and compare the calculated text similarity value with a preset similarity threshold set in advance to determine whether the text similarity value is greater than or equal to the preset similarity threshold. If it is greater than or equal to the preset similarity threshold, it indicates that the similarity degree between the keyword vector and the reference vector is high, and the text step information indicates that the processing operator operates according to the reference processing method, and the operation order is correct and effective. Therefore, the text analysis result generated at this time is an effective result.
[0118] On the contrary, if it is determined through comparison that the text similarity value is less than the preset similarity threshold, it indicates that there is a difference between the processing operation of the processing operator and the reference processing method. At this time, in order to determine the impact of the difference on the performance of the traditional Chinese medicine cut pieces, determine the reference keyword corresponding to each keyword in the reference text according to the arrangement order, that is, determine the reference keyword with the same arrangement order as each keyword. For example, the keywords divided by the text step information include A1, A2, A3, A4, and their arrangement orders in the text step information are the 1st, 2nd, 3rd, and 4th positions respectively. Then determine the reference keywords arranged in the 1st, 2nd, 3rd, and 4th positions in the reference text information as the reference keywords corresponding to A1, A2, A3, and A4 respectively. Furthermore, calculate the word similarity between each keyword and its corresponding reference keyword.
[0119] Furthermore, after calculating the word similarity corresponding to each keyword, a text analysis result is generated based on each word similarity. Among them, the text analysis result can also be divided into two categories: valid results and invalid results. Specifically, each word similarity value can also be compared with the preset similarity threshold, determine the size relationship between each word similarity value and the preset similarity threshold, and filter out the target word similarity value whose word similarity value is less than the preset similarity threshold. The existence of this type of target word similarity value makes the text similarity value less than the preset similarity threshold, and then find the keyword from which the target word similarity value comes, and determine whether the difference between the keyword and the reference keyword has an impact on the performance of the Chinese herbal medicine. If an impact is generated, the text analysis result is generated as an invalid result, otherwise if the impact is not significant, the text analysis result is generated as a valid result. In this way, the influence of unimportant factors on the text normative analysis is avoided.
[0120] This embodiment divides the processing and preparation video into multiple processing and preparation sub-videos according to the processing steps, and performs text standardization analysis and operation standardization analysis on each processing and preparation sub-video, so as to ensure the standardization of the text information uploaded by the processing operators for the processing steps corresponding to the processing sub-video, as well as the standardization of the actual processing operations, thereby ensuring the processing quality of Chinese herbal medicines during the processing process.
[0121] For further information, please refer to Figure 3 Based on the first and second embodiments of the processing traceability method of the Chinese herbal medicine slices of the present invention, a third embodiment of the processing traceability method of the Chinese herbal medicine slices of the present invention is proposed.
[0122] The third embodiment of the processing traceability method of Chinese herbal medicine pieces is different from the first and second embodiments of the processing traceability method of Chinese herbal medicine pieces in that the step of determining the preset submodule corresponding to the processing and preparation sub-video in the preset recognition model of the traceability cloud platform includes:
[0123] Step S60, obtaining the standard sample images and abnormal sample images corresponding to the Chinese herbal medicine pieces and the processing sub-video, and training the initial sub-module in the preset initial model based on the standard training images in the standard sample images and the abnormal training images in the abnormal sample images;
[0124] Step S70, when the number of single trainings for the initial submodule reaches a preset number, the initial submodule is verified based on the standard verification image in the standard sample image and the abnormal verification image in the abnormal sample image, respectively, to generate a standard verification result and an abnormal verification result;
[0125] Step S80: Calculate the standard verification result and the abnormal verification result respectively based on a pre-designed calculation formula to obtain a standard loss value and an abnormal loss value, and perform an addition operation on the standard loss value and the abnormal loss value to generate a loss function value corresponding to the initial sub-module;
[0126] Step S90: Determine whether both the standard loss value and the abnormal loss value are less than a first preset threshold, and whether the loss function value is less than a second preset threshold. If both the standard loss value and the abnormal loss value are less than the first preset threshold, and the loss function value is less than the second preset threshold, then generate a change trend parameter corresponding to the preset function value, and generate the initial sub-module into a preset sub-module according to the change trend parameter;
[0127] Step S100: If at least one of the standard loss value and / or the abnormal loss value is not less than the first preset threshold, and / or the loss function value is not less than the second preset threshold, then execute the step of training the initial sub-module in the preset initial model based on the standard training samples in the standard sample and the abnormal training samples in the abnormal sample.
[0128] Furthermore, for each preset sub-module corresponding to the processing and preparation sub-videos of different processing steps of traditional Chinese medicine decoction pieces in the preset recognition model, it is pre-trained through a large number of sample images corresponding to the processing and preparation sub-videos of traditional Chinese medicine decoction pieces. Among them, the sample images can be divided into standard sample images and abnormal sample images. The standard sample images represent the images of the normative operations in the processing and preparation sub-videos, and the abnormal sample images represent the images of the non-normative operations in the processing and preparation sub-videos. Obtain a large number of such standard sample images and abnormal sample images, and divide the standard sample images into standard training images for training and standard verification images for verification according to a preset ratio, and divide the abnormal sample images into abnormal training images for training and abnormal verification images for verification according to a preset ratio. The number of standard training images after division is more than the number of standard verification images, and the number of abnormal training images is more than the number of abnormal verification images.
[0129] Even further, a preset initial model is pre-set, and the preset initial model is set to include multiple initial sub-modules, and different initial sub-modules are used to process the processing and preparation sub-videos of different processing steps of traditional Chinese medicine decoction pieces. Determine the relevant initial sub-module according to the correspondence between the image sample and the processing and preparation sub-video, and train the initial sub-module with the divided standard training images and abnormal training images. A preset number of times for a single training is pre-set, and the number of training times is counted during the training process. When the counted number of times reaches the preset number of times, verify the trained initial sub-module with the standard verification images and abnormal verification images to generate a standard verification result and an abnormal verification result.
[0130] Furthermore, a predefined calculation formula is set for the initial sub-module in advance. By using this calculation formula, the standard verification result and the abnormal verification result are calculated respectively to obtain the corresponding standard loss value and abnormal loss value. Among them, the standard loss value represents the size of the standard difference between the standard verification result obtained by the initial sub-module processing the standard verification image and the reference result corresponding to the standard verification image. The smaller the standard loss value, the smaller the standard difference, and the better the processing effect of the initial sub-module on the standard image. The abnormal loss value represents the size of the abnormal difference between the abnormal verification result obtained by the initial sub-module processing the abnormal verification image and the reference result corresponding to the abnormal verification image. The smaller the abnormal loss value, the smaller the abnormal difference, and the better the processing effect of the initial sub-module on the abnormal image. In order to represent the overall processing effect of the initial sub-module, an addition operation is performed between the standard loss value and the abnormal loss value, and the operation result is used as the loss function value corresponding to the initial sub-module, representing the processing effect of the initial sub-module on the standard image and the abnormal image. Among them, the predefined calculation formula can be specifically referred to as the following formula (3).
[0131]
[0132] Among them, L represents the loss value, n represents the number of verification images, pi represents the image type result corresponding to the i-th verification image in the verification result, pi0 represents the reference image type result corresponding to the i-th verification image, X ni and Y ni respectively represent the minimum pixel coordinates of the recognition frame corresponding to the i-th verification image in the verification result, X ni0 and Y ni0 respectively represent the minimum pixel coordinates of the reference recognition frame corresponding to the i-th verification image, X fi and Y fi respectively represent the maximum pixel coordinates of the recognition frame corresponding to the i-th verification image in the verification result, X fi0 and Y fi0respectively represent the maximum pixel coordinates of the reference recognition frame corresponding to the i-th verification image, wi and hi respectively represent the width and height of the recognition frame corresponding to the i-th verification image in the verification result, wi0 and hi0 respectively represent the width and height of the reference recognition frame corresponding to the i-th verification image, s represents the loss scale factor of the initial sub-module, m represents the loss parameter of the initial sub-module, θi represents the verification result corresponding to the i-th verification image in the verification result, and θi0 represents the reference verification result corresponding to the i-th verification image. The pre-designed calculation formula includes type recognition loss, recognition frame loss, and recognition result loss. The type recognition loss represents the loss of the initial sub-module in recognizing whether the image is a standard image or an abnormal image. The recognition frame loss represents the loss of the initial sub-module in recognizing the position of the key information in the image, that is, the accuracy of the recognition frame position reflected by the minimum value, maximum value, width, and height of the coordinates. The recognition result loss represents the loss of the initial sub-module in recognizing whether the key information in the image is accurate. Through the division of these three parts of losses, it is beneficial to improve the accuracy of type recognition, position recognition, and information recognition of the initial sub-module.
[0133] For the above formula (3), when calculating the standard loss value, L represents the standard loss value, n represents the number of standard verification images, pi represents the image type result corresponding to the i-th standard verification image in the standard verification result, pi0 represents the reference image type result corresponding to the i-th standard verification image, X ni 、Y ni respectively represent the minimum pixel coordinates of the recognition frame corresponding to the i-th standard verification image in the standard verification result, X ni0 、Y ni0 respectively represent the minimum pixel coordinates of the reference recognition frame corresponding to the i-th standard verification image, X fi 、Y fi respectively represent the maximum pixel coordinates of the recognition frame corresponding to the i-th standard verification image in the standard verification result, X fi0 、Y fi0 respectively represent the maximum pixel coordinates of the reference recognition frame corresponding to the i-th standard verification image, wi and hi respectively represent the width and height of the recognition frame corresponding to the i-th standard verification image in the standard verification result, wi0 and hi0 respectively represent the width and height of the reference recognition frame corresponding to the i-th standard verification image, s represents the loss scale factor, m represents the loss parameter, θi represents the verification result corresponding to the i-th standard verification image in the standard verification result, and θi0 represents the reference verification result corresponding to the i-th standard verification image.
[0134] When calculating the abnormal loss value, L represents the abnormal loss value, n represents the number of abnormal verification images, pi represents the image type result corresponding to the i-th abnormal verification image in the abnormal verification result, pi0 represents the reference image type result corresponding to the i-th abnormal verification image, Xni and Y ni respectively represent the minimum pixel coordinates of the recognition frame corresponding to the i-th abnormal verification image in the abnormal verification result, X ni0 and Y ni0 respectively represent the minimum pixel coordinates of the reference recognition frame corresponding to the i-th abnormal verification image, X fi and Y fi respectively represent the maximum pixel coordinates of the recognition frame corresponding to the i-th abnormal verification image in the abnormal verification result, X fi0 and Y fi0 respectively represent the maximum pixel coordinates of the reference recognition frame corresponding to the i-th abnormal verification image. wi and hi respectively represent the width and height of the recognition frame corresponding to the i-th abnormal verification image in the abnormal verification result, wi0 and hi0 respectively represent the width and height of the reference recognition frame corresponding to the i-th abnormal verification image, s represents the loss scale factor, m represents the loss parameter, θi represents the verification result corresponding to the i-th abnormal verification image in the abnormal verification result, and θi0 represents the reference verification result corresponding to the i-th abnormal verification image.
[0135] Furthermore, in order to reflect the processing performance of the initial sub-module for standard images, abnormal images, and the overall situation, a first preset threshold and a second preset threshold are preset, and the first preset threshold is less than the second preset threshold. Compare the calculated standard loss value and abnormal loss value with the first preset threshold respectively, and compare the loss function value with the second preset threshold to determine whether both the standard loss value and the abnormal loss value are less than the first preset threshold, and whether the loss function value is less than the second preset threshold. If both the standard loss value and the abnormal loss value are less than the first preset threshold, and the loss function value is less than the second preset threshold, it indicates that the processing performance of the initial sub-module for standard images, abnormal images, and the overall situation is relatively good. At this time, combine the loss function value generated during the previous verification with the loss function value generated this time to generate a change trend parameter corresponding to the loss function value, and this change trend parameter reflects the change situation of the loss function value during each recent training process. If the generated change trend parameter reflects that the change of the loss function value is relatively stable, it indicates that the processing performance of the initial sub-module is relatively stable, so it can be determined as the preset sub-module. If the generated change trend parameter reflects that the change of the loss function value is unstable, it indicates that the processing performance of the initial sub-module can be optimized relatively, and the initial sub-module needs to be continuously trained.
[0136] Further, if it is determined by comparison that both the standard loss value and / or the abnormal loss value are not less than the first preset threshold, and / or the loss function value is not less than the second preset threshold, it indicates that the processing performance of the initial sub-module for the standard image and / or the abnormal image and / or the whole does not meet the requirements. Iterative training needs to be performed based on the standard training samples and the abnormal training samples until the calculated standard loss value and abnormal loss value are both less than the first preset threshold, the loss function value is less than the second preset threshold, and the generated change trend parameter reflects that the change of the loss function value is relatively stable. Then, stop the training of the initial sub-module and generate the initial sub-module into a preset sub-module.
[0137] In this embodiment, by setting the initial recognition model to include each initial sub-module corresponding to the processing and preparation sub-videos of different processing steps of traditional Chinese medicine decoction pieces, and obtaining the image samples corresponding to the processing and preparation sub-videos for training and verification, so that the processing and preparation sub-videos of each processing step are processed by the corresponding preset sub-module, which is beneficial to improving the processing efficiency and accuracy. At the same time, the loss of the initial sub-module is set to reflect the standard loss value of the processing performance of the standard image, the abnormal loss value of the processing performance of the abnormal image, and the loss function value of the overall performance. And the standard loss value and the abnormal loss value are divided into three types: type loss, position loss, and recognition loss, realizing multi-dimensional and comprehensive ensuring the accuracy of loss evaluation, so that the preset sub-module obtained by training has good performance in processing standard images and abnormal images.
[0138] Further, please refer to Figure 4 , based on the first, second, and third embodiments of the processing traceability method of traditional Chinese medicine decoction pieces of the present invention, a fourth embodiment of the processing traceability method of traditional Chinese medicine decoction pieces of the present invention is proposed.
[0139] The difference between the fourth embodiment of the processing traceability method of traditional Chinese medicine decoction pieces and the first, second, and third embodiments of the processing traceability method of traditional Chinese medicine decoction pieces is that the step of generating the label ID, the processing and preparation video, and the processing analysis result into a processing data group for storage based on the traceability cloud platform includes:
[0140] Step S31, generating a first key-value pair based on the traceability cloud platform with the label ID and the processing analysis result, where the label ID is generated as the first key of the first key-value pair, and the processing analysis result is generated as the first value corresponding to the first key in the first key-value pair;
[0141] Step S32: Based on the traceability cloud platform, generate a second key-value pair with the label ID, the processing analysis result, and the processing and preparation video. Among them, the label ID is generated as the second key of the second key-value pair, the processing analysis result is generated as the second value corresponding to the second key in the second key-value pair, and the processing and preparation video is generated as a subset corresponding to the second value in the second key-value pair.
[0142] Step S33: Based on the traceability cloud platform, generate the first key-value pair and the second key-value pair into the processing data group for storage.
[0143] Understandably, when tracing the processing link of traditional Chinese medicine decoction pieces, different traceability parties have different requirements. Some traceability parties only need to trace the processing standardization of the processing link of traditional Chinese medicine decoction pieces, and understand whether there are non-standard processing situations through the analysis results of the processing and preparation video. While other traceability parties need to comprehensively trace the processing link of traditional Chinese medicine decoction pieces. In addition to understanding whether there are non-standard processing situations through the analysis results of the processing and preparation video, they also need to view the processing and preparation video itself. For these two different traceability requirements, in the process of generating and storing the label ID, the processing and preparation video, and the processing analysis result into the processing data group by the traceability cloud platform of this embodiment, different traceable data are generated for the processing data group.
[0144] Specifically, generate the label ID and the processing analysis result into a first key-value pair. The first key-value pair includes two types of data: key and value. Generate the label ID as the first key among them, and the processing analysis result as the first value corresponding to the first key, so as to realize the quick search of the processing analysis result as the first value through the label ID as the first key.
[0145] At the same time, generate the label ID, the processing analysis result, and the processing and preparation video into a second key-value pair. The second key-value pair also includes two types of data: key and value. Use the label ID as the second key in the second key-value pair, and generate the processing analysis result as the second value corresponding to the second key in the second key-value pair. In addition, further extend the second value, and generate the processing and preparation video that generates the processing analysis result as a subset corresponding to the second value in the second key-value pair. Through the search of the label ID, the corresponding processing and preparation video and its corresponding processing analysis result can be quickly found. Then, the generated first key-value pair and second key-value pair are jointly used as the processing data group for storage to facilitate quick search and traceability during the traceability process.
[0146] Further, corresponding to different processing traceability requirements, the step of finding the target processing data group corresponding to the label ID to be traced includes:
[0147] Step S41: Identify the request type of the processing traceability request. If the request type is a simple type, search for the first type of processing data group corresponding to the to-be-traced label ID from each of the processing data groups, and use the first key-value pair in the first type of processing data group as the target processing data group;
[0148] Step S42: If the request type is a complete type, search for the second type of processing data group corresponding to the to-be-traced label ID from each of the processing data groups, and use the second key-value pair in the second type of processing data group as the target processing data group.
[0149] Furthermore, for the processing traceability request received by the traceability server, first identify its request type, whether it is a processing standardization request or a comprehensive traceability request. Since the processing standardization request only needs to trace the analysis results of the processing and preparation video, the request type of this type of traceability request is determined as a simple request. And the comprehensive traceability request needs to trace not only the analysis results of the processing and preparation video but also the processing and preparation video itself, so the request type of this type of traceability request is determined as a complete type. Moreover, different request types can be determined by the traceability identifier carried in the processing traceability request.
[0150] Further, if the request type determined by the traceability identifier is a simple type, compare the label ID of each stored processing data group with the to-be-traced label ID of the Chinese herbal pieces to be traced carried in the processing traceability request, and determine the target label ID corresponding to the to-be-traced label ID among the label IDs of each processing data group. Then, search for the processing data group with this target label ID from each of the processing data groups as the first type of processing data group corresponding to the to-be-traced label ID. Since the request type at this time is a simple type, the first key-value pair in the first type of processing data group is used as the target processing data group and transmitted to the request terminal corresponding to the processing traceability request to achieve traceability.
[0151] Furthermore, if the request type determined by the traceability identifier is a complete type, also compare the label ID of each stored processing data group with the to-be-traced label ID of the Chinese herbal pieces to be traced carried in the processing traceability request, and determine the target label ID corresponding to the to-be-traced label ID among the label IDs of each processing data group. Then, search for the processing data group with this target label ID from each of the processing data groups as the second type of processing data group corresponding to the to-be-traced label ID. Since the request type at this time is a complete type, the second key-value pair in the second type of processing data group is used as the target processing data group and transmitted to the request terminal corresponding to the processing traceability request to achieve traceability.
[0152] In this embodiment, by setting the processing data group as a data store containing the first key-value pair and the second key-value pair, and corresponding to different processing traceability requests, the first key-value pair or the second key-value pair is output for traceability, which is beneficial to meeting different traceability requirements. At the same time, it avoids the problem of only tracing with the first key-value pair and lacking the complete processing traceability process reflected by the processing and preparation video, and also avoids the problem of only tracing with the second key-value pair, which may affect the transmission efficiency to the requesting terminal due to the large amount of data in the processing and preparation video.
[0153] In addition, an embodiment of the present invention further provides a processing traceability system for traditional Chinese medicine decoction pieces. The processing traceability system for traditional Chinese medicine decoction pieces includes a traceability cloud platform, as well as a reader-writer and a video acquisition device communicatively connected to the traceability cloud platform. Please refer to Figure 5 , Figure 5 which is a schematic structural diagram of the hardware operating environment of the equipment involved in the embodiment scheme of the processing traceability system for traditional Chinese medicine decoction pieces of the present invention.
[0154] As Figure 5 shown, the processing traceability system for traditional Chinese medicine decoction pieces may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0155] Those skilled in the art can understand that Figure 5 the hardware structure of the processing traceability system for traditional Chinese medicine decoction pieces shown in
[0156] does not constitute a limitation on the processing traceability system for traditional Chinese medicine decoction pieces, and may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements. Figure 5 shown, the memory 1005 as a medium may include an operating system, a network communication module, a user interface module, and a control program. Among them, the operating system is a program for managing and controlling the processing traceability system for traditional Chinese medicine decoction pieces and software resources, and supports the operation of the network communication module, the user interface module, the control program, and other programs or software; the network communication module is used to manage and control the network interface 1004; the user interface module is used to manage and control the user interface 1003.
[0157] In Figure 5 In the hardware structure of the processing traceability system for traditional Chinese medicine decoction pieces shown, the network interface 1004 is mainly used to connect to the system server and communicate data with the system server; the user interface 1003 is mainly used to connect to the client (user side) and communicate data with the client; the processor 1001 can call the control program stored in the memory 1005 and perform the following operations:
[0158] During the processing of traditional Chinese medicine decoction pieces, based on the reader reading the label ID of the electronic tag corresponding to the traditional Chinese medicine decoction pieces, and based on the video acquisition device acquiring the processing and preparation video of the traditional Chinese medicine decoction pieces;
[0159] Transmit the label ID and the preparation processing video to the traceability cloud platform, and based on the traceability cloud platform, perform a normative analysis on the preparation processing video to generate a processing analysis result;
[0160] Based on the traceability cloud platform, generate the label ID, the preparation processing video, and the processing analysis result into a processing data group for storage;
[0161] When the traceability cloud platform receives a processing traceability request, obtain the to-be-traced label ID of the to-be-traced traditional Chinese medicine decoction pieces carried in the processing traceability request, and search for the target processing data group corresponding to the to-be-traced label ID;
[0162] Based on the traceability cloud platform, transmit the target processing array to the request terminal corresponding to the processing traceability request to complete the processing traceability of the to-be-traced traditional Chinese medicine decoction pieces.
[0163] Further, the step of performing a normative analysis on the preparation processing video based on the traceability cloud platform to generate a processing analysis result includes:
[0164] Based on the traceability cloud platform, obtain the text information corresponding to the preparation processing video, and based on each time point in the text information, perform a processing step identification on the preparation processing video to obtain a plurality of preparation processing sub-videos, wherein one of the preparation processing sub-videos corresponds to one processing step;
[0165] For each of the preparation processing sub-videos, determine the text step information corresponding to the preparation processing sub-video from the text information, and obtain the reference text information corresponding to the preparation processing sub-video;
[0166] Based on the reference text information, perform a text normative analysis on the text step information to generate a text analysis result, and when the text analysis result is a valid result, obtain the video parameters and duration corresponding to the preparation processing sub-video;
[0167] Calculate the video parameters and the duration based on a first preset random number algorithm to generate a random number corresponding to the processed and prepared sub-video. The calculation formula corresponding to the first preset random number algorithm is as follows:
[0168]
[0169] Where k represents the random number, f() represents a function for comparing sizes and taking the smaller value, t represents the duration, T represents a preset time interval parameter, R1 and R2 respectively represent the first pixel and the second pixel of the resolution in the video parameters, F represents the frame rate in the video parameters, B represents the bit rate in the video parameters, and γ represents an adjustment parameter corresponding to the frame rate and the bit rate;
[0170] Extract multiple image frames from the processed and prepared sub-video based on the random number, and determine a preset sub-module corresponding to the processed and prepared sub-video in the preset recognition model of the traceability cloud platform;
[0171] Perform an operation standardization analysis on the multiple image frames based on the preset sub-module to generate an operation analysis result, and generate the processing analysis result by combining the text analysis result and the operation analysis result.
[0172] Further, after the step of performing an operation standardization analysis on the multiple image frames based on the sub-module to generate an operation analysis result, the processor 1001 can call the control program stored in the memory 1005 and perform the following operations:
[0173] Judge whether the operation analysis result is a valid result. If it is a valid result, calculate the random number based on a second preset random number algorithm to generate a new random number. The second preset random number algorithm is as follows:
[0174]
[0175] Where k represents the random number, g() represents a function for taking the smaller value, int represents taking an integer value, t represents the duration, mod represents taking a modulus value, and if represents a condition for establishment;
[0176] Based on the new random number, execute the step of extracting multiple image frames from the processed and prepared sub-video based on the random number to generate a new operation analysis result, and generate the processing analysis result according to the new operation analysis result;
[0177] If the operation analysis result is not a valid result, execute the step of generating the processing analysis result by combining the text analysis result and the operation analysis result, where the generated processing analysis result is an invalid result.
[0178] Further, the step of performing text normalization analysis on the text step information based on the reference text information to generate a text analysis result includes:
[0179] Divide the text step information into multiple keywords, and determine whether the number of the multiple keywords is consistent with the reference quantity corresponding to the reference text information;
[0180] If they are consistent, based on the arrangement order of each keyword in the text step information, generate each keyword into a keyword vector, and calculate the text similarity value between the keyword vector and the reference vector corresponding to the reference text information;
[0181] Determine whether the text similarity value is greater than or equal to a preset similarity threshold. If it is greater than the preset similarity threshold, generate the text analysis result into a valid result;
[0182] If the text similarity value is less than the preset similarity threshold, based on the arrangement order, determine the reference keyword corresponding to each keyword in the reference text information, and calculate the word similarity between each keyword and the reference keyword;
[0183] Generate the text analysis result according to each word similarity.
[0184] Further, the step of performing processing step recognition on the processing and preparation video based on each time point in the text information to obtain multiple processing and preparation sub-videos includes:
[0185] Determine the text time points corresponding to each time point in the processing and preparation video, and for each text time point, extract at least four text frames from the processing and preparation video. The four text frames include a first text frame corresponding to the text time point, a second text frame earlier than the text time point, and a third text frame and a fourth text frame later than the text time point;
[0186] Perform grayscale conversion on the first text frame, the second text frame, the third text frame, and the fourth text frame to obtain a first grayscale image, a second grayscale image, a third grayscale image, and a fourth grayscale image;
[0187] Calculate a first similarity value between the first grayscale image and the second grayscale image, a second similarity value between the second grayscale image and the third grayscale image, and a third similarity value between the third grayscale image and the fourth grayscale image;
[0188] When both the first similarity value and the third similarity value are greater than a preset similarity threshold, and the second similarity value is less than the preset similarity threshold, the text time point is used as the processing step identification time point of the processing and preparation video, and the processing and preparation video is divided into preparation sub-videos corresponding to different processing steps based on each processing step identification time point.
[0189] Further, before the step of determining the preset sub-module corresponding to the processing and preparation sub-video in the preset recognition model of the traceability cloud platform, the processor 1001 may call the control program stored in the memory 1005 and perform the following operations:
[0190] Obtain the standard sample image and the abnormal sample image corresponding to the Chinese herbal pieces and the processing and preparation sub-video, and train the initial sub-module in the preset initial model based on the standard training images in the standard sample image and the abnormal training images in the abnormal sample image;
[0191] When the number of single training times of the initial sub-module reaches the preset number of times, verify the initial sub-module based on the standard verification images in the standard sample image and the abnormal verification images in the abnormal sample image respectively, and generate a standard verification result and an abnormal verification result;
[0192] Calculate the standard verification result and the abnormal verification result respectively based on a preset calculation formula, obtain a standard loss value and an abnormal loss value, and perform an addition operation on the standard loss value and the abnormal loss value to generate a loss function value corresponding to the initial sub-module. The preset calculation formula is:
[0193]
[0194] where L represents the loss value, n represents the number of verification images, pi represents the image type result corresponding to the i-th verification image in the verification result, pi0 represents the reference image type result corresponding to the i-th verification image, X ni 、Y ni respectively represent the minimum pixel coordinates of the recognition frame corresponding to the i-th verification image in the verification result, X ni0 、Y ni0 respectively represent the minimum pixel coordinates of the reference recognition frame corresponding to the i-th verification image, X fi 、Y fi respectively represent the maximum pixel coordinates of the recognition frame corresponding to the i-th verification image in the verification result, X fi0 、Y fi0respectively represent the maximum pixel coordinates of the reference recognition frame corresponding to the i-th verification image, wi and hi respectively represent the width and height of the recognition frame corresponding to the i-th verification image in the verification result, wi0 and hi0 respectively represent the width and height of the reference recognition frame corresponding to the i-th verification image, s represents the loss scale factor of the initial sub-module, m represents the loss parameter of the initial sub-module, θi represents the verification result corresponding to the i-th verification image in the verification result, and θi0 represents the reference verification result corresponding to the i-th verification image;
[0195] Determine whether both the standard loss value and the abnormal loss value are less than a first preset threshold, and whether the loss function value is less than a second preset threshold. If both the standard loss value and the abnormal loss value are less than the first preset threshold, and the loss function value is less than the second preset threshold, generate a change trend parameter corresponding to the preset function value, and generate the initial sub-module into a preset sub-module according to the change trend parameter;
[0196] Determine whether both the standard loss value and the abnormal loss value are less than a first preset threshold, and whether the loss function value is less than a second preset threshold. If both the standard loss value and the abnormal loss value are less than the first preset threshold, and the loss function value is less than the second preset threshold, generate a change trend parameter corresponding to the preset function value, and generate the initial sub-module into a preset sub-module according to the change trend parameter.
[0197] Further, the step of generating a processing data group from the label ID, the processing and preparation video, and the processing analysis result based on the traceability cloud platform for storage includes:
[0198] Generate a first key-value pair from the label ID and the processing analysis result based on the traceability cloud platform, where the label ID is generated as the first key of the first key-value pair, and the processing analysis result is generated as the first value corresponding to the first key in the first key-value pair;
[0199] Generate a second key-value pair from the label ID, the processing analysis result, and the processing and preparation video based on the traceability cloud platform, where the label ID is generated as the second key of the second key-value pair, the processing analysis result is generated as the second value corresponding to the second key in the second key-value pair, and the processing and preparation video is generated as a subset corresponding to the second value in the second key-value pair;
[0200] Generate the processing data group from the first key-value pair and the second key-value pair based on the traceability cloud platform for storage.
[0201] Further, the step of finding the target processing data group corresponding to the label ID to be traced includes:
[0202] Identify the request type of the processing traceability request. If the request type is a simple type, search for the first type of processing data group corresponding to the label ID to be traced from each of the processing data groups, and use the first key-value pair in the first type of processing data group as the target processing data group;
[0203] If the request type is a complete type, search for the second type of processing data group corresponding to the label ID to be traced from each of the processing data groups, and use the second key-value pair in the second type of processing data group as the target processing data group.
[0204] The specific implementation manner of the processing traceability system for traditional Chinese medicine decoction pieces in the present invention is basically the same as each embodiment of the above-mentioned processing traceability method for traditional Chinese medicine decoction pieces, and will not be elaborated here.
[0205] An embodiment of the present invention also proposes a medium. The medium is a readable storage medium, and a control program is stored on the readable storage medium. When the control program is executed by a processor, the steps of the processing traceability method for traditional Chinese medicine decoction pieces as described above are implemented.
[0206] The storage medium of the present invention can be a computer-readable storage medium, and its implementation manner is basically the same as each embodiment of the above-mentioned processing traceability method for traditional Chinese medicine decoction pieces, and will not be elaborated here.
[0207] The embodiments of the present invention have been described above in conjunction with the accompanying drawings. However, the present invention is not limited to the above specific implementation manners. The above specific implementation manners are merely illustrative and not restrictive. Under the inspiration of the present invention, those of ordinary skill in the art can also make many forms without departing from the spirit and scope protected by the present invention and the claims. Any equivalent structural or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied to other related technical fields, all fall within the protection scope of the present invention.
Claims
1. A processing traceability method for traditional Chinese medicine decoction pieces, characterized in that, Applied to a processing traceability system, the processing traceability system includes a traceability cloud platform, a reader-writer, and a video acquisition device that are communicatively connected to the traceability cloud platform. The processing traceability method for traditional Chinese medicine decoction pieces includes: During the processing of traditional Chinese medicine decoction pieces, based on the reader-writer, read the label ID of the electronic label corresponding to the traditional Chinese medicine decoction pieces, and based on the video acquisition device, acquire the processing and preparation video of the traditional Chinese medicine decoction pieces; Transmit the label ID and the preparation processing video to the traceability cloud platform, and based on the traceability cloud platform, perform a normative analysis on the processing and preparation video to generate a processing analysis result; Based on the traceability cloud platform, generate a processing data group from the label ID, the processing and preparation video, and the processing analysis result for storage; When the traceability cloud platform receives a processing traceability request, obtain the to-be-traced label ID of the to-be-traced traditional Chinese medicine decoction piece carried in the processing traceability request, and search for the target processing data group corresponding to the to-be-traced label ID; Based on the traceability cloud platform, transmit the target processing data array to the request terminal corresponding to the processing traceability request to complete the processing traceability of the to-be-traced traditional Chinese medicine decoction piece.
2. The processing traceability method of the traditional Chinese medicine decoction pieces according to claim 1, characterized in that, The step of performing a normative analysis on the processing and preparation video based on the traceability cloud platform to generate a processing analysis result includes: Based on the traceability cloud platform, obtain the text information corresponding to the processing and preparation video, and based on each time point in the text information, perform a processing step identification on the processing and preparation video to obtain a plurality of processing and preparation sub-videos, wherein one processing and preparation sub-video corresponds to one processing step; For each processing and preparation sub-video, determine the corresponding text step information from the text information, and obtain the reference text information corresponding to the processing and preparation sub-video; Based on the reference text information, perform a text normative analysis on the text step information to generate a text analysis result, and when the text analysis result is a valid result, obtain the video parameters and duration corresponding to the processing and preparation sub-video; Based on a first preset random number algorithm, calculate the video parameters and the duration to generate a random number corresponding to the processing and preparation sub-video. The calculation formula corresponding to the first preset random number algorithm is: where k represents the random number, f() represents a function of comparing sizes and taking the smaller value, t represents the duration, T represents a preset time interval parameter, R1 and R2 respectively represent the first pixel and the second pixel of the resolution in the video parameters, F represents the frame rate in the video parameters, B represents the bit rate in the video parameters, and γ represents an adjustment parameter corresponding to the frame rate and the bit rate; Based on the random number, extract a plurality of image frames from the processing and preparation sub-video, and determine the preset sub-module corresponding to the processing and preparation sub-video in the preset recognition model of the traceability cloud platform; Based on the preset sub-module, perform an operation normative analysis on the plurality of image frames to generate an operation analysis result, and generate the processing analysis result by combining the text analysis result and the operation analysis result.
3. The processing traceability method of traditional Chinese medicine pieces as described in claim 2, characterized in that, After the step of performing operation standardization analysis on the multiple image frames based on the sub-module and generating an operation analysis result, the following steps are included: Determine whether the operation analysis result is a valid result. If it is a valid result, calculate the random number based on a second preset random number algorithm to generate a new random number. The second preset random number algorithm is: where k represents the random number, g() represents the function of taking the smaller value, int represents taking the integer value, t represents the duration, mod represents the modulus value, and if represents the condition for establishment; Based on the new random number, execute the step of extracting multiple image frames from the processed and prepared sub-video based on the random number to generate a new operation analysis result, and generate the processing analysis result according to the new operation analysis result; If the operation analysis result is not a valid result, execute the step of generating the processing analysis result by combining the text analysis result and the operation analysis result, where the generated processing analysis result is an invalid result.
4. The processing traceability method of the traditional Chinese medicine decoction pieces according to claim 2, wherein, The step of performing text standardization analysis on the text step information based on the reference text information and generating a text analysis result includes: Divide the text step information into multiple keywords, and determine whether the number of the multiple keywords is consistent with the reference number corresponding to the reference text information; If they are consistent, generate keyword vectors for each keyword based on the arrangement order of each keyword in the text step information, and calculate the text similarity value between the keyword vectors and the reference vectors corresponding to the reference text information; Determine whether the text similarity value is greater than or equal to a preset similarity threshold. If it is greater than the preset similarity threshold, generate the text analysis result as a valid result; If the text similarity value is less than the preset similarity threshold, determine the reference keywords corresponding to each keyword in the reference text information based on the arrangement order, and calculate the word similarity between each keyword and the reference keyword; Generate the text analysis result according to each word similarity.
5. The processing traceability method for traditional Chinese medicine pieces as claimed in claim 2, wherein, The step of performing processing step recognition on the processed and prepared video based on each time point in the text information and obtaining multiple processed and prepared sub-videos includes: Determine the text time points corresponding to each time point in the processed and prepared video, and for each text time point, extract at least four text frames from the processed and prepared video. The four text frames include a first text frame corresponding to the text time point, a second text frame earlier than the text time point, and a third text frame and a fourth text frame later than the text time point; Convert the first text frame, the second text frame, the third text frame, and the fourth text frame into grayscale images to obtain a first grayscale image, a second grayscale image, a third grayscale image, and a fourth grayscale image; Calculate a first similarity value between the first grayscale image and the second grayscale image, a second similarity value between the second grayscale image and the third grayscale image, and a third similarity value between the third grayscale image and the fourth grayscale image; When both the first similarity value and the third similarity value are greater than a preset similarity threshold, and the second similarity value is less than the preset similarity threshold, the text time point is used as the processing step identification time point of the processing and preparation video, and the processing and preparation video is divided into preparation sub-videos corresponding to different processing steps based on each processing step identification time point.
6. The processing traceability method for traditional Chinese medicine decoction pieces according to claim 2, wherein, Before the step of determining the preset sub-module corresponding to the processing and preparation sub-video in the preset recognition model of the traceability cloud platform, it includes: Obtain the standard sample image and the abnormal sample image corresponding to the processed and prepared sub-video of the Chinese herbal pieces, and train the initial sub-module in the preset initial model based on the standard training image in the standard sample image and the abnormal training image in the abnormal sample image; When the number of single training times of the initial sub-module reaches the preset number of times, verify the initial sub-module based on the standard verification image in the standard sample image and the abnormal verification image in the abnormal sample image respectively, and generate a standard verification result and an abnormal verification result; Calculate the standard verification result and the abnormal verification result respectively based on a preset calculation formula to obtain a standard loss value and an abnormal loss value, and perform an addition operation on the standard loss value and the abnormal loss value to generate a loss function value corresponding to the initial sub-module. The preset calculation formula is: Among them, L represents the loss value, n represents the number of verification images, pi represents the image type result corresponding to the i-th verification image in the verification result, pi0 represents the reference image type result corresponding to the i-th verification image, X ni and Y ni respectively represent the minimum pixel coordinates of the recognition frame corresponding to the i-th verification image in the verification result, X ni0 and Y ni0 respectively represent the minimum pixel coordinates of the reference recognition frame corresponding to the i-th verification image, X fi and Y fi respectively represent the maximum pixel coordinates of the recognition frame corresponding to the i-th verification image in the verification result, X fi0 and Y fi0 respectively represent the maximum pixel coordinates of the reference recognition frame corresponding to the i-th verification image, wi and hi respectively represent the width and height of the recognition frame corresponding to the i-th verification image in the verification result, wi0 and hi0 respectively represent the width and height of the reference recognition frame corresponding to the i-th verification image, s represents the loss scale factor of the initial sub-module, m represents the loss parameter of the initial sub-module, θi represents the verification result corresponding to the i-th verification image in the verification result, and θi0 represents the reference verification result corresponding to the i-th verification image; Judge whether both the standard loss value and the abnormal loss value are less than a first preset threshold, and whether the loss function value is less than a second preset threshold. If both the standard loss value and the abnormal loss value are less than the first preset threshold, and the loss function value is less than the second preset threshold, then generate a change trend parameter corresponding to the preset function value, and generate the initial sub-module into a preset sub-module according to the change trend parameter; Judge whether both the standard loss value and the abnormal loss value are less than a first preset threshold, and whether the loss function value is less than a second preset threshold. If both the standard loss value and the abnormal loss value are less than the first preset threshold, and the loss function value is less than the second preset threshold, then generate a change trend parameter corresponding to the preset function value, and generate the initial sub-module into a preset sub-module according to the change trend parameter.
7. The processing traceability method of the traditional Chinese medicine decoction pieces according to any one of claims 1-6, characterized in that, The step of generating and storing the label ID, the processing and preparation video, and the processing analysis result into a processing data group based on the traceability cloud platform includes: Generate a first key-value pair based on the traceability cloud platform with the label ID and the processing analysis result. Among them, the label ID is generated as the first key of the first key-value pair, and the processing analysis result is generated as the first value corresponding to the first key in the first key-value pair; Generate a second key-value pair based on the traceability cloud platform with the label ID, the processing analysis result, and the processing and preparation video. Among them, the label ID is generated as the second key of the second key-value pair, the processing analysis result is generated as the second value corresponding to the second key in the second key-value pair, and the processing and preparation video is generated as the subset corresponding to the second value in the second key-value pair; Based on the traceability cloud platform, the first key-value pair and the second key-value pair are generated into the processing data group for storage.
8. The processing traceability method for traditional Chinese medicine decoction pieces according to claim 7, characterized in that, The step of finding the target processing data group corresponding to the to-be-traced label ID includes: Identifying the request type of the processing traceability request. If the request type is a simple type, searching for the first type of processing data group corresponding to the to-be-traced label ID from each of the processing data groups, and taking the first key-value pair in the first type of processing data group as the target processing data group; If the request type is a complete type, searching for the second type of processing data group corresponding to the to-be-traced label ID from each of the processing data groups, and taking the second key-value pair in the second type of processing data group as the target processing data group.
9. A processing traceability system for traditional Chinese medicine decoction pieces, characterized in that, The processing traceability system includes a traceability cloud platform, a reader-writer and a video acquisition device communicatively connected to the traceability cloud platform; The processing traceability system further includes a memory, a processor, a communication bus, and a control program stored on the memory: The communication bus is used to realize the connection communication between the processor and the memory; The processor is used to execute the control program to realize the steps of the processing traceability method of the traditional Chinese medicine decoction pieces as described in any one of claims 1-8.
10. A medium, characterized in that, The medium is a readable storage medium, and a control program is stored on the readable storage medium. When the control program is executed by the processor, the steps of the processing traceability method of the traditional Chinese medicine decoction pieces as described in any one of claims 1-8 are realized.