Pork information anomaly detection and traceability method based on Internet of Things

Through Internet of Things technology, the drug residue data of pigs is collected and analyzed, and the characteristic matrix and difference matrix are constructed. Combined with outlier factors and correlation coefficients, the problem of inability to accurately locate abnormal drugs and time points in the existing technology is solved, and pork is realized High accuracy and comprehensiveness of traceability.

CN118863928BActive Publication Date: 2024-12-06LUODING CITY JIN JIN FOODSTUFF LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411336633.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-25
Publication Date
2024-12-06
Estimated Expiration
2044-09-25

AI Technical Summary

Technical Problem

The prior art cannot accurately locate which drug is used to cause abnormal situations by pigs, and cannot accurately trace the time point when the abnormality occurs, and lacks guarantees for pork safety.

Method used

Through the Internet of Things pork information abnormality detection and traceability method, the drug residues of each pig are collected, the drug residue characteristics and difference matrix are constructed, the difference index and abnormal time points of abnormal pigs are calculated, and the LOF outlier factor algorithm is combined with the Correlation coefficient with Pearson, determine the sequence and time point of the abnormal drug residue.

Benefits of technology

Accurate screening of abnormal pigs and precise positioning of abnormal time points are achieved, the accuracy of pork traceability and comprehensive safety information are improved, and the accuracy of pork traceability is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118863928B_ABST
    Figure CN118863928B_ABST
Patent Text Reader

Abstract

The present application relates to the field of abnormality detection technology, and specifically to a pork information abnormality detection and traceability method based on the Internet of Things, constructing a drug residue feature matrix for each pig; obtaining a drug residue difference matrix based on the drug residue feature matrix of each pig and other pigs, thereby obtaining abnormal pigs; constructing a set of change factors for each drug residue sequence of normal pigs; obtaining a set of change factors for each abnormal pig; obtaining an abnormal drug residue sequence for each abnormal pig based on the set of change factors for normal pigs; calculating the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig to obtain each abnormal time point, and judging the abnormal situation of each pig. The evaluation results of abnormal pigs are more comprehensive, which improves the accuracy of abnormal pig screening and the accuracy of pork traceability positioning.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of anomaly detection technology, and specifically to a pork information anomaly detection and traceability method based on the Internet of Things. Background Art

[0002] The Internet of Things technology is a bridge connecting objects to the Internet, and it monitors, controls, and collects information about objects through sensors and communication technologies. In the management of pork safety information traceability, the Internet of Things technology can be used to monitor the pig breeding environment, feed conditions, health conditions, etc. in real time. Carrying out pork safety information traceability can ensure that the breeding and slaughtering processes meet certain standards and use drugs scientifically; it can also quickly identify the source of problematic pork, and promptly investigate and prevent risks; at the same time, it can optimize the production process and improve efficiency.

[0003] If there are any quality problems with the pork currently sold on the market, the pork can only be traced back to the breeding manufacturer. It is impossible to accurately locate which drug will cause abnormal reactions in the pigs, and it is impossible to solve the problem of drug abnormalities in a targeted manner, which is not conducive to exploring the causes of the abnormalities. Moreover, it is impossible to accurately locate and trace the time when the abnormality occurred, which lacks guarantee for the safety of edible pork. Summary of the invention

[0004] In order to solve the above technical problems, the present application provides a pork information anomaly detection and traceability method based on the Internet of Things to solve the existing problems.

[0005] The pork information anomaly detection and traceability method based on the Internet of Things in this application adopts the following technical solutions:

[0006] An embodiment of the present application provides a pork information anomaly detection and tracing method based on the Internet of Things, the method comprising the following steps:

[0007] The residues of various drugs in each pig at different collection times are collected to form a residue sequence of various drugs in each pig;

[0008] Construct a drug residue characteristic matrix for each pig based on the drug residue sequence of each pig; obtain the difference index of each pig based on the drug residue characteristic matrix of each pig and other pigs, and construct a drug residue difference matrix based on the difference index between each pig; obtain abnormal pigs based on the drug residue difference matrix, and mark the remaining pigs as normal pigs; construct the change factor of each drug residue sequence of normal pigs;

[0009] Construct a set of change factors according to the change factors of each drug residue sequence of normal pigs; obtain the set of change factors of each abnormal pig; obtain the abnormal drug residue sequence of each abnormal pig based on the set of change factors of normal pigs; calculate the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig; obtain each abnormal time point according to the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig;

