CN116930162A - Method for identifying freshness grade of chilled fresh pork - Google Patents

Method for identifying freshness grade of chilled fresh pork Download PDF

Info

Publication number
CN116930162A
CN116930162A CN202310698025.2A CN202310698025A CN116930162A CN 116930162 A CN116930162 A CN 116930162A CN 202310698025 A CN202310698025 A CN 202310698025A CN 116930162 A CN116930162 A CN 116930162A
Authority
CN
China
Prior art keywords
image
shikonin
label
fresh pork
freshness
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310698025.2A
Other languages
Chinese (zh)
Inventor
祝志慧
蔡紫荆
何昱廷
李沃霖
马美湖
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huazhong Agricultural University
Original Assignee
Huazhong Agricultural University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huazhong Agricultural University filed Critical Huazhong Agricultural University
Priority to CN202310698025.2A priority Critical patent/CN116930162A/en
Publication of CN116930162A publication Critical patent/CN116930162A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/68Food, e.g. fruit or vegetables
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/75Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated
    • G01N21/77Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated by observing the effect on a chemical indicator
    • G01N21/78Systems in which material is subjected to a chemical reaction, the progress or the result of the reaction being investigated by observing the effect on a chemical indicator producing a change of colour
    • GPHYSICS
    • G01MEASURING; TESTING
    • G01NINVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
    • G01N21/00Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
    • G01N21/84Systems specially adapted for particular applications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/36Applying a local operator, i.e. means to operate on image points situated in the vicinity of a given point; Non-linear local filtering operations, e.g. median filtering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • G06V10/765Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects using rules for classification or partitioning the feature space
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/766Arrangements for image or video recognition or understanding using pattern recognition or machine learning using regression, e.g. by projecting features on hyperplanes

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Chemical & Material Sciences (AREA)
  • Software Systems (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Evolutionary Computation (AREA)
  • Pathology (AREA)
  • Medical Informatics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Artificial Intelligence (AREA)
  • Immunology (AREA)
  • Biochemistry (AREA)
  • Computing Systems (AREA)
  • Analytical Chemistry (AREA)
  • Plasma & Fusion (AREA)
  • Chemical Kinetics & Catalysis (AREA)
  • Nonlinear Science (AREA)
  • Image Analysis (AREA)

Abstract

The invention discloses a method for identifying freshness grade of chilled fresh pork. The method comprises the steps of preparation of shikonin indicating films, determination of a cold fresh pork packaging mode, establishment of a shikonin indicating label image acquisition system, image processing, establishment of a cold fresh pork freshness detection model, and identification of the cold fresh pork freshness grade by adopting the model. According to the method, shikonin is used for preparing the cold fresh pork freshness indication label, so that the visualization of the cold fresh pork freshness is realized; determining a cold fresh pork packaging mode suitable for a commercial super-special environment, and constructing a shikonin indication tag image acquisition system to avoid environmental illumination interference; establishing a cold fresh pork freshness detection model based on shikonin indication labels, and realizing accurate identification of the cold fresh pork freshness; by further quantifying the freshness of the chilled fresh pork, a use suggestion is given, more visual judgment is provided for consumers, and user experience is improved.

Description

Method for identifying freshness grade of chilled fresh pork
Technical Field
The invention belongs to the technical production field of meat product detection, and particularly relates to a method for identifying freshness grade of chilled fresh pork.
Background
Ensuring the freshness of meat products has important significance for ensuring the safety of the food. The traditional meat freshness detection method and the common nondestructive detection method have high dependence on detection personnel and detection instruments, are complex to operate, are easy to damage meat in the detection process, and are not suitable for rapid online detection in the meat production process. Therefore, indicator tags capable of monitoring freshness of meat in real time have been developed and have been in a trend of getting hotter as technology is developed.
The meat freshness indicator tag is used as a visual tag, the quality of meat in the package can be reflected visually through color change, the quality condition of the meat is monitored, and the food safety is ensured. At present, most of meat freshness indication labels are prepared based on chemical synthesis indicators, have the problems of narrow pH color development range, single color change and the like, and are easy to cause potential threat to human health. Therefore, monitoring freshness of foods during storage using natural pigments sensitive to pH changes and green, healthy and environmentally friendly as indicators is a hotspot of current research. Prietto et al prepares a pH sensitive film based on red cabbage anthocyanin, can realize detection of various acid-base components in food, and researches show that the indicator has higher color stability under cooling conditions and is suitable for detecting freshness of refrigerated food such as fish meat. Sun Wuliang and the like, the anthocyanin nanofiber intelligent tag is applied to mutton in the market under the temperature storage, and the new mutton is realized by establishing a model for predicting the total nitrogen content of volatile salt groups by using chromatic aberration The nondestructive real-time visual detection of the freshness is realized, and the detection accuracy reaches 88.2 percent. Feng Qingxia and the like, which successfully indicate the freshness of beef stored at room temperature, have good application prospect. Xiaodong to solve the problem of color fading of indication label caused by ultraviolet light decomposition of anthocyanin, rutile type nanometer titanium dioxide is adopted to block ultraviolet light to protect anthocyanin. Research results show that the light stability of the double-layer film is along with that of TiO 2 The increase in concentration is enhanced.
The common natural pigments such as anthocyanin, curcumin, alizarin and the like in the meat freshness indication label can well indicate the meat freshness, but have the problems of unobvious color change or easy dissolution in a high humidity environment, and are not suitable for packaging commercial super-cooled fresh meat. The shikonin is used as a typical mauve naphthoquinone alcohol-soluble natural pigment, is insoluble in water, has obvious color change, has the functions of antioxidation, antivirus, antibiosis and the like, and is very suitable for monitoring the quality of food in real time in food packaging. CN114805875A low-temperature molded pork freshness visual intelligent indication film, a preparation method and application thereof, wherein the detection of the freshness of the chilled fresh pork is realized, but the detection is not combined with a commercial superenvironment in application, the influence of commercial supercomplex illumination on color identification is not considered, errors are easy to exist, and meanwhile, the freshness of the chilled fresh pork is not quantized, so that more visual judgment cannot be provided for consumers.
Disclosure of Invention
The invention provides a method for identifying the freshness grade of chilled fresh pork and an information output device of a nondestructive testing device, wherein shikonin is used as an indicator, gelatin and sodium alginate are used as film forming base materials, edible glycerol is used as a plasticizer, and an indicator film is prepared by a tape casting method and is used for monitoring the freshness of chilled fresh pork. Meanwhile, aiming at the problem of inaccurate color identification caused by subjective judgment of people, an image acquisition system is built to acquire stable and reliable label images, the acquired images are preprocessed and feature extracted, a chilled fresh pork freshness detection model is built, and an information output device capable of displaying the freshness of chilled fresh pork and giving use suggestions by scanning shikonin indication labels is developed so as to achieve the purposes of detecting the freshness of the chilled fresh pork in real time and guaranteeing food safety.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for identifying freshness grade of chilled fresh pork, the method comprising the steps of:
s1: preparing a shikonin indicating film;
s2: determining a packaging mode of the chilled fresh pork;
s3: building a shikonin indication tag image acquisition system;
s4: image processing;
S5: establishing a cold fresh pork freshness detection model;
s2: the model of the step S4 is used for identifying the freshness grade of the chilled fresh pork.
Preferably, the preparation method of the step S1 is as follows:
s1.1, preparing a film forming liquid: under the magnetic stirring condition, uniformly mixing a sodium alginate solution and a gelatin solution according to the mass ratio of 4:6, then adding a shikonin solution and a glycerol solution, and uniformly stirring to obtain a film forming solution; wherein, the liquid crystal display device comprises a liquid crystal display device,
the mass concentration of the sodium alginate solution is 1.49%, the mass concentration of the gelatin solution is 8.84%, the mass of the shikonin powder is 1.0% of the dry weight of the film forming matrix, the mass concentration of the glycerol solution is 6%, and the mass of the added glycerol solution is 6% of the total mass of the film forming liquid.
S1.2, casting the prepared film forming liquid on a film blank, then placing the film blank at a low temperature of 4 ℃ for film forming, and finally removing the film to obtain the indication film in which shikonin is dispersed in a molecular free state.
Preferably, the step S2 is carried out by packaging the chilled fresh pork; a disposable PET plastic packaging box with the length of 20.5cm multiplied by 13cm multiplied by 4.5cm is used for storing chilled fresh pork, a prepared shikonin indication label is stuck to the inner side of a packaging box cover to monitor the freshness of the chilled fresh pork, and a white balance calibration card is stuck to the periphery of the shikonin indication label to be used as a reference for the automatic white balance adjustment effect.
Preferably, the step S3 of constructing the shikonin indication tag image acquisition system comprises a detection platform and a mobile phone, wherein the inner wall of the camera bellows is tiled by black light absorption paper, the detection platform comprises a light source and an objective table, and the light source is arranged at the top of the interior of the camera bellows; determining the distance between the objective table and the top of the camera bellows to be 20cm; in the test process, the box-packed chilled fresh pork with the shikonin indication label is placed on an objective table in a camera bellows, the camera bellows is closed to reduce the influence of natural light, then a mobile phone is placed at the outer top of the camera bellows and fixed, a camera of the mobile phone is opened to adjust the focal length, and finally a photo is clicked to obtain a shikonin indication label image.
Further preferably, the positive white light LED flexible lamp strip with the color temperature of the light source being 6000-6500K is used as the light source. Preferably, the step S4 image processing includes the following steps;
s4.1, automatic white balance adjustment is carried out, and a real image is obtained;
s4.2, separating the front background of the image, reserving an alkannin indication label image, and basically removing useless information;
s4.3, image segmentation;
s4.4, extracting shikonin to indicate the color characteristics of the label.
Further preferably, the method of automatic white balance adjustment in step S4.1 is to perform automatic white balance adjustment by adopting a perfect reflection method, find out a pixel point with highest image brightness as a reference white point, calculate gains of RGB channels according to the reference white point, and perform color adjustment, and the calculation method is as follows:
Wherein R is max 、G max 、B max Respectively representing the maximum value of three channels of red, green and blue, R ij 、G ij 、B ij Respectively representing the gray values of three red, green and blue channels at point (i, j), R, G, B respectively representing the gray values of three red, green and blue channels, R new 、G new 、B new Respectively representing gray values of the red, green and blue channels after processing;
further preferably, the step S4.2 image front background separation method is as follows: performing image graying and binarization processing according to the gray value of the shikonin indication label area, and then performing phase subtracting operation on the binarized image and the image subjected to automatic white balance adjustment to separate the shikonin indication label area;
the gray processing treatment is carried out on the shikonin indication label picture after the automatic white balance treatment by adopting a weighted average method, and the calculation method is as follows:
L(i,j)=ω R ×R(i,j)+ω G ×G(i,j)+ω B ×B(i,j) (3);
wherein omega R 、ω G 、ω B Weights of three components R, G, B respectively, and ω is taken R =0.299,ω G =0.587,ω B =0.114;
In order to distinguish shikonin indication label areas and background areas, binarization processing is carried out on the images, and the fixed double-threshold method is used for binarization of the images, wherein the calculation method is as follows:
where L (i, j) is the gray value of the gray image at point (i, j), T 1 、T 2 For the set threshold, T is adopted 1 =100、T 2 =180;
After the shikonin indication label image is subjected to binarization processing, the gray value of the label part is set to be 0, the image subjected to automatic white balance processing and the binarization image are subjected to phase subtraction operation, the calculation method is shown as a formula (5), the image of the label part is completely reserved through the operation, the image background is basically removed,
Wherein R is new (i,j)、G new (i,j)、B new (i, j) are gray values of red, green and blue channels at a point (i, j) of the image after the region of interest is extracted, R (i, j), G (i, j) and B (i, j) are gray values of red, green and blue channels at the point (i, j) of the image after automatic white balance adjustment, and L (i, j) is a gray value of the gray image at the point (i, j).
Further preferably, the image segmentation method in step S4.3 is as follows:
s4.3.1: converting the RGB color image of the shikonin indication label of the region of interest into an HSV color space, and finding the position of the shikonin indication label by threshold segmentation of the S component and the V component to generate a mask image; wherein the S component of the label color is between 0.5 and 0.7 and the V component is between 0.7 and 0.9;
s4.3.2: filling the hollows around the label to obtain a complete frame area, performing morphological operation on the mask image generated in the previous step, namely firstly expanding and then corroding, filling the hollows at the edge of the label indicated by shikonin, and smoothing the boundary, wherein the calculation method comprises the following steps:
wherein, (x ', y') is the position of the morphological operation convolution kernel, and a plane disc-shaped structural element with the radius of 20 is adopted as the convolution kernel; when the expansion operation is carried out, after the convolution kernel slides over the whole image, the pixel passing by the kernel anchor point becomes the brightness maximum value in the kernel coverage area; when the 'erosion' operation is performed, after the convolution kernel slides over the whole image, the pixel passing by the kernel anchor point becomes the brightness minimum value in the kernel coverage area.
S4.3.3: and finding out the boundary box of the label area by searching the attribute of the connected area in the mask, finding out the position of the label, and cutting out the label to obtain the shikonin indication label.
Further preferably, the method for extracting shikonin indication tag color features in the step S4.4 is as follows:
s4.4.1: cutting a target area, wherein the label size is 590 multiplied by 590pixels, firstly finding out the center point of the extracted label image, and then expanding outwards from the center point to obtain a label image with the size of 400 multiplied by 400 pixels;
s4.4.2: the extracted shikonin indicates that the label image has noise interference, so the label image is firstly subjected to Gaussian filtering,
the calculation method is shown as a formula (8);
wherein, (2k+1) x (2k+1) is a gaussian convolution kernel, and a square window of 3 x 3 is used for filtering; sigma is the variance of the sum of the squares,
herein σ=20;
s4.4.3: taking the average value of gray values of three channels of the whole area R, G, B of the filtered tag image as the gray values of R, G, B three channels of the shikonin indication tag; modeling an image sample by extracting 22-dimensional features, including R, G, B, R + G, R + B, G + B, R +g+ B, R/(r+g), R/(r+b), R/(g+b), R/(r+g+b), G/(r+g), G/(r+b), G/(g+b), G/(r+g+b), B/(r+g), B/(r+b), B/(g+b), B/(r+g+b), (r+g)/(r+b), (r+g)/(g+b), and (r+b)/(g+b);
S4.4.4: in order to eliminate the dimensional influence among the color indexes of the shikonin indication label, normalization processing is carried out on the shikonin indication label, and the calculation method is as follows:
wherein x is max ,x min To represent the maximum and minimum values in the dataset, a normalization range of 0 to 1 is chosen.
Further preferably, the step S5: the establishment of the cold fresh pork freshness detection model comprises the following steps:
(one) partial least squares regression: carrying out standardized processing on the data; obtaining main components meeting the requirements; establishing regression between the main component and the original independent variable and between the main component and the dependent variable; continuing to calculate the main component until the requirement is met; deriving a regression expression of the dependent variable from the independent variable; checking-cross validity; setting the maximum main factor number of the PLSR model as 20, determining the optimal main factor number by a 10-fold cross validation method, and finally setting the main factor number as 10;
and (II) a support vector machine: preprocessing data; mapping data into a high-dimensional space using a kernel function; calculating a hyperplane, and searching a hyperplane in a high-dimensional space so as to maximize the distance between various data points and the hyperplane; classifying the new sample using the learned model; modeling by using a Gaussian kernel function, wherein the regularization term coefficient C is 16, and gamma is 32;
(III) K-nearest neighbor: calculating the distance between each sample point in the training sample and the test sample; sorting all the distance values; selecting the first k samples with the minimum distance; voting according to the labels of the k samples to obtain the final classification category; wherein the K value is 5;
(IV) random forest: sampling the training set sample with a place back to obtain M groups of subsets for establishing decision trees; randomly selecting m features, and training a classification regression decision tree by using the subsets; integrating the M decision trees into a random forest; the number of decision trees is 5, the maximum tree depth is not limited, the minimum number of samples of leaf nodes is 2, and the minimum number of samples required by node splitting is 2;
evaluation index of the above model: the root mean square error (Root Mean Square Error, RMSE) and the correlation coefficient R are used as evaluation indexes of the regression model, and the calculation methods are shown in formulas (10) and (11):
wherein n is a sampleQuantity, y i For the predicted value of the ith sample, y i For the true value of the ith sample, y is the average of the true values of the samples.
Using the Accuracy (Accuracy, a), the fresh meat identification Accuracy (Fresh meat recognition Accuracy, frc) and the spoiled meat identification Accuracy (Spoiled meat recognition Accuracy, src) as the evaluation indexes of the classification model, the calculation methods are as shown in formulas (12), (13) and (14):
TP is the number of correctly identified fresh meat samples; FN is the number of misjudged fresh meat samples; TN is the number of correctly identified spoiled meat samples; FP is the number of erroneous decisions of the spoiled meat sample.
Further preferably, the step S5: in the establishment of a chilled fresh pork freshness detection model, a random forest model is used for quantifying the freshness of chilled fresh pork, and the establishment of a random forest regression model is used for detecting the TVB-N content of pork, wherein the number of decision trees is 5, the maximum tree depth is not limited, the minimum number of samples of leaf nodes is 2, and the minimum number of samples required by node splitting is 2.
According to the method, a cold fresh pork packaging mode suitable for a commercial ultra-special environment is determined, an alkannin image acquisition system is built to avoid environmental illumination interference, and the cold fresh pork freshness is accurately identified and quantified by building a cold fresh pork freshness detection model.
Compared with the prior art, the invention has the following beneficial effects:
1) The freshness of the chilled fresh pork is visualized through the shikonin indication label, so that the chilled fresh pork is easy to observe;
2) The cold fresh pork packaging mode and the shikonin indication label image acquisition system which are suitable for the ultra-complex environment of the commercial industry are determined, and the method is practical;
3) The fresh pork freshness information can be obtained by taking pictures through the mobile phone, the operation is simple, and the accuracy is high. By further quantifying the freshness of the chilled fresh pork, a use suggestion is given, more visual judgment is provided for consumers, and user experience is improved.
4) The method has good grading effect on the chilled fresh pork, the overall accuracy of the test set is over 95 percent, the identification accuracy of the deteriorated pork of the test set is 100 percent, and the accurate detection of the deteriorated pork can be realized.
Drawings
FIG. 1 is a flow chart of the preparation of shikonin indicator film;
FIG. 2 is a packaging of chilled fresh pork;
FIG. 3 is a schematic diagram of a shikonin indication tag image acquisition platform;
figure 4 shikonin indication label image at different stage heights: a) 35cm, b) 30cm, c) 25cm, d) 20cm,
e)15cm;
fig. 5 is a comparison of different automatic white balance adjustment methods: a) original image, b) gray world method, c) perfect reflection method, d) dynamic threshold method;
figure 6 shikonin indicates label image background removal:
fig. 7 shikonin indicates HSV component of the label image: a) H component b) S component c) V component;
FIG. 8 shikonin indicates a mask for a label image;
the shikonin image of fig. 9;
fig. 10 shikonin indication label image clipping schematic diagram: a) Clipping the schematic diagram b) the clipped label image;
FIG. 11 changes in TVB-N content during storage of pork;
FIG. 12 shikonin indicates a label image processing flow chart;
FIG. 13 shikonin indicates tag color predicted TVB-N concentration;
FIG. 14 comparison of TVB-N content results for test set samples;
FIG. 15 is a functional block diagram of software;
FIG. 16 is a flow chart of the detection software;
FIG. 17 part of the detection software operator interface: a) detecting a software main interface, b) a user login interface, c) displaying a detection result, d) automatically scanning, e) displaying an inventory result, and f) returning to a default mode.
The specific embodiment is as follows:
the preferred embodiments of the present invention will be described below with reference to the accompanying drawings, it being understood that the preferred embodiments described herein are for illustration and explanation of the present invention only, and are not intended to limit the present invention.
Preferred embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While the preferred embodiments of the present disclosure are illustrated in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Example 1
1.1 shikonin indication tag image data acquisition
1.1.1 preparation of shikonin indication film
The film-forming liquid comprises a chromogenic matrix and a film-forming matrix, wherein the chromogenic matrix is shikonin with an antioxidant function and sensitive response to environmental pH change, the film-forming matrix is sodium alginate and gelatin, and the plasticizer is glycerol. Firstly, preparing a film forming liquid: under the magnetic stirring condition, uniformly mixing a sodium alginate solution and a gelatin solution according to the mass ratio of 4:6, then adding a shikonin solution and a glycerol solution, and uniformly stirring to obtain a film forming solution; wherein the mass concentration of the sodium alginate solution is 1.49%, the mass concentration of the gelatin solution is 8.84%, the mass of the shikonin powder is 1.0% of the dry weight of the film forming matrix, the mass concentration of the glycerol solution is 6%, and the mass of the added glycerol solution is 6% of the total mass of the film forming liquid. Casting the prepared film forming liquid on a film blank, then placing the film blank at a low temperature of 4 ℃ for film forming, and finally removing the film to obtain the indication film in which shikonin is dispersed in a molecular free state. The preparation flow of the shikonin indicating film is shown in figure 1.
1.2.1 determination of the packaging means for chilled fresh pork
In order to delay deterioration of fresh meat, reduce juice loss and keep fresh meat bright red, the invention adopts a disposable PET plastic packaging box with 20.5cm multiplied by 13cm multiplied by 4.5cm to store chilled fresh pork in the test process. Because the density of volatile nitrogen-containing gas generated in the meat product deterioration process is lower than that of air, the volatile nitrogen-containing gas can be accumulated above the inside of the packaging box, and shikonin can change color only after reacting with the gas, the prepared shikonin indication label is stuck on the inner side of the cover of the packaging box to monitor the freshness of the chilled fresh pork. In the invention, automatic white balance adjustment is adopted to correct the color cast problem of the shikonin indication label image in the test process, so that the white balance calibration card is stuck around the shikonin indication label to be used as a reference for the automatic white balance adjustment effect in order to conveniently evaluate the processing effect of the white balance algorithm. The packaging mode of the chilled fresh pork is shown in figure 2.
1.2.3 construction of shikonin indication tag image acquisition System
As shown in fig. 3, the shikonin indication tag image acquisition system consists of a detection platform and a mobile phone, and the inner wall of the camera bellows is tiled by black light absorption paper. The detection platform consists of a light source and an objective table, wherein the light source is arranged at the top in the camera bellows.
The shooting target of the invention is a shikonin indication label which is a color image, and a white light source is needed to avoid the problem of color bias caused by the color of the light source; in order to enable the light to cover the whole shikonin indication label area, the size of the light source is selected to be larger than that of the shikonin indication label; meanwhile, in order to make the illumination intensity of the whole label area consistent, the shape of the light source is close to that of the shikonin indication label, so that a strip light source is used. Therefore, the positive white light LED flexible lamp strip with the color temperature of 6000-6500K is finally selected as a light source.
According to the invention, the shikonin indication label image is acquired by using the mobile phone, the mobile phone is placed at the top of the camera bellows to acquire the image, and the sample is placed in the center of the objective table to facilitate image acquisition, so that the distance between the objective table and the mobile phone end can influence the picture quality. Too far distance can cause excessive useless information in the picture, and the workload is increased; too close a distance can cause difficulty in focusing the mobile phone and long shooting time. And adjusting the distance between the objective table and the mobile phone end to shoot a sample image, and determining the optimal height of the camera bellows by comparing the quality of the picture and the focusing time. FIG. 4, the mobile phone focuses fast when the distance between the object stage and the mobile phone end is 35cm, 30cm and 25cm, but the alkannin indication label part occupies small proportion in the picture, and the useless information is too much; when the distance between the objective table and the mobile phone end is 15cm, the ratio of the shikonin indication label part in the picture is large, but the focusing of the mobile phone is slow; the distance between the objective table and the mobile phone end is 20cm, the mobile phone focuses fast, and the shikonin indication label part occupies a proper proportion in the picture, so that the shooting effect is good. Therefore, the distance between the object stage and the mobile phone end is finally determined to be 20cm.
In the test process, the box-packed chilled fresh pork with the shikonin indication label is placed on an objective table in a camera bellows, the camera bellows is closed to reduce the influence of natural light, then a mobile phone is placed at the outer top of the camera bellows and fixed, a camera of the mobile phone is opened to adjust the focal length, and finally a photo is clicked to obtain a shikonin indication label image.
1.2 image processing
And performing a series of processing on the acquired image of the shikonin indication label to acquire color information. Firstly, carrying out automatic white balance adjustment on an image to obtain a real image; then separating the front background of the image, reserving the shikonin indication label image, and basically removing useless information; then image segmentation is carried out, and shikonin indication label areas are extracted; and finally, reading the color information of the shikonin indication label image.
1.2.1 automatic white balance adjustment
The image processed by the perfect reflection method is found that the pixel value of the white balance calibration card is closer to the real white point by comparing the processing effects of three automatic white balance adjustment algorithms, namely a gray world method, a perfect reflection method and a dynamic threshold method, so that the perfect reflection method is determined to be used as the automatic white balance adjustment algorithm. The pixel values of the white balance calibration card processed by the three algorithms are shown in table 1, and the processed image is shown in fig. 5.
TABLE 1 Pixel values of white points after automatic white balance adjustment
Because reflection points exist in the image, the invention adopts a perfect reflection method to carry out automatic white balance adjustment, finds out the pixel point with the highest image brightness as a reference white point, calculates the gain of each RGB channel according to the reference white point, and carries out color adjustment. The calculation method comprises the following steps:
wherein R is max 、G max 、B max Respectively representing the maximum value of three channels of red, green and blue, R ij 、G ij 、B ij Respectively representing the gray values of three red, green and blue channels at point (i, j), R, G, B respectively representing the gray values of three red, green and blue channels, R new 、G new 、B new Respectively representing the gray values of the red, green and blue channels after processing.
1.2.2 image front background separation
The color of the image after the automatic white balance processing is more real, but contains a lot of useless information, such as pork, a packaging box, a white balance calibration card and the like, so that the interesting shikonin indication label is required to be extracted, the foreground and the background of the image are separated, and the subsequent further processing is convenient. The invention processes the image graying and binarization according to the gray value of the shikonin indication label area by means of the color information of the image, then carries out phase-pressing subtraction operation on the binarization image and the image after automatic white balance adjustment, and separates the shikonin indication label area.
The image graying method comprises a component method, a maximum value method, an average value method, a weighted average value method and the like, and the method adopts the weighted average method to carry out graying treatment on the shikonin indication label picture after automatic white balance treatment, and comprises the following calculation methods:
L(i,j)=ω R ×R(i,j)+ω G ×G(i,j)+ω B ×B(i,j) (17)
wherein omega R 、ω G 、ω B The weights of the three components R, G, B, respectively. The invention takes omega R =0.299,ω G =0.587,ω B =0.114。
In order to distinguish shikonin indication label areas and background areas and carry out binarization processing on images, the invention uses a fixed double-threshold method to carry out binarization on the images, and the calculation method is as follows:
where L (i, j) is the gray value of the gray image at point (i, j), T 1 、T 2 For the set threshold, T is used herein 1 =100、T 2 =180。
After the shikonin indication label image is subjected to binarization processing, gray values of the label part are all set to 0, and the image subjected to automatic white balance processing and the binarization image are subjected to phase subtraction operation, wherein the calculation method is shown as a formula (19). Through this operation, the image of the label portion remains intact and the image background is substantially removed. The processed image is shown in fig. 6.
Wherein R is new (i,j)、G new (i,j)、B new (i, j) are gray values of red, green and blue channels at a point (i, j) of the image after the region of interest is extracted, R (i, j), G (i, j) and B (i, j) are gray values of red, green and blue channels at the point (i, j) of the image after automatic white balance adjustment, and L (i, j) is a gray value of the gray image at the point (i, j).
1.2.3 image segmentation
After the region of interest of the image is separated, image segmentation is required to extract the target shikonin indication region for subsequent processing. According to the method, a mask is generated through color information of the tag, then the boundary box of the tag area is found through searching the attribute of the communication area in the mask, and the position of the tag is found and cut out, so that the shikonin indication tag is obtained.
The RGB color image of the shikonin indication tag extracted from the region of interest is converted into HSV color space as shown in fig. 7. Because the label area in the H component has no obvious boundary with the surrounding environment, the positions of labels in the S component and the V component are obvious, the S component of the label color is between 0.5 and 0.7, and the V component is between 0.7 and 0.9, the positions of the shikonin indication labels can be found by threshold segmentation of the S component and the V component, and a mask is generated.
Because the shikonin indication label image has a reflective area, and the shikonin indication label in the mask has a cavity around, the cavity around the label needs to be filled to obtain a complete frame area. By performing morphological operation on the mask image generated in the previous step, the mask image is firstly inflated and then corroded, the shikonin is filled to indicate the cavity at the edge of the label, the boundary is smoothed, and the mask image is shown in fig. 8. The calculation method comprises the following steps:
Where (x ', y') is the position of the morphologically operated convolution kernel, the present invention employs a planar disc-shaped structural element of radius 20 as the convolution kernel. When the expansion operation is performed, after the convolution kernel slides over the whole image, the pixel passing by the kernel anchor point becomes the brightness maximum value in the kernel coverage area. When the 'erosion' operation is performed, after the convolution kernel slides over the whole image, the pixel passing by the kernel anchor point becomes the brightness minimum value in the kernel coverage area.
And (3) according to the attribute of the connected region in the mask, using the connected region to analyze and find out the boundary box of the label region, obtaining the label region, and then cutting out the label region corresponding to the original image. The cut label area is shown in fig. 9.
1.2.4 extraction of shikonin indicating Label color characteristics
After the target area is segmented, color information of the target area needs to be read, and in order to avoid interference of black dots at the boundary of the label area on a reading result, the invention cuts the target area, as shown in fig. 10. The size of the label extracted in the previous step is 590×590pixels, so the present invention finds the center point of the extracted label image, and then expands outwards from the center point to obtain a label image with the size of 400×400 pixels.
The extracted shikonin indicates that noise interference exists in the tag image, so that Gaussian filtering is firstly carried out on the tag image, and the calculation method is shown in a formula (8). The filtered shikonin indicating label image has uneven color, so the average gray values of three channels in the whole area R, G, B of the filtered label image are used as the gray values of R, G, B three channels of the shikonin indicating label.
Basic color information of the tag can be known through a R, G, B channel of the shikonin indication tag, but the color condition of the tag cannot be fully reflected only by the information in modeling, so that modeling inaccuracy is easily caused, and more comprehensive color characteristics are required to be extracted from the shikonin indication tag. The R+ G, R + B, G +B and R+G+B channels can reflect hue, saturation and brightness information of shikonin indicating label colors; R/(R+G), R/(R+B), R/(G+B), R/(R+G+B), G/(R+G), G/(R+B), G/(G+B), G/(R+G+B), B/(R+G), B/(R+B), B/(G+B), B/(R+G+B) can display the color tone trend information of the color among different channels; the (r+g)/(r+b), (r+g)/(g+b), and (r+b)/(g+b) can show tone balance information of colors between different channels. By extracting the color features, different aspects of the color can be captured as much as possible, richer color information is provided, various description and analysis are performed, and the model accuracy is improved. Therefore, the method disclosed by the invention is used for carrying out image processing on an image sample to obtain a shikonin indication tag image, and then extracting 22-dimensional characteristics of the shikonin indication tag image to model the image sample, wherein the 22-dimensional characteristics comprise R, G, B, R + G, R + B, G + B, R +G+ B, R/(R+G), R/(R+B), R/(G+B), R/(R+G+B), G/(R+G), G/(G+B), G/(R+G+B), B/(R+G), B/(R+B), B/(R+G)/(R+B), (R+G)/(G+B) and (R+B)/(G+B).
In order to eliminate the dimensional influence among the color indexes of the shikonin indication label, normalization processing is carried out on the shikonin indication label, and the calculation method is as follows:
wherein x is max ,x min To represent the maximum and minimum values in the dataset. The normalization range is chosen to be 0 to 1.
1.2 establishing a fresh pork freshness detection model
According to the national standard GB 2707-2016, volatile basic nitrogen (Total Volatile Basic Nitrogen, TVB-N) closely related to the sanitation of fresh meat products is selected as a physical and chemical index of pork, the TVB-N content of the pork is measured according to a full-automatic Kaplan azotometer method in the national standard GB 5009.228-2016, and a cold fresh pork freshness detection model is established according to the relation between the TVB-N content of the pork and the color characteristics of shikonin indication tags. To fully compare the impact of different modeling methods on detection performance, quantitative analysis was performed using partial least squares regression (Partial Least Squares Regression, PLSR), and qualitative analysis was performed using a support vector machine (Support Vector Machine, SVM), K-Nearest Neighbor (K-NN), and Random Forest (RF). The parameters of each model in this test were set as follows: the maximum number of main factors of the PLSR model is 20, and the number of main factors is 10; the SVM model uses Gaussian kernel function, the regularization term coefficient C is 16, and gamma is 32; K-NN model has K value of 5; the number of decision trees in the RF model is 5, the maximum tree depth is not limited, the minimum number of samples of leaf nodes is 1, and the minimum number of samples required by node splitting is 2.
The root mean square error (Root Mean Square Error, RMSE) and the correlation coefficient R are used as evaluation indexes of the regression model, and the calculation methods are shown in formulas (10) and (11).
Where n is the number of samples, y i For the predicted value of the ith sample, y i For the true value of the ith sample, y is the average of the true values of the samples.
Using the Accuracy (Accuracy, a), the fresh meat identification Accuracy (Fresh meat recognition Accuracy, frc) and the spoiled meat identification Accuracy (Spoiled meat recognition Accuracy, src) as the evaluation indexes of the classification model, the calculation methods are as shown in formulas (26), (27) and (28):
TP is the number of correctly identified fresh meat samples; FN is the number of misjudged fresh meat samples; TN is the number of correctly identified spoiled meat samples; FP is the number of erroneous decisions of the spoiled meat sample.
2.1 analysis of quality of chilled fresh pork
The meat product has high protein content and is easy to be infected by microorganisms, a large amount of nitrogen-containing substances such as ammonia and amines are released in the decomposition process, and the nitrogen-containing substances can form volatile basic nitrogen after being combined with organic acid, so that the content of the basic nitrogen is closely related to the freshness of the meat product, and is a common evaluation index in food safety standards. The national standard GB 2707-2016 specifies that the TVB-N content of fresh meat cannot exceed 15mg/100g. As can be seen from fig. 11, the TVB-N content gradually increased with the increase of the storage time during the storage of the chilled fresh pork. The TVB-N content increases slowly after 0 to 84 hours of storage, because less microorganisms are in the package at the initial stage of storage, the protein decomposition is slow, and the TVB-N is generated less; after 84 hours, the TVB-N content increased, because the protein decomposition rate increased and TVB-N was increased as the microorganism was propagated. When the storage is started, the TVB-N content of the pork is 7.08mg/100g, and the freshness is good; when the pork is stored for 168 hours, the TVB-N content of the pork is 14.89mg/100g, and is close to the upper limit value of fresh meat; when the pork is stored for 180 hours, the TVB-N content of the pork is 15.39mg/100g, and is higher than 15mg/100g, which indicates that the pork has started to deteriorate and is not edible.
2.2 establishment of a model for detecting freshness of chilled fresh pork
Fig. 12 shows a preprocessing flow of shikonin-indicating label image samples. Firstly, a perfect reflection method is utilized to carry out automatic white balance adjustment, and the true color of the image is restored. And (3) carrying out image graying treatment by using a weighted average method, and highlighting the shikonin label area. And (3) binarizing the gray level image by using a fixed double-threshold method, performing phase-pressing subtraction operation on the image subjected to automatic white balance processing and the binarized image, reserving a label area, and removing an image background. Then, threshold segmentation is carried out according to HSV components of the shikonin indication label, then the holes at the edge of the shikonin indication label are filled through expansion and corrosion operations, the boundary is smoothed, a mask is obtained, and a label area is cut out according to the mask. Finally, gaussian filtering is carried out after the edges of the labels are cut, and the color characteristics of the labels are extracted.
Classifying the freshness of the chilled fresh pork according to national standard GB 2707-2016, dividing the pork with TVB-N content lower than 15mg/100g into fresh pork, and marking the fresh pork as 1; pork above 15mg/100g was classified as spoiled and marked 0. The image sample of the 378 Zhang Zicao element indication label is collected in a test mode, 22-dimensional color features are extracted from the image sample, and after normalization processing, the image sample is processed through a Kennerd-Stone algorithm according to 3:1 training set (284 pieces) and test set (94 pieces), and the sample set division results are shown in table 2. And respectively establishing a TVB-N content prediction model and a chilled fresh pork freshness classification model according to the modeling method.
Table 2 test sample set partitioning
TVB-N content prediction model
FIG. 13 uses shikonin to indicate tag color characteristics to build a Partial Least Squares Regression (PLSR) model of TVB-N content, predicting TVB-N concentration content. Correlation coefficient R of training set c 0.4559, root mean square error RMSEC 3.5423; correlation coefficient R of test set p 0.4886, the root mean square error RMSEP is 3.4631. The higher the correlation coefficient R, the closer the absolute value is to 1, and the stronger the correlation between the variables. The correlation coefficient of the model is between 0.4 and 0.5, which shows that the shikonin indication label color is related to the TVB-N concentration but the correlation is not strong. The TVB-N content of the meat is not in linear change and is closer to exponential change, the PLSR model has poorer nonlinear prediction result, and when the meat is close to spoiled meat, the TVB-N content of the meat is accelerated to cause the model to be reduced in applicability and the detection accuracy to be reduced. In addition, for commercial improvement, the false identification of spoiled meat as fresh meat brings greater loss, and false detection of spoiled meat is avoided as much as possible in the detection of freshness of chilled fresh pork. Therefore, it is not suitable to classify freshness by predicting TVB-N content using shikonin-indicating tag color characteristics.
Fresh pork freshness grading and quantifying model
Table 3 compares the modeling effects of the Support Vector Machine (SVM), the K-nearest neighbor (K-NN) and the Random Forest (RF), and can show that the three classification models have good classification effects on chilled fresh pork, the overall accuracy of the test set is over 95%, the identification accuracy of the deteriorated pork of the test set is 100%, and the accurate detection of the deteriorated pork can be realized. The training set fresh meat recognition accuracy of the SVM model, the K-NN model and the RF model is 97.10%, 95.65% and 98.55% respectively, and accurate recognition of all fresh meat is not realized, because shikonin indicates that the color change of the tag is tiny when the freshness of the pork is close to a critical state, and the recognition is difficult. The detection effects of the three models are comprehensively compared, the RF model has the best performance, the accuracy of the training set reaches 99.65%, the accuracy of the test set and the accuracy of the fresh meat identification reach 98.94% and 98.55%, the accuracy of the fresh meat detection is higher, and higher economic benefits can be realized. Therefore, the invention selects random forests to establish an image detection model.
Table 3 comparison of three image detection models
In order to further improve user experience, a consumer can judge the freshness of the chilled fresh pork more intuitively when selecting commodities, the method continues to use the selected random forest model to quantify the freshness of the chilled fresh pork, and the TVB-N content of the pork is detected by establishing a random forest regression model, wherein the decision tree number is 5, the maximum tree depth is not limited, the minimum number of samples of leaf nodes is 2, and the minimum number of samples required by node splitting is 2. FIG. 14 shows the comparison between the predicted and actual values of TVB-N content of the test set sample, with the correlation coefficient R P 0.7163, the root mean square error RMSEP is 0.8712. The correlation coefficient of the model is larger than 0.7, which shows that the correlation is strong, and the model can be used for quantifying the freshness of the chilled fresh pork.
Therefore, the method establishes the chilled fresh pork freshness classification and quantification model by using a random forest, and applies the established model development software to judge the freshness of the chilled fresh pork and simultaneously give the use suggestion.
2.3 development of software for detecting freshness of chilled fresh pork
Fig. 15 is a main functional block diagram of software, and the detection software is matched with an image acquisition system built in a commercial process to realize rapid nondestructive detection of freshness of chilled fresh pork by scanning shikonin indication tag images. The two modes are divided into an administrator mode and a consumer mode according to the difference of the objects used. The manager mode is suitable for being used when the super business staff checks the stock, the account party can be logged in, the picture is automatically and regularly scanned after successful login, the detection result is stored, and the detection result is displayed after the checking is finished; the consumer mode is suitable for being used when the consumer purchases chilled meat, the consumer does not need to log in an account, and the consumer autonomously selects the picture for detection.
FIG. 16 illustrates the detection software execution flow, entering a default consumer mode after software is started, and automatically performing image processing, model prediction and result visualization by a consumer after selecting picture input by the software background; if the mode is switched to the manager mode, the software automatically calls the camera to scan and detect the quality of the chilled fresh meat at regular time after the user logs in, and the detection result is stored and displayed after the counting is finished.
Based on the Android platform, the programming of detection software is respectively carried out from four aspects of interface design, detection model packaging and interface design, front-end and back-end functional coupling and software testing. Firstly, carrying out layout of corresponding controls according to functional requirements by using an Android Studio to realize configuration design of a main interface, a login interface and a result display interface. Then, the image data processing flow determined according to the application encapsulates the functions of the image processing, feature extraction and detection model and debugs the data interface, so that the model can successfully realize the image processing and freshness detection of the sample to be detected. And finally, coupling the key signals and the response groove functions, and performing program debugging. Fig. 17 illustrates a portion of the detection software operation interface.
The above embodiments are merely preferred embodiments of the present application, and should not be construed as limiting the present application, and the embodiments and features of the embodiments of the present application may be arbitrarily combined with each other without collision. The protection scope of the present application is defined by the claims, and the protection scope includes equivalent alternatives to the technical features of the claims. I.e., equivalent replacement modifications within the scope of this application are also within the scope of the application.

Claims (10)

1. A method for identifying freshness grade of chilled fresh pork, the method comprising the steps of:
s1: preparing a shikonin indicating film;
s2: determining a packaging mode of the chilled fresh pork;
s3: building a shikonin indication tag image acquisition system;
s4: image processing;
s5: establishing a cold fresh pork freshness detection model;
s2: the model of the step S4 is used for identifying the freshness grade of the chilled fresh pork.
2. The method for identifying the freshness level of chilled fresh pork according to claim 1, wherein the steps of
The preparation method of S1 comprises the following steps:
s1.1, preparing a film forming liquid: uniformly mixing a sodium alginate solution and a gelatin solution, then adding a shikonin solution and a glycerol solution, and uniformly stirring to obtain a film forming solution;
s1.2, casting the prepared film forming liquid on a film blank, then placing the film blank for film forming, and finally removing the film to obtain an indication film in which shikonin is dispersed in a molecular free state;
the step S2 is to pack the chilled fresh pork in the following way; the cold fresh pork is stored by adopting a PET plastic packaging box, the prepared shikonin indication label is stuck to the inner side of the packaging box cover to monitor the freshness of the cold fresh pork, and the white balance calibration card is stuck to the periphery of the shikonin indication label to be used as a reference for the automatic white balance adjustment effect.
3. The method for identifying the freshness level of chilled fresh pork according to claim 1, wherein the step S3 is characterized in that the construction of the shikonin indication tag image acquisition system comprises a detection platform and a mobile phone, the inner wall of a camera bellows is tiled by black light-absorbing paper, the detection platform comprises a light source and an objective table, and the light source is arranged at the top of the interior of the camera bellows; determining the distance between the objective table and the top of the camera bellows to be 20cm; in the test process, the box-packed chilled fresh pork with the shikonin indication label is placed on an objective table in a camera bellows, the camera bellows is closed to reduce the influence of natural light, then a mobile phone is placed at the outer top of the camera bellows and fixed, a camera of the mobile phone is opened to adjust the focal length, and finally a photo is clicked to obtain a shikonin indication label image.
4. The method for identifying the freshness grade of chilled fresh pork according to claim 3, wherein the light source color temperature is 6000-6500K, and the light source is a positive white light LED flexible light strip.
5. The method for identifying the freshness level of chilled fresh pork according to claim 1, wherein the steps of
S4, image processing comprises the following steps of;
s4.1, automatic white balance adjustment is carried out, and a real image is obtained;
s4.2, separating the front background of the image, reserving an alkannin indication label image, and basically removing useless information;
S4.3, image segmentation;
s4.4, extracting shikonin to indicate the color characteristics of the label.
6. The method for identifying freshness grade of chilled fresh pork according to claim 5, wherein the method for automatic white balance adjustment in step S4.1 is to perform automatic white balance adjustment by adopting a perfect reflection method, find out a pixel point with highest image brightness as a reference white point, calculate gains of RGB channels according to the reference white point, perform color adjustment, and the calculation method is as follows:
wherein R is max 、G max 、B max Respectively represent three channels of red, green and blueMaximum value of track, R ij 、G ij 、B ij Respectively representing the gray values of three red, green and blue channels at point (i, j), R, G, B respectively representing the gray values of three red, green and blue channels, R new 、G new 、B new Respectively representing the gray values of the red, green and blue channels after processing.
7. The method for identifying the freshness level of chilled fresh pork according to claim 5, wherein the step S4.2 of separating the foreground from the background comprises: performing image graying and binarization processing according to the gray value of the shikonin indication label area, and then performing phase subtracting operation on the binarized image and the image subjected to automatic white balance adjustment to separate the shikonin indication label area;
The gray processing treatment is carried out on the shikonin indication label picture after the automatic white balance treatment by adopting a weighted average method, and the calculation method is as follows:
L(i,j)=ω R ×R(i,j)+ω G ×G(i,j)+ω B ×B(i,j) (3);
wherein omega R 、ω G 、ω B Weights of three components R, G, B respectively, and ω is taken R =0.299,ω G =0.587,ω B =0.114;
In order to distinguish shikonin indication label areas and background areas, binarization processing is carried out on the images, and the fixed double-threshold method is used for binarization of the images, wherein the calculation method is as follows:
where L (i, j) is the gray value of the gray image at point (i, j), T 1 、T 2 For the set threshold, T is adopted 1 =100、T 2 =180;
After the shikonin indication label image is subjected to binarization processing, the gray value of the label part is set to be 0, the image subjected to automatic white balance processing and the binarization image are subjected to phase subtraction operation, the calculation method is shown as a formula (5), the image of the label part is completely reserved through the operation, the image background is basically removed,
wherein R is new (i,j)、G new (i,j)、B new (i, j) are respectively the gray values of the red, green and blue channels of the image at the point (i, j) after the region of interest is extracted, R (i, j), G (i, j) and B (i, j) are respectively the gray values of the red, green and blue channels of the image at the point (i, j) after the automatic white balance adjustment, and L (i, j) is the gray value of the gray image at the point (i, j);
The image segmentation method in the step S4.3 comprises the following steps:
s4.3.1: converting the RGB color image of the shikonin indication label of the region of interest into an HSV color space, and finding the position of the shikonin indication label by threshold segmentation of the S component and the V component to generate a mask image; wherein the S component of the label color is between 0.5 and 0.7 and the V component is between 0.7 and 0.9;
s4.3.2: filling the hollows around the label to obtain a complete frame area, performing morphological operation on the mask image generated in the previous step, namely firstly expanding and then corroding, filling the hollows at the edge of the label indicated by shikonin, and smoothing the boundary, wherein the calculation method comprises the following steps:
wherein, (x ', y') is the position of the morphological operation convolution kernel, and a plane disc-shaped structural element with the radius of 20 is adopted as the convolution kernel; when the expansion operation is carried out, after the convolution kernel slides over the whole image, the pixel passing by the kernel anchor point becomes the brightness maximum value in the kernel coverage area; when the erosion operation is performed, after the convolution kernel slides over the whole image, the pixel passing by the kernel anchor point becomes the minimum brightness value in the kernel coverage area
S4.3.3: and finding out the boundary box of the label area by searching the attribute of the connected area in the mask, finding out the position of the label, and cutting out the label to obtain the shikonin indication label.
8. The method for identifying freshness level of chilled fresh pork according to claim 5, wherein said step of
S4.4, the method for extracting the shikonin indication label color features comprises the following steps:
s4.4.1: cutting a target area, wherein the label size is 590 multiplied by 590pixels, firstly finding out the center point of the extracted label image, and then expanding outwards from the center point to obtain a label image with the size of 400 multiplied by 400 pixels;
s4.4.2: the extracted shikonin indicates that noise interference exists in the tag image, so that Gaussian filtering is firstly carried out on the tag image, and the calculation method is shown in a formula (8);
wherein, (2k+1) x (2k+1) is a gaussian convolution kernel, and a square window of 3 x 3 is used for filtering; σ is variance, herein σ=20;
s4.4.3: taking the average value of gray values of three channels of the whole area R, G, B of the filtered tag image as the gray values of R, G, B three channels of the shikonin indication tag; modeling an image sample by extracting 22-dimensional features, including R, G, B, R + G, R + B, G + B, R +g+ B, R/(r+g), R/(r+b), R/(g+b), R/(r+g+b), G/(r+g), G/(r+b), G/(g+b), G/(r+g+b), B/(r+g), B/(r+b), B/(g+b), B/(r+g+b), (r+g)/(r+b), (r+g)/(g+b), and (r+b)/(g+b);
S4.4.4: in order to eliminate the dimensional influence among the color indexes of the shikonin indication label, the shikonin indication label is normalized,
the calculation method comprises the following steps:
wherein x is max ,x min To represent the maximum and minimum values in the dataset, a normalization range of 0 to 1 is chosen.
9. The method for identifying the freshness level of chilled fresh pork according to claim 1, wherein the step S5: the establishment of the cold fresh pork freshness detection model comprises the following steps:
(one) partial least squares regression: carrying out standardized processing on the data; obtaining main components meeting the requirements; establishing regression between the main component and the original independent variable and between the main component and the dependent variable; continuing to calculate the main component until the requirement is met; deriving a regression expression of the dependent variable from the independent variable; checking-cross validity; setting the maximum main factor number of the PLSR model as 20, determining the optimal main factor number by a 10-fold cross validation method, and finally setting the main factor number as 10; and (II) a support vector machine: preprocessing data; mapping data into a high-dimensional space using a kernel function; calculating a hyperplane, and searching a hyperplane in a high-dimensional space so as to maximize the distance between various data points and the hyperplane; classifying the new sample using the learned model; modeling by using a Gaussian kernel function, wherein the regularization term coefficient C is 16, and gamma is 32;
(III) K-nearest neighbor: calculating the distance between each sample point in the training sample and the test sample; sorting all the distance values; selecting the first k samples with the minimum distance; voting according to the labels of the k samples to obtain the final classification category; wherein the K value is 5;
(IV) random forest: sampling the training set sample with a place back to obtain M groups of subsets for establishing decision trees; randomly selecting m features, and training a classification regression decision tree by using the subsets; integrating the M decision trees into a random forest; the number of decision trees is 5, the maximum tree depth is not limited, the minimum number of samples of leaf nodes is 2, and the minimum number of samples required by node splitting is 2.
10. The method for identifying the freshness level of chilled fresh pork according to claim 1, wherein the step S5: in the establishment of a fresh pork freshness detection model, detecting the TVB-N content of pork by establishing a random forest regression model, wherein the number of decision trees is 5, the maximum tree depth is not limited, the minimum number of samples of leaf nodes is 2, and the minimum number of samples required by node splitting is 2.
CN202310698025.2A 2023-06-13 2023-06-13 Method for identifying freshness grade of chilled fresh pork Pending CN116930162A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310698025.2A CN116930162A (en) 2023-06-13 2023-06-13 Method for identifying freshness grade of chilled fresh pork

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310698025.2A CN116930162A (en) 2023-06-13 2023-06-13 Method for identifying freshness grade of chilled fresh pork

Publications (1)

Publication Number Publication Date
CN116930162A true CN116930162A (en) 2023-10-24

Family

ID=88381798

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310698025.2A Pending CN116930162A (en) 2023-06-13 2023-06-13 Method for identifying freshness grade of chilled fresh pork

Country Status (1)

Country Link
CN (1) CN116930162A (en)

Similar Documents

Publication Publication Date Title
US11410295B2 (en) System and method for hyperspectral image processing to identify foreign object
AU2018289402B2 (en) System and method for hyperspectral image processing to identify object
Chen et al. Color grading of beef fat by using computer vision and support vector machine
EP2681715B1 (en) Method and software for analysing microbial growth
Blasco et al. Recognition and classification of external skin damage in citrus fruits using multispectral data and morphological features
Almeida et al. Applying machine learning based on multiscale classifiers to detect remote phenology patterns in Cerrado savanna trees
CN109740639A (en) A kind of wind and cloud satellite remote-sensing image cloud detection method of optic, system and electronic equipment
Aguilar et al. Determination of pineapple ripeness using support vector machine for philippine standards
Ulrici et al. Automated identification and visualization of food defects using RGB imaging: Application to the detection of red skin defect of raw hams
Asmara et al. Chicken meat freshness identification using the histogram color feature
CN113295690A (en) Strawberry maturity rapid discrimination method based on machine learning
Zuñiga et al. Grape maturity estimation based on seed images and neural networks
You et al. A novel chicken meat quality evaluation method based on color card localization and color correction
Ambarwati et al. Feature selection on magelang duck egg candling image using variance threshold method
CN117392104A (en) Computer vision rice quality determination method based on deep learning
CN116930162A (en) Method for identifying freshness grade of chilled fresh pork
CN116416523A (en) Machine learning-based rice growth stage identification system and method
Shah et al. Automatically localising ROIs in hyperspectral images using background subtraction techniques
Zakiyyah et al. Characterization and Classification of Citrus reticulata var. Keprok Batu 55 Using Image Processing and Artificial Intelligence
Busin et al. Color space selection for color image segmentation by spectral clustering
CN113808116A (en) Intelligent detection method and system based on image recognition and product detection system
CN112949634A (en) Bird nest detection method for railway contact network
Winiarti et al. Determining feasibility level of beef quality based on histogram and k-means clustering
CN118014443B (en) Medicine monitoring method and device
Zárate et al. Fruit Detection and Classification Using Computer Vision and Machine Learning Techniques

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination