A method for detecting pig verification stamps

By collecting and preprocessing images in the pig verification chapter detection, a deep learning model is constructed, signal intensity and Euro-style distance difference is calculated, and misjudgment problems are solved, the detection accuracy is improved and the false detection rate is reduced.

CN120299048BActive Publication Date: 2025-08-08JIANGSU ZHIWEI AUTOMATION EQUIP CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510784348.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-12
Publication Date
2025-08-08
Estimated Expiration
2045-06-12

AI Technical Summary

Technical Problem

Existing deep learning algorithms have misjudgment problems in pig verification chapter detection, which affects the accuracy of detection.

Method used

By collecting and preprocessing pig images, a deep learning model is constructed, the pixel point signal intensity and Euro-style distance difference of the image in the verification chapter area are calculated, and the error detection rate is reduced using the Gaussian distribution.

Benefits of technology

It improves the accuracy of pig verification stamp detection, reduces the error detection rate, saves time and computing resources, and is simple and has strong applicability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120299048B_ABST
    Figure CN120299048B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of pork quarantine technology, and in particular to a method for detecting pig verification stamps. The method comprises collecting images of pigs bearing verification stamps and preprocessing the pig images; constructing a deep learning model to identify the verification stamps in the images and output an image of the verification stamp region; calculating the signal strength of each pixel in the verification stamp region image; selecting feature points whose signal strength exceeds a set threshold and calculating the Euclidean distance difference between the feature points. When the Euclidean distance difference of the feature points satisfies a Gaussian distribution, it is determined that a verification stamp is present in the verification stamp region image; otherwise, the verification stamp region image is deemed to be absent. The present invention solves the problem of misjudgment of verification stamps detected by existing deep learning algorithms.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of pork quarantine, and in particular to a method for detecting pig verification stamps. Background Art

[0002] Pig verification stamp testing is an important means to ensure the quality and safety of pork products. Through visual inspection, spectral detection, fluorescence detection and RFID and other technologies, verification stamps can be effectively identified to ensure that the source of pork is reliable and the quality is qualified.

[0003] Publication number CN118072056A is a machine vision-based pork quarantine stamp recognition system. After feature matching, the object recognition module compares and identifies the matched features with known pork quarantine stamp features. Feature matching uses a classifier or classification algorithm, such as support vector machine (SVM), k-nearest neighbor (KNN), or deep learning algorithm. Training is used to determine whether the input image contains the pork quarantine stamp. Due to the influence of the quality of the collected image, the size of the data set, and the accuracy of the algorithm, there may be misjudgments of the detected verification stamps. How to reduce misjudgments and improve accuracy is an urgent problem that needs to be solved. Summary of the Invention

[0004] In view of the shortcomings of the existing methods, the present invention solves the problem of misjudgment of verification stamps detected by existing deep learning algorithms.

[0005] The technical solution adopted by the present invention is: a method for detecting pig verification stamps comprises the following steps:

[0006] Step 1: Collect images of pigs with verification stamps and pre-process the images of pigs;

[0007] As a preferred embodiment of the present invention, the verification stamp is divided into: function, style, and color.

[0008] As a preferred embodiment of the present invention, the preprocessing includes: image enhancement, image denoising, and image geometric transformation.

[0009] Step 2: Build a deep learning model to identify the verification stamp in the image and output the verification stamp area image;

[0010] As a preferred embodiment of the present invention, the deep learning model includes: Yolo network and CNN network.

[0011] Step 3: Calculate the signal strength of each pixel point in the verification stamp area image; select feature points whose signal strength exceeds a set threshold, and calculate the Euclidean distance difference between the feature points. If the Euclidean distance difference of the feature points satisfies the Gaussian distribution, it is determined that there is a verification stamp in the verification stamp area image; otherwise, there is no verification stamp in the verification stamp area image;

[0012] As a preferred embodiment of the present invention, the signal strength includes: comprehensive signal strength, single-channel signal strength, and hyperspectral image signal strength.

[0013] As a preferred embodiment of the present invention, step three specifically includes:

[0014] Step 31: When the signal strength value of a pixel exceeds a first threshold, the pixel is determined to be a feature point;

[0015] Step 32: Calculate the Euclidean distance difference between any two feature points;

[0016] Step 33: The Euclidean distance difference satisfies the Gaussian distribution, and the calculation expectation of the Gaussian distribution m 计 and preset expectations m 预 The error is less than the second threshold, calculate the variance σ 计 2 and the preset variance σ 预 2 When the error is less than the third threshold, it is determined that there is a verification stamp in the verification stamp area image.

[0017] As a preferred embodiment of the present invention, when there is a verification stamp in the verification stamp area image, the text of the verification stamp is extracted.

[0018] As a preferred embodiment of the present invention, when there is a verification stamp in the verification stamp shape area image, the shape of the verification stamp is extracted.

