CN117893793A - Target detection classification method, system and storage medium - Google Patents

Target detection classification method, system and storage medium Download PDF

Info

Publication number
CN117893793A
CN117893793A CN202311769977.5A CN202311769977A CN117893793A CN 117893793 A CN117893793 A CN 117893793A CN 202311769977 A CN202311769977 A CN 202311769977A CN 117893793 A CN117893793 A CN 117893793A
Authority
CN
China
Prior art keywords
preset
target
spectrum
classification
images
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
CN202311769977.5A
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.)
Research Institute Of Tsinghua Pearl River Delta
Original Assignee
Research Institute Of Tsinghua Pearl River Delta
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 Research Institute Of Tsinghua Pearl River Delta filed Critical Research Institute Of Tsinghua Pearl River Delta
Priority to CN202311769977.5A priority Critical patent/CN117893793A/en
Publication of CN117893793A publication Critical patent/CN117893793A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a target detection classification method, a target detection classification system and a storage medium, which are applied to the technical field of image recognition, and can effectively improve the accuracy of target detection classification and the detection classification efficiency. The method comprises the following steps: acquiring a plurality of groups of preset spectrum images; wherein each group of the preset spectrum images corresponds to different wavelengths; performing target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information; the preset wavelength images comprise a plurality of groups of images with corresponding wavelengths in a first preset wave band in the preset spectrum images; generating a corresponding region of interest according to the target object information; respectively calculating the spectrum values of each group of preset spectrum images according to the region of interest so as to generate a spectrum curve according to the spectrum values; and carrying out classification and identification through the target classification combination model according to the spectrum curve to obtain a target classification result.

Description