[0010] The abnormal condition of each pig was determined based on the drug residue sequence of each abnormal pig at each abnormal time point.

[0011] Preferably, the step of constructing a drug residue feature matrix for each pig according to the drug residue sequence for each pig comprises:

[0012] For each pig, the drug residue sequence of each pig is used as each column data in the drug residue characteristic matrix of the pig to obtain the drug residue characteristic matrix of the pig.

[0013] Preferably, the difference index of each pig is obtained according to the drug residue characteristic matrix between each pig and other pigs, including:

[0014] For each pig, calculate the DTW distance between the drug residue sequence in the corresponding column of the drug residue feature matrix of the pig and any other pig;

[0015] The mean of the DTW distances between all corresponding columns in the drug residue feature matrix of a pig and any other pigs was taken as the difference index of the pigs.

[0016] Preferably, obtaining abnormal pigs according to the drug residue difference matrix includes:

[0017] The LOF outlier factor algorithm is used on the drug residue difference matrix to obtain the LOF value of each element, and the elements with LOF values ​​greater than the abnormal score threshold are marked as abnormal elements;

[0018] Pigs whose number of abnormal elements in each row is greater than the abnormal number threshold are marked as abnormal pigs.

[0019] Preferably, the variation factors for constructing the sequence of drug residues in normal pigs include:

[0020] For each drug residue sequence, calculate the maximum value, average value and variance of the second-order difference sequence of the drug residue sequence of each normal pig;

[0021] The product of the maximum value, the average value and the variance of the second-order difference sequence is calculated, and the mean of the product of all normal pigs is used as the variation factor of the drug residue sequence of normal pigs.

[0022] Preferably, the abnormal drug residue sequence of each abnormal pig is obtained based on the variation factor set of normal pigs, including:

[0023] Obtain the set of change factors for each abnormal pig;

[0024] For each abnormal pig, when the absolute value of the difference between each corresponding element in the change factor set of the abnormal pig and the normal pig is greater than the range threshold, the corresponding drug residue sequence of the abnormal pig is marked as an abnormal drug residue sequence.

[0025] Preferably, the calculation of the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig includes:

[0026] For each peak of each abnormal drug residue sequence of each abnormal pig, obtain the time shift distance of the peak;

[0027] The average value of the corresponding peak value of the drug residue sequence of normal pigs is obtained, the absolute value of the difference between the peak value and the average value is calculated, and the product of the absolute value of the difference and the time shift distance of the peak value is taken as the peak difference of the peak value.

[0028] Preferably, the step of obtaining the time-shift distance of the peak value includes:

[0029] Calculate the time average of the peak value at the time of the corresponding peak value of the drug residue sequence of normal pigs;

[0030] The absolute value of the difference between the time at which the peak value occurs and the average value at the time is taken as the time shift distance of the peak value.

[0031] Preferably, the method of obtaining each abnormal time point according to the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig includes:

[0032] A peak threshold is set; the moment when the peak difference of each peak value of each abnormal drug residue sequence of each abnormal pig is greater than the peak threshold is recorded as the abnormal time point.

[0033] Preferably, the method of judging the abnormal condition of each pig according to the drug residue sequence of each abnormal pig at each abnormal time point includes:

[0034] For each abnormal pig, when there is only one drug residue sequence at the abnormal time point of the abnormal pig, the safety information traceability can be completed based on the abnormal time point;

[0035] When there is more than one drug residue sequence at the abnormal time point of the abnormal pig, the Pearson correlation coefficient between any two drug residue sequences is calculated; when the Pearson correlation coefficient is greater than the relevant threshold, it means that the two drugs have an abnormal phenomenon caused by mutual influence; when the Pearson correlation coefficient is less than the relevant threshold, it means that the two drugs do not have an abnormal phenomenon caused by mutual influence; based on the abnormal time point and the abnormal phenomenon, the safety information traceability is completed.

[0036] This application has at least the following beneficial effects:

[0037] This application constructs a drug residue feature matrix for each pig, and constructs a drug residue difference matrix based on the similarity index between all drug residue feature matrices, so as to determine the abnormal pigs, which is conducive to the judgment of different absorption conditions of the same drug by different pigs in real scenarios, and is not limited to the abnormal judgment of the same drug, so that the results of evaluating abnormal pigs are more comprehensive and the accuracy of screening abnormal pigs is improved;