[0019] As a preferred embodiment of the present invention, a pig verification stamp detection system includes: a memory for storing instructions executable by a processor; and a processor for executing the instructions to implement a pig verification stamp detection method.

[0020] As a preferred embodiment of the present invention, a computer readable medium stores computer program code, and the computer program code implements the pig verification stamp detection method when executed by a processor.

[0021] Beneficial effects of the present invention:

[0022] 1. The present invention calculates the signal strength of each pixel point in the verification stamp area image, and then calculates the Euclidean distance difference of the feature points whose signal strength meets the threshold condition. Based on whether the Euclidean distance difference conforms to the Gaussian distribution, the calculated expectation and variance are compared with the corresponding preset value to determine whether the error is within the range. It is determined that there is a verification stamp in the verification stamp area image; this effectively reduces the problem of false detection of deep learning models and improves detection accuracy;

[0023] 2. Compared with the existing method of optimizing the network model, the method of the present invention can effectively reduce the false detection rate. The method is simpler and more applicable. There is no need to repeatedly train the network, saving time and computing resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 It is a flow chart of the pig verification stamp detection method of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be further described below in conjunction with the accompanying drawings and embodiments. This figure is a simplified schematic diagram, which only illustrates the basic structure of the present invention in a schematic manner, and therefore only shows the components related to the present invention.

[0026] like Figure 1 As shown, a method for detecting a pig verification stamp includes the following steps:

[0027] Step 1: Collect images of pigs with verification stamps and pre-process the images of pigs;

[0028] Pig verification stamps are used to indicate that pork has undergone legal quarantine and inspection. The types and styles of verification stamps vary depending on the country, region, industry standards, and specific uses.

[0029] Verification stamps are divided into the following categories according to their functions: quarantine stamp, used to indicate that pork has undergone animal quarantine and meets hygiene standards; inspection stamp, used to indicate that pork has undergone quality inspection and meets food safety standards; enterprise stamp, used to identify the source enterprise of pork for traceability and management;

[0030] Verification stamps are available in various shapes including circular, oval, rectangular and square;

[0031] Verification stamps are divided into blue, green, red and purple according to their colors;

[0032] Preprocessing includes: image enhancement, image denoising, and image geometric transformation;

[0033] Construct a dataset of pig images with verification stamps and divide it into training and test sets;

[0034] Step 2: Build a deep learning model to identify the verification stamp in the image and output the verification stamp area image;

[0035] Deep learning models include: Yolo network, CNN network;

[0036] The convolutional layers in the deep learning model can use normal convolutional layers or dynamic convolutional layers; the number of convolutional layers can be customized.

[0037] The verification stamp area image can be obtained through the detection box of the deep learning model.

[0038] Step 3: Calculate the signal strength of each pixel point in the verification stamp area image; select feature points whose signal strength exceeds a set threshold, and calculate the Euclidean distance difference between the feature points. If the Euclidean distance difference of the feature points satisfies the Gaussian distribution, it is determined that there is a verification stamp in the verification stamp area image; otherwise, there is no verification stamp in the verification stamp area image;

[0039] When it is determined that there is no verification stamp, the image of the verification stamp area should be removed;

[0040] The signal strength of the pixel point includes: single channel signal strength, comprehensive signal strength, and hyperspectral image signal strength;

[0041] The formula for the integrated signal strength is:

[0042] I z ( x , y )=0.299* R ( x , y )+0.587* G ( x , y )+0.114* B ( x , y ) (1)

[0043] Among them, the coefficients 0.299, 0.587, and 0.114 are the weights of the human eye's sensitivity to different colors; R (x,y), G (x,y), B (x,y) are the red, green, and blue channel values of the pixel respectively.

[0044] The formula for single-channel signal strength is:

[0045] IR ( x , y )= R ( x , y ), IG ( x , y )= G ( x , y ), IB ( x , y )= B ( x , y ) (2)

[0046] The formula for the hyperspectral image signal intensity is:

[0047] I ( x , y )=∑ w i * B i ( x , y ) (3)

[0048] in, B i ( x , y ) is the i The pixel value of each band, w i It is i The weight of the band.

[0049] Step 31: When the signal strength value of a pixel exceeds a first threshold, the pixel is determined to be a feature point;

[0050] Taking the comprehensive signal strength as an example, feature points are extracted from the verification stamp area image, and the first threshold is set to 100. I z ( x , y )≥100, 30 feature points are screened out;

[0051] Verification stamps with different functions and styles may have different preset first thresholds.

[0052] Step 32: Calculate the Euclidean distance difference between any two feature points;

[0053] The formula for Euclidean distance difference is:

[0054] d ( P , Q )=sqrt[( x 2- x 1) 2 +( y 2- y 1) 2 ] (4)

[0055] in, P 、 Q are different feature points; x 2. y 2 is the feature point Q The pixel coordinates of x 1, y 1 is the feature point P The pixel coordinates; sqrt is the square root.