Target detection classification method, system and storage medium
Technical Field
The present invention relates to the field of image recognition technologies, and in particular, to a target detection classification method, system, and storage medium.
Background
With the development of deep learning and machine learning techniques, target recognition and target detection techniques have been applied in many fields. However, in the related art, in the process of performing target detection and classification, for example, classifying quality of objects, it is often difficult to quickly and accurately identify related objects, and it is also difficult to obtain accurate classification results. Therefore, the above technical problems need to be solved.
Disclosure of Invention
In order to solve at least one of the above technical problems, the present invention provides a target detection classification method, system and storage medium, which can effectively improve the accuracy of target detection classification and effectively improve the detection classification efficiency.
In one aspect, an embodiment of the present invention provides a target detection classification method, including the following steps:
acquiring a plurality of groups of preset spectrum images; wherein each group of the preset spectrum images corresponds to different wavelengths;
performing target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information; the preset wavelength images comprise a plurality of groups of images with corresponding wavelengths in a first preset wave band in the preset spectrum images;
Generating a corresponding region of interest according to the target object information;
respectively calculating the spectrum values of each group of preset spectrum images according to the region of interest so as to generate a spectrum curve according to the spectrum values;
and carrying out classification and identification through the target classification combination model according to the spectrum curve to obtain a target classification result.
According to some embodiments of the present invention, the performing target recognition on the preset wavelength image by using a preset recognition algorithm to obtain target object information includes:
arranging a plurality of groups of preset spectrum images according to wavelengths, and selecting the preset spectrum images in the middle of arrangement as the preset wavelength images;
performing target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information; the preset recognition algorithm comprises a preset deep learning target detection algorithm or a preset contour detection algorithm.
According to some embodiments of the invention, the generating a corresponding region of interest according to the target object information includes:
determining center position information of an object to be identified according to the target object information;
and constructing a square block with a preset pixel size according to the central position information to obtain the region of interest.
According to some embodiments of the invention, the calculating the spectral values of each set of the preset spectral images according to the region of interest to generate a spectral curve according to the spectral values includes:
carrying out average calculation on the reflection intensity values of pixels in the interested areas of each group of preset spectrum images to obtain corresponding spectrum values;
and connecting the spectrum values corresponding to the interested areas of the preset spectrum images into curves, and constructing and obtaining the spectrum curves.
According to some embodiments of the invention, the target classification combination model comprises a target preprocessing algorithm and a target machine learning model;
before the step of performing classification recognition through the target classification combination model according to the spectrum curve to obtain a target classification result, the method further comprises the following steps:
classifying the spectrum curves according to preset classification information to construct a training data set;
selecting the target preprocessing algorithm from a preprocessing algorithm library to preprocess the training data set to obtain a preprocessing data set; wherein the target preprocessing algorithm comprises at least one of denoising, baseline drift correction, data normalization processing and data whitening processing;
Selecting a first machine learning model from a preset machine learning model library to train the first machine learning model through the preprocessing data set to obtain the target machine learning model; wherein the first machine learning model includes one of a random forest model, a K-nearest neighbor algorithm model, and a gradient lifting model.
According to some embodiments of the present invention, the performing classification and identification according to the spectrum curve through a target classification combination model to obtain a target classification result includes:
acquiring an evaluation index to determine the target preprocessing algorithm and the target machine learning model according to the evaluation index;
preprocessing the spectrum curve through the target preprocessing algorithm to obtain preprocessing curve data;
and classifying and identifying the preprocessing curve data through the target machine learning model to obtain the target classification result.
According to some embodiments of the invention, the acquiring a plurality of sets of preset spectral images includes:
acquiring a plurality of groups of preset spectrum images of an object to be identified in a second preset wave band through a preset near infrared spectrum imaging camera; wherein the preset spectral image comprises a near infrared spectral image.
In another aspect, an embodiment of the present invention further provides an object detection classification system, including:
the first module is used for acquiring a plurality of groups of preset spectrum images; wherein each group of the preset spectrum images corresponds to different wavelengths;
the second module is used for carrying out target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information; the preset wavelength images comprise a plurality of groups of images with corresponding wavelengths in a first preset wave band in the preset spectrum images;
a third module, configured to generate a corresponding region of interest according to the target object information;
a fourth module, configured to calculate, according to the region of interest, a spectral value of each set of preset spectral images, so as to generate a spectral curve according to the spectral values;
and a fifth module, configured to perform classification and identification through a target classification combination model according to the spectrum curve, so as to obtain a target classification result.
In another aspect, an embodiment of the present invention further provides an object detection classification system, including:
at least one processor;
at least one memory for storing at least one program;
the at least one program, when executed by the at least one processor, causes the at least one processor to implement the object detection classification method as described in the above embodiments.
In another aspect, an embodiment of the present invention further provides a computer storage medium, in which a program executable by a processor is stored, where the program executable by the processor is used to implement the object detection classification method according to the above embodiment.
According to the target detection classification method, the target detection classification system and the storage medium, the target detection classification method and the storage medium have at least the following beneficial effects: according to the embodiment of the invention, a plurality of groups of preset spectrum images are firstly obtained, wherein each group of preset spectrum images corresponds to different wavelengths, and a person carries out target recognition on the preset wavelength images through a preset recognition algorithm to obtain target object information. Correspondingly, the preset wavelength image in the embodiment of the invention comprises images with the corresponding wavelengths in a first preset wave band in a plurality of groups of preset spectrum images. Then, the embodiment of the invention generates a corresponding region of interest according to the target object information, so as to respectively calculate the spectrum values of each group of preset spectrum images according to the region of interest, thereby generating a spectrum curve according to the spectrum values. Finally, the embodiment of the invention carries out classification and identification through the target classification combination model according to the spectrum curve to obtain a target classification result, realizes detection and classification of the target object, and effectively improves the accuracy and efficiency of target detection and classification. It is easy to understand that in the embodiment of the invention, the region of interest is generated through the target object information, and the corresponding spectrum curve is generated according to the region of interest, so that the spectrum curve is classified and identified through the target classification combination model, the accuracy of target detection classification can be effectively improved, and the detection classification efficiency is effectively improved.
Drawings
FIG. 1 is a flow chart of a target detection classification method provided by an embodiment of the invention;
FIG. 2 is a schematic flow chart of the steps of the spectral curve classification training and inference process provided by an embodiment of the present invention;
FIG. 3 is a flowchart illustrating the overall steps of a target detection classification method according to an embodiment of the present invention;
FIG. 4 is a schematic illustration of an application of the spectral curve classification training and inference process provided by an embodiment of the present invention;
FIG. 5 is a schematic diagram of a target detection classification system according to an embodiment of the present invention;
fig. 6 is a schematic block diagram of an object detection classification system according to an embodiment of the present invention.
Detailed Description
The embodiments described in the present application should not be construed as limitations on the present application, but rather as many other embodiments as possible without inventive faculty to those skilled in the art, are intended to be within the scope of the present application.
In the following description, reference is made to "some embodiments" which describe a subset of all possible embodiments, but it is to be understood that "some embodiments" can be the same subset or different subsets of all possible embodiments and can be combined with one another without conflict.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the present application.
Before describing embodiments of the present application, related terms referred to in the present application will be first described.
Near infrared spectrum: is a wave of electromagnetic radiation between the visible and mid-infrared, and the near infrared region is defined as the region 780nm to 2526 nm. Accordingly, the near infrared spectrum image is an image obtained by measuring absorption, reflection and scattering characteristics of a substance in a near infrared band using the principle of near infrared spectroscopy, and converting the data.
Machine learning algorithm: is an algorithm capable of automatically solving various problems by analyzing and processing data according to mathematical and statistical methods to learn corresponding rules and patterns therefrom. Among other things, machine learning algorithms can be used for various tasks such as classification, clustering, regression, dimension reduction, and the like. Accordingly, common machine learning algorithms include decision trees, support vector machines, neural networks, naive bayes, random forests, and the like.
Microelectromechanical System (MEMS) spectral imaging: the imaging method combines a micro-electromechanical system and a spectrum imaging technology, and utilizes a micro-sized optical element and a mechanical system to realize high-resolution spectrum acquisition. Near infrared spectral imaging can provide rich information of substances, and has wide application in the fields of biomedicine, agriculture, environmental monitoring and the like.
With the development of deep learning and machine learning techniques, target recognition and target detection techniques have been applied in many fields. However, in the related art, in the process of performing target detection and classification, for example, classifying quality of objects, it is often difficult to quickly and accurately identify related objects, and it is also difficult to obtain accurate classification results. Therefore, the above technical problems need to be solved.
Based on the above, an embodiment of the present invention provides a target detection classification method, system and storage medium, which can effectively improve accuracy of target detection classification and effectively improve detection classification efficiency. Referring to fig. 1, the method of the embodiment of the present invention includes, but is not limited to, step S110, step S120, step S130, step S140, and step S150.
Specifically, the method application process of the embodiment of the invention includes, but is not limited to, the following steps:
s110: and acquiring a plurality of groups of preset spectrum images. Wherein each set of preset spectral images corresponds to a different wavelength.
S120: and carrying out target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information. The preset wavelength images comprise images with corresponding wavelengths in preset wave bands in a plurality of groups of preset spectrum images.
S130: and generating a corresponding region of interest according to the target object information.
S140: and respectively calculating the spectrum values of each group of preset spectrum images according to the region of interest so as to generate a spectrum curve according to the spectrum values.
S150: and carrying out classification and identification through the target classification combination model according to the spectrum curve to obtain a target classification result.
In the working process of the specific embodiment, the embodiment of the invention firstly acquires a plurality of groups of preset spectrum images. Specifically, in the embodiment of the present invention, each set of preset spectral images corresponds to a different wavelength. For example, in the embodiment of the present invention, 10 sets of preset spectral images are obtained in preset bands, where the bands where the preset spectral images of each set are located are different, that is, the preset spectral images are in one-to-one correspondence with the spectral wavelengths. Then, the embodiment of the invention carries out target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information. Specifically, the preset wavelength image in the embodiment of the invention includes images with corresponding wavelengths in a first preset wave band in a plurality of groups of preset spectrum images. Correspondingly, in the embodiment of the invention, the first preset wave band is determined by the exposure degree and definition of the preset spectrum images, namely, wavelength images with the exposure degree and definition meeting corresponding requirements in a plurality of groups of spectrum images are selected as preset wavelength images. Meanwhile, the embodiment of the invention identifies the target object in the preset wavelength image through the preset identification algorithm, so that corresponding target object information is obtained. The preset recognition algorithm is a target detection algorithm for object recognition, and specific objects are automatically detected and identified in the spectrum image. Accordingly, the target object information in the embodiment of the present invention refers to related information of the target object that needs to be detected and classified, such as contour information, position coordinate information, and the like. Then, the embodiment of the invention generates a corresponding region of interest according to the target object information. Specifically, spectral characteristics of some specific regions are interested in spectroscopy, and the embodiment of the invention draws the position of a region of interest (ROI) in a spectral image in a manner of generating corresponding regions of interest by using target object information, so as to facilitate extraction of information of related regions for further analysis.
Further, according to the embodiment of the invention, the spectrum values of each group of preset spectrum images are calculated according to the region of interest, so that a spectrum curve is generated according to the spectrum values. Specifically, in the embodiment of the present invention, the spectrum curve is a spectrum distribution curve of an object drawn according to reflected, absorbed or transmitted images of the object, i.e., the target object, on light with different wavelengths. According to the embodiment of the invention, the spectrum values of the interested areas in each group of preset spectrum images are calculated, and then the spectrum curves are drawn according to the calculated spectrum values corresponding to each group of preset spectrum images, so that preparation is made for identifying the substances in the interested areas (ROI). Finally, according to the embodiment of the invention, the classification and identification are carried out through the target classification combination model according to the spectrum curve, and the target classification result is obtained. Specifically, the object classification combination model in the embodiment of the invention refers to a spectrum curve classification model, such as a machine learning model. Accordingly, in the embodiment of the invention, the corresponding target classification combination model is determined by the evaluation index identified by the classification. In the embodiment of the invention, the evaluation index refers to an index for evaluating the performance of the classification model, such as precision, recall, F1 measurement, and the like. According to the embodiment of the invention, the selected target classification combination model is determined through the evaluation index of classification and identification, so that the classification and identification of the spectrum curve are carried out through the target classification model, and the target classification result is obtained, thereby effectively improving the accuracy of target detection and classification and effectively improving the detection and classification efficiency.
In some embodiments of the present invention, target recognition is performed on the preset wavelength image by a preset recognition algorithm to obtain target object information, including but not limited to the following steps:
and arranging a plurality of groups of preset spectrum images according to the wavelength, and selecting the preset spectrum images in the middle of arrangement as preset wavelength images.
And carrying out target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information. The preset recognition algorithm comprises a preset deep learning target detection algorithm or a preset contour detection algorithm.
In this embodiment, the embodiment of the present invention selects a corresponding preset wavelength image from preset spectrum images, so as to perform target identification on the preset wavelength image, thereby obtaining target object information. Specifically, in the embodiment of the invention, a plurality of groups of preset spectrum images are arranged according to the wavelength, so that the preset spectrum images in the middle of arrangement are selected as the preset wavelength images. For example, in the embodiment of the present invention, 10 sets of preset spectrum images are obtained, and each set of preset spectrum images corresponds to a different wavelength. The embodiment of the invention arranges the preset spectrum images according to the corresponding wavelengths, for example, the preset spectrum images are arranged according to the wavelengths from big to small or from small to big, so as to obtain the corresponding image arrangement. Then, the embodiment of the invention selects the preset spectral images in the middle of the image arrangement of the 10 sets of images as the preset wavelength images, for example, selects the 5 th or 6 th preset spectral image in the 10 sets of wavelength images as the preset wavelength image. It is easy to understand that, because the exposure of the wavelength image in the middle of the arrangement is moderate, the image is relatively clear, and therefore, the embodiment of the invention can effectively improve the accuracy of target identification by selecting the preset spectrum image in the middle of the arrangement as the preset wavelength image.
Then, the embodiment of the invention carries out target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information. Specifically, the preset recognition algorithm in the embodiment of the invention comprises a preset deep learning target detection algorithm or a preset contour detection algorithm. According to the embodiment of the invention, the target recognition is carried out on the preset wavelength image through a deep learning target detection algorithm or a contour-based target detection algorithm, so that a specific object is automatically detected and identified in a spectrum image (preset wavelength image) to obtain target object information. For example, the preset deep object detection algorithm in the embodiment of the present invention includes a YOLO deep learning object detection algorithm. The YOLO (You Only Look Once) is a deep learning target recognition algorithm, which regards the target detection problem as a regression problem, and can obtain object position information and category information by implementing one-time deep neural network calculation. Compared with the traditional target detection method, the YOLO deep learning target detection algorithm can achieve both speed and accuracy. In addition, the YOLO algorithm in the embodiment of the present invention needs a training model to identify the target object, for example, for common objects, a pre-training model may be used, and for specific objects, a self-training model may be used. The self-training model in the embodiment of the invention requires a user to label an object and train a corresponding object identification model.
In addition, the preset contour detection algorithm in the embodiment of the invention is an algorithm for detecting the boundary of the target object in the image, and the detection of the target object is realized by finding the outer boundary of the object in the image. According to the embodiment of the invention, the strong edge in the image is searched through the edge detection algorithm, the corresponding edge information is further utilized, the contour in the image is searched through the contour extraction algorithm, and the corresponding target object information is finally obtained. It should be noted that, in the embodiment of the present invention, the YOLO target detection algorithm needs a pre-training model, which can detect the types of the articles and can better process the overlapping situation of the articles, while the contoured target detection algorithm does not need a pre-training model, but cannot detect the types of the articles and can hardly process the overlapping situation of the articles, so that the embodiment of the present invention selects a corresponding target recognition mode according to specific target detection classification requirements.
In some embodiments of the present invention, the corresponding region of interest is generated from the target object information, including, but not limited to, the steps of:
and determining the center position information of the object to be identified according to the target object information.
And constructing a square block with a preset pixel size according to the central position information to obtain the region of interest.
In this embodiment, the embodiment of the present invention first determines center position information of an object to be identified according to target object information, and then constructs a square with a preset pixel size according to the center position information, so as to obtain a region of interest. Specifically, after the position of the object in the preset wavelength image is identified through a deep learning object detection algorithm or object detection based on contour identification, the embodiment of the invention needs to draw a region of interest (ROI) based on the object position identification result, namely object information, so as to prepare for generating a spectral curve. Illustratively, since it is generally necessary to draw a region of interest (ROI) on a corresponding target object to analyze reflection of light of different wavelengths by an object to obtain a spectral curve, the region of interest (ROI) needs to be located on the target object in a preset wavelength image. Correspondingly, the embodiment of the invention constructs a square frame with a preset pixel size by selecting the central position of the detection result of the object (target object), such as drawing a square frame with a side length of about 10 pixels, so as to generate a corresponding region of interest.
In some embodiments of the present invention, the spectral values of each set of preset spectral images are calculated separately from the region of interest to generate a spectral curve from the spectral values, including, but not limited to, the steps of:
And carrying out average calculation on the reflection intensity values of the pixels in the interested areas of each group of preset spectrum images to obtain corresponding spectrum values.
And connecting the spectrum values corresponding to the interested areas of each group of preset spectrum images into a curve, and constructing to obtain a spectrum curve.
In this embodiment, the embodiment of the present invention firstly performs average calculation on the reflection intensity values of the pixels in the interested areas of each set of preset spectrum images to obtain corresponding spectrum values, and further connects the spectrum values corresponding to the interested areas of each set of preset spectrum images into a curve, so as to construct and obtain a spectrum curve. Specifically, in the embodiment of the present invention, the reflection intensity value refers to a gray-scale image value of a pixel. Correspondingly, the embodiment of the invention obtains the corresponding average value by calculating the average of the gray image values of each pixel in the interested region of each group of preset spectrum images, namely, the average calculation is carried out on the reflection intensity data of the pixels in the interested region, and the average value is used as the spectrum value of the preset spectrum image with the wavelength in the interested region. Then, according to the embodiment of the invention, the spectrum values corresponding to the preset spectrum images of each wavelength are connected in a curve mode, so that the spectrum curve of the region of interest is obtained. It is easy to understand that, in the embodiment of the invention, by automatically generating the corresponding region of interest (ROI), and further calculating the spectrum curve of each region of interest, preparation can be made for identifying the target object in the region of interest, and the efficiency of target detection classification is improved.
In some embodiments of the invention, the target classification combination model includes a target preprocessing algorithm and a target machine learning model. Accordingly, before performing the step of performing classification recognition according to the spectrum curve through the object classification combination model to obtain the object classification result, the object detection classification method provided by the embodiment of the invention further includes, but is not limited to, the following steps:
classifying the spectrum curves according to preset classification information to construct and obtain a training data set.
And selecting a target preprocessing algorithm from the preprocessing algorithm library to preprocess the training data set, so as to obtain a preprocessing data set. The target preprocessing algorithm comprises at least one of denoising, baseline drift correction, data normalization processing and data whitening processing.
And selecting a first machine learning model from a preset machine learning model library so as to train the first machine learning model through a preprocessing data set to obtain a target machine learning model. The first machine learning model comprises one of a random forest model, a K-nearest neighbor algorithm model and a gradient lifting model.
In this embodiment, the embodiment of the present invention trains the target classification combination model before performing classification recognition by the target classification combination model. Specifically, referring to fig. 2, the object classification combination model in the embodiment of the present invention includes an object preprocessing algorithm and an object machine learning model. The target preprocessing algorithm refers to an algorithm for preprocessing a spectrum curve. Correspondingly, the target machine learning model is a model for analyzing and classifying the preprocessed spectrum curve. First, in training the target classification model, it is necessary to know the classification of the target object or substance represented by each spectral curve. Therefore, the embodiment of the invention firstly classifies the spectrum curves according to the preset classification information to construct the training data set. The preset classification information can be set in a self-defining mode according to specific classification requirements, for example, the preset classification information is divided into normal-class target objects and abnormal-class target objects according to quality requirements of the target objects, and further, the spectrum curves are classified, so that a training data set is constructed.
Then, the embodiment of the invention selects a target preprocessing algorithm from a preprocessing algorithm library to preprocess the training data set, so as to obtain a preprocessing data set. Specifically, in the embodiment of the invention, a plurality of classes of target preprocessing algorithms are arranged in a preprocessing algorithm library, including denoising, baseline drift correction, data normalization processing and data whitening processing. Accordingly, the embodiment of the invention obtains the corresponding preprocessing data set by selecting at least one of denoising, baseline drift correction, data normalization processing and data whitening processing as a target preprocessing algorithm to preprocess the spectrum curve in the training data set. It is readily understood that the raw spectral data in embodiments of the present invention captures not only the spectral features of the sample being measured, such as near infrared signature spectra, but also includes interference factors such as high frequency random noise and baseline drift. At the same time, these data are comprehensively influenced by physical properties such as viscosity, granularity, surface texture, density and the like of the sample. Therefore, prior to performing the analysis of the spectral sample properties, it is necessary to pre-process the spectral data to achieve noise reduction and to reduce the effects of other interference factors. Correspondingly, in the embodiment of the invention, the denoising is performed by a digital filtering technology, including a moving average method, vector normalization, fourier transformation and the like. According to the moving average method, a moving window is arranged, data in the window are added, the number of the data is divided, a corresponding average value is obtained, and all data processing is completed in a convolution mode. In addition, in the embodiment of the invention, vector normalization can be used for removing random noise caused by equipment states and sample differences, and a calculation formula is shown in the following formula (1):
Wherein x is i As a result of the original spectrum of light,is the spectrum average value.
In addition, in the embodiment of the invention, the Fourier transform decomposes the original spectrum into sine wave superposition of a plurality of different frequencies, thereby realizing the conversion between the frequency domain function and the time domain function. Wherein the corresponding discrete fourier transform formula is shown in the following formula (2):
wherein e is a natural constant, m is the number of spectral wavelength groups, and i is an imaginary unit.
Accordingly, the embodiment of the invention can reduce the spectrum baseline drift phenomenon caused by the influence of factors such as instruments, environment or sample preparation and the like through baseline drift correction. The baseline wander correction in the embodiment of the invention comprises a trending algorithm and a derivative method. The derivative method in the embodiment of the invention can be used for eliminating the influence of baseline drift or gentle background interference and distinguishing overlapped peaks, thereby providing spectrum profile transformation with higher definition than the original spectrum resolution and improving resolution and sensitivity. In addition, the trending algorithm first fits the spectral absorbance and wavelength to a trend line by a polynomial, and then subtracts the trend line from the spectrum. The binomial fitted trend line is shown in the following formula (3):
where x' is the spectral data after standard normal transformation. Accordingly, the spectral data after trending treatment are: x "=x' -x d
In addition, the numbers in the embodiment of the inventionNormalization processes are used to reduce variability between different samples due to instrument, collection conditions, or sample concentration variations. The data normalization processing comprises mean value centering and data normalization. Accordingly, the mean center and the average spectrum of the training set is subtracted from the sample spectrum to emphasize the differences between the sample spectra. The spectrum data normalization transformation is to divide the spectrum after the mean value centering treatment by the standard deviation spectrum of the training set. Wherein the average spectrumAnd standard deviation spectra are shown in the following formulas (4) and (5), respectively:
wherein, for unknown sample spectraThe standardized spectral data are: />
In addition, in the embodiment of the invention, the correlation between the detection data is removed through the data whitening process, so that the subsequent processing process is simplified. Specifically, in the embodiment of the present invention, first, a covariance matrix of sample spectrum data is decomposed as shown in the following formula (6):
x =VDV T (6)
wherein D is a diagonal matrix and V is a feature matrix. Accordingly, a Principal Component Analysis (PCA) whitening transformation is shown in the following formula (7):
z=(D -1/2 V T )x (7)
in addition, in the embodiment of the invention, ZCA whitening transformation is shown in the following formula (8):
z=(VD -1/2 V T )x (8)
It is easy to understand that, in the embodiment of the present invention, the preprocessing flow is formed by selecting one or more data preprocessing algorithms, so that the preprocessed data is imported into a machine learning classification algorithm for further calculation and analysis.
Further, the embodiment of the invention obtains the target machine learning model by selecting the first machine learning model from the preset machine learning model library so as to train the first machine learning model through preprocessing the data set. Specifically, in the embodiment of the invention, the first machine learning model comprises one of a random forest model, a K nearest neighbor algorithm model and a gradient lifting model. In the embodiment of the invention, the target machine learning model is used for dividing the spectrum data into different categories, and each category represents a sample with different characteristics or attributes. Accordingly, in the embodiment of the invention, the K-nearest neighbor classification algorithm (K-Nearest Neighbors, KNN) classifies or predicts according to the distance between samples, i.e. samples with close distances are considered to have similar characteristics in the feature space. The KNN (K nearest neighbor algorithm) model classifies the spectrum to be classified into the class nearest to the spectrum by comparing the spectrum to be classified with the spectrum most similar to the training set. In addition, random forest algorithms are classified by constructing a plurality of decision trees and synthesizing their results. Wherein each decision tree is trained on a different sample subset and feature subset. Therefore, the random forest model is suitable for processing spectral data of noise and complex relations, and can effectively cope with diversity of spectral curves through a voting mechanism of the tree. In addition, the gradient lifting algorithm (eXtreme Gradient Boosting, XGBoost) in the embodiment of the invention is used for iteratively training a plurality of weak learners, and each training is used for attempting to correct errors of a previous round of model, so that the nonlinear relation can be adaptively learned when the spectrum curve classification is processed, and the method has stronger fitting capability on complex spectrum characteristics and data structures.
It is easy to understand that in the embodiment of the invention, the target preprocessing algorithm is selected from the preprocessing algorithm library, and the first machine learning model is selected from the preset machine learning model library so as to train the target classification combination model, so that the processing effects of the combination of different preprocessing algorithms and corresponding machine learning algorithms can be obtained, the corresponding algorithm combination can be selected according to the corresponding evaluation index to carry out classification recognition, and the accuracy and the efficiency of target classification recognition are effectively improved.
In some embodiments of the present invention, classification recognition is performed by the target classification combination model according to the spectral curve to obtain a target classification result, including but not limited to the following steps:
and acquiring an evaluation index to determine a target preprocessing algorithm and a target machine learning model according to the evaluation index.
Preprocessing the spectrum curve through a target preprocessing algorithm to obtain preprocessing curve data.
And classifying and identifying the preprocessing curve data through the target machine learning model to obtain a target classification result.
In this embodiment, the embodiment of the present invention first obtains an evaluation index to determine a target preprocessing algorithm and a target machine learning model according to the evaluation index. Specifically, the evaluation indexes in the embodiment of the invention comprise indexes such as precision, recall, F1 measurement and the like. The Precision refers to the proportion of samples actually in the positive category among all samples predicted by the model as the positive category, and the calculation formula is shown in the following formula (9):
Where TP is the number of samples of the true class and FP is the number of negative samples that are incorrectly predicted as positive classes. Accordingly, the precision concerns how much of the samples that the model predicts as positive categories are truly positive.
In addition, in the embodiment of the present invention, the Recall ratio (Recall) refers to the proportion of samples correctly predicted by the model to be positive in all samples of the actual positive category, and the calculation formula is shown in the following formula (10):
where TP is the number of samples of the true class and FN is the number of positive samples that are incorrectly predicted as negative classes. Accordingly, the recall concerns how much was successfully predicted in the actual positive class samples.
In addition, in the embodiment of the invention, the F1 metric refers to a harmonic mean of the precision and recall, and the precision and recall of the model are comprehensively considered, and the calculation formula of the F1 metric is shown in the following formula (11):
wherein, the value range of F1 measurement in the formula is between [0,1], and the closer to 1 is the better the performance of the model.
Further, referring to fig. 2, in the embodiment of the present invention, a target preprocessing algorithm is used to preprocess a spectrum curve to obtain preprocessed curve data, and then a target machine learning model is used to classify and identify the preprocessed curve data to obtain a target classification result. Specifically, in the embodiment of the invention, by selecting an appropriate evaluation index, using a spectrum curve of a certain training sample, and selecting an appropriate preprocessing algorithm and machine learning algorithm according to the evaluation index, a corresponding target classification combination model, namely a preprocessing algorithm and machine learning algorithm combination, is obtained. Then, for the object sample to be classified, namely the object to be identified, only photographing through a spectrum camera and automatically generating a spectrum curve of the sample, and importing a classification model which is constructed in advance, namely a target classification combination model, so as to obtain an automatic classification result, namely a target classification result, of the target object. It is easy to understand that according to the embodiment of the invention, the requirements of target detection classification can be effectively adapted by selecting the corresponding preprocessing algorithm and the machine learning model according to the corresponding evaluation indexes, and the accuracy and the efficiency of the target detection classification can be further effectively improved.
In some embodiments of the present invention, sets of preset spectral images are acquired, including, but not limited to, the steps of:
and acquiring a plurality of groups of preset spectrum images of the object to be identified in a second preset wave band through a preset near infrared spectrum imaging camera. The preset spectrum image comprises a near infrared spectrum image.
In this specific embodiment, the preset spectrum image acquired in the embodiment of the present invention includes a near infrared spectrum image. Specifically, the embodiment of the invention obtains a plurality of groups of preset spectrum images of the object to be identified in a second preset wave band through a preset near infrared spectrum imaging camera. In the embodiment of the invention, the preset near infrared spectrum imaging camera extracts a large number of information layers from a plurality of near infrared spectrums, so that the information of a shooting object can be better acquired. Accordingly, the filter of the pre-set near infrared spectrum imaging camera in the embodiment of the invention is based on the fabry-perot optical cavity principle, which is designed as a series of coated mirrors, mounted on the MEMS component. According to the embodiment of the invention, the space of the Fabry-Perot cavity is changed by controlling the change of the voltage applied to the upper mirror support, so that only the light with the required infrared wavelength can pass through, and the image shooting with multiple groups of wavelengths is realized. For example, the preset near infrared spectrum imaging camera in the embodiment of the invention, such as a Monarch Pro camera, can obtain 10 groups of near infrared images with wavelengths between 713 and 920nm (1 image for each group of wavelengths and 10 images for the total) at the same time so as to adapt to different shooting environments and provide conditions for preferentially selecting shooting results.
It should be noted that, in the embodiment of the present invention, the preset near infrared spectrum imaging camera is a MEMS near infrared spectrum camera that uses a micro-sized optical element and a mechanical system to realize high resolution spectrum acquisition, and is a technology combining the MEMS technology with near infrared spectrum imaging. Among them, high accuracy and high efficiency in target detection can be achieved by miniaturized mechanical systems and high-sensitivity spectrum detectors. In addition, the technology can collect spectrum information at a very rapid speed, and provides possibility for real-time application. Therefore, the target detection classification method based on MEMS spectral imaging in the embodiment of the invention can rapidly shoot a multiband near infrared spectral image, realize automatic article position detection, automatically generate a spectral curve of a substance, and simultaneously complete the training of a substance spectral classification model and the substance classification detection inference by selecting an optimized preprocessing algorithm and a classification detection algorithm. Accordingly, the target detection classification method in the embodiment of the invention has the beneficial effects of convenience, rapidness, no damage, accuracy and the like. For example, the embodiment of the invention is based on the MEMS near infrared spectrum camera with low cost, and a user can finish operations such as target detection, material classification and the like by only easy operation without complex instruments and equipment or professional knowledge, thereby improving convenience. Meanwhile, the MEMS near infrared spectrum camera is used, so that various objects can be shot at one time in a short time, and the infrared images of a plurality of wave bands are obtained, so that the detection efficiency is greatly improved. In addition, since MEMS spectral imaging is a non-contact detection technique, there is no need to contact or destructively sample the target, thus ensuring the integrity of the detected object. Meanwhile, abundant spectrum information can be provided through the MEMS spectrum imaging technology, and then the characteristics of different substances can be accurately identified by combining a corresponding preprocessing algorithm and a machine learning classification algorithm, so that a corresponding target classification result is obtained through identification.
Referring to fig. 3, taking an example of a target detection classification application scenario, the embodiment of the present invention first obtains a plurality of sets of preset spectral images, such as 10 sets of near infrared spectral images with wavelengths. Then, the embodiment of the invention selects a preset spectrum image with middle wavelength after shooting, and uses a target detection algorithm, such as a YOLO target recognition algorithm, to detect the position of the object to be detected. Further, in the embodiment of the invention, a region of interest (ROI) is drawn at the position of the object to be detected, i.e., the object to be identified, and the infrared reflection values of 10 wave bands of the region of interest (ROI) are calculated to obtain an infrared spectrum curve. Further, the embodiment of the invention calculates the combination of classification through the data preprocessing model and the machine learning classification model, and selects the optimal combination from the combination as the classification model of the substance. Finally, the embodiment of the invention utilizes the established material classification model and combines the target position detection and identification and the spectrum curve generation technology, thereby realizing the automatic detection and classification of the target object and obtaining the target classification result. For example, referring to fig. 4, taking classification of peanuts as an example, when normal peanut and peanut shell impurities need to be analyzed in a stack of peanuts, then embodiments of the present invention first obtain training samples: a portion of normal peanuts and peanut hulls are classified. Then, the embodiment of the invention shoots through a spectrum camera and generates a spectrum curve of normal peanuts and peanut shells. Further, according to the corresponding service requirement, the candidate pre-classification model of the embodiment of the invention is as follows: moving average, vector normalization, data normalization, candidate machine learning models are: nearest neighbor, random forest. In addition, in the embodiment of the invention, the evaluation indexes are as follows: recall ratio. Therefore, the embodiment of the invention combines the model with the highest recall ratio from the preprocessing algorithm and the machine learning algorithm as the classification model, namely the target classification combination model. Finally, when a new peanut sample exists, after the spectrum curve is shot and generated, the embodiment of the invention carries out classification recognition through the classification model, so that a classification result is obtained.
It should be noted that, in the embodiment of the invention, by selecting the corresponding preprocessing algorithm and machine learning model, the requirement of target detection classification can be effectively adapted, and the accuracy and efficiency of target detection classification can be effectively improved. Meanwhile, near infrared spectrum imaging provides more spectrum information, and can be used for analyzing and identifying the characteristics of different objects. In addition, the spectrum imaging camera, namely the preset near infrared spectrum imaging camera, in the embodiment of the invention can shoot near infrared pictures with 10 wavelengths from 713-920 nm at one time, so that the spectrum imaging camera can be better adapted to the scene actually shot, and better imaging effects can be ensured to be achieved in different environments. Meanwhile, the spectrum curve based on MEMS spectrum imaging target detection in the embodiment of the invention is automatically generated, and the target detection classification method has the characteristics of convenience, rapidness, no damage, accuracy and the like, and has wide application potential in a plurality of fields, such as quality detection, food detection, agricultural field, environment detection and the like. For example, in quality detection applications, defects, foreign objects or quality problems on the surface of a product can be monitored and identified in real time by automatically generating a spectrum curve on the surface of the product and detecting the classification of the substances, thereby improving the efficiency and accuracy of product quality control. In the field of food detection, the content of components, pollutants and deterioration conditions in food can be detected through spectral imaging, which is helpful for ensuring the safety and quality of the food. In the agricultural field, spectral information on the surface of a plant can be obtained through spectral imaging, so that the health condition of the plant is analyzed, and meanwhile, the characteristics of possible diseases or insect pests can be detected, so that the growth state of the crop is monitored. In the field of environmental detection, rapid detection and monitoring of pollutants in the environment can be realized by analyzing spectral characteristics of soil or other specific substances.
Referring to fig. 5, an embodiment of the present invention further provides an object detection classification system, including:
a first module 210, configured to acquire a plurality of sets of preset spectral images. Wherein each set of preset spectral images corresponds to a different wavelength.
The second module 220 is configured to perform target recognition on the preset wavelength image through a preset recognition algorithm, so as to obtain target object information. The preset wavelength images comprise images with corresponding wavelengths in preset wave bands in a plurality of groups of preset spectrum images.
A third module 230, configured to generate a corresponding region of interest according to the target object information.
A fourth module 240, configured to calculate the spectral values of each set of preset spectral images according to the region of interest, so as to generate a spectral curve according to the spectral values.
And a fifth module 250, configured to perform classification recognition through the target classification combination model according to the spectrum curve, so as to obtain a target classification result.
It will be appreciated that the above-described embodiments of the target detection classification method are applicable to the embodiments of the target detection classification system, and the functions of the embodiments of the target detection classification system are the same as those of the embodiments of the target detection classification method, and the advantages achieved by the embodiments of the target detection classification method are the same as those achieved by the embodiments of the target detection classification method.
Referring to fig. 6, an embodiment of the present invention further provides an object detection classification system, including:
at least one processor 310.
At least one memory 320 for storing at least one program.
The at least one program, when executed by the at least one processor 310, causes the at least one processor 310 to implement the object detection classification method as described in the above embodiments.
It will be appreciated that the above-described embodiments of the target detection classification method are applicable to the embodiments of the target detection classification system, and the functions of the embodiments of the target detection classification system are the same as those of the embodiments of the target detection classification method, and the advantages achieved by the embodiments of the target detection classification method are the same as those achieved by the embodiments of the target detection classification method.
An embodiment of the present invention also provides a computer-readable storage medium storing computer-executable instructions for execution by one or more control processors, e.g., to perform the steps described in the above embodiments.
It will be appreciated that the above-described embodiments of the object detection classification method are applicable to the embodiments of the computer-readable storage medium, and the functions of the embodiments of the computer-readable storage medium are the same as those of the embodiments of the object detection classification method, and the advantages achieved by the embodiments of the object detection classification method are the same as those achieved by the embodiments of the object detection classification method.
Those of ordinary skill in the art will appreciate that all or some of the steps, systems, and methods disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on computer readable media, which may include computer storage media (or non-transitory media) and communication media (or transitory media). The term computer storage media includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data, as known to those skilled in the art. Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital Versatile Disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other medium which can be used to store the desired information and which can be accessed by a computer. Furthermore, as is well known to those of ordinary skill in the art, communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media.
While the preferred embodiment of the present invention has been described in detail, the present invention is not limited to the above embodiment, and various equivalent modifications and substitutions can be made by those skilled in the art without departing from the spirit of the present invention, and these equivalent modifications and substitutions are intended to be included in the scope of the present invention as defined in the appended claims.

