CN117831026A - Food quality detection method and device based on machine learning - Google Patents

Food quality detection method and device based on machine learning Download PDF

Info

Publication number
CN117831026A
CN117831026A CN202311842746.2A CN202311842746A CN117831026A CN 117831026 A CN117831026 A CN 117831026A CN 202311842746 A CN202311842746 A CN 202311842746A CN 117831026 A CN117831026 A CN 117831026A
Authority
CN
China
Prior art keywords
data
model
detection
food quality
yolo
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
CN202311842746.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.)
Zhejiang University Yangtze River Delta Wisdom Oasis Innovation Center
Original Assignee
Zhejiang University Yangtze River Delta Wisdom Oasis Innovation Center
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 Zhejiang University Yangtze River Delta Wisdom Oasis Innovation Center filed Critical Zhejiang University Yangtze River Delta Wisdom Oasis Innovation Center
Priority to CN202311842746.2A priority Critical patent/CN117831026A/en
Publication of CN117831026A publication Critical patent/CN117831026A/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
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/06Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
    • G06Q10/063Operations research, analysis or management
    • G06Q10/0639Performance analysis of employees; Performance analysis of enterprise or organisation operations
    • G06Q10/06395Quality analysis or management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/22Image preprocessing by selection of a specific region containing or referencing a pattern; Locating or processing of specific regions to guide the detection or recognition
    • 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
    • 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
    • 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/82Arrangements for image or video recognition or understanding using pattern recognition or machine learning using neural networks
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Evolutionary Computation (AREA)
  • Multimedia (AREA)
  • Human Resources & Organizations (AREA)
  • Software Systems (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Molecular Biology (AREA)
  • Strategic Management (AREA)
  • Entrepreneurship & Innovation (AREA)
  • Biomedical Technology (AREA)
  • Development Economics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Mathematical Physics (AREA)
  • Biophysics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Educational Administration (AREA)
  • Economics (AREA)
  • General Engineering & Computer Science (AREA)
  • Tourism & Hospitality (AREA)
  • General Business, Economics & Management (AREA)
  • Quality & Reliability (AREA)
  • Operations Research (AREA)
  • Marketing (AREA)
  • Game Theory and Decision Science (AREA)
  • Image Analysis (AREA)

Abstract

The disclosure provides a food quality detection method and device based on machine learning, wherein the method comprises the following steps: collecting historical detection records of food quality detection, public data sets and related data of data provided by partners, and integrating the collected data to ensure that the format and structure of the data are consistent; labeling the data with consistent format and structure, and distributing quality labels for each sample data; inputting the labeling data into a yolo-v5 model for training; classifying each anchor frame determined by the yolo-v5 model to distinguish the existence of an object in the anchor frame; continuously monitoring detection data output by the yolo-v5 model, observing the distribution, change and other conditions of the data, determining information that the data value exceeds a threshold value and the distribution changes when the monitoring data is abnormal, and outputting abnormal identification as records of food quality detection abnormality. The food quality detection method and device improve accuracy, efficiency and automation degree of food quality detection, and reduce detection cost.

Description

Food quality detection method and device based on machine learning
Technical Field
The disclosure relates to food quality detection technology, in particular to a food quality detection method and device based on machine learning.
Background
The existing food quality detection method mainly comprises physical detection, chemical detection and sensory identification. However, current food detection schemes suffer from several drawbacks:
the subjectivity is strong: the sensory identification method mainly depends on personal experience and subjective judgment of a detector, so that the sensory identification method is easily influenced by personal factors, and has certain subjectivity and error.
The detection period is long: traditional physical detection and chemical detection methods generally require complex sample pretreatment and analysis processes, resulting in a long detection period and failing to meet the requirement of rapid detection.
The detection cost is high: these detection methods require the use of expensive instrumentation and specialized detection personnel, thereby increasing detection costs and compromising large-scale food quality monitoring and screening.
Insufficient sensitivity: some physical detection and chemical detection methods have insufficient detection sensitivity for trace pollutants, and trace harmful substances in food are difficult to accurately detect.
The coverage is limited: traditional food quality detection methods often can only detect known, specific contaminants or quality indicators, and have limited detection capabilities for unknown or novel contaminants.
Destructive detection: part of chemical detection methods belong to destructive detection, require certain treatment or consumption of food, and are not suitable for quality detection of all types of food.
Disclosure of Invention
The disclosure provides a food quality detection method and device based on machine learning, aiming at fusing detection data of food quality so as to at least solve the technical problems existing in the prior art.
According to a first aspect of the present disclosure, there is provided a machine learning-based food quality detection method, comprising:
collecting historical detection records of food quality detection, public data sets and related data of data provided by partners, and integrating the collected data to ensure that the format and structure of the data are consistent;
labeling the data with consistent format and structure, and distributing quality labels for each sample data;
extracting feature data related to food quality based on the labeling data;
dividing the feature data and the labeling data into at least a training set, a verification set and a test set;
inputting the annotation data into the yolo-v5 model to train the network using bounding box regression to determine the exact location of the bounding box; classifying each anchor frame determined by the yolo-v5 model to distinguish the existence of an object in the anchor frame; calculating the accurate position of the image by using the target classification and the bounding box regression, and taking the accurate position as output;
selecting a proper loss function and an optimizer according to the task type and the model characteristics, wherein the loss function is used for measuring the difference between a model prediction result and a real label, and the optimizer is used for updating parameters of the model to minimize the loss function;
continuously monitoring detection data output by the yolo-v5 model, observing distribution and change conditions of the data, determining information that data values exceed threshold values and distribution change when monitoring that the data are abnormal, and outputting abnormal identification as records of food quality detection abnormality.
In some executable embodiments, before continuously monitoring the detected data output by the yolo-v5 model, the method further comprises:
and (3) performing evaluation test on the trained model by using the verification set, acquiring an evaluation result by using indexes of calculation accuracy and recall rate, and adjusting weight parameters of the model according to the evaluation result to optimize the model.
In some executable embodiments, before continuously monitoring the detected data output by the yolo-v5 model, the method further comprises:
training the model by using a training set, updating parameters of the model by using a back propagation algorithm, and setting parameters of the learning rate, the batch size and the iteration number of the model so as to control the training process of the model.
In some executable embodiments, the method further comprises:
and acquiring detection data in real time, observing at least the distribution and change conditions of the data, preprocessing the acquired detection data, inputting the detection data into a detection model again, and carrying out real-time inference on the detection data.
In some executable embodiments, the method further comprises:
collecting feedback information of a user on a detection result, processing and analyzing the collected user feedback, and screening useful feedback information;
and optimizing and improving the detection model according to the screened feedback information, and redeploying the optimized model into a real-time detection system to form a feedback loop.
In some executable embodiments, the method further comprises:
assigning a unique identifier to each detection data, and establishing an association relationship between the detection data;
recording detailed log information in the detection process, wherein the log information at least comprises operation time, operators and operation content;
setting a query and search interface, receiving a search request for log information through the query and search interface, and responding matched log information through the query and search interface;
and processing the matched log information into a chart or report form for visual display.
According to a second aspect of the present disclosure, there is provided a machine learning-based food quality detection apparatus, comprising:
the collection unit is used for collecting historical detection records of food quality detection, public data sets and related data of data provided by partners, integrating the collected data and ensuring that the format and the structure of the data are consistent;
the labeling unit is used for labeling the data with consistent format and structure, and distributing quality labels for each sample data;
an extraction unit for extracting feature data related to food quality based on the labeling data;
the dividing unit is used for dividing the characteristic data and the labeling data into at least a training set, a verification set and a test set;
a training unit for inputting annotation data into the yolo-v5 model application bounding box regression to train the network to determine the exact location of the bounding box; classifying each anchor frame determined by the yolo-v5 model to distinguish the existence of an object in the anchor frame; calculating the accurate position of the image by using the target classification and the bounding box regression, and taking the accurate position as output;
the optimizing unit is used for selecting a proper loss function and an optimizer according to the task type and the model characteristics, wherein the loss function is used for measuring the difference between a model prediction result and a real label, and the optimizer is used for updating parameters of the model to minimize the loss function;
the monitoring unit is used for continuously monitoring the detection data output by the yolo-v5 model, observing the distribution and change conditions of the data, determining the information that the data value exceeds a threshold value and the distribution changes when the monitoring of the data is abnormal, and outputting abnormal identification as a record of food quality detection abnormality.
In some executable embodiments, the optimizing unit is further configured to:
and (3) performing evaluation test on the trained model by using the verification set, acquiring an evaluation result by using indexes of calculation accuracy and recall rate, and adjusting weight parameters of the model according to the evaluation result to optimize the model.
In some executable embodiments, the optimizing unit is further configured to:
training the model by using a training set, updating parameters of the model by using a back propagation algorithm, and setting parameters of the learning rate, the batch size and the iteration number of the model so as to control the training process of the model.
In some executable embodiments, the apparatus further comprises:
the data response unit is used for distributing a unique identifier for each detection data and establishing an association relation between the detection data; recording detailed log information in the detection process, wherein the log information at least comprises operation time, operators and operation content; setting a query and search interface, receiving a search request for log information through the query and search interface, and responding matched log information through the query and search interface; and processing the matched log information into a chart or report form for visual display.
According to the technical scheme, by combining the machine learning technology and the data analysis method, the accuracy, the efficiency and the automation degree of food quality detection are improved, the detection cost is reduced, the detection range is widened, and nondestructive detection is realized. This provides an effective solution to the shortcomings of existing food quality detection methods.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The above, as well as additional purposes, features, and advantages of exemplary embodiments of the present disclosure will become readily apparent from the following detailed description when read in conjunction with the accompanying drawings. Several embodiments of the present disclosure are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings, in which:
in the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
FIG. 1 illustrates a schematic implementation flow diagram of a machine learning based food quality detection method of an embodiment of the present disclosure;
FIG. 2 is a schematic diagram showing the constitution of a food quality detecting apparatus based on machine learning according to an embodiment of the present disclosure;
fig. 3 shows a schematic diagram of a composition structure of an electronic device according to an embodiment of the disclosure.
Detailed Description
In order to make the objects, features and advantages of the present disclosure more comprehensible, the technical solutions in the embodiments of the present disclosure will be clearly described in conjunction with the accompanying drawings in the embodiments of the present disclosure, and it is apparent that the described embodiments are only some embodiments of the present disclosure, but not all embodiments. Based on the embodiments in this disclosure, all other embodiments that a person skilled in the art would obtain without making any inventive effort are within the scope of protection of this disclosure.
Fig. 1 shows a schematic implementation flow chart of a food quality detection method based on machine learning according to an embodiment of the present disclosure, and as shown in fig. 1, the food quality detection method based on machine learning according to an embodiment of the present disclosure includes the following processing steps:
step 101, collecting historical detection records of food quality detection, public data sets and related data of data provided by partners, and integrating the collected data to ensure that the format and structure of the data are consistent.
In the embodiment of the disclosure, data is collected, and relevant data such as historical detection records, public data sets, data provided by a partner and the like is collected. And integrating the data collected by different sources to ensure the consistency of the format and structure of the data. And (3) filling missing values, deleting abnormal values, removing duplicates and the like in the collected data.
The data is normalized, and standardized, so that the model can learn the internal rules and structures of the data more easily.
The cleaned and preprocessed data is divided into a training set, a validation set and a test set. The training set is used for training the model, the verification set is used for adjusting the model super-parameters and evaluating the model performance, and the test set is used for evaluating the generalization capability of the model. The cleaned and preprocessed data is stored for subsequent training, data verification, etc.
And 102, labeling the data with consistent format and structure, and distributing quality labels for each sample data.
In the embodiment of the disclosure, the data is marked, that is, a quality label is allocated to each sample, and the quality label may include pass or fail, as an example.
And step 103, extracting characteristic data related to food quality based on the labeling data.
And extracting characteristics related to food quality from the cleaned data. These features may include image features of color, texture, shape, etc.
And 104, dividing the characteristic data and the labeling data into at least a training set, a verification set and a test set.
The cleaned and preprocessed data is divided into a training set, a validation set and a test set. The training set is used for training the model, the verification set is used for adjusting the model super-parameters and evaluating the model performance, and the test set is used for evaluating the generalization capability of the model.
Step 105, inputting the labeling data into yolo-v5 model application bounding box regression to train the network to determine the accurate position of the bounding box; classifying each anchor frame determined by the yolo-v5 model to distinguish the existence of an object in the anchor frame; the exact position of the image is calculated using the target classification and bounding box regression and is taken as output.
In the embodiment of the disclosure, the model such as yolo-v5 is used for training and verifying the results, and the model with proper parameters is selected for detecting the food quality. The yolo-v5 training algorithm is mainly dependent on the constructed model structure and mainly comprises three steps: feature extraction, coarse position prediction and fine position prediction. In the feature extraction step, the network is trained by extracting the bounding box in the image and then applying bounding box regression to determine the exact location of the bounding box; in the rough position prediction step, classifying each automatically determined anchor frame to distinguish which anchor frames exist objects and which do not exist; then in the accurate position prediction step, the accurate position is calculated using the target classification and bounding box regression, and is taken as an output. yolo-v5 uses a pre-trained model to process input-related data during an inference phase to infer the presence of objects therein. Firstly, taking an input image as input, and then carrying out feature extraction on the input image by using an implemented deep learning neural network to obtain advanced features; then, using the extracted features, calculating different kinds of anchor frames at the rough position prediction layer for specifying objects possibly existing in each frame; finally, a final precise location is calculated using the precise location prediction layer to describe the class, location and size of objects present in the image. The embodiment of the disclosure utilizes YOLO (You Only Look Once) algorithm to identify the food quality characteristics in the food image in real time, and the YOLO algorithm can be almost applied to all image processing tasks, has very high calculation efficiency and high accuracy, and becomes one of the most popular object detection algorithms at present. The yolo-v5 of the embodiment of the disclosure is an object detection algorithm based on a convolutional neural network, and is one of the most popular object detection methods at present.
According to the embodiment of the disclosure, according to the selected yolo-v5 model type and a corresponding algorithm, initializing parameters and structures of the model; and selecting a proper loss function and an optimizer according to the task type and the model characteristics. The loss function is used to measure the gap between the model predictions and the real labels, and the optimizer is used to update the parameters of the model to minimize the loss function. Training the model by using the training set, and updating parameters of the model by a back propagation algorithm. The training process is controlled by setting appropriate super parameters such as learning rate, batch size, iteration number and the like. And (3) performing evaluation test on the trained model by using the verification set, acquiring an evaluation result by using indexes such as calculation accuracy, recall rate and the like, and adjusting and optimizing the model, adjusting parameters and the like according to the evaluation result.
And 106, selecting a proper loss function and an optimizer according to the task type and the model characteristics, wherein the loss function is used for measuring the gap between the model prediction result and the real label, and the optimizer is used for updating the parameters of the model to minimize the loss function.
And 107, continuously monitoring detection data output by the yolo-v5 model, observing the distribution, change and other conditions of the data, determining information that the data value exceeds a threshold value and the distribution changes when the monitoring data is abnormal, and outputting abnormal identification as a record of food quality detection abnormality.
In the embodiment of the disclosure, in the food quality detection process, a child can acquire data to be detected in real time through a sensor, a camera and other devices in real time. And preprocessing the data acquired in real time, and cleaning the data, converting the format and the like. The quality and consistency of the data are ensured. Loading a trained detection model, and ensuring that the model is in a usable state; and inputting the preprocessed data into a detection model, and carrying out real-time inference. The prediction result of the model is output in a proper format such as a graph or a table.
In the actual detection process, feedback of a user on a detection result, such as correctness, false alarm rate and the like, is collected. The collected user feedback is processed and analyzed to extract useful information and advice. Optimizing and improving the detection model according to user feedback and analysis results; and redeploying the optimized model into a real-time detection system to form a feedback loop.
Continuously monitoring the data detected in real time, and observing the distribution, change and other conditions of the data. When the data is monitored to be abnormal, the data value exceeds a threshold value, distribution changes and the like, and the abnormality identification is timely carried out. The identified anomalies are classified as normal anomalies, abnormal events, and the like. The position and time of the occurrence of the abnormality are determined so as to take corresponding measures in time.
In the embodiment of the disclosure, an early warning rule can be set according to food quality detection requirements, for example: setting an early warning rule, an early warning threshold value, an early warning level and the like. When detecting the abnormality conforming to the early warning rule, the early warning information is timely sent to related personnel through short messages, mails, sounds and the like. This ensures that the relevant personnel can learn about the abnormal situation in time and take corresponding measures. And processing and tracking the sent early warning, so as to ensure that the early warning is effectively responded and solved. And evaluating the effect of the early warning mechanism at regular intervals, such as early warning accuracy, response speed and the like.
In the embodiment of the disclosure, a unique identifier is further allocated to each detection data, so that the data can be accurately identified and positioned in the process of storage and inquiry, and an association relationship between the data is established. The detailed log information including the operation time, the operator, the operation content, etc. is recorded in the detection process.
The disclosed embodiments also support query and retrieval for detection results: flexible query and search functions are provided so that related personnel can trace back data as required. For example, the traceability result is visually displayed, such as displaying the source, the processing procedure and the processing result of the data in the form of charts, reports and the like.
In the embodiment of the disclosure, the inspection result and the data can be integrated and docked with the existing food production management system, quality management system and the like through the API interface, so that the sharing and interaction of the data are realized. By cooperating with other systems, the efficiency and accuracy of overall food production and quality management is improved.
Based on the foregoing description of the technical means, embodiments of the present disclosure have at least the following significant technical effects:
the detection accuracy is improved: by training and optimizing the machine learning model, relevant characteristics and rules of food quality can be learned and identified, so that the detection accuracy is improved. The method can reduce human error and subjectivity and provide more objective and reliable detection results.
Detection efficiency promotes: can automatically process and analyze a large amount of food quality data, and realize rapid detection. Compared with the traditional detection method, the method reduces complex sample pretreatment and complex analysis processes, thereby improving the detection efficiency.
The detection cost is reduced: through automatic and intelligent detection mode, can reduce the reliance to expensive instrument and equipment and professional detection personnel, reduce detection cost. This enables larger scale food quality monitoring and screening.
Sensitivity is improved: by combining a machine learning algorithm and a data analysis technology, the detection sensitivity of the micro-pollutants can be improved. The method can accurately detect the trace pollutants in the food and ensure the safety of the food.
Widening the detection range: has stronger adaptability and generalization capability, and can be applied to quality detection of different types of foods. By training and optimizing the model, the model can detect unknown or novel pollutants, and the detection range is widened.
Realizing nondestructive testing: by using a non-invasive detection method, destructive processing of the food is avoided. This makes possible non-destructive testing techniques suitable for more types of food quality testing.
Fig. 2 is a schematic diagram showing a composition structure of a machine-learning-based food quality detection apparatus according to an embodiment of the present disclosure, and as shown in fig. 2, the machine-learning-based food quality detection apparatus according to an embodiment of the present disclosure includes:
the collecting unit 20 is used for collecting historical detection records of food quality detection, public data sets and related data of data provided by partners, integrating the collected data and ensuring that the format and structure of the data are consistent;
a labeling unit 21, configured to label data with consistent format and structure, and assign a quality label to each sample data;
an extracting unit 22 for extracting feature data related to food quality based on the labeling data;
a dividing unit 23 for dividing the feature data and the labeling data into at least a training set, a verification set, and a test set;
a training unit 24 for inputting annotation data into the yolo-v5 model application bounding box regression to train the network to determine the exact location of the bounding box; classifying each anchor frame determined by the yolo-v5 model to distinguish the existence of an object in the anchor frame; calculating the accurate position of the image by using the target classification and the bounding box regression, and taking the accurate position as output;
an optimizing unit 25, configured to select an appropriate loss function and an optimizer according to the task type and the model characteristics, where the loss function is used to measure a gap between a model prediction result and a real label, and the optimizer is used to update parameters of the model to minimize the loss function;
the monitoring unit 26 is configured to continuously monitor the detected data output by the yolo-v5 model, observe the distribution, change, etc. of the data, determine information that the data value exceeds a threshold value and the distribution changes when an abnormality occurs in the monitored data, and output abnormality identification as a record of an abnormality in food quality detection.
In some executable embodiments, the optimizing unit 25 is further configured to:
and (3) performing evaluation test on the trained model by using the verification set, acquiring an evaluation result by using indexes of calculation accuracy and recall rate, and adjusting weight parameters of the model according to the evaluation result to optimize the model.
In some executable embodiments, the optimizing unit 25 is further configured to:
training the model by using a training set, updating parameters of the model by using a back propagation algorithm, and setting parameters of the learning rate, the batch size and the iteration number of the model so as to control the training process of the model.
In some executable embodiments, the optimizing unit 25 is further configured to:
and acquiring detection data in real time, observing at least the distribution and change conditions of the data, preprocessing the acquired detection data, inputting the detection data into a detection model again, and carrying out real-time inference on the detection data.
In some executable embodiments, the optimizing unit 25 is further configured to:
collecting feedback information of a user on a detection result, processing and analyzing the collected user feedback, and screening useful feedback information;
and optimizing and improving the detection model according to the screened feedback information, and redeploying the optimized model into a real-time detection system to form a feedback loop.
On the basis of the machine learning-based food quality detection apparatus shown in fig. 2, the machine learning-based food quality detection apparatus of the embodiment of the present disclosure further includes:
a data response unit (not shown in fig. 2) for assigning a unique identifier to each detection data and establishing an association relationship between the detection data; recording detailed log information in the detection process, wherein the log information at least comprises operation time, operators and operation content; setting a query and search interface, receiving a search request for log information through the query and search interface, and responding matched log information through the query and search interface; and processing the matched log information into a chart or report form for visual display.
In an exemplary embodiment, each processing unit in the machine learning based food quality detection apparatus of the embodiments of the present disclosure may be implemented by one or more central processing units (CPU, central Processing Unit), graphics processors (GPU, graphics Processing Unit), application specific integrated circuits (ASIC, application Specific Integrated Circuit), DSPs, programmable logic devices (PLD, programmable Logic Device), complex programmable logic devices (CPLD, complex Programmable Logic Device), field programmable gate arrays (FPGA, field-Programmable Gate Array), general purpose processors, controllers, microcontrollers (MCU, micro Controller Unit), microprocessors (Microprocessor), or other electronic components.
The specific manner in which the various modules and units perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
Fig. 3 illustrates a schematic block diagram of an example electronic device 800 that may be used to implement embodiments of the present disclosure. As shown in fig. 3, the electronic device 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 802 or a computer program loaded from a storage unit 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
Various components in electronic device 800 are connected to I/O interface 805, including: an input unit 806 such as a keyboard, mouse, etc.; an output unit 807 such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, optical disk, etc.; and a communication unit 809, such as a network card, modem, wireless communication transceiver, or the like. The communication unit 809 allows the electronic device 800 to exchange information/data with other devices through a computer network such as the internet and/or various telecommunication networks.
The computing unit 801 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the respective methods and processes described above, such as a food quality detection method based on machine learning. For example, in some embodiments, the machine learning-based food quality detection method of embodiments of the present disclosure may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 800 via the ROM 802 and/or the communication unit 809. When the computer program is loaded into RAM 803 and executed by computing unit 801, one or more steps of the machine learning based food quality detection method described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the steps of the machine learning based food quality detection method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems-on-a-chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
Furthermore, the terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In the description of the present disclosure, the meaning of "a plurality" is two or more, unless explicitly defined otherwise.
The foregoing is merely specific embodiments of the disclosure, but the protection scope of the disclosure is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the disclosure, and it is intended to cover the scope of the disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (10)

1. A machine learning-based food quality detection method, the method comprising:
collecting historical detection records of food quality detection, public data sets and related data of data provided by partners, and integrating the collected data to ensure that the format and structure of the data are consistent;
labeling the data with consistent format and structure, and distributing quality labels for each sample data;
extracting feature data related to food quality based on the labeling data;
dividing the feature data and the labeling data into at least a training set, a verification set and a test set;
inputting the annotation data into the yolo-v5 model to train the network using bounding box regression to determine the exact location of the bounding box; classifying each anchor frame determined by the yolo-v5 model to distinguish the existence of an object in the anchor frame; calculating the accurate position of the image by using the target classification and the bounding box regression, and taking the accurate position as output;
selecting a proper loss function and an optimizer according to the task type and the model characteristics, wherein the loss function is used for measuring the difference between a model prediction result and a real label, and the optimizer is used for updating parameters of the model to minimize the loss function;
continuously monitoring detection data output by the yolo-v5 model, observing distribution and change conditions of the data, determining information that data values exceed threshold values and distribution change when monitoring that the data are abnormal, and outputting abnormal identification as records of food quality detection abnormality.
2. The method of claim 1, wherein prior to continuously monitoring the detected data output by the yolo-v5 model, the method further comprises:
and (3) performing evaluation test on the trained model by using the verification set, acquiring an evaluation result by using indexes of calculation accuracy and recall rate, and adjusting weight parameters of the model according to the evaluation result to optimize the model.
3. The method of claim 2, wherein prior to continuously monitoring the detected data output by the yolo-v5 model, the method further comprises:
training the model by using a training set, updating parameters of the model by using a back propagation algorithm, and setting parameters of the learning rate, the batch size and the iteration number of the model so as to control the training process of the model.
4. The method according to claim 1, wherein the method further comprises:
and acquiring detection data in real time, observing at least the distribution and change conditions of the data, preprocessing the acquired detection data, inputting the detection data into a detection model again, and carrying out real-time inference on the detection data.
5. The method according to claim 1, wherein the method further comprises:
collecting feedback information of a user on a detection result, processing and analyzing the collected user feedback, and screening useful feedback information;
and optimizing and improving the detection model according to the screened feedback information, and redeploying the optimized model into a real-time detection system to form a feedback loop.
6. The method according to claim 1, wherein the method further comprises:
assigning a unique identifier to each detection data, and establishing an association relationship between the detection data;
recording detailed log information in the detection process, wherein the log information at least comprises operation time, operators and operation content;
setting a query and search interface, receiving a search request for log information through the query and search interface, and responding matched log information through the query and search interface;
and processing the matched log information into a chart or report form for visual display.
7. A machine learning based food quality inspection device, the device comprising:
the collection unit is used for collecting historical detection records of food quality detection, public data sets and related data of data provided by partners, integrating the collected data and ensuring that the format and the structure of the data are consistent;
the labeling unit is used for labeling the data with consistent format and structure, and distributing quality labels for each sample data;
an extraction unit for extracting feature data related to food quality based on the labeling data;
the dividing unit is used for dividing the characteristic data and the labeling data into at least a training set, a verification set and a test set;
a training unit for inputting annotation data into the yolo-v5 model application bounding box regression to train the network to determine the exact location of the bounding box; classifying each anchor frame determined by the yolo-v5 model to distinguish the existence of an object in the anchor frame; calculating the accurate position of the image by using the target classification and the bounding box regression, and taking the accurate position as output;
the optimizing unit is used for selecting a proper loss function and an optimizer according to the task type and the model characteristics, wherein the loss function is used for measuring the difference between a model prediction result and a real label, and the optimizer is used for updating parameters of the model to minimize the loss function;
the monitoring unit is used for continuously monitoring the detection data output by the yolo-v5 model, observing the distribution and change conditions of the data, determining the information that the data value exceeds a threshold value and the distribution changes when the monitoring of the data is abnormal, and outputting abnormal identification as a record of food quality detection abnormality.
8. The apparatus of claim 7, wherein the optimizing unit is further configured to:
and (3) performing evaluation test on the trained model by using the verification set, acquiring an evaluation result by using indexes of calculation accuracy and recall rate, and adjusting weight parameters of the model according to the evaluation result to optimize the model.
9. The apparatus of claim 8, wherein the optimizing unit is further configured to:
training the model by using a training set, updating parameters of the model by using a back propagation algorithm, and setting parameters of the learning rate, the batch size and the iteration number of the model so as to control the training process of the model.
10. The apparatus of claim 7, wherein the apparatus further comprises:
the data response unit is used for distributing a unique identifier for each detection data and establishing an association relation between the detection data; recording detailed log information in the detection process, wherein the log information at least comprises operation time, operators and operation content; setting a query and search interface, receiving a search request for log information through the query and search interface, and responding matched log information through the query and search interface; and processing the matched log information into a chart or report form for visual display.
CN202311842746.2A 2023-12-28 2023-12-28 Food quality detection method and device based on machine learning Pending CN117831026A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311842746.2A CN117831026A (en) 2023-12-28 2023-12-28 Food quality detection method and device based on machine learning

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311842746.2A CN117831026A (en) 2023-12-28 2023-12-28 Food quality detection method and device based on machine learning

Publications (1)

Publication Number Publication Date
CN117831026A true CN117831026A (en) 2024-04-05

Family

ID=90518504

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311842746.2A Pending CN117831026A (en) 2023-12-28 2023-12-28 Food quality detection method and device based on machine learning

Country Status (1)

Country Link
CN (1) CN117831026A (en)

Similar Documents

Publication Publication Date Title
KR101811270B1 (en) Method and system for checking goods
CN109186813A (en) A kind of temperature sensor self-checking unit and method
CN111611294B (en) Star sensor data anomaly detection method
CN112581719B (en) Semiconductor packaging process early warning method and device based on time sequence generation countermeasure network
CN109374631A (en) A kind of tunnel state evaluating method
CN107248039A (en) Real-time quality control method and device based on medical specimen detection project result
CN109308225B (en) Virtual machine abnormality detection method, device, equipment and storage medium
US20210041397A1 (en) Computer-implemented processing for non-destructive evaluation of wooden specimen
CN113409284A (en) Circuit board fault detection method, device, equipment and storage medium
Kitchenham et al. Design metrics in practice
CN118067204B (en) Safety production data acquisition system based on digital metering technology
CN113449703A (en) Quality control method and device for environment online monitoring data, storage medium and equipment
KR20140051678A (en) Apparatus and method for fault management of smart devices
CN116520236A (en) Abnormality detection method and system for intelligent ammeter
Yu et al. LRProb control chart based on logistic regression for monitoring mean shifts of auto-correlated manufacturing processes
CN113312696B (en) Bridge health condition dynamic prediction alarm method based on ARIMA algorithm
CN109213119B (en) Complex industry key component fault prediction method and system based on online learning
CN117831026A (en) Food quality detection method and device based on machine learning
CN115293735A (en) Unmanned factory industrial internet platform monitoring management method and system
CN115600695A (en) Fault diagnosis method of metering equipment
CN112187555B (en) Real-time KPI data anomaly detection method and device based on machine learning
CN118052443B (en) Stainless steel material harmful heavy metal migration early warning system for food contact
KR102521000B1 (en) System and method for managing plant facilities
CN117171478B (en) Medical detection data error recognition model construction method and device
Sharp et al. Distribution of reported durations of behavior in applied behavioral research

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