A milk traceability method based on NFC

By deploying NFC tags and real-time monitoring equipment in all aspects of milk production, processing and transportation, combined with blockchain technology and deep learning models, the problem that existing technology cannot provide detection data in real time is solved, dynamic monitoring and data integration of milk quality is achieved, and traceability efficiency and system automation are improved.

CN119494668BActive Publication Date: 2025-04-18BEIJING PURE HI-TECH AGRICULTURE & ANIMAL HUSBANDRY TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411576005.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-06
Publication Date
2025-04-18
Estimated Expiration
2044-11-06

AI Technical Summary

Technical Problem

The existing NFC-based milk traceability method cannot provide detection data in real time, resulting in the traceability system lacking the dynamic monitoring ability of milk quality, and the detection data and traceability information are separated, making it impossible to integrate data and real-time feedback.

Method used

By deploying NFC tags and real-time monitoring devices in all aspects of milk production, processing and transportation, combining blockchain technology and deep learning models, data from each link can be recorded and analyzed in real time, and data integration and real-time feedback can be achieved.

Benefits of technology

It significantly improves the efficiency of milk traceability, realizes dynamic monitoring of milk quality, can timely identify potential quality problems, and improves the degree of automation of the system and the reliability of data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119494668B_ABST
    Figure CN119494668B_ABST
Patent Text Reader

Abstract

The present invention discloses a milk traceability method based on NFC, and relates to the technical field of milk traceability, including: the present invention combines NFC tags and blockchains, encrypts and transmits data in each link, stores data through the distributed ledger technology of blockchain, ensures data transparency and non-tamperability, and updates monitoring data of various stages of milk production, processing and transportation to blockchains based on NFC tags, significantly improves traceability efficiency, reduces manual participation, introduces deep learning models, realizes prediction and identification of potential quality problems of milk, helps enterprises take corrective measures in advance, reduces losses, and provides a risk warning mechanism for regulatory agencies, improves the overall security of the supply chain, and through NFC tags and blockchain technology, consumers can use NFC scanning devices to view complete traceability information of products, greatly improves consumers' trust in products, and can enhance brand credibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of milk traceability, and in particular to a milk traceability method based on NFC. Background Art

[0002] The milk traceability method based on NFC (near field communication) is mainly used to record and transmit basic information in the production, processing, transportation and other links of milk. Most of this information is static, such as production date, production location, supplier, etc. The main advantages of NFC technology are convenient data reading and strong real-time transmission capabilities. It can better realize the traceability of products from production to sales. However, when it comes to quality and safety monitoring of milk products, such as detecting adulteration and illegal additives, traditional traceability methods based on NFC have significant disadvantages.

[0003] Metabolomics is a technology that reflects the quality and source of food by analyzing changes in metabolites in organisms. It is used to analyze different metabolites in milk (such as fatty acids, proteins, amino acids, etc.), which can provide important information for adulteration detection. However, the existing NFC-based milk traceability method cannot process such metabolic information and cannot capture changes in metabolites in milk. When identifying adulteration, it lacks such data support.

[0004] Current rapid milk quality screening technologies, such as chromatography and mass spectrometry, can effectively detect illegal additives (melamine) and other harmful substances in milk. However, the current NFC-based milk traceability solution only records quality test results and cannot be combined with rapid screening technology. Traditional NFC tags cannot directly store complex mass spectrometry data or real-time analysis results. Therefore, when it comes to rapid detection of illegal additives in milk, NFC is only used as a tool for information transmission and cannot participate in more complex data processing and analysis.

[0005] For metabolomics and rapid screening, traditional solutions mostly send milk samples to laboratories for independent metabolomics testing or mass spectrometry analysis, which requires additional processing of milk samples and cannot provide real-time test data during the traceability process. Although it can provide accurate test results, it takes a long time, and the detection process is separated from the NFC tag system and lacks real-time performance. Therefore, there is an urgent need for an NFC-based milk traceability method to solve such problems. Summary of the invention

[0006] In view of the above existing problems, the present invention is proposed.

[0007] Therefore, the present invention provides a milk traceability method based on NFC to solve the problem that laboratory testing takes a long time and cannot provide test data in real time, resulting in the traceability system lacking the ability to dynamically monitor milk quality, and the test data and traceability information are separated, resulting in information isolation in the traceability process, and the inability to achieve data integration and real-time feedback.

[0008] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0009] The present invention provides a milk tracing method based on NFC, comprising:

[0010] Step S1, NFC tag initialization and embedding,

[0011] During the raw milk collection stage of milk production, a unique NFC tag is assigned to each batch of milk. The tag records basic information about the milk, including the source of the farm, the health status of the cow, the collection time, and the batch number. The health status of the cow is automatically uploaded through the health monitoring equipment.

[0012] Initialize the NFC tag, encrypt the tag and write the basic data into the blockchain;

[0013] Step S2, real-time quality detection and data update,

[0014] During the milk processing, namely the sterilization, filtration and homogenization stages, real-time monitoring equipment is installed to detect processing indicators, including protein content, fat content, acidity and temperature control.

[0015] The processing index detection is wirelessly connected to the NFC tag, and the processing index detection information is updated to the tag in real time and synchronized to the blockchain.

[0016] At this time, the NFC tag contains basic information and processing index detection information.

[0017] Step S3: cold chain transportation temperature monitoring and abnormal warning.

[0018] Temperature sensors are deployed during the transportation and storage of milk. NFC tags are combined with temperature sensors in transportation and storage to monitor the cold chain temperature in real time.

[0019] Step S4: Blockchain and deep learning data fusion analysis,

[0020] Using the full-chain data of production, processing and transportation stored in blockchain, a deep learning model is used to analyze the data trends of each link and identify potential quality problems:

[0021] Analyze the relationship between the transportation temperature and shelf life of multiple batches to identify the potential spoilage risk of a batch of milk.

[0022] Analyze processing index test information to identify adulteration (such as mixing milk with cheap milk) or illegal additives (such as melamine) during processing;

[0023] When the milk reaches the hands of consumers, they can use devices that support NFC scanning to scan the NFC tag on the milk package to view the complete production, processing, and transportation data chain, including the detected quality parameters, temperature monitoring records, and abnormal events. All data is saved through the blockchain, and consumers can rest assured that the data is authentic and reliable. This content can be used as a product feature;

[0024] The milk traceability system architecture adopted by the above NFC-based milk traceability method includes:

[0025] NFC tags, which record basic information, including farm origin, cow health, collection time, and batch number;

[0026] Real-time monitoring equipment is deployed in the milk processing link to detect processing indicators and output processing indicator detection information. The real-time monitoring equipment uses high-performance liquid chromatography HPLC and mass spectrometer MS;

[0027] The cold chain transportation monitoring module conducts real-time cold chain temperature monitoring during the transportation and storage of milk;

[0028] Data analysis module, used to analyze the full-chain data of production, processing and transportation and identify potential quality problems:

[0029] Analyze the relationship between the transportation temperature and shelf life of multiple batches to identify the potential spoilage risk of a batch of milk.

[0030] Analyze processing index detection information to identify adulteration in the processing link;

[0031] The blockchain database is used to store traceability data, including basic information and full-link data of production, processing and transportation.

[0032] Furthermore, in step S1, NFC tag initialization and basic data generation are performed:

[0033] The identifier ID is generated using a cryptographic hash function H(·) based on the hash value of the farm where the milk is produced, the health status of the cow, the collection time, and the batch number. NFC :

[0034] ID NFC=H(BatchID||FarmID||Timestamp), where BatchID represents the unique number of the milk production batch, FarmID represents the unique identifier of the farm, Timestamp represents the timestamp of the collection time, H(·) represents the cryptographic hash function, and ∥ represents the string concatenation operation;

[0035] The underlying data stored in the tag is encrypted using asymmetric encryption:

[0036] C=Enc(K priv ,D base ), where Enc(K priv ,D base ) indicates the use of private key K priv For basic data D base Perform encryption operation, D base Indicates basic information of milk, K priv Indicates the private key of the production phase;

[0037] Generate a digital signature: Sign(K priv ,H(C)), where H(C) represents the hashing of the encrypted data C, Sign(K priv ,H(C)) represents the process of signing the hash value H(C) with a private key to generate a digital signature;

[0038] Write data to the blockchain: T NFC ={ID NFC ,C,Sign}, where T NFC Represents a transaction written into the blockchain, ID NFC Represents the unique identifier of the NFC tag, C represents the encrypted basic data, and Sign represents the digital signature;

[0039] Will trade T NFC Broadcast to the blockchain network and verified by multiple nodes. After verification, the data is permanently written to the blockchain using the public key K pub Verify the transaction signature:

[0040] Verify(K pub ,Sign,H(C)), where,Verify(K pub ,Sign,H(C)) indicates the use of the public key K pub The process of verifying the signature, K pub It represents the public key corresponding to the production link, Sign represents the signature read from the NFC tag, and H(C) represents the hash value of the encrypted data C. If the verification is successful, the transaction is deemed valid and permanently recorded in the blockchain.

[0041] Furthermore, in step S2, the real-time quality detection and data update method is:

[0042] Define processing data D process As a processing data set, each D i Represents a specific indicator: D process ={D1,D2,D3,…,D n}, where D process represents the detection data set of the processing link, D i represents the i-th quality inspection index, and n represents the number of different inspection indexes;

[0043] For each D i , define its structure as D i =(V i ,T i ), where D i =(V i ,T i ), V i Represents the value of the i-th detection index, T i The timestamp representing the generation of the detection data;

[0044] A symmetric encryption algorithm is used to encrypt all detection data in the processing link, and the key K is used process After encryption, the encrypted data is:

[0045] C process =Enc(K process ,D process ), where C process represents the encrypted processing detection data, Enc(·) represents the symmetric encryption algorithm, K process Represents the symmetric key used for encryption;

[0046] The encrypted processed data C process The data is transmitted to the NFC tag in real time, and the data structure in the NFC tag is updated at any time. NFC , T NFC ∪{C process}, where T NFC represents all data currently stored on the NFC tag, including previous production data, and ∪ represents merging the encrypted processing inspection data into the NFC tag.

[0047] Furthermore, in step S2, the method of real-time quality detection and data update also includes:

[0048] After the NFC tag is updated, the data in the NFC tag is synchronized to the blockchain. Each synchronization forms a transaction T chain, the transaction contains the unique identification ID in the NFC tag NFC 、Encrypted data C process and timestamp information T s , that is, T chain ={ID NFC ,C process ,T s};

[0049] Each transaction T synchronized to the blockchain chain Verify the blockchain network nodes. Verification steps:

[0050] Using key K process After decryption, compare the data C on the NFC tag process Whether it matches the original data, verification method:

[0051] If Dec(K process ,C process )=D process , then Verify=True,

[0052] Otherwise, Verify = False, where Verify indicates the verification result, True indicates passing, False indicates failure, Dec(K process ,C process ) indicates the use of key K process Decrypt the encrypted data, D process Represents the original processing test data. If the verification is passed, the transaction T chain Permanently recorded in the blockchain.

[0053] Furthermore, in step S3, if the temperature fluctuates abnormally during transportation, an early warning is automatically generated, and the abnormal data is fed back to the data analysis module through the NFC tag, and the abnormal event is synchronously written into the blockchain.

[0054] Furthermore, in step S3, abnormal temperature fluctuation detection is performed, warning information is generated, and the data is synchronized to the blockchain. Specifically:

[0055] Based on the temperature sensors in the transportation process, real-time temperature data T(t) is collected, where t is the time variable. The ideal temperature range of cold chain transportation is [T min ,T max ], then the anomaly detection formula of the range is:

[0056] If T(t) <T min or T(t)>T max , then E(t)=1,

[0057] Otherwise, E(t) = 0, where T(t) represents the actual temperature data at a certain time t during the transportation process, T min , T max The lower and upper limits of the normal temperature range. E(t) indicates the abnormality detection result. 1 indicates abnormality and 0 indicates normality. When E(t) = 1, it means that a temperature abnormality is detected and an early warning is triggered.

[0058] Once a temperature anomaly is detected, the abnormal data is encrypted and transmitted to the data analysis module through the NFC tag. The symmetric encryption algorithm Enc(K, D) is used for encryption, where K temp is the key used for encryption. The abnormal data includes the abnormal temperature value T(t), time t, location L(t) and vehicle ID V id , encrypted data C temp Expressed as: C temp =Enc(K temp ,{T(t),t,L(t),V id}),

[0059] Encrypted data C temp Wireless transmission to the data analysis module via NFC tags.

[0060] Furthermore, in step S3, the method of generating the warning information is:

[0061] When a temperature anomaly is detected, an early warning signal is automatically generated. The early warning signal A(t) is defined as a discrete function, indicating when the early warning is triggered, namely:

[0062] If E(t) = 1, then A(t) = 1, otherwise A(t) = 0,

[0063] Among them, A(t) represents the warning signal, 1 means triggering the warning, and 0 means not triggering.

[0064] If A(t) = 1, the warning information and the encrypted abnormal data C temp The data analysis module is sent together, and abnormal events are synchronized to the blockchain;

[0065] Abnormal data C temp Synchronize to the blockchain, and each abnormal event is recorded as a transaction T chain , including NFC tag IDID NFC 、Encrypted data C temp And the warning signal A(t) and timestamp t s :

[0066] T chain ={ID NFC ,C temp ,A(t),t s}, the transaction T chain Through the verification mechanism of the blockchain network, it is recorded on the blockchain.

[0067] Furthermore, in step S3, blockchain verification is performed:

[0068] T per transaction chain Node verification is performed, and the verification steps include:

[0069] Using the symmetric decryption algorithm Dec(K temp ,C temp ) Decrypt the encrypted data and verify whether it is consistent with the original data. The verification formula is:

[0070] If Dec(K temp ,C temp )={T(t),t,L(t),V id}, then, Verify = True,

[0071] Otherwise, Verify = False, where Verify indicates the verification result, True indicates that the verification is passed, and False indicates that the verification fails. Dec(K temp ,C temp ) indicates the use of key K temp For abnormal data C temp To decrypt,

[0072] If the verification is successful, the abnormal event T chain Permanently recorded in the blockchain.

[0073] Furthermore, in step S4, the full-link data stored in the blockchain is used to analyze the relationship between transportation temperature and shelf life, and to identify adulteration or illegal additives in the processing link. Specifically:

[0074] Extract the full-link data from the blockchain, which are defined as:

[0075] D prod , that is, the data of the production process, D proc , i.e. processing data, D trans , i.e., transportation data;

[0076] Integrate the full-link data into a feature matrix X, where each row of X i Represents all features of a batch:

[0077] X i =[D prod,i ,D proc,i ,D trans,i] , where X i represents the full-link data vector of the i-th batch, D prod,i , Dproc,i , D trans,i They are production, processing and transportation data respectively;

[0078] Using a multi-layer feedforward neural network θ Analyze the relationship between the transportation temperature of multiple batches and the shelf life of milk. Assume that Y i is the shelf life of the i-th batch, and the neural network model is used to predict the shelf life:

[0079] Y i =f θ (D trans,i ) = f θ (T min,i ,T avg,i ,T max,i ,t trans,i ), where Y i represents the shelf life of the i-th batch of milk, T min,i ,T avg,i ,T max,i represents the minimum, average and maximum transportation temperature of the i-th batch, t trans,i represents the transportation time of the i-th batch, f θ represents a multi-layer feed-forward neural network with parameter θ, which is used to fit the relationship between transportation data and shelf life;

[0080] Minimize the loss function L(θ) and adjust the parameter θ:

[0081] Where L(θ) represents the loss function, i.e., the mean square error between the predicted value and the actual shelf life, and n represents the number of batches;

[0082] For adulteration in the processing stage, anomaly detection models are used to detect and define the quality characteristics of the processing stage D proc,i for:

[0083] D proc,i =[P i ,F i ,A i ], where P i represents the protein content of the i-th batch, F i represents the fat content of the i-th batch, A i represents the acidity of the i-th batch,

[0084] Build the Autoencoder model g φ (D proc,i ), compress the input features and reconstruct them. If the reconstruction error E recon If the threshold ∈ is exceeded, the batch is considered to be adulterated or illegally added:

[0085] Erecon =|D proc,i -g φ (D proc,i )|, where E recon represents the reconstruction error, that is, the difference between the processed data reconstructed by the autoencoder and the actual data, g φ represents the autoencoder model, with parameter φ, ∈ represents the error threshold, exceeding which triggers anomaly detection;

[0086] If E recon >∈, it is considered that the batch of milk may contain adulteration or illegal additives;