Claims (10)

1. A method for classifying target detection, comprising the steps of:
acquiring a plurality of groups of preset spectrum images; wherein each group of the preset spectrum images corresponds to different wavelengths;
performing target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information; the preset wavelength images comprise a plurality of groups of images with corresponding wavelengths in a first preset wave band in the preset spectrum images;
generating a corresponding region of interest according to the target object information;
respectively calculating the spectrum values of each group of preset spectrum images according to the region of interest so as to generate a spectrum curve according to the spectrum values;
and carrying out classification and identification through the target classification combination model according to the spectrum curve to obtain a target classification result.
2. The method according to claim 1, wherein the performing target recognition on the preset wavelength image by the preset recognition algorithm to obtain target object information includes:
Arranging a plurality of groups of preset spectrum images according to wavelengths, and selecting the preset spectrum images in the middle of arrangement as the preset wavelength images;
performing target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information; the preset recognition algorithm comprises a preset deep learning target detection algorithm or a preset contour detection algorithm.
3. The object detection classification method according to claim 1, wherein the generating a corresponding region of interest according to the object information includes:
determining center position information of an object to be identified according to the target object information;
and constructing a square block with a preset pixel size according to the central position information to obtain the region of interest.
4. The object detection classification method according to claim 1, wherein the calculating the spectral values of each set of the preset spectral images according to the region of interest to generate a spectral curve according to the spectral values, respectively, comprises:
carrying out average calculation on the reflection intensity values of pixels in the interested areas of each group of preset spectrum images to obtain corresponding spectrum values;
And connecting the spectrum values corresponding to the interested areas of the preset spectrum images into curves, and constructing and obtaining the spectrum curves.
5. The target detection classification method of claim 1, wherein the target classification combination model comprises a target preprocessing algorithm and a target machine learning model;
before the step of performing classification recognition through the target classification combination model according to the spectrum curve to obtain a target classification result, the method further comprises the following steps:
classifying the spectrum curves according to preset classification information to construct a training data set;
selecting the target preprocessing algorithm from a preprocessing algorithm library to preprocess the training data set to obtain a preprocessing data set; wherein the target preprocessing algorithm comprises at least one of denoising, baseline drift correction, data normalization processing and data whitening processing;
selecting a first machine learning model from a preset machine learning model library to train the first machine learning model through the preprocessing data set to obtain the target machine learning model; wherein the first machine learning model includes one of a random forest model, a K-nearest neighbor algorithm model, and a gradient lifting model.
6. The method according to claim 5, wherein the performing classification and identification by the target classification combination model according to the spectrum curve to obtain a target classification result comprises:
acquiring an evaluation index to determine the target preprocessing algorithm and the target machine learning model according to the evaluation index;
preprocessing the spectrum curve through the target preprocessing algorithm to obtain preprocessing curve data;
and classifying and identifying the preprocessing curve data through the target machine learning model to obtain the target classification result.
7. The method of any one of claims 1 to 6, wherein the acquiring a plurality of sets of preset spectral images includes:
acquiring a plurality of groups of preset spectrum images of an object to be identified in a second preset wave band through a preset near infrared spectrum imaging camera; wherein the preset spectral image comprises a near infrared spectral image.
8. An object detection classification system, comprising:
the first module is used for acquiring a plurality of groups of preset spectrum images; wherein each group of the preset spectrum images corresponds to different wavelengths;
The second module is used for carrying out target recognition on the preset wavelength image through a preset recognition algorithm to obtain target object information; the preset wavelength images comprise a plurality of groups of images with corresponding wavelengths in a first preset wave band in the preset spectrum images;
a third module, configured to generate a corresponding region of interest according to the target object information;
a fourth module, configured to calculate, according to the region of interest, a spectral value of each set of preset spectral images, so as to generate a spectral curve according to the spectral values;
and a fifth module, configured to perform classification and identification through a target classification combination model according to the spectrum curve, so as to obtain a target classification result.
9. An object detection classification system, comprising:
at least one processor;
at least one memory for storing at least one program;
when the at least one program is executed by the at least one processor, the at least one processor is caused to implement the object detection classification method according to any one of claims 1 to 7.
10. A computer storage medium in which a processor-executable program is stored, wherein the processor-executable program is for implementing the object detection classification method according to any one of claims 1 to 7 when executed by the processor.
CN202311769977.5A 2023-12-20 2023-12-20 Target detection classification method, system and storage medium Pending CN117893793A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311769977.5A CN117893793A (en) 2023-12-20 2023-12-20 Target detection classification method, system and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311769977.5A CN117893793A (en) 2023-12-20 2023-12-20 Target detection classification method, system and storage medium

