Agricultural product visual traceability method based on batch number and vehicle-mounted image recognition linkage

By generating a globally unique batch number and binding it to loading image data, and combining vehicle-mounted image recognition and lightweight convolutional neural networks, visual traceability of agricultural products has been achieved. This solves the problems of discontinuous image data and incomplete batch number binding in existing technologies, and improves the credibility of the traceability system and the judgment ability of end users.

CN120746595BActive Publication Date: 2026-05-19CHONGQING ACAD OF AGRI SCI
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHONGQING ACAD OF AGRI SCI
Filing Date
2025-06-18
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing agricultural product traceability systems struggle to achieve continuous image data acquisition and complete batch number binding, making it difficult to effectively identify whether goods originate from the same source, whether they have been damaged or replaced, and lack in-depth comparison and intelligent discrimination between physical images and historical images, thus hindering the realization of highly reliable traceability and authenticity verification.

Method used

By generating a globally unique batch number and binding it with loading image data, and combining it with real-time acquisition of transportation process images by vehicle-mounted cameras, a dynamic transportation process data chain is generated. Dynamic QR codes are generated at the distribution nodes, allowing end users to visually display the loading scene, transportation route, and changes in cargo status. Consumers can compare the actual images with historical images and use lightweight convolutional neural networks for matching and generating difference heatmaps.

Benefits of technology

It enables the structuring of information and image recording during the loading of agricultural products, enhances the real-time recording of morphological anomalies and environmental changes during transportation, provides a fully visualized traceability chain, improves information transparency and end-user trust, and enhances the ability to verify the authenticity of agricultural products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120746595B_ABST
    Figure CN120746595B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of agricultural product supply chain, and specifically relates to a kind of agricultural product visual traceability method based on batch number and vehicle-mounted image recognition linkage, comprising the following steps: S1, batch loading and data binding: after loading, generate a unique batch number, generate a data package;S2, dynamic transport image association: image and environmental data are collected in transport, identify abnormalities and associate batch number, form transport data chain;S3, distribution link batch code activation: generate a two-dimensional code containing image entry and paste it on the vehicle or container;S4, visual traceability data integration: call image and timeline data by scanning code, generate loading and transport process atlas;S5, consumer image verification: generate heat map and judge consistency level by comparing with historical image.The present application realizes image visual traceability and consistency intelligent verification of agricultural products from loading to consumption whole process, and improves the transparency of the process and the credibility of terminal identification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of agricultural product supply chain technology, and in particular to a visual traceability method for agricultural products based on the linkage between batch number and vehicle-mounted image recognition. Background Technology

[0002] As the digitalization level of the agricultural product supply chain continues to improve, consumers are paying increasing attention to the product's origin, transportation process, and authenticity. Traditional agricultural product traceability systems are mostly based on batch numbers, sensor data, or RFID tags and other information technology methods for traceability management, which can achieve basic information tracking of the place of origin, transportation route, and sales flow. However, in the actual circulation process, the form of agricultural products is easily affected by transportation disturbances, and traceability methods that rely solely on text or sensor data cannot fully reflect the authenticity and integrity of the goods' status. There is an urgent need for more intuitive and highly reliable visual traceability methods to supplement this.

[0003] Currently available image traceability technologies are mostly applied in the food processing or warehousing fields, and have problems such as discontinuous image data collection, inability to associate image content with transportation routes, and weak image verification capabilities at the consumer end. In addition, although some systems can record loading images or images of some transportation nodes, they do not achieve complete binding between images and batch numbers, and lack in-depth comparison and intelligent discrimination mechanisms between physical images and historical images. This makes it difficult to identify whether goods come from the same source, whether they have been damaged or replaced, at the end consumer stage, and fails to meet the actual needs of high-reliability traceability and authenticity verification. Summary of the Invention

[0004] This invention provides a visual traceability method for agricultural products based on the linkage of batch number and vehicle-mounted image recognition. It realizes dynamic tracking of batch images and intelligent comparative analysis of three-source images, which not only enhances the visualization and transparency of the traceability system, but also improves the end users' ability to judge the authenticity and status changes of agricultural products, thereby significantly enhancing the trust guarantee and quality supervision level of agricultural product circulation.

[0005] A method for visual traceability of agricultural products based on the linkage of batch number and vehicle-mounted image recognition includes the following steps:

[0006] S1, Batch loading and data binding: After bulk agricultural products are loaded, a globally unique batch number is generated, loading image data including the stacking shape of goods and the panoramic view of the vehicle cargo compartment is collected, and the batch number, loading image data, loading time, loading personnel information and geographical location information are bound together to generate a loading batch data package.

[0007] S2, Dynamic Transportation Image Association: During transportation, on-board camera data is collected in real time to identify abnormal shapes caused by cargo displacement and temperature and humidity changes. On-board image data, GPS trajectory and collection timestamp are dynamically associated with batch number to form a transportation process data chain.