[0038] At the same time, by analyzing the differences in the drug residue feature matrices between abnormal pigs and normal pigs, the drug residue sequence that causes the pig abnormality is determined. By comparing the differences between the peak values ​​of the abnormal drug residue sequence and the normal drug residue sequence, the abnormal time point is determined, and the abnormal points in the safety information of each pig can be accurately traced. Finally, the safety information traceability is completed by analyzing the abnormal time points, thereby improving the accuracy of pork traceability positioning. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0040] Figure 1 A flowchart of a pork information anomaly detection and traceability method based on the Internet of Things provided in one embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to further explain the technical means and effects adopted by the present application to achieve the predetermined invention purpose, the following is a detailed description of the specific implementation method, structure, characteristics and effects of the pork information anomaly detection and traceability method based on the Internet of Things proposed in this application in combination with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.

[0042] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.

[0043] The specific scheme of the pork information anomaly detection and traceability method based on the Internet of Things provided by this application is described in detail below with reference to the accompanying drawings.

[0044] An embodiment of the present application provides a method for detecting and tracing pork information anomalies based on the Internet of Things.

[0045] Specifically, the following pork information anomaly detection and traceability method based on the Internet of Things is provided. Please refer to Figure 1 , the method comprises the following steps:

[0046] Step S001, obtaining safety information of all pigs in the farm.

[0047] This embodiment proposes a management method for tracing pork safety information through digital data processing technology. RFID electronic ear tags are installed on pigs from birth to record their basic information, including birth time, gender, types of drugs used in the breeding process, dosage, injection time, etc., and urine of the pigs is collected one week after each drug injection. The drug residue in the urine is detected by chromatography-mass spectrometry and the data is recorded.

[0048] Before the pigs are slaughtered, the electronic ear tags of the pigs are scanned and the basic information is uploaded to the central database. The basic information of all pigs is analyzed to see if it meets the slaughter standards. If it does, they will be slaughtered. A unique barcode label is affixed to each piece of pork cut in the slaughterhouse. The barcode contains the pig's RFID electronic ear tag information and cutting batch information. The barcode information data is then uploaded to the central database and associated with the pig's digital identity. Anyone can scan the barcode label to obtain the pig's safety information.

[0049] In this embodiment, the drug residue detection components for pigs include: antibiotics, hormone drugs, etc. of pigs, the first Drug residue sequence of test results , , , They respectively represent the 1st, 2nd and Uth drug residues in the tth test result of the pig labeled n.

[0050] At this point, according to the above method of the embodiment, the safety information of all pigs in the farm can be obtained as the basic information for the traceability management of pork safety information.

[0051] Step S002, determining the abnormal time point of each pig according to the safety information of each pig.

[0052] Obtain the safety information of each pig from the central database, and construct a drug residue feature matrix for each pig based on the drug residue sequence of each pig. For example, the drug residue characteristic matrix It can be expressed as:

[0053]

[0054] In the formula, is the drug residue characteristic matrix of the pig numbered n, , , Represents the residue sequence of the first, second, and U drugs in the pig numbered n. , , , They respectively represent the residues of the first drug in the pig labeled n in the 1st, 2nd and Tth tests.

[0055] Abnormal pigs with drug residues are screened out by comparing the similarities of the drug residue feature matrices among all pigs. In this embodiment, each column of data in the drug residue feature matrix represents the residues of the same type of drugs at different times. Therefore, when calculating the similarities between the drug residue feature matrices, the difference index of the drug residue feature matrix is ​​constructed with each column of data in the matrix as the analysis object.

[0056] For the label And the label is The difference index between the corresponding drug residue feature matrices of pigs is calculated as follows:

[0057]

[0058] In the formula, Indicates the label is Pigs and pigs numbered The drug residue characteristic matrix corresponding to the pigs and The difference index between , Respectively represent the labels , The first Column residue sequence, for Distance function, is the total number of columns in the drug residue feature matrix.

[0059] It should be noted that here, by calculating the relationship between all corresponding columns in the two drug residue feature matrices The mean of the distance is used as an indicator of the difference between the two pigs. Considering the different absorption of the same drug by different pigs, the greater the difference, the greater the possibility that the pigs are abnormal.

[0060] Calculate the difference index of each pig with all other pigs and construct the drug residue difference matrix. pigs, then the drug residue difference index is , in the matrix Line The elements of the column are numbered The pigs with the label The elements on the diagonal represent the difference between each pig and itself, and are set to 0, which means that each pig does not differ from itself.

[0061] Here, the LOF local outlier factor algorithm is used to screen abnormal pigs. The input of the algorithm is the drug residue similarity matrix and parameters , this embodiment sets , which can be set by the implementer, and the output is the LOF value of each element in the drug residue similarity matrix.