[0087] After identifying a batch of milk with potential quality problems, the abnormal data is synchronized to the blockchain, and the abnormal event record is set as E issue , including batch ID batch , Exception type E type and detection time t s ,Right now:

[0088] T issue ={ID batch ,E type ,t s}, where T issue Indicates the abnormal event transaction synchronized to the blockchain, ID batch A unique identifier for the abnormal batch, E type Indicates the exception type, t s Indicates the timestamp of the detected anomaly event.

[0089] The beneficial effects of the present invention are:

[0090] The present invention combines NFC tags with blockchain, encrypts data in every link for transmission, and stores it through the distributed ledger technology of blockchain to ensure data transparency and non-tamperability.

[0091] The present invention, based on NFC tags, updates the monitoring data of each stage of milk production, processing and transportation to the blockchain, significantly improving the traceability efficiency, while reducing manual participation and improving the automation level of the system.

[0092] This invention introduces a deep learning model to analyze the transportation temperature, processing data and other production indicators of multiple batches to predict and identify potential quality problems of milk. The intelligent identification function helps companies take corrective measures in advance to reduce losses, and provides a risk warning mechanism for regulatory agencies to improve the overall safety of the supply chain.

[0093] The present invention, through NFC tags and blockchain technology, gives consumers the ability to directly access data on the entire process of production, processing and transportation. Consumers can use NFC scanning devices to view the complete traceability information of the product, including the health status of the cows, quality inspection data of the processing link and temperature monitoring records during transportation, which greatly improves consumers' trust in the product and can enhance the credibility of the brand.

[0094] The present invention, through the combination of temperature sensors and NFC tags, can automatically generate early warning signals at the moment of detecting abnormal temperature, and encrypt and transmit them to the data analysis module, and synchronize them to the blockchain in time, so as to quickly respond to potential cold chain problems and reduce losses. BRIEF DESCRIPTION OF THE DRAWINGS

[0095] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.

[0096] Figure 1 This is a schematic diagram of the structure of the milk traceability system based on NFC of the present invention;

[0097] Figure 2 This is a schematic diagram of the process of the NFC-based milk traceability method of the present invention. DETAILED DESCRIPTION

[0098] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.

[0099] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0100] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.

[0101] Example 1, reference Figure 1 This embodiment provides a milk traceability system based on NFC, including:

[0102] NFC tags, which record basic information, including farm origin, cow health, collection time, and batch number;

[0103] Real-time monitoring equipment is deployed in the milk processing link to detect processing indicators and output processing indicator detection information. The real-time monitoring equipment uses high-performance liquid chromatography HPLC and mass spectrometer MS;

[0104] The cold chain transportation monitoring module conducts real-time cold chain temperature monitoring during the transportation and storage of milk;

[0105] Data analysis module, used to analyze the full-chain data of production, processing and transportation and identify potential quality problems:

[0106] Analyze the relationship between the transportation temperature and shelf life of multiple batches to identify the potential spoilage risk of a batch of milk.

[0107] Analyze processing index detection information to identify adulteration in the processing link;

[0108] The blockchain database is used to store traceability data, including basic information and full-link data of production, processing and transportation.

[0109] Example 2, reference Figure 2 This embodiment provides a milk traceability method based on NFC, comprising the following steps:

[0110] Step S1, NFC tag initialization and embedding,

[0111] During the raw milk collection stage of milk production, a unique NFC tag is assigned to each batch of milk. The tag records basic information about the milk, including the source of the farm, the health status of the cow, the collection time, and the batch number. The health status of the cow is automatically uploaded through the health monitoring equipment.

[0112] Initialize the NFC tag, encrypt the tag and write the basic data into the blockchain;

[0113] Specifically, the milk traceability system based on NFC technology assigns a unique NFC tag to each batch of milk in the production process, and ensures the immutability of the data through encryption and blockchain technology, thereby improving data security and enabling every transaction in the production process to be traced.

[0114] In step S1, NFC tag initialization and basic data generation are performed:

[0115] The identifier ID is generated using a cryptographic hash function H(·) based on the hash value of the farm where the milk is produced, the health status of the cow, the collection time, and the batch number. NFC :

[0116] ID NFC =H(BatchID||FarmID||Timestamp), where BatchID represents the unique number of the milk production batch, FarmID represents the unique identifier of the farm, Timestamp represents the timestamp of the collection time, H(·) represents the cryptographic hash function, and ∥ represents the string concatenation operation;

[0117] The underlying data stored in the tag is encrypted using asymmetric encryption:

[0118] C=Enc(K priv ,D base ), where Enc(K priv ,D base ) indicates the use of private key K priv For basic data D base Perform encryption operation, D base Indicates basic information of milk, K priv Indicates the private key of the production phase;

[0119] Generate a digital signature: Sign(K priv ,H(C)), where H(C) represents the hashing of the encrypted data C, Sign(K priv ,H(C)) represents the process of signing the hash value H(C) with a private key to generate a digital signature;

[0120] Write data to the blockchain: T NFC ={ID NFC ,C,Sign}, where T NFC Represents a transaction written into the blockchain, ID NFC Represents the unique identifier of the NFC tag, C represents the encrypted basic data, and Sign represents the digital signature;

[0121] Will trade T NFC Broadcast to the blockchain network and verified by multiple nodes. After verification, the data is permanently written to the blockchain using the public key K pub Verify the transaction signature:

[0122] Verify(K pub ,Sign,H(C)), where,Verify(K pub ,Sign,H(C)) indicates the use of the public key K pub The process of verifying the signature, K pub Indicates the public key corresponding to the production process, Sign indicates the signature read from the NFC tag, and H(C) indicates the hash value of the encrypted data C. If the verification is successful, the transaction is considered valid and permanently recorded in the blockchain;