[0008] S3, Batch code activation in the distribution process: At the distribution node, the batch number in the loading batch data packet is read by scanning the code, a dynamic batch QR code including loading image data and access to the transportation process data chain is generated, and the QR code is pasted on the transport vehicle or distribution container.

[0009] S4, Visualized Traceability Data Integration: When end users scan the dynamic batch QR code, loading image data and vehicle image data are called and integrated with the timeline to form a visualized traceability map, showing the loading scene, transportation route and cargo status change images.

[0010] S5, Consumer-End Physical-Image Chain Intelligent Verification: At the consumer end, real-time images of purchased agricultural products are captured via mobile terminals and compared with loading and vehicle-mounted image data. A lightweight convolutional neural network model is used to match image features, generate a difference heatmap to mark stacked contours or areas of appearance change, and automatically determine the image consistency level.

[0011] Optionally, the batch packaging vehicle and data binding in S1 includes:

[0012] S11, Generation of unique batch identifier: Construct a globally unique batch number BatchID based on three pieces of information: loading timestamp, loading location code, and vehicle number;

[0013] S12, Loading image data acquisition and preprocessing: The dual-camera array deployed above and at the rear of the vehicle cargo compartment synchronously acquires images of the stacked goods and panoramic images of the cargo compartment after loading. The stacked goods and panoramic images of the cargo compartment are stored in RGB three-channel format and are normalized and noise filtered after acquisition. The standard output size is 640×480 pixels.

[0014] S13, Batch Data Packet Construction and Binding: The generated batch number BatchID, normalized loading image data, loading timestamp, loading personnel identification code, and loading geographical location are structurally integrated to generate the loading batch data packet D. batch .

[0015] Optionally, the dynamic transport image association in S2 includes:

[0016] S21, Synchronous Acquisition of Vehicle-Mounted Images and Environmental Data: During transportation, the vehicle-mounted intelligent terminal periodically triggers the image acquisition module and environmental sensors at set time intervals Δt to acquire the current cargo image frame F. curr Temperature θ t Humidity h t and GPS location G t And record the current timestamp τ t ;

[0017] S22, Cargo shape anomaly identification: For the current frame F curr Compared to the previous frame F prev Morphological and structural change analysis was performed, and a deformation region identification algorithm based on structural similarity was used to calculate the stacking morphological anomaly index α. t When α t Exceeding the set threshold α th If so, it is considered that the cargo's form is abnormal;

[0018] S23, Data Link Generation and Binding during Transportation: The currently acquired image frame F... curr GPS coordinates G t Temperature and humidity data θ t ,h t Timestamp τ t Morphological abnormality index α t The corresponding batch number (BatchID) is then used for data structuring and integration to generate the transportation node data item D. t ={F curr G t ,θ t ,h t ,τ t ,α t BatchID}, and will all D t Connected sequentially in time, forming a data chain for the transportation process.

[0019] Optionally, batch code activation in the distribution process of S3 includes:

[0020] S31, Batch Number Parsing and Distribution Node Identity Binding: Distribution nodes use barcode scanners to scan the batch number identifier on transport vehicles or cargo labels, and obtain the corresponding batch number (BID) through the loading batch data packet interface. scan and assign the current distribution node's identity code BID node This is bound to form the distribution node context information, represented as:

[0021] CTX dist ={BID scan DID nod e,T dist};

[0022] Among them, T dist This is the timestamp for activation via QR code scanning;

[0023] S32, Dynamic QR Code Data Construction and Encryption Compression: Based on the bound distribution node context information CTX dist Corresponding loading image data reference address U img Transportation process data link entry address U trace Generate the original data structure of the QR code. raw ={BID scan U img U trace DID node ,T dist The original QR code data structure is encrypted using AES symmetric encryption and Base64 compression encoding to generate the QR code string. code ;

[0024] S33, QR code generation and deployment: Paste the QR code string "QR". code Rendered as an image format QR code (IMG) QR The QR code is printed and affixed to the surface of the transport vehicle or the outside of the distribution container using a thermal printing device or digital label terminal.

[0025] Optionally, the visualization and traceability data integration in S4 includes:

[0026] S41, Dynamic QR Code Parsing and Data Retrieval: After the end user scans the dynamic batch QR code, the loading image data address U in the QR code is parsed. load Data link address U during transportation trans It then uses a unified access interface to retrieve image content and associated timestamp information to form an initial set of image sequences.

[0027] S42, Image Timeline Reconstruction and Annotation: Reconstructing and Annotating the Initial Image Sequence Set According to timestamp τ (k) Arrange the images in ascending order and construct a timeline index, represented as follows:

[0028]

[0029] Among them, T index (k) represents the normalized position of the kth image on the time axis, and n is the total number of image frames;

[0030] S43, Visual Atlas Generation and Display: Based on Image Time Axis Index T index With image content I (k)The terminal interface constructs a traceability visualization map, including an initial real-world image of loading, images of the transportation process arranged in chronological order, an overlaid transportation route map trajectory, and an anomaly marker layer for changing frames.

[0031] Optionally, the consumer-side physical-image chain intelligent verification in S5 includes:

[0032] S51, Real-world image acquisition and image source preparation: At the consumer end, users take real-time photos of the agricultural products they purchase using mobile devices, acquiring the current real-world image G. real Synchronously call the loading image G corresponding to this batch number load and transport node image G trans The current physical images, loading images, and transportation node images are formatted, sized, and aligned with color histograms.

[0033] S52, Image Feature Extraction and Difference Heatmap Generation: The current physical object image, loading image, and transportation node image are sequentially input into a lightweight convolutional neural network to extract structural feature vectors and deep semantic representations. Through a multi-scale feature matching mechanism, the similarity between the current physical object image and historical images is compared, and a difference heatmap is generated using Grad-CAM (gradient-weighted class activation mapping).

[0034] S53, Image Consistency Level Assessment and Risk Warning: Based on the regional distribution density and change intensity in the difference heatmap, calculate the image consistency score index S. sim It compares the results with the preset consistency level standard and outputs the consistency level, including high consistency, moderate deviation, and serious non-compliance, and triggers the corresponding risk warning based on the output consistency level.

[0035] Optionally, the physical image acquisition and image three-source preparation in S51 include:

[0036] S511, Real-world image acquisition and identification association: Consumers use a mobile terminal camera module to capture real-time images of the agricultural products they purchase, generating the current real-world image G. curr It automatically parses the bound dynamic batch QR code and extracts the corresponding batch number (BID). term ;

[0037] S512, Dual-source retrieval of historical images: via batch number (BID) term Access the traceability image database and retrieve the loading image G associated with this batch. load and transport node image G trans Together they form the set of images to be compared.

[0038] S513, Image Format Normalization and Color Histogram Alignment: For Sets of Images to be Compared All images in the process undergo format conversion, size normalization, and color distribution standardization in sequence, specifically including:

[0039] Size normalization: Each image is uniformly scaled to a fixed size W0×H0 using bilinear interpolation.

[0040] Color histogram alignment: based on loading image G load As a reference, perform color histogram matching on the current physical object image and the transportation node image, and output a set of images with uniform format, size, and color space.

[0041] Optionally, the image feature extraction and difference heatmap generation in S52 includes:

[0042] S521, Image Feature Extraction: Input the normalized current physical image, loading image and transportation node image into the lightweight convolutional neural network model respectively, and extract their corresponding structural feature vectors;

[0043] S522, Multi-scale Feature Similarity Comparison: At different receptive field scales, the structural feature cosine similarity is calculated for the current object image, loading image, and transportation node image, respectively, and a fusion similarity score S is formed. fuse ;

[0044] S523, Differential Heatmap Generation: The Grad-CAM algorithm is used to locate the regions with the greatest feature differences, generating a differential heatmap H. diff (x,y).

[0045] Optionally, the image consistency level determination and risk warning in S53 includes:

[0046] S531, Variation Region Extraction and Heatmap Analysis: Based on the Generated Differential Heatmap H diff Extract all pixel regions (x, y) that satisfy the pixel threshold δ for significant change, and calculate the density D of the changed regions. var and average intensity I mean ;

[0047] S532, Image Consistency Score Calculation and Grade Determination: Fusing density and average intensity of changed regions to calculate image consistency score index S. sim When S sim A value ≥ 0.85 indicates a high level of consistency; a value ≤ 0.60 indicates a high level of consistency. sim When S < 0.85, the consistency level is considered to be of moderate deviation. sim A value less than 0.60 indicates a serious non-compliance.

[0048] S533, Consistency Level Output and Risk Warning Trigger: Based on the consistency scoring indicator S sim The corresponding level range and the output image consistency level label L. sim ∈{highly consistent, moderately divergent, seriously inconsistent}, and trigger corresponding risk warning strategies, specifically including:

[0049] If L sim = High consistency, consistent prompt images, and trustworthy product;

[0050] If L sim =Moderate deviation, indicating a moderate deviation exists. Please pay attention to identification.

[0051] If L sim = Seriously inconsistent. The image is seriously inconsistent. It is recommended to refuse delivery or verify the source.

[0052] The beneficial effects of this invention are:

[0053] This invention, through a batch number generation and loading image data binding mechanism, enables the structuring of information and image recording of agricultural product loading processes. This ensures that the loading status of each batch of agricultural products is accurately captured and traceable throughout the entire process. Furthermore, by leveraging vehicle-mounted image recognition and environmental monitoring equipment, a dynamic correlation between transportation images and trajectories is constructed, enabling real-time recording of abnormal morphology and environmental changes of goods during transportation. This provides end-users with a visualized, end-to-end traceability chain, enhancing the transparency and safety of the distribution process.

[0054] This invention enables dynamic management and controllable transmission of batch numbers among various distribution nodes through a mechanism that activates distribution node scanning and binds the identities of upstream and downstream nodes. Combined with an interface-based referencing method for loading and transportation images and a dynamically generated QR code through encryption and compression, users can conveniently access batch-level image time-series data and location information, realizing a multi-dimensional traceability map display based on the image timeline, thereby improving the transparency of agricultural product information and digital supervision capabilities.

[0055] This invention achieves deep matching between purchased agricultural products and historical loading and transportation images by acquiring physical images and using a three-image comparison mechanism. It utilizes a lightweight neural network to extract image features and generate a difference heatmap, which can efficiently identify differences in the stacking outline or appearance of goods. Combined with a consistency scoring and grading model, it accurately classifies high consistency, moderate deviation, and serious non-compliance levels and triggers corresponding risk warning strategies, effectively improving the ability to verify the authenticity of agricultural products and the trust of end consumers. Attached Figure Description

[0056] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only for this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0057] Figure 1 This is a schematic diagram of the source tracing method according to an embodiment of the present invention;

[0058] Figure 2 This is a schematic diagram of dynamic transportation image association according to an embodiment of the present invention. Detailed Implementation

[0059] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. Those skilled in the art may employ other alternative methods to implement some well-known technologies; moreover, the accompanying drawings are only for more specific description of the embodiments and are not intended to specifically limit the present invention.

[0060] like Figures 1-2 As shown, a method for visual traceability of agricultural products based on the linkage of batch number and vehicle-mounted image recognition includes the following steps:

[0061] S1, Batch loading and data binding: After bulk agricultural products are loaded, a globally unique batch number is generated, loading image data including the stacking shape of goods and the panoramic view of the vehicle cargo compartment is collected, and the batch number, loading image data, loading time, loading personnel information and geographical location information are bound together to generate a loading batch data package.

[0062] S2, Dynamic Transportation Image Association: During transportation, on-board camera data is collected in real time to identify abnormal shapes caused by cargo displacement and temperature and humidity changes. On-board image data, GPS trajectory and collection timestamp are dynamically associated with batch number to form a transportation process data chain.

[0063] S3, Batch code activation in the distribution process: At the distribution node, the batch number in the loading batch data packet is read by scanning the code, a dynamic batch QR code including loading image data and access to the transportation process data chain is generated, and the QR code is pasted on the transport vehicle or distribution container.

[0064] S4, Visualized Traceability Data Integration: When end users scan the dynamic batch QR code, loading image data and vehicle image data are called and integrated with the timeline to form a visualized traceability map, showing the loading scene, transportation route and cargo status change images.

[0065] S5, Consumer-End Physical-Image Chain Intelligent Verification: At the consumer end, real-time images of purchased agricultural products are captured via mobile terminals and compared with loading and vehicle-mounted image data. A lightweight convolutional neural network model is used to match image features, generate a difference heatmap to mark stacked contours or areas of appearance change, and automatically determine the image consistency level.

[0066] The batch makeup vehicle and data binding in S1 include:

[0067] S11, Generation of Batch Unique Identifier: A globally unique batch number BatchID is constructed based on three pieces of information: loading timestamp, loading location code, and vehicle number, represented as:

[0068] BatchID = Hash(T) load ||L code ||V id );

[0069] Among them, T load For loading timestamp, L code For the coding information of the loading location, V id It serves as a unique vehicle identification number, and the hash function is an irreversible cryptographic hash function (SHA-256).

[0070] S12, Loading image data acquisition and preprocessing: The dual-camera array deployed above and at the rear of the vehicle cargo compartment synchronously acquires images of the stacked goods and panoramic images of the cargo compartment after loading. The stacked goods and panoramic images of the cargo compartment are stored in RGB three-channel format and are normalized and noise filtered after acquisition. The standard output size is 640×480 pixels.

[0071] S13, Batch Data Packet Construction and Binding: The generated batch number BatchID, normalized loading image data, loading timestamp, loading personnel identification code, and loading geographical location are structurally integrated to generate the loading batch data packet D. batch , represented as:

[0072] D batch ={BatchID,I cargo ,I view ,T load ,P id ,L gps};

[0073] Among them, I cargo For image data of stacked goods, I view For panoramic image data of the cargo compartment, P id L is the certification number for the loading personnel. gps These are the current GPS coordinates.

[0074] The dynamic transport image association in S2 includes:

[0075] S21, Synchronous Acquisition of Vehicle-Mounted Images and Environmental Data: During transportation, the vehicle-mounted intelligent terminal periodically triggers the image acquisition module and environmental sensors at set time intervals Δt to acquire the current cargo image frame F. curr Temperature θ t Humidity h t and GPS location G t And record the current timestamp τ t ;

[0076] S22, Cargo shape anomaly identification: For the current frame F curr Compared to the previous frame F prev Morphological and structural change analysis was performed, and a deformation region identification algorithm based on structural similarity was used to calculate the stacking morphological anomaly index α. t When α t Exceeding the set threshold α th If so, it is considered an abnormality in the form of the goods, as indicated by:

[0077]

[0078] Where, μ i,j v i,j Let be the local gradient magnitudes of the i-th and j-th pixels in the two frames, respectively, and M and N be the row and column numbers of the image resolution, respectively. t ∈[0,1], the larger the value, the more significant the morphological change;

[0079]

[0080] in, This represents the average abnormality index in the normal sample. Let λ be the standard deviation of the abnormality index in the normal sample, λ be the deviation amplification factor based on the standard deviation, and θ be the deviation amplification factor. t h t θ0 and h0 represent the temperature and humidity at the current transportation node, θ0 and h0 represent the temperature and humidity at the initial loading time, and η represents the environmental disturbance weighting factor.

[0081] S23, Data Link Generation and Binding during Transportation: The currently acquired image frame F... curr GPS coordinates G t Temperature and humidity data θ t ,h t Timestamp τ t Morphological abnormality index α t The corresponding batch number (BatchID) is then used for data structuring and integration to generate the transportation node data item D. t ={F curr Gt ,θ t ,h t ,τ t ,α t BatchID}, and will all D t Connected sequentially in time, forming a data chain for the transportation process.

[0082] Batch code activation in the distribution process of S3 includes:

[0083] S31, Batch Number Parsing and Distribution Node Identity Binding: Distribution nodes use barcode scanners to scan the batch number identifier on transport vehicles or cargo labels, and obtain the corresponding batch number (BID) through the loading batch data packet interface. scan and assign the current distribution node's identity code DID node This is bound to form the distribution node context information, represented as:

[0084] CTX dist ={BID scan DID node ,T dist};

[0085] Among them, T dist This is the timestamp for activation via QR code scanning;

[0086] S32, Dynamic QR Code Data Construction and Encryption Compression: Based on the bound distribution node context information CTX dist Corresponding loading image data reference address U img Transportation process data link entry address U trace Generate the original data structure of the QR code. raw ={BID scan U img ,u trace DID node ,T dist The original QR code data structure is encrypted using AES symmetric encryption and Base64 compression encoding to generate the QR code string. code , represented as:

[0087] QR code =Base64(AES) K (QR raw ));

[0088] Among them, AES K The AES encryption function uses key K, and Base64 is used to compress and encode the encrypted data into a QR code. code The content of the generated QR code string;

[0089] S33, QR code generation and deployment: Paste the QR code string "QR". code Rendered as an image format QR code (IMG) QR The QR code is printed and affixed to the surface of the transport vehicle or the outside of the distribution container using a thermal printing device or digital label terminal.

[0090] The integration of visual traceability data in S4 includes:

[0091] S41, Dynamic QR Code Parsing and Data Retrieval: After the end user scans the dynamic batch QR code, the loading image data address U in the QR code is parsed. load Data link address U during transportation trans It then uses a unified access interface to retrieve image content and associated timestamp information to form an initial set of image sequences. Represented as:

[0092]

[0093] Among them, I (1) I (2) I (n) These are the 1st, 2nd, and nth images (including loading or transport images), respectively, τ (1) τ (2) τ (n) These are the timestamps corresponding to the image acquisition;

[0094] S42, Image Timeline Reconstruction and Annotation: Reconstructing and Annotating the Initial Image Sequence Set According to timestamp τ (k) Arrange the images in ascending order and construct a timeline index, represented as follows:

[0095]

[0096] Among them, T index (k) represents the normalized position of the kth image on the time axis, and n is the total number of image frames;

[0097] S43, Visual Atlas Generation and Display: Based on Image Time Axis Index T index With image content I (k) The terminal interface constructs a traceability visualization map, including an initial real-world image of loading, images of the transportation process arranged in chronological order, an overlaid transportation route map trajectory, and an anomaly marker layer for changing frames.

[0098] S5's consumer-end physical-image chain intelligent verification includes:

[0099] S51, Real-world image acquisition and image source preparation: At the consumer end, users take real-time photos of the agricultural products they purchase using mobile devices, acquiring the current real-world image G. realSynchronously call the loading image G corresponding to this batch number load and transport node image G trans The current physical images, loading images, and transportation node images are formatted, sized, and aligned with color histograms.

[0100] S52, Image Feature Extraction and Difference Heatmap Generation: The current physical object image, loading image, and transportation node image are sequentially input into a lightweight convolutional neural network to extract structural feature vectors and deep semantic representations. Through a multi-scale feature matching mechanism, the similarity between the current physical object image and historical images is compared, and a difference heatmap is generated using Grad-CAM (gradient-weighted class activation mapping) to highlight areas of significant change such as stacking contour shift, packaging deformation, or epidermal damage.

[0101] S53, Image Consistency Level Assessment and Risk Warning: Based on the regional distribution density and change intensity in the difference heatmap, calculate the image consistency score index S. sim It compares the results with the preset consistency level standard and outputs the consistency level, including high consistency, moderate deviation, and serious non-compliance, and triggers the corresponding risk warning based on the output consistency level.

[0102] The physical image acquisition and three-source image preparation in S51 include:

[0103] S511, Real-world image acquisition and identification association: Consumers use a mobile terminal camera module to capture real-time images of the agricultural products they purchase, generating the current real-world image G. curr It automatically parses the bound dynamic batch QR code and extracts the corresponding batch number (BID). term ;

[0104] S512, Dual-source retrieval of historical images: via batch number (BID) term Access the traceability image database and retrieve the loading image G associated with this batch. load and transport node image G trans Together they form the set of images to be compared.

[0105] S513, Image Format Normalization and Color Histogram Alignment: For Sets of Images to be Compared All images in the process undergo format conversion, size normalization, and color distribution standardization in sequence, specifically including:

[0106] Size normalization: Each image is uniformly scaled to a fixed size W0×H0 using bilinear interpolation.

[0107] Color histogram alignment: based on loading image G loadAs a reference, perform color histogram matching on the current physical object image and the transportation node image, and output a set of images with uniform format, size, and color space. Represented as:

[0108]

[0109] Among them, G ' The output is the image after histogram alignment. For the cumulative distribution histogram of the target image G, This is the inverse CDF mapping function for the reference image.

[0110] Image feature extraction and differential heatmap generation in S52 include:

[0111] S521, Image Feature Extraction: Input the normalized current object image, loading image, and transportation node image into a lightweight convolutional neural network model respectively, and extract their corresponding structural feature vectors, represented as:

[0112]

[0113] in, f is the feature extraction function for a neural network. real f load f trans These are the extracted high-dimensional feature vectors;

[0114] Neural network feature extraction function Represented as:

[0115]

[0116] Where I is the input image, W i For the i-th convolutional kernel, b i For convolution bias terms, This represents the sum of convolutional outputs with C channels. BN stands for Batch Normalization, σ is the activation function, and GAP stands for Global Average Pooling, which compresses each channel into a single value.

[0117] S522, Multi-scale Feature Similarity Comparison: At different receptive field scales, the structural feature cosine similarity is calculated for the current object image, loading image, and transportation node image, respectively, and a fusion similarity score S is formed. fuse , represented as:

[0118]

[0119] Among them, S fuse∈[0,1], the smaller the value, the lower the similarity and the greater the structural change;

[0120] S523, Differential Heatmap Generation: The Grad-CAM algorithm is used to locate the regions with the greatest feature differences, generating a differential heatmap H. diff (x,y) is represented as:

[0121] H diff (x,y)=ReLU(∑ k αk · A k (x,y));

[0122] Among them, A k (x,y) represents the response value of the convolutional activation map of the k-th channel at position (x,y). For the k-th channel, output S for target category c c Gradient-weighted average, Z is the total number of pixels in the activation map, ReLU is the non-negative value operation, H diff (x,y) represents the significance of the difference at pixel position (x,y).

[0123] Image consistency level assessment and risk warnings in S53 include:

[0124] S531, Variation Region Extraction and Heatmap Analysis: Based on the Generated Differential Heatmap H diff Extract all pixel regions (x, y) that satisfy the pixel threshold δ for significant change, and calculate the density D of the changed regions. var and average intensity I mean , represented as:

[0125]

[0126] Where W and H are the width and height of the heatmap, respectively, and δ = 0.6 is the pixel threshold for the significance of change. This is an indicator function; it returns 1 if the condition is true and 0 otherwise. Ω δ For all satisfying H diff The set of pixel coordinates N where (x,y)>δ δ =|Ω δ | represents the number of pixels in the changing region;

[0127] S532, Image Consistency Score Calculation and Grade Determination: Fusing density and average intensity of changed regions to calculate image consistency score index S. sim When S sim A value ≥ 0.85 indicates a high level of consistency; a value ≤ 0.60 indicates a high level of consistency. sim When S < 0.85, the consistency level is considered to be of moderate deviation.sim A value less than 0.60 indicates a serious non-compliance, as shown below:

[0128] S sim =1-γ1·D var -γ2·I mean ;

[0129] Wherein, γ1 and γ2 are weighting factors;

[0130] S533, Consistency Level Output and Risk Warning Trigger: Based on the consistency scoring indicator S sim The corresponding level range and the output image consistency level label L. sim ∈{highly consistent, moderately divergent, seriously inconsistent}, and trigger corresponding risk warning strategies, specifically including:

[0131] If L sim = High consistency, consistent prompt images, and trustworthy product;

[0132] If L sim =Moderate deviation, indicating a moderate deviation exists. Please pay attention to identification.