[0062] Elements with LOF values ​​greater than the anomaly score threshold are marked as anomaly elements. The LOF local outlier factor algorithm is a well-known technology and will not be described in detail. In this embodiment, the anomaly score threshold is set to 5.

[0063] Set an abnormal number threshold and calculate the number of abnormal elements in each row of the drug residue difference matrix. If the number exceeds the abnormal number threshold, mark the pigs in the row as abnormal pigs.

[0064] So far, the safety information of abnormal pigs can be obtained after screening. In the future, it is only necessary to compare each abnormal pig with the drug residue feature matrix of normal pigs to determine the abnormal drug sequence in the drug residue feature matrix of abnormal pigs. Drug residue characteristic matrix of normal pigs Take this as an example for analysis.

[0065] In order to analyze the characteristics of the drug residue feature matrix of normal pigs and further identify the abnormal conditions of abnormal pigs, the variation factors of the residue sequence of the drug residue feature matrix of normal pigs were constructed. For example, the variation factor of the first drug residue sequence of normal pigs is , the calculation process is as follows:

[0066]

[0067] In the formula, The variation factor of the residue sequence of the first drug in normal pigs, is the normal number of pigs, Indicates The maximum value of the residue sequence of the first drug in normal pigs, Indicates The average value of the residue sequence of the first drug in normal pigs, Indicates The variance of the second-order difference sequence of the residue sequence of the first drug in normal pigs, where the second-order difference sequence is composed of The first-order difference sequence of the residue sequence of the first drug in a normal pig is obtained by taking the difference of adjacent elements, and the first-order difference sequence is obtained by taking the first The residue sequence of the first drug in normal pigs was obtained by subtracting adjacent elements.

[0068] It should be noted that the above content takes the residue sequence of the first drug as an example. First, the maximum value, average value and variance of the second-order difference sequence of the residue sequence of the first drug of all normal pigs are calculated, and the variation factor of the residue sequence of the first drug of normal pigs is constructed by the average value of the product of the above three parameters. , which reflects the changes in the drug sequence under normal circumstances, and the change factors of the remaining drug residue sequences in normal pigs can be obtained by analogy.

[0069] The same calculation method is used to obtain the variation factors of the residue sequence of all drugs remaining in normal pigs. Finally, the variation factor set of all drug residue sequences in normal pigs can be obtained according to the above method. ,in, .

[0070] The same calculation method is used to calculate the change factors of all drug residue sequences in the drug residue feature matrix of each abnormal pig, and the change factor set of each abnormal pig is obtained, which is compared with the change factor set of the normal pig mentioned above. The elements were compared one by one to determine the sequence of drug residues that caused abnormalities in pigs.

[0071] Among them, a range threshold is set, and the change factor set of each abnormal pig is compared with each corresponding element of the change factor set of normal pigs. If the change factor of each drug of the abnormal pig is not within the upper and lower ranges of the change factor of each corresponding drug of the normal pig, the drug residue sequence of the abnormal pig is marked as an abnormal drug residue sequence. Among them, the upper limit of the upper and lower ranges is the change factor of the normal pig plus the range threshold, and the lower limit of the upper and lower ranges is the change factor of the normal pig minus the range threshold. In this embodiment, the range threshold is set to 7, and the implementer can set it by himself.

[0072] For each abnormal pig, it may be that the residues of multiple types of drugs are abnormal or the residues of one type of drug are abnormal. Since there are many detected drugs in the drug residue feature matrix, an example is given here. Assuming that the abnormal pig The residue sequence of the first drug in the drug residue feature matrix is ​​abnormal.

[0073] Since different pigs have different physiques and absorption capacities, when comparing abnormal drug residue sequences, the peak differences of each peak value of each abnormal drug residue sequence are constructed by comparison to determine the abnormal peak value, and the abnormal peak detection time is the abnormal time point.

[0074] For abnormal pigs The first abnormal drug residue sequence The peak difference calculation process of the peaks is as follows:

[0075]

[0076] In the formula, Indicates the residue amount of the first abnormal drug in the sequence The peak difference of the peaks; Indicates the residue amount of the first abnormal drug in the sequence The peak value, Indicates the residue sequence of the first abnormal drug in all normal pigs The average value of the peak values, Indicates abnormal pigs The first abnormal drug residue sequence The peak moment, Indicates the residue amount of the first abnormal drug in all normal pigs. The average value of the peak time. Indicates abnormal pigs The first abnormal drug residue sequence The peak time is the same as the residue sequence of the first abnormal drug in all normal pigs. The time shift distance of the average value at the time of the peak in the time series.

[0077] It should be noted that when The larger the value, the more abnormal the pigs are. The first abnormal drug residue sequence The peak value is the same as the residue sequence of the first abnormal drug in all normal pigs. The greater the difference in the average values ​​of the peaks, the greater the peak difference. The larger the value, the more likely the peak is an abnormal peak. The larger the value, the higher the residual amount of the first abnormal drug. The peak time is the same as the residue sequence of the first abnormal drug in all normal pigs. The greater the time shift distance between the average time values ​​of the peaks, the greater the peak difference. The larger it is, the more likely the peak is an abnormal peak.

[0078] Through the above calculation, the peak difference of all peaks in the residue sequence of the first abnormal drug can be obtained.

[0079] Normalize the peak differences of all the above peaks, and determine whether the corresponding peak is an abnormal peak by judging the peak difference. Here, the peak difference greater than the peak threshold The peak value is marked as an abnormal peak value, and the detection time corresponding to the abnormal peak value is the abnormal time point. The implementer can select according to the actual situation. 0.8.

[0080] At this point, each abnormal time point in the sequence of various abnormal drug residues in each abnormal pig can be obtained. The above content is based on the abnormal pig The abnormal time point was determined by taking the first abnormal drug residue sequence as an example. For the abnormal drug residue sequences of the remaining abnormal pigs, the abnormal time points were obtained in the same way as above.

[0081] Step S003, determine the abnormal cause of each pig based on the abnormal time point of each pig, and complete the traceability of pork safety information.

[0082] Based on the abnormal time points obtained in the previous step, analysis is carried out to determine the cause of the pig's abnormality.

[0083] For abnormal pigs, if only one type of drug residue is abnormal, then the safety information traceability can be completed by obtaining the abnormal time point of the abnormal drug residue sequence;

[0084] If the abnormal pigs only have abnormal residues of multiple types of drugs, then the correlation between the residue sequences of multiple types of drugs is analyzed to determine whether the abnormality is caused by the mutual influence of drugs.

[0085] Set relevant thresholds; for an abnormal pig, if it has abnormal time points at which the residues of two types of drugs are greater than or equal to each other, then calculate the Pearson coefficient of each type of abnormal drug residue sequence and the other abnormal drug residue sequences. When the Pearson coefficient of a certain type of abnormal drug residue sequence and another type of abnormal drug residue sequence is greater than the relevant threshold, it means that there is an abnormality caused by the mutual influence between the two types of drugs. For the abnormal pig, only the two drugs need to be injected in different time periods to complete the safety information traceability.

[0086] In this embodiment, the relevant threshold is set to 0.8, which can be set by the implementer.

[0087] In summary, the embodiment of the present application proposes a pork information anomaly detection and traceability method based on the Internet of Things, which obtains the safety information of all pigs, analyzes the drug residue feature matrix of each pig, determines the abnormal time point, and completes the pork safety information traceability.

[0088] The embodiment of the present application constructs a drug residue feature matrix for each pig, and constructs a drug residue difference matrix based on the similarity index between all drug residue feature matrices, so as to determine the abnormal pigs therein, which is conducive to realizing the judgment of different absorption conditions of the same drug by different pigs in real scenarios, and is not limited to the abnormal judgment of the same drug, so that the results of evaluating abnormal pigs are more comprehensive and the accuracy of screening abnormal pigs is improved;

[0089] At the same time, by analyzing the differences in the drug residue feature matrices between abnormal pigs and normal pigs, the drug residue sequence that causes the pig abnormality is determined. By comparing the differences between the peak values ​​of the abnormal drug residue sequence and the normal drug residue sequence, the abnormal time point is determined, and the abnormal points in the safety information of each pig can be accurately traced. Finally, the safety information traceability is completed by analyzing the abnormal time points, thereby improving the accuracy of pork traceability positioning.