[0056] For example: 30 feature points are calculated pairwise to obtain C 30 2 = 435 Euclidean distance differences.

[0057] The probability density function curve of the Gaussian distribution is bell-shaped, so it is also called the bell curve, that is, the random variable X obeys a mathematical expectation m , the variance is σ 2 Gaussian distribution, denoted as N( m , s 2 ); In Gaussian distribution, the mathematical expectation m Indicates the center position of the bell, that is, the position of the curve, and the standard deviation s Characterizes the degree of dispersion of the curve.

[0058] Step 33: The Euclidean distance difference satisfies the Gaussian distribution, and the calculation expectation of the Gaussian distribution m 计 and preset expectations m 预 The error is less than the second threshold, calculate the variance σ 计 2 and the preset variance σ 预 2 When the error is less than the third threshold, it is determined that there is a verification stamp in the verification stamp area image.

[0059] Verification stamps with different functions and styles have different presets m 预 and σ 预 2 , when the Euclidean distance difference of the verification stamp of a certain function and style conforms to the Gaussian distribution, and the calculated m 计 and σ 计 2 With preset m 预 and σ 预 2 When the error is less than the set threshold, it is judged that there is a verification stamp in the verification stamp area image; otherwise, it is judged that there is a verification stamp in the verification stamp area image;

[0060] For example: | m 预 - m 计 |≤ɑ,ɑ=0.1;|σ 预 2 -σ 计 2 |≤β, β=0.2; ɑ is the second threshold, β is the third threshold.

[0061] The formula for Gaussian distribution is:

[0062] f ( x )=exp(−( x-m ) 2 / 2 s 2 ) / (sqrt(2 π )* s ) (5)

[0063] in, x is the value of the random variable, exp(.) is the exponential function, s is the standard deviation.

[0064] When there is a verification stamp in the verification stamp area image, text extraction and shape recognition are performed on the verification stamp image;

[0065] Among them, text recognition can be performed through ORC recognition tools to extract text;

[0066] Shape recognition can adopt the geometric model method based on the least squares method or the graphical model method based on the Hungarian algorithm.

[0067] With the above-described preferred embodiments of the present invention as a guide, and with reference to the above description, relevant personnel are fully capable of making various changes and modifications without departing from the technical scope of this invention. The technical scope of this invention is not limited to the contents of the specification and must be determined according to the scope of the claims.

Claims

1. A method for detecting pig verification stamps, characterized in that: The following steps are involved: Step 1: Collect images of pigs with verification stamps and pre-process the images of pigs; Step 2: Build a deep learning model to identify the verification stamp in the image and output the verification stamp area image; Step 3: Calculate the signal strength of each pixel point in the verification stamp area image; select feature points whose signal strength exceeds the set threshold, and calculate the Euclidean distance difference between the feature points. When the Euclidean distance difference of the feature points satisfies the Gaussian distribution, it is judged that there is a verification stamp in the verification stamp area image; otherwise, there is no verification stamp in the verification stamp area image.

2. The pig verification stamp detection method according to claim 1, characterized in that: Step three specifically includes: Step 31: When the signal strength value of a pixel exceeds a first threshold, the pixel is determined to be a feature point; Step 32: Calculate the Euclidean distance difference between any two feature points; Step 33: The Euclidean distance difference satisfies the Gaussian distribution, and the calculation expectation of the Gaussian distribution μ 计 and preset expectations μ 预 The error is less than the second threshold, calculate the variance σ 计 2 With the preset variance σ 预 2 When the error is less than the third threshold, it is determined that there is a verification stamp in the verification stamp area image.

3. The pig verification stamp detection method according to claim 1, characterized in that: Signal strength includes: comprehensive signal strength, single-channel signal strength, and hyperspectral image signal strength.

4. The pig verification stamp detection method according to claim 1, characterized in that: The classification of verification stamps includes: function, style, and color.

5. The pig verification stamp detection method according to claim 1, characterized in that: Preprocessing includes: Image enhancement, image denoising, and image geometric transformation.

6. The method for detecting pig verification stamps according to claim 1, wherein: Deep learning models include: Yolo network and CNN network.

7. The method for detecting pig verification stamps according to claim 1, wherein: When there is a verification stamp in the verification stamp area image, the shape of the verification stamp is extracted.

8. The method for detecting pig verification stamps according to claim 1, wherein: When there is a verification stamp in the verification stamp area image, the text of the verification stamp is extracted.

9. The pig verification stamp detection system is characterized by: include: a memory for storing instructions executable by the processor; A processor, configured to execute instructions to implement the pig verification stamp detection method according to any one of claims 1 to 8.

10. A computer-readable medium storing computer program code, characterized in that The computer program code, when executed by a processor, implements the pig verification stamp detection method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Pork quarantine seal recognition system based on machine vision

    CN118072056A

  • Unsupervised human detecting and positioning method

    CN104267439A

  • Tray detecting and positioning method based on RGB-D camera

    CN116309817A