[0133] If L sim = Seriously inconsistent. The image is seriously inconsistent. It is recommended to refuse delivery or verify the source.

[0134] This invention encompasses any substitutions, modifications, equivalent methods, and solutions made within the spirit and scope of this invention. To provide the public with a thorough understanding of this invention, specific details are described in detail in the following preferred embodiments; however, those skilled in the art will fully understand the invention even without these details. Furthermore, to avoid unnecessary misunderstanding of the essence of this invention, well-known methods, processes, procedures, components, and circuits are not described in detail.

[0135] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for visual traceability of agricultural products based on the linkage of batch number and vehicle-mounted image recognition, characterized in that, Includes the following steps: S1, Batch loading and data binding: After bulk agricultural products are loaded, a globally unique batch number is generated, loading image data including the stacking shape of goods and the panoramic view of the vehicle cargo compartment is collected, and the batch number, loading image data, loading time, loading personnel information and geographical location information are bound together to generate a loading batch data package. S2, Dynamic Transportation Image Association: During transportation, on-board camera data is collected in real time to identify abnormal shapes caused by cargo displacement and temperature and humidity changes. On-board image data, GPS trajectory and collection timestamp are dynamically associated with batch number to form a transportation process data chain. S3, Batch code activation in the distribution process: At the distribution node, the batch number in the loading batch data packet is read by scanning the code, a dynamic batch QR code including loading image data and access to the transportation process data chain is generated, and the QR code is pasted on the transport vehicle or distribution container. S4, Visualized Traceability Data Integration: When end users scan the dynamic batch QR code, loading image data and vehicle image data are called and integrated with the timeline to form a visualized traceability map, showing the loading scene, transportation route and cargo status change images. S5, Intelligent Verification of Consumer-End Physical-Image Chain: At the consumer end, real-time images of purchased agricultural products are captured via mobile devices and compared with loading and vehicle-mounted images. A lightweight convolutional neural network model is used to match image features, generating a difference heatmap to mark stacked contours or areas of appearance change, and automatically determining the image consistency level; specifically including: S51, Real-world Image Acquisition and Three-Source Image Preparation: At the consumer end, users capture real-time images of the agricultural products they purchase using their mobile devices, thus acquiring the current real-world image. Synchronously retrieve the loading images corresponding to that batch number. and transportation node images The current physical images, loading images, and transportation node images are formatted, sized, and aligned with color histograms. S52, Image Feature Extraction and Difference Heatmap Generation: The current physical object image, loading image, and transportation node image are sequentially input into a lightweight convolutional neural network to extract structural feature vectors and deep semantic representations. Through a multi-scale feature matching mechanism, the similarity between the current physical object image and historical images is compared, and a difference heatmap is generated using Grad-CAM. S53, Image Consistency Level Assessment and Risk Warning: Calculate the image consistency score index based on the regional distribution density and change intensity in the difference heatmap. It compares the results with the preset consistency level standard and outputs the consistency level, including high consistency, moderate deviation, and serious non-compliance, and triggers the corresponding risk warning based on the output consistency level.

2. The method for visual traceability of agricultural products based on batch number and vehicle-mounted image recognition according to claim 1, characterized in that, The batch makeup vehicle and data binding in S1 include: S11, Generation of unique batch identifier: Construct a globally unique batch number BatchID based on three pieces of information: loading timestamp, loading location code, and vehicle number; S12, Loading image data acquisition and preprocessing: The dual-camera array deployed above and at the rear of the vehicle cargo compartment synchronously acquires images of the stacked goods and panoramic images of the cargo compartment after loading. The stacked goods and panoramic images of the cargo compartment are stored in RGB three-channel format and are normalized and noise filtered after acquisition. The standard output size is 640×480 pixels. S13, Batch Data Package Construction and Binding: The generated batch ID, normalized loading image data, loading timestamp, loading personnel identification code, and loading geographical location are structurally integrated to generate a loading batch data package. .

3. The method for visual traceability of agricultural products based on batch number and vehicle-mounted image recognition according to claim 1, characterized in that, The dynamic transportation image association in S2 includes: S21, Synchronous Acquisition of Vehicle-Mounted Images and Environmental Data: During transportation, the vehicle-mounted intelligent terminal acquires data at set time intervals. Periodically trigger the image acquisition module and environmental sensors to acquire current cargo image frames. ,temperature ,humidity and GPS location And record the current timestamp. ; S22, Cargo Shape Anomaly Detection: For the current frame With the previous frame Morphological and structural change analysis was performed, and a deformation region identification algorithm based on structural similarity was used to calculate the stacking morphological anomaly index. ,when Exceeding the set threshold If so, it is considered that the goods are in an abnormal state; S23, Data Link Generation and Binding during Transportation: This involves generating and binding the currently acquired image frames. GPS coordinates Temperature and humidity data timestamp Morphological abnormality index The corresponding batch number (BatchID) is then used for data structuring and integration to generate transportation node data items. and all Connected sequentially in time, forming a data chain for the transportation process. .

4. The method for visual traceability of agricultural products based on batch number and vehicle-mounted image recognition according to claim 1, characterized in that, The batch code activation in the distribution process of S3 includes: S31, Batch Number Parsing and Distribution Node Identity Binding: Distribution nodes use barcode scanners to scan batch number identifiers on transport vehicles or cargo labels, and obtain the corresponding batch number through the loading batch data packet interface. and assign the current distribution node identity code This is bound to form the distribution node context information, represented as: ; in, This is the timestamp for activation via QR code scanning; S32, Dynamic QR code data construction and encryption compression: based on the context information of the bound distribution node. Corresponding loading image data reference address , Data link entry address during transportation Generate the original data structure of the QR code The original QR code data structure is encrypted using AES symmetric encryption and Base64 compression encoding to generate a QR code string. ; S33, QR code generation and deployment pasting: Paste the QR code string Render as image format QR code The QR code is printed and affixed to the surface of the transport vehicle or the outside of the distribution container using a thermal printing device or digital label terminal.

5. The method for visual traceability of agricultural products based on batch number and vehicle-mounted image recognition according to claim 1, characterized in that, The visualization and tracing data integration in S4 includes: S41, Dynamic QR Code Parsing and Data Retrieval: After the end user scans the dynamic batch QR code, the loading image data address in the QR code is parsed. Data link address during transportation It then uses a unified access interface to retrieve image content and associated timestamp information to form an initial set of image sequences. ; S42, Image Timeline Reconstruction and Annotation: Reconstructing and Annotating the Initial Image Sequence Set According to timestamp Arrange the images in ascending order and construct a timeline index, represented as follows: ; in, For the first The normalized position of the image on the time axis This represents the total number of frames in the image. S43, Visual Atlas Generation and Display: Based on Image Timeline Indexing With image content The terminal interface constructs a traceability visualization map, including an initial real-world image of loading, images of the transportation process arranged in chronological order, an overlaid transportation route map trajectory, and an anomaly marker layer for changing frames.

6. The method for visual traceability of agricultural products based on batch number and vehicle-mounted image recognition according to claim 1, wherein the physical image acquisition and image three-source preparation in S51 includes: S511, Real-world image acquisition and identification association: Consumers use a mobile terminal camera module to capture real-time images of the agricultural products they purchase, generating a current real-world image. It automatically parses the bound dynamic batch QR code and extracts the corresponding batch number. ; S512, Dual-source retrieval of historical images: via batch number Access the traceability image database to obtain the loading images associated with this batch. and transportation node images Together they form the set of images to be compared. ; S513, Image Format Normalization and Color Histogram Alignment: For Sets of Images to be Compared All images in the process undergo format conversion, size normalization, and color distribution standardization in sequence, specifically including: Size normalization: Bilinear interpolation is used to uniformly scale each image to a fixed size. ; Color histogram alignment: with loading image As a reference, perform color histogram matching on the current physical object image and the transportation node image, and output a set of images with uniform format, size, and color space. .

7. The method for visual traceability of agricultural products based on batch number and vehicle-mounted image recognition according to claim 6, characterized in that, The image feature extraction and differential heatmap generation in S52 include: S521, Image Feature Extraction: Input the normalized current physical image, loading image and transportation node image into the lightweight convolutional neural network model respectively, and extract their corresponding structural feature vectors; S522, Multi-scale Feature Similarity Comparison: At different receptive field scales, the structural feature cosine similarity is calculated for the current object image, loading image, and transportation node image, respectively, and a fusion similarity score is formed by combining them. ; S523, Difference Heatmap Generation: The Grad-CAM algorithm is used to locate the regions with the greatest feature differences, generating a difference heatmap. .

8. The method for visual traceability of agricultural products based on batch number and vehicle-mounted image recognition according to claim 7, characterized in that, The image consistency level determination and risk warning in S53 include: S531, Extraction of Change Regions and Analysis of Heatmaps: Based on Existing Differential Heatmaps Extract all pixel thresholds that satisfy the significant change condition. Calculate the density of the varying regions within the pixel area. and average intensity ; S532, Image Consistency Score Calculation and Grade Determination: Fusing density and average intensity of changed regions to calculate image consistency score index. ,when When, it indicates that the consistency level is highly consistent. When, it indicates that the consistency level is moderate deviation, when When this occurs, it indicates a serious non-compliance level. S533, Consistency Level Output and Risk Warning Trigger: Based on consistency scoring indicators The corresponding level range and output image consistency level label. And trigger corresponding risk warning strategies, including: like The images match, indicating the product is trustworthy; like The error message indicates a moderate deviation; please pay attention to identification. like The message indicates that the image is seriously mismatched; it is recommended to refuse delivery or verify the source.