[0123] Step S2, real-time quality detection and data update,

[0124] During the milk processing, namely the sterilization, filtration and homogenization stages, real-time monitoring equipment is installed to detect processing indicators, including protein content, fat content, acidity and temperature control.

[0125] The processing index detection is wirelessly connected to the NFC tag, and the processing index detection information is updated to the tag in real time and synchronized to the blockchain.

[0126] At this time, the NFC tag contains basic information and processing index detection information.

[0127] In step S2, the method of real-time quality detection and data update is:

[0128] Define processing data D process As a processing data set, each D i Represents a specific indicator: D process ={D1,D2,D3,…,D n}, where D process represents the detection data set of the processing link, D i represents the i-th quality inspection index, and n represents the number of different inspection indexes;

[0129] For each D i , define its structure as D i =(V i ,T i ), where D i =(V i ,T i ), V i Represents the value of the i-th detection index, T i The timestamp representing the generation of the detection data;

[0130] A symmetric encryption algorithm is used to encrypt all detection data in the processing link, and the key K is used process After encryption, the encrypted data is:

[0131] C process =Enc(K process ,D process ), where C process represents the encrypted processing detection data, Enc(·) represents the symmetric encryption algorithm, K process Represents the symmetric key used for encryption;

[0132] The encrypted processed data C processThe data is transmitted to the NFC tag in real time, and the data structure in the NFC tag is updated at any time. NFC , T NFC ∪{C process}, where T NFC Indicates all data currently stored on the NFC tag, including previous production data, and ∪ indicates merging the encrypted processing inspection data into the NFC tag;

[0133] In step S2, the method of real-time quality detection and data update also includes:

[0134] After the NFC tag is updated, the data in the NFC tag is synchronized to the blockchain. Each synchronization forms a transaction T chain , the transaction contains the unique identification ID in the NFC tag NFC 、Encrypted data C process and timestamp information T s , that is, T chain ={ID NFC ,C process ,T s};

[0135] Each transaction T synchronized to the blockchain chain Verify the blockchain network nodes. Verification steps:

[0136] Using key K process After decryption, compare the data C on the NFC tag process Whether it matches the original data, verification method:

[0137] If Dec(K process ,C process )=D process , then Verify=True,

[0138] Otherwise, Verify = False, where Verify indicates the verification result, True indicates passing, False indicates failure, Dec(K process ,C process ) indicates the use of key K process Decrypt the encrypted data, D process Represents the original processing test data. If the verification is passed, the transaction T chain Permanently recorded in the blockchain;

[0139] Specifically, in the processing stage, the processing data is monitored in real time, and a symmetric encryption algorithm is used to protect the data. Wireless updates are performed through NFC tags, and the processing information is written to the blockchain in real time. The data is complete and consistent throughout the entire process from raw milk collection to processing completion.

[0140] Step S3: cold chain transportation temperature monitoring and abnormal warning.

[0141] Temperature sensors are deployed during the transportation and storage of milk. NFC tags are combined with temperature sensors in transportation and storage to monitor the cold chain temperature in real time.

[0142] In step S3, if the temperature fluctuates abnormally during transportation, an early warning is automatically generated, and the abnormal data is fed back to the data analysis module through the NFC tag, and the abnormal event is synchronously written into the blockchain.

[0143] In step S3, abnormal temperature fluctuation detection is performed, warning information is generated, and data is synchronized to the blockchain. Specifically:

[0144] Based on the temperature sensors in the transportation process, real-time temperature data T(t) is collected, where t is the time variable. The ideal temperature range of cold chain transportation is [T min ,T max ], then the anomaly detection formula of the range is:

[0145] If T(t) <T min or T(t)>T max , then E(t)=1,

[0146] Otherwise, E(t) = 0, where T(t) represents the actual temperature data at a certain time t during the transportation process, T min 、T max The lower and upper limits of the normal temperature range. E(t) indicates the abnormality detection result. 1 indicates abnormality and 0 indicates normality. When E(t) = 1, it means that a temperature abnormality is detected and an early warning is triggered.

[0147] Once a temperature anomaly is detected, the abnormal data is encrypted and transmitted to the data analysis module through the NFC tag. The symmetric encryption algorithm Enc(K, D) is used for encryption, where K temp is the key used for encryption. The abnormal data includes the abnormal temperature value T(t), time t, location L(t) and vehicle ID V id , encrypted data C temp Expressed as: C temp =Enc(K temp ,{T(t),t,L(t),V id}),

[0148] Encrypted data C temp Wireless transmission to the data analysis module via NFC tags;

[0149] In step S3, the method of generating the warning information is as follows:

[0150] When a temperature anomaly is detected, an early warning signal is automatically generated. The early warning signal A(t) is defined as a discrete function, indicating when the early warning is triggered, namely:

[0151] If E(t) = 1, then A(t) = 1, otherwise A(t) = 0,

[0152] Among them, A(t) represents the warning signal, 1 means triggering the warning, and 0 means not triggering.

[0153] If A(t) = 1, the warning information and the encrypted abnormal data C temp The data analysis module is sent together, and abnormal events are synchronized to the blockchain;

[0154] Abnormal data C temp Synchronize to the blockchain, and each abnormal event is recorded as a transaction T chain , including NFC tag IDID NFC 、Encrypted data C temp And the warning signal A(t) and timestamp t s :

[0155] T chain ={ID NFC ,C temp ,A(t),t s}, the transaction T chain Through the verification mechanism of the blockchain network, it is recorded on the blockchain;

[0156] In step S3, blockchain verification is performed:

[0157] T per transaction chain Node verification is performed, and the verification steps include:

[0158] Using the symmetric decryption algorithm Dec(K temp ,C temp ) Decrypt the encrypted data and verify whether it is consistent with the original data. The verification formula is:

[0159] If Dec(K temp ,C temp )={T(t),t,L(t),V id}, then, Verify = True,

[0160] Otherwise, Verify = False, where Verify indicates the verification result, True indicates that the verification is passed, and False indicates that the verification fails. Dec(K temp ,C temp ) indicates the use of key K temp For abnormal data C temp To decrypt,

[0161] If the verification is successful, the abnormal event T chain Permanently recorded in the blockchain;

[0162] Specifically, the deployed temperature sensors detect temperature fluctuations in real time and automatically generate warnings when abnormalities occur. They can promptly identify potential problems in the cold chain and feed abnormal data back to the analysis module for processing through NFC tags. The synchronization of warning information and encrypted data greatly improves the system's response speed.

[0163] Step S4: Blockchain and deep learning data fusion analysis,

[0164] Using the full-chain data of production, processing and transportation stored in blockchain, a deep learning model is used to analyze the data trends of each link and identify potential quality problems:

[0165] Analyze the relationship between the transportation temperature and shelf life of multiple batches to identify the potential spoilage risk of a batch of milk.

[0166] Analyze processing index test information to identify adulteration (such as mixing milk with cheap milk) or illegal additives (such as melamine) during processing;

[0167] When the milk reaches the hands of consumers, they can use devices that support NFC scanning to scan the NFC tag on the milk package to view the complete production, processing, and transportation data chain, including the detected quality parameters, temperature monitoring records, and abnormal events. All data is saved through the blockchain, and consumers can rest assured that the data is authentic and reliable. This content can be used as a product feature;

[0168] In step S4, the full-link data stored in the blockchain is used to analyze the relationship between transportation temperature and shelf life, and to identify adulteration or illegal additives in the processing process. Specifically:

[0169] Extract the full-link data from the blockchain, which are defined as:

[0170] D prod , that is, the data of the production process, D proc , i.e. processing data, D trans , i.e., transportation data;

[0171] Integrate the full-link data into a feature matrix X, where each row of X i Represents all features of a batch:

[0172] X i =[D prod,i ,D proc,i ,D trans,i ], where X i represents the full-link data vector of the i-th batch, Dprod,i , D proc,i , D trans,i They are production, processing and transportation data respectively;

[0173] Using a multi-layer feedforward neural network θ Analyze the relationship between the transportation temperature of multiple batches and the shelf life of milk. Assume that Y i is the shelf life of the i-th batch, and the neural network model is used to predict the shelf life:

[0174] Y i =f θ (D trans,i ) = f θ (T min,i ,T avg,i ,T max,i ,t trans,i ), where Y i represents the shelf life of the i-th batch of milk, T min,i ,T avg,i ,T max,i represents the minimum, average and maximum transportation temperature of the i-th batch, T trans,i represents the transportation time of the i-th batch, f θ represents a multi-layer feed-forward neural network with parameter θ, which is used to fit the relationship between transportation data and shelf life;

[0175] Minimize the loss function L(θ) and adjust the parameter θ:

[0176] Where L(θ) represents the loss function, i.e., the mean square error between the predicted value and the actual shelf life, and n represents the number of batches;

[0177] For adulteration in the processing stage, anomaly detection models are used to detect and define the quality characteristics of the processing stage D proc,i for:

[0178] D proc,i =[P i ,F i ,A i ], where P i represents the protein content of the i-th batch, F i represents the fat content of the i-th batch, A i represents the acidity of the i-th batch,

[0179] Build the Autoencoder model g φ (D proc,i ), compress the input features and reconstruct them. If the reconstruction error E recon If the threshold ∈ is exceeded, the batch is considered to be adulterated or illegally added:

[0180] E recon =|D proc,i -g φ (D proc,i )|, where E recon represents the reconstruction error, that is, the difference between the processed data reconstructed by the autoencoder and the actual data, g φ represents the autoencoder model, with parameter φ, ∈ represents the error threshold, exceeding which triggers anomaly detection;

[0181] If E recon >∈, it is considered that the batch of milk may contain adulteration or illegal additives;

[0182] After identifying a batch of milk with potential quality problems, the abnormal data is synchronized to the blockchain, and the abnormal event record is set as E issue , including batch ID batch , Exception type E type and detection time t s ,Right now:

[0183] T issue ={ID batch ,E type ,t s}, where T issue Indicates the abnormal event transaction synchronized to the blockchain, ID batch A unique identifier for the abnormal batch, E type Indicates the exception type, t s Indicates the timestamp of the detected abnormal event;

[0184] Specifically, a deep learning model was introduced to analyze data trends, and the transportation temperature and shelf life data stored in the blockchain were used through a neural network model to predict the risk of milk spoilage, thereby improving the shelf life management of milk in the supply chain and reducing potential losses. In addition, an autoencoder model was used to detect adulteration in the processing link and automatically identify abnormal data, thereby improving the level of intelligence in milk quality supervision.

[0185] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.

Claims

1. A milk traceability method based on NFC, characterized in that: The following steps are included: Step S1, NFC tag initialization and embedding, During the raw milk collection stage of milk production, a unique NFC tag is assigned to each batch of milk. The tag records basic information about the milk, including the source of the farm, the health of the cow, the collection time, and the batch number. The NFC tag is initialized, the tag is encrypted, and the basic data is written into the blockchain. In step S1, NFC tag initialization and basic data generation are performed: The identifier ID is generated using a cryptographic hash function H(·) based on the hash value of the farm where the milk is produced, the health status of the cow, the collection time, and the batch number. NFC : ID NFC =H(BatchID||FarmID||Timestamp), where BatchID represents the unique number of the milk production batch, FarmID represents the unique identifier of the farm, Timestamp represents the timestamp of the collection time, H(·) represents the cryptographic hash function, and || represents the string concatenation operation; The underlying data stored in the tag is encrypted using asymmetric encryption: C=Enc(K priv ,D base ), where Enc(K priv ,D base ) indicates the use of private key K priv For basic data D base Perform encryption operation, D base Indicates basic information of milk, K priv Indicates the private key of the production phase; Generate a digital signature: Sign(K priv ,H(C)), where H(C) represents the hashing of the encrypted data C, Sign(K priv ,H(C)) represents the process of signing the hash value H(C) with a private key to generate a digital signature; Write data to the blockchain: T NFC ={ID NFC ,C,Sign}, where T NFC Represents a transaction written into the blockchain, ID NFC Represents the unique identifier of the NFC tag, C represents the encrypted basic data, and Sign represents the digital signature; Will trade T NFC Broadcast to the blockchain network and verified by multiple nodes. After verification, the data is permanently written to the blockchain using the public key K pub Verify the transaction signature: Verify(K pub ,Sign,H(C)), where,Verify(K pub ,Sign,H(C)) indicates the use of the public key K pub The process of verifying the signature, K pub Indicates the public key corresponding to the production process, Sign indicates the signature read from the NFC tag, and H(C) indicates the hash value of the encrypted data C. If the verification is successful, the transaction is considered valid and permanently recorded in the blockchain; Step S2, real-time quality detection and data update, During the milk processing, namely the sterilization, filtration and homogenization stages, real-time monitoring equipment is installed to detect processing indicators, including protein content, fat content, acidity and temperature control. The processing index detection is wirelessly connected to the NFC tag, and the processing index detection information is updated to the tag in real time and synchronized to the blockchain. Step S3: cold chain transportation temperature monitoring and abnormal warning. Temperature sensors are deployed during the transportation and storage of milk. NFC tags are combined with temperature sensors in transportation and storage to monitor the cold chain temperature in real time. Step S4: Blockchain and deep learning data fusion analysis, Using the full-chain data of production, processing and transportation stored in blockchain, a deep learning model is used to analyze the data trends of each link and identify potential quality problems: Analyze the relationship between the transportation temperature and shelf life of multiple batches to identify the potential spoilage risk of a batch of milk. Analyze processing index test information to identify adulteration or illegal additives in the processing process; The milk traceability system architecture adopted by the milk traceability method includes: NFC tags, which record basic information, including farm origin, cow health, collection time, and batch number; Real-time monitoring equipment is deployed in the milk processing link to detect processing indicators and output processing indicator detection information. The real-time monitoring equipment uses high-performance liquid chromatography HPLC and mass spectrometer MS; The cold chain transportation monitoring module conducts real-time cold chain temperature monitoring during the transportation and storage of milk; Data analysis module, used to analyze the full-chain data of production, processing and transportation and identify potential quality problems: Analyze the relationship between the transportation temperature and shelf life of multiple batches to identify the potential spoilage risk of a batch of milk. Analyze processing index detection information to identify adulteration in the processing link; The blockchain database is used to store traceability data, including basic information and full-link data of production, processing and transportation.

2. A milk tracing method based on NFC according to claim 1, characterized in that: In step S2, the method of real-time quality detection and data update is: Define processing data D process As a processing data set, each D i Represents a specific indicator: D process ={D1,D2,D3,…,D n }, where D process represents the detection data set of the processing link, D i represents the i-th quality inspection index, and n represents the number of different inspection indexes; For each D i , define its structure as D i =(V i ,T i ), where D i =(V i ,T i ), V i Represents the value of the i-th detection index, T i The timestamp representing the generation of the detection data; A symmetric encryption algorithm is used to encrypt all detection data in the processing link, and the key K is used process After encryption, the encrypted data is: C process =Enc(K process ,D process ), where C process represents the encrypted processing detection data, Enc(·) represents the symmetric encryption algorithm, K process Represents the symmetric key used for encryption; The encrypted processed data C process The data is transmitted to the NFC tag in real time, and the data structure in the NFC tag is updated at any time. NFC , T NFC ∪{C process }, where T NFC represents all data currently stored on the NFC tag, including previous production data, and ∪ represents merging the encrypted processing inspection data into the NFC tag.

3. A milk traceability method based on NFC according to claim 2, characterized in that: In step S2, the method of real-time quality detection and data update also includes: After the NFC tag is updated, the data in the NFC tag is synchronized to the blockchain. Each synchronization forms a transaction T chain , the transaction contains the unique identification ID in the NFC tag NFC 、Encrypted data C process and timestamp information T s , that is, T chain ={ID NFC ,C process ,T s }; Each transaction T synchronized to the blockchain chain Verify the blockchain network nodes. Verification steps: Using key K process After decryption, compare the data C on the NFC tag process Whether it matches the original data, verification method: If Dec(K process ,C process )=D process , then Verify=True, Otherwise, Verify = False, where Verify indicates the verification result, True indicates passing, False indicates failure, Dec(K process ,C process ) indicates the use of key K process Decrypt the encrypted data, D process Represents the original processing test data. If the verification is passed, the transaction T chain Permanently recorded in the blockchain.

4. The NFC-based milk tracing method according to claim 3, characterized in that: In step S3, if the temperature fluctuates abnormally during transportation, an early warning is automatically generated, and the abnormal data is fed back to the data analysis module through the NFC tag, and the abnormal event is synchronously written into the blockchain.

5. The NFC-based milk tracing method according to claim 4, characterized in that: In step S3, abnormal temperature fluctuation detection is performed, warning information is generated, and data is synchronized to the blockchain. Specifically: Based on the temperature sensors in the transportation process, real-time temperature data T(t) is collected, where t is the time variable. The ideal temperature range of cold chain transportation is [T min ,T max ], then the anomaly detection formula of the range is: If T(t) <T min or T(t)>T max , then T(t)=1, Otherwise, E(t) = 0, where T(t) represents the actual temperature data at a certain time t during the transportation process, T min , T max The lower and upper limits of the normal temperature range. E(t) indicates the abnormality detection result. 1 indicates abnormality and 0 indicates normality. When E(t) = 1, it means that a temperature abnormality is detected and an early warning is triggered. Once a temperature anomaly is detected, the abnormal data is encrypted and transmitted to the data analysis module through the NFC tag. The symmetric encryption algorithm Enc(K, D) is used for encryption, where K temp is the key used for encryption. The abnormal data includes the abnormal temperature value T(t), time t, location L(t) and vehicle ID V id , encrypted data C temp Expressed as: C temp =Enc(K temp ,{T(t),t,L(t),V id }), Encrypted data C temp Wireless transmission to the data analysis module via NFC tags.

6. The NFC-based milk tracing method according to claim 5, characterized in that: In step S3, the method of generating warning information is: When a temperature anomaly is detected, an early warning signal is automatically generated. The early warning signal A(t) is defined as a discrete function, indicating when the early warning is triggered, namely: If E(t) = 1, then A(t) = 1, otherwise A(t) = 0, Among them, A(t) represents the warning signal, 1 means triggering the warning, and 0 means not triggering. If A(t) = 1, the warning information and the encrypted abnormal data C temp The data analysis module is sent together, and abnormal events are synchronized to the blockchain; Abnormal data C temp Synchronize to the blockchain, and each abnormal event is recorded as a transaction T chain , including NFC tag IDID NFC 、Encrypted data C temp And the warning signal A(t) and timestamp t s : T chain ={ID NFC ,C temp ,A(t),t s }。 7. The NFC-based milk tracing method according to claim 6, characterized in that: In step S3, blockchain verification is performed: T per transaction chain Node verification is performed, and the verification steps include: Using the symmetric decryption algorithm Dec(K temp ,C temp ) Decrypt the encrypted data and verify whether it is consistent with the original data. The verification formula is: If Dec(K temp ,C temp )={T(t),t,L(t),V id }, then, Verify = True, Otherwise, Verify = False, where Verify indicates the verification result, True indicates that the verification is passed, and False indicates that the verification fails. Dec(K temp ,C temp ) indicates the use of key K temp For abnormal data C temp To decrypt, If the verification is successful, the abnormal event T chain Permanently recorded in the blockchain.

8. The NFC-based milk tracing method according to claim 7, characterized in that: In step S4, the full-link data stored in the blockchain is used to analyze the relationship between transportation temperature and shelf life, and to identify adulteration or illegal additives in the processing process. Specifically: Extract the full-link data from the blockchain, which are defined as: D prod , that is, the data of the production process, D proc , i.e. processing data, D trans , i.e., transportation data; Integrate the full-link data into a feature matrix X, where each row of X i Represents all features of a batch: X i =[D prod,i ,D proc,i ,D trans,i ], where X i represents the full-link data vector of the i-th batch, D prod,i , D proc,i , D trans,i They are production, processing and transportation data respectively; Using a multi-layer feedforward neural network θ Analyze the relationship between the transportation temperature of multiple batches and the shelf life of milk. Assume that Y i is the shelf life of the i-th batch, and the neural network model is used to predict the shelf life: Y i =f θ (D trans,i ) = f θ (T min,i ,T avg,i ,T max,i ,t trans,i ), where Y i represents the shelf life of the i-th batch of milk, T min,i ,T avg,i ,T max,i represents the minimum, average and maximum transportation temperature of the i-th batch, t trans,i represents the transportation time of the i-th batch, f θ represents a multi-layer feed-forward neural network with parameter θ, which is used to fit the relationship between transportation data and shelf life; Minimize the loss function L(θ) and adjust the parameter θ: Where L(θ) represents the loss function, i.e., the mean square error between the predicted value and the actual shelf life, and n represents the number of batches; For adulteration in the processing stage, anomaly detection models are used to detect and define the quality characteristics of the processing stage D proc,i for: D proc,i =[P i ,F i ,A i ], where P i represents the protein content of the i-th batch, F i represents the fat content of the i-th batch, A i represents the acidity of the i-th batch, Build the Autoencoder model g φ (D proc,i ), compress the input features and reconstruct them. If the reconstruction error E recon If the threshold ∈ is exceeded, the batch is considered to be adulterated or illegally added: E recon =|D proc,i -g φ (D proc,i )|, where E recon represents the reconstruction error, that is, the difference between the processed data reconstructed by the autoencoder and the actual data, g φ represents the autoencoder model, with parameter φ, ∈ represents the error threshold, exceeding which triggers anomaly detection; If E recon >∈, it is considered that the batch of milk may contain adulteration or illegal additives; After identifying a batch of milk with potential quality problems, the abnormal data is synchronized to the blockchain, and the abnormal event record is set as E issue , including batch ID batch , Exception type E type and detection time t s ,Right now: T issue ={ID batch ,E type ,t s }, where T issue Indicates the abnormal event transaction synchronized to the blockchain, ID batch A unique identifier for the abnormal batch, E type Indicates the exception type, t s Indicates the timestamp of the detected anomaly event.

Citation Information

Patent Citations

  • Quantum encryption anti-counterfeiting traceability method and terminal based on block chain and NFC

    CN116091087A

  • Dairy product tracing method based on block chain

    CN118822560A