[0090] It should be noted that the above sequence of the embodiments of the present application is for description only and does not represent the advantages and disadvantages of the embodiments. The above is a description of a specific embodiment of this specification. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0091] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0092] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Modifications to the technical solutions recorded in the aforementioned embodiments, or equivalent replacement of some of the technical features therein, do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A pork information anomaly detection and traceability method based on the Internet of Things, characterized in that: The method comprises the following steps: The residues of various drugs in each pig at different collection times are collected to form a residue sequence of various drugs in each pig; Construct a drug residue characteristic matrix for each pig based on the drug residue sequence of each pig; obtain the difference index of each pig based on the drug residue characteristic matrix of each pig and other pigs, and construct a drug residue difference matrix based on the difference index between each pig; obtain abnormal pigs based on the drug residue difference matrix, and mark the remaining pigs as normal pigs; construct the change factor of each drug residue sequence of normal pigs; Construct a set of change factors according to the change factors of each drug residue sequence of normal pigs; obtain the set of change factors of each abnormal pig; obtain the abnormal drug residue sequence of each abnormal pig based on the set of change factors of normal pigs; calculate the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig; obtain each abnormal time point according to the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig; Determine the abnormal condition of each pig based on the drug residue sequence at each abnormal time point of each abnormal pig; The difference index of each pig is obtained according to the drug residue characteristic matrix between each pig and other pigs, including: For each pig, calculate the DTW distance between the drug residue sequence in the corresponding column of the drug residue feature matrix of the pig and any other pig; The mean of the DTW distances between all corresponding columns in the drug residue feature matrix of a pig and any other pigs is used as the difference index of the pigs; The method of obtaining abnormal pigs according to the drug residue difference matrix includes: The LOF outlier factor algorithm is used on the drug residue difference matrix to obtain the LOF value of each element, and the elements with LOF values ​​greater than the abnormal score threshold are marked as abnormal elements; The pigs whose number of abnormal elements in each row is greater than the abnormal number threshold are marked as abnormal pigs; The variation factors for constructing the sequence of drug residues in normal pigs include: For each drug residue sequence, calculate the maximum value, average value and variance of the second-order difference sequence of the drug residue sequence of each normal pig; Calculate the product of the maximum value, the average value and the variance of the second-order difference sequence, and use the mean of the product of all normal pigs as the variation factor of the drug residue sequence of normal pigs; The abnormal drug residue sequence of each abnormal pig is obtained based on the variation factor set of normal pigs, including: Obtain the set of change factors for each abnormal pig; For each abnormal pig, when the absolute value of the difference between each corresponding element in the variation factor set of the abnormal pig and the normal pig is greater than the range threshold, the corresponding drug residue sequence of the abnormal pig is marked as an abnormal drug residue sequence; The calculation of the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig includes: For each peak of each abnormal drug residue sequence of each abnormal pig, obtain the time shift distance of the peak; Obtaining the average value of the corresponding peak value of the drug residue sequence corresponding to normal pigs, calculating the absolute value of the difference between the peak value and the average value, and taking the product of the absolute value of the difference and the time shift distance of the peak value as the peak difference degree of the peak value; The step of obtaining the time shift distance of the peak value includes: Calculate the time average of the peak value at the time of the corresponding peak value of the drug residue sequence of normal pigs; The absolute value of the difference between the peak moment and the average value at the said moment is taken as the time shift distance of the peak; The abnormal time points are obtained according to the peak difference of each peak of each abnormal drug residue sequence of each abnormal pig, including: A peak threshold is set; the moment when the peak difference of each peak value of each abnormal drug residue sequence of each abnormal pig is greater than the peak threshold is recorded as the abnormal time point.

2. The pork information anomaly detection and tracing method based on the Internet of Things as claimed in claim 1 is characterized in that: The method of constructing a drug residue feature matrix for each pig according to the drug residue sequence of each pig includes: For each pig, the drug residue sequence of each pig is used as each column data in the drug residue characteristic matrix of the pig to obtain the drug residue characteristic matrix of the pig.

3. The pork information anomaly detection and tracing method based on the Internet of Things as claimed in claim 1 is characterized in that: The method of judging the abnormal condition of each pig according to the drug residue sequence of each abnormal pig at each abnormal time point includes: For each abnormal pig, when there is only one drug residue sequence at the abnormal time point of the abnormal pig, the safety information traceability can be completed based on the abnormal time point; When there is more than one drug residue sequence at the abnormal time point of the abnormal pig, the Pearson correlation coefficient between any two drug residue sequences is calculated; when the Pearson correlation coefficient is greater than the relevant threshold, it means that the two drugs have an abnormal phenomenon caused by mutual influence; when the Pearson correlation coefficient is less than the relevant threshold, it means that the two drugs do not have an abnormal phenomenon caused by mutual influence; based on the abnormal time point and the abnormal phenomenon, the safety information traceability is completed.