Publications (1)

Publication Number Publication Date
CN117893793A true CN117893793A (en) 2024-04-16

Family

ID=90638813

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311769977.5A Pending CN117893793A (en) 2023-12-20 2023-12-20 Target detection classification method, system and storage medium

Country Status (1)

Country Link
CN (1) CN117893793A (en)

Similar Documents

Publication Publication Date Title
US11861889B2 (en) Analysis device
CN111630356B (en) Method for characterizing a sample using a neural network
US7555155B2 (en) Classifying image features
Kurtulmus et al. Green citrus detection using ‘eigenfruit’, color and circular Gabor texture features under natural outdoor conditions
US10013615B2 (en) Inspection methods and devices
Matteoli et al. Models and methods for automated background density estimation in hyperspectral anomaly detection
Bhargava et al. Machine learning based quality evaluation of mono-colored apples
Kumar et al. Deep remote sensing methods for methane detection in overhead hyperspectral imagery
KR102448123B1 (en) Method And Apparatus for Predicting Agricultural Freshness
Yoon et al. Hyperspectral image processing methods
Yadav et al. Citrus disease classification with convolution neural network generated features and machine learning classifiers on hyperspectral image data
CN111488851A (en) Traceability detection method, device, equipment and medium for fruit production place
Steffens et al. A texture driven approach for visible spectrum fire detection on mobile robots
CN117893793A (en) Target detection classification method, system and storage medium
CN110807387A (en) Object classification method and system based on hyperspectral image characteristics
Kunik et al. Raspberry Pi based complete embedded system for iris recognition
CN114913415A (en) Disease and pest detection system based on remote sensing monitoring
Du et al. Multidimensional local spatial autocorrelation measure for integrating spatial and spectral information in hyperspectral image band selection
Jinglei et al. Distance-based separability criterion of ROI in classification of farmland hyper-spectral images
Jia et al. Apple surface pesticide residue detection method based on hyperspectral imaging
CN114494152A (en) Unsupervised change detection method based on associated learning model
CN117274236B (en) Urine component abnormality detection method and system based on hyperspectral image
CN108491895A (en) A kind of Terahertz perspective imaging identifying system
Sigar Visible hyperspectral imaging for predicting intra-muscular fat content from sheep carcasses
DI RAIMONDO Hyperspectral imaging and machine learning for automatic food quality inspection

Legal Events

Date Code Title Description
PB01 Publication