Qualitative discrimination method and system of near infrared spectrum

By converting near-infrared spectral data into polar coordinate images and constructing a lightweight convolutional network, combined with hierarchical sampling and cosine similarity algorithms, the problem of high sample dependence of traditional methods is solved, and efficient and flexible spectral discrimination is achieved in textile material detection.

CN120877026BActive Publication Date: 2026-01-23EAST CHINA JIAOTONG UNIVERSITY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511367127.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-24
Publication Date
2026-01-23
Estimated Expiration
2045-09-24

AI Technical Summary

Technical Problem

In existing technologies, near-infrared spectroscopy analysis methods are too dependent on samples. Traditional methods require a large number of labeled samples for model training, making it difficult to quickly and effectively detect textile materials in industrial settings. Furthermore, they are not applicable to small sample datasets, have limited model generalization ability, and exhibit poor flexibility and adaptability.

Method used

Near-infrared spectral data is converted into polar coordinate images, and features are extracted through a lightweight convolutional network. A support set is constructed using hierarchical sampling and cosine similarity algorithms to achieve few-sample discrimination. By constructing the support set through image transformation and few-sample strategy, the modeling process is simplified, and the flexibility and adaptability of the model are improved.

Benefits of technology

It reduces sample collection and preparation costs, improves detection efficiency, enables accurate identification under conditions of few samples, and has high flexibility and adaptability, making it suitable for scenarios such as textile material testing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120877026B_ABST
    Figure CN120877026B_ABST
Patent Text Reader

Abstract

The application provides a near-infrared spectrum qualitative discrimination method and system, the method comprises the following steps: collecting a near-infrared spectrum data set, converting a one-dimensional spectrum sequence into a polar coordinate image; constructing a light-weight convolution network architecture and processing the polar coordinate image; dynamically extracting K samples of each class from the training set, constructing a support set based on the K samples and a few-shot strategy, and constructing a query support similarity matrix through a cosine similarity algorithm; discriminating the test set based on the query support similarity matrix, the support set and a preset threshold to obtain the highest similarity of the test set and the support set, and if the highest similarity exceeds the preset threshold, determining that the test set is the corresponding category. The application can reduce the cost and time of sample collection and preparation, effectively extract the feature information of the spectrum data, and has high flexibility in discrimination.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of spectral analysis, in particular to a near-infrared spectrum qualitative discrimination method and system. BACKGROUND

[0002] The near-infrared spectrum analysis technology has been widely used in the industrial detection field due to its advantages of rapidity, non-destructiveness, environmental protection, etc., and plays an important role in scenes such as textile material composition identification, active ingredient analysis of medicines and food safety detection. The current mainstream spectral analysis method mainly relies on traditional machine learning algorithms such as partial least squares discriminant analysis (PLS-DA), which has significant limitations: on the one hand, a large number of labeled samples are needed for model training, which is a challenge in industrial field applications where sample acquisition is difficult; on the other hand, the feature expression ability of spectral data is limited, making it difficult to fully exploit the complex patterns hidden in high-dimensional spectra.

[0003] In recent years, the few-shot method technology has shown good research prospects in the field of spectral analysis, and its core is to learn transferable feature representations through limited samples. However, in the field of textile materials, the structural characteristics of one-dimensional spectral data have not been effectively combined with the spatial expression ability of visual features. In recent years, image processing technology in the field of feature extraction has become increasingly mature, and by converting abstract data into two-dimensional images, the powerful spatial feature extraction ability of convolutional neural networks can be fully utilized, providing a new approach to improving spectral analysis efficiency. However, how to efficiently convert spectral data into discriminative visual representations and build a robust classification system suitable for few-shot scenarios remains a technical challenge in this field.

[0004] In summary, the existing technology has too high sample dependence. Traditional spectral classification methods (such as PLS-DA) require hundreds of labeled samples for model training, but industrial sites often only have limited samples, making it difficult to effectively build models. For example, in textile material detection, the sample acquisition period of new blended materials is as long as 2-3 months, which severely restricts the detection efficiency; the modeling process is complex and time-consuming, and traditional methods require tedious data preprocessing, feature extraction, model training and optimization steps, which not only takes a long time, but also requires high professional knowledge and experience of the operator; not suitable for few-shot data, as it relies on the learning of statistical features of a large number of samples, when encountering new unknown categories or only having a small number of samples for reference, traditional models often cannot accurately discriminate; the model generalization ability is limited, and once the source, preparation method or measurement condition of the sample changes significantly, the traditional model may need to be retrained to ensure accurate discrimination, which reduces the flexibility and adaptability of the method. SUMMARY

[0005] Based on this, the purpose of the present application is to provide a near-infrared spectrum qualitative discrimination method and system to solve the above-mentioned deficiencies in the prior art.

[0006] In a first aspect, the present application provides a near-infrared spectrum qualitative discrimination method, which comprises:

[0007] Collecting a near-infrared spectrum data set and converting one-dimensional spectrum sequences in the near-infrared spectrum data set into polar coordinate images based on Circle Mapping;

[0008] Constructing a lightweight convolutional network architecture to obtain a feature extraction network, and processing the polar coordinate images based on the feature extraction network;

[0009] Dividing the near-infrared spectrum data set into a training set and a test set using a hierarchical sampling strategy;

[0010] Dynamically extracting K samples of each class from the training set, constructing a support set based on the K samples and a few-shot strategy, and constructing a query support similarity matrix through a cosine similarity algorithm;

[0011] Discriminating the test set based on the query support similarity matrix, the support set, and a preset threshold to obtain the highest similarity of the test set to the support set, and if the highest similarity exceeds the preset threshold, determining that the test set is of the corresponding class.

[0012] Compared with the prior art, the present application has the following advantages: by converting one-dimensional spectrum sequences into polar coordinate images and constructing a support set based on K samples and a few-shot strategy, the need for complex modeling of a large number of samples in traditional methods is eliminated, and qualitative discrimination can be achieved with only a small number of samples, greatly reducing the cost and time of sample collection and preparation. Moreover, through image conversion, the characteristic information of the spectrum data can be effectively extracted, avoiding the defects of noise sensitivity and computational redundancy of image pixel contrast, and the spectrum characteristics can be more intuitively observed and analyzed. Furthermore, by discriminating through the support set, there is no need to perform a complex modeling process again, and only the support set needs to be updated to discriminate new categories, which has high flexibility.

[0013] Further, the step of converting one-dimensional spectrum sequences in the near-infrared spectrum data set into polar coordinate images based on Circle Mapping comprises:

[0014] Converting one-dimensional spectrum data in the near-infrared spectrum data set into a floating-point matrix, and dynamically normalizing each spectrum in the near-infrared spectrum data set;

[0015] Constructing a polar coordinate system with the center point of the pixel canvas as the origin on a preset pixel canvas, and controlling the maximum radiation radius of the polar coordinate system.

[0016] convert the spectrum point sequence of each of the processed spectrum into a geometric figure, and distribute the spectrum values at preset angles equidistantly on the polar coordinate system based on the wavelength sequence, wherein adjacent coordinate points on the polar coordinate system are connected by a dynamically enhanced gradient line, a viridis color system is used to realize mapping of the spectrum values to colors, the thickness of the gradient line is positively correlated with the data intensity, and a floating point matrix is embedded in the polar coordinate system to obtain a polar coordinate image.

[0017] Further, the light-weight convolutional network architecture is constructed to obtain a feature extraction network, and the step of processing the polar coordinate image based on the feature extraction network comprises:

[0018] the light-weight convolutional network architecture is constructed based on a three-level convolutional pooling layer, and the light-weight convolutional network architecture is used as the feature extraction network;

[0019] the first layer of the feature extraction network uses 32 3*3 convolutional kernels to extract primary spatial features of the polar coordinate image, and the dimension is compressed through 2*2 maximum pooling;

[0020] the second layer of the feature extraction network is expanded to 64 channels to perform deep channel feature extraction on the polar coordinate image;

[0021] the third layer of the feature extraction network captures high-level abstract features of the polar coordinate image through 128-channel convolution, and outputs a 128-dimensional feature vector after unfolding through a Flatten layer.

[0022] Further, the step of dynamically extracting K samples of each class from the training set, constructing a support set based on the K samples and a few-shot strategy, and constructing a query support similarity matrix through a cosine similarity algorithm comprises:

[0023] K samples of each class are dynamically extracted from the training set through a random sampling strategy, and a support set is constructed based on the K samples and a few-shot strategy;

[0024] the test set is converted into a query feature vector, and a query support similarity matrix is constructed through a cosine similarity algorithm.

[0025] Further, after the step of obtaining the highest similarity between the test set and the support set, the method further comprises:

[0026] if the highest similarity does not exceed the preset threshold, the test set is marked as an unknown class.

[0027] In a second aspect, the present application also provides a near-infrared spectrum qualitative discrimination system, which comprises:

[0028] The acquisition conversion module is configured to acquire a near-infrared spectrum dataset, and convert a one-dimensional spectrum sequence in the near-infrared spectrum dataset into a polar coordinate image based on Circle Mapping;

[0029] The construction processing module is configured to construct a lightweight convolutional network architecture to obtain a feature extraction network, and process the polar coordinate image based on the feature extraction network;

[0030] The division module is configured to divide the near-infrared spectrum dataset into a training set and a test set by using a hierarchical sampling strategy;

[0031] The extraction construction module is configured to dynamically extract K samples of each class from the training set, construct a support set based on the K samples and a few-shot strategy, and construct a query support similarity matrix by using a cosine similarity algorithm;

[0032] The discrimination module is configured to discriminate the test set based on the query support similarity matrix, the support set, and a preset threshold, to obtain the highest similarity between the test set and the support set, and determine that the test set belongs to the corresponding class if the highest similarity exceeds the preset threshold.

[0033] Further, the acquisition conversion module comprises:

[0034] The first conversion unit is configured to convert one-dimensional spectrum data in the near-infrared spectrum dataset into a floating-point matrix, and perform dynamic normalization processing on each spectrum in the near-infrared spectrum dataset;

[0035] The first construction unit is configured to construct a polar coordinate system on a preset pixel canvas, with the center point of the pixel canvas as the origin, and control the maximum radiation radius of the polar coordinate system;

[0036] The second conversion unit is configured to convert the spectrum point sequence of each processed spectrum into a geometric figure, and distribute the spectrum values on the polar coordinate system at a preset angle according to the wavelength sequence, wherein adjacent coordinate points on the polar coordinate system are connected by dynamically enhanced gradient lines, the viridis color system is used to realize the mapping of spectrum values to colors, the thickness of the gradient lines is positively correlated with the data intensity, and the floating-point matrix is embedded in the polar coordinate system to obtain a polar coordinate image.

[0037] Further, the construction processing module comprises:

[0038] The second construction unit is configured to construct a lightweight convolutional network architecture based on a three-level convolutional pooling layer, and use the lightweight convolutional network architecture as a feature extraction network;

[0039] The first extraction unit is configured to use 32 3*3 convolution kernels to extract primary spatial features of the polar coordinate image for a first layer of the feature extraction network, and compress dimensions through 2*2 maximum pooling;

[0040] The second extraction unit is configured to expand to 64 channels to perform deep channel feature extraction on the polar coordinate image for a second layer of the feature extraction network.

[0041] The capture unit is configured to capture high-level abstract features of the polar coordinate image through 128-channel convolution for a third layer of the feature extraction network, and output a 128-dimensional feature vector after expansion through a Flatten layer.

[0042] In a third aspect, the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the near-infrared spectrum qualitative discrimination method when executing the computer program.

[0043] In a fourth aspect, the present application further provides a storage medium having a computer program stored thereon, wherein the program is executed by a processor to implement the near-infrared spectrum qualitative discrimination method. BRIEF DESCRIPTION OF DRAWINGS

[0044] Figure 1 A flowchart of the near-infrared spectrum qualitative discrimination method in the first embodiment of the present application;

[0045] Figure 2 A spectrum conversion diagram in the first embodiment of the present application;

[0046] Figure 3 A model training result comparison diagram in the first embodiment of the present application;

[0047] Figure 4 A structural block diagram of the near-infrared spectrum qualitative discrimination system in the second embodiment of the present application;

[0048] Figure 5 A structural schematic diagram of the electronic device in the third embodiment of the present application.

[0049] Explanation of main element symbols:

[0050] 10, acquisition and conversion module; 20, construction processing module; 30, division module; 40, extraction and construction module; 50, discrimination module;

[0051] 60, bus; 61, processor; 62, memory; 63, communication interface.

[0052] The following specific embodiments will further illustrate the present application in conjunction with the above-mentioned drawings. DETAILED DESCRIPTION

[0053] For the purpose of promoting an understanding of the principles of the application, reference will now be made to the embodiments illustrated in the drawings. There is shown in the drawings several embodiments of the application. It is expressly understood that the application can be practiced otherwise than as set forth in the accompanying

[0054] It is to be understood that the hereinafter use of terms such as "above", "below", "upper", "lower", and "lateral" are made by reference to the accompanying drawings.

[0055] Unless otherwise defined, 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 in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this description, the singular forms "a", "an" and "the" include plural references

[0056] Embodiment one

[0057] Referring to Fig. 1, there is shown a near-infrared spectrum qualitative discrimination method according to a first embodiment of the present application, which comprises steps S1 to S5: Figure 1

[0058] S1, collecting a near-infrared spectrum data set, and converting one-dimensional spectrum sequences in the near-infrared spectrum data set into polar coordinate images based on Circle Mapping;

[0059] Specifically, the step S1 comprises steps S11 to S13:

[0060] S11, converting one-dimensional spectrum data in the near-infrared spectrum data set into a floating point matrix, and performing dynamic normalization processing on each spectrum in the near-infrared spectrum data set;

[0061] It can be understood that the one-dimensional spectrum data is converted into a floating point matrix, and an equal-interval wavelength sequence is generated based on the spectrum band number in the range of 900-1700 nm. The label data is converted into a category index through numerical coding, and the spectrum data is standardized to eliminate dimensional differences;

[0062] S12, constructing a polar coordinate system with the center point of a preset pixel canvas as the origin, and controlling the maximum radiation radius of the polar coordinate system; ​

[0063] S13, converting the spectrum point sequence of each processed spectrum into a geometric figure, and distributing the spectrum values at a preset angle equidistantly on the polar coordinate system based on the wavelength sequence, wherein adjacent coordinate points on the polar coordinate system are connected by a dynamically enhanced gradient line, a viridis color system is used to realize mapping of the spectrum values to colors, the thickness of the gradient line is positively correlated with the data intensity, and a floating point matrix is embedded in the polar coordinate system to obtain a polar coordinate image;

[0064] It can be understood that the original data is linearly mapped to the interval [0, 1] by dynamic normalization processing of each spectrum to eliminate amplitude differences. On a preset 256x256 pixel canvas, the system constructs a polar coordinate system with the center point as the origin, and controls the maximum radiation radius to ensure that the waveform is completely presented in a limited space. In the conversion process, the algorithm converts the spectrum point sequence into a geometric figure: based on the wavelength sequence, the spectrum values are distributed at an angle equidistantly on the circumference, and the radial length is strictly proportional to the normalized value; adjacent coordinate points are connected by a dynamically enhanced gradient line, a viridis color system is used to realize mapping of the spectrum values to colors, and the thickness of the line is positively correlated with the data intensity, which visually strengthens the feature difference. Finally, a green anchor point is embedded at the center position as a spatial reference to form a circular atlas with numerical accuracy and visual recognition. Figure 2 As shown, abstract spectrum data is converted into an image representation with spatial structure.

[0065] S2, constructing a lightweight convolutional network architecture to obtain a feature extraction network, and processing the polar coordinate image based on the feature extraction network;

[0066] Specifically, the step S2 includes steps S21 to S24:

[0067] S21, constructing a lightweight convolutional network architecture based on a three-level convolutional pooling layer, and taking the lightweight convolutional network architecture as a feature extraction network;

[0068] S22, the first layer of the feature extraction network uses 32 3x3 convolutional kernels to extract primary spatial features of the polar coordinate image, and compresses the dimension by 2x2 maximum pooling;

[0069] S23, the second layer of the feature extraction network is expanded to 64 channels to perform deep channel feature extraction on the polar coordinate image;

[0070] S24, the third layer of the feature extraction network captures high-level abstract features of the polar coordinate image through 128 channel convolution, and outputs a 128-dimensional feature vector after unfolding via a Flatten layer;

[0071] It can be understood that the feature extraction network adopts a lightweight convolutional architecture to process the converted image, including a three-level convolution-pooling layer structure: the first layer uses 32 3x3 convolution kernels to extract primary spatial features, and the dimension is compressed by 2x2 maximum pooling; the second layer expands to 64 channels to deepen feature extraction; the third layer captures high-level abstract features through 128 channel convolution. Finally, a 128-dimensional feature vector is output after the Flatten layer is expanded, forming a discriminative embedded representation. This design effectively controls the parameter amount while ensuring the expressive power of the features, laying the foundation for efficient learning in the few-shot scenario.

[0072] It is worth noting that the lightweight convolutional network architecture structure is shown in Table 1:

[0073] Table 1

[0074]

[0075] S3, adopting a hierarchical sampling strategy to divide the near-infrared spectrum data set into a training set and a test set;

[0076] It can be understood that the data set is divided into a training set and a test set by adopting a hierarchical sampling strategy, and the category distribution consistency is maintained. The whole process implements strict dimension verification and abnormal isolation to ensure the output of standardized spectrum matrix, encoded label and wavelength sequence, and lays a data foundation for subsequent analysis.

[0077] S4, dynamically extracting K samples of each class from the training set, constructing a support set based on the K samples and a few-shot strategy, and constructing a query support similarity matrix through a cosine similarity algorithm;

[0078] Specifically, the step S4 includes steps S41 to S42:

[0079] S41, dynamically extracting K samples of each class from the training set through a random sampling strategy, and constructing a support set based on the K samples and a few-shot strategy;

[0080] S42, converting the test set into a query feature vector, and constructing a query support similarity matrix through a cosine similarity algorithm;

[0081] It can be understood that K samples of each class are dynamically extracted from the training set to form a support set, and the category representation diversity is ensured by a random sampling strategy. These samples are input into a convolution feature extractor, which includes a cascade of convolution-pooling layers with 32 / 64 / 128 channels, and finally compresses the 256x256 pixel circular map into a 128-dimensional feature vector, which realizes efficient dimension reduction while preserving spatial features. Here, a feature vector is used instead of the original image for similarity calculation, because the original converted image contains a large number of redundant background pixels, and direct comparison will introduce noise interference. The 128-dimensional feature vector is an efficient distillation representation of the data, which can preserve discriminative patterns and compress irrelevant details, and realizes lightweight modeling. After the feature space mapping is completed, the system performs double-layer similarity calculation: first, the test set circular map is converted into a query feature vector, and then a query support similarity matrix is constructed by using the cosine similarity algorithm.

[0082] It is worth noting that the 128-dimensional feature vector extracted by the convolutional network is an abstract representation of the high-order semantics of the spectral image (such as texture and shape patterns), which can effectively filter out instrument noise and brightness fluctuation interference. At the same time, the similarity calculation of the feature vector on the 256x256 image can greatly compress the computational complexity compared to the full image pixel-level comparison, meeting the real-time requirements of industry. More importantly, in the embedding space, the features of the same class samples are close in distance, and the features of different class samples are far apart. Even if there are only 3-5 non-aligned samples in each class, a robust metric relationship can still be established. Direct picture comparison is prone to misjudgment due to small deformations or brightness differences when the sample is scarce.

[0083] S5, based on the query support similarity matrix, the support set and a preset threshold, discriminating the test set to obtain the highest similarity of the test set and the support set, if the highest similarity exceeds the preset threshold, determining that the test set is of the corresponding category;

[0084] In addition, the step S5 further includes a step S51:

[0085] S51, if the highest similarity does not exceed the preset threshold, marking the test set as an unknown category;

[0086] It can be understood that the prediction mechanism introduces a threshold decision innovation: for each test sample, the highest similarity value of the support set is selected, and if it exceeds the preset threshold (0.81), it is determined as the corresponding category, otherwise it is marked as the "unknown" category, realizing the open set recognition ability urgently needed in industrial scenes. The performance evaluation focuses on the accuracy rate of known category samples, which is usually significantly higher than the traditional PLS-DA benchmark, and the similarity distribution histogram reveals the model decision boundary through the visualization interface. The entire process is saved in TensorFlow format to support incremental learning of the feature extractor, and through an abnormal isolation mechanism to ensure the integrity of the system when the support set construction fails, forming a hybrid architecture that combines metric learning and threshold decision, achieving superior classification performance and unknown sample detection capability under limited sample conditions.

[0087] The specific process of the traditional classification method (PLS-DA) is as follows: after the data preprocessing is completed, the system immediately starts the training process of the partial least squares discriminant analysis (PLS-DA) classifier. First, initialize a PLS-DA model, and set the key parameter to 5 principal components. This value is optimized to effectively capture the discriminant features of spectral data while avoiding overfitting. The model uses one-hot encoded training labels as a supervision signal and trains them jointly with the normalized spectral training data. During training, PLS-DA maximizes the covariance between spectral data and class labels to construct latent variable space and find the optimal projection direction to effectively separate samples of different categories; after the model training converges, the system applies it to the test set for prediction. The prediction result is output in the form of a probability matrix, each sample corresponds to the membership score of all categories, and the system uses the argmax function to select the category corresponding to the highest score as the final prediction result. To evaluate model performance, the system calculates the accuracy of the prediction result and the true label, which directly reflects the model's discriminant ability on unknown samples. Finally, the trained PLS-DA model and the accompanying data standardizer are serialized and saved to the specified directory, forming a deployable analysis module that provides a benchmark discriminant ability for subsequent comparative experiments; the entire training process uses strict random seed control to ensure experimental reproducibility, and records key performance indicators through real-time logs, allowing analysts to accurately track the discriminant efficiency of the model in the spectral feature space.

[0088] The comparison table of PLS-D and few-shot recognition results is shown in Table 2:

[0089] Table 2

[0090]

[0091] By combining the image conversion with the few-shot method, the sample quantity requirement is effectively reduced, the modeling process is simplified, and the applicability and adaptability and flexibility of the model to few-shot data are improved. Therefore, the method has a significant advantage in the scene of textile near-infrared spectrum qualitative discrimination with limited sample quantity, high modeling efficiency and accuracy requirements, and can be applied to other fields of near-infrared spectrum qualitative discrimination.

[0092] It is worth noting that after extracting the features of the to-be-tested sample, the system calculates the cosine similarity of the to-be-tested sample with each sample in the support set. When the maximum similarity exceeds the preset threshold 0.81, it is determined as the corresponding category, otherwise it is marked as an "unknown" category. This dual-mode decision mechanism not only guarantees accurate discrimination of known categories, but also has open set recognition capability, effectively solving the key problem of identifying new materials in industrial sites. Figure 3 As shown in the model training result, the discrimination framework is significantly better than the traditional method under the condition of few samples.

[0093] In summary, the near-infrared spectrum qualitative discrimination method in the above embodiments of the present application, through image conversion and few-shot method, gets rid of the need for complex modeling of a large number of samples in traditional methods, and only a small number of samples (such as 3-5 per category) are needed to realize qualitative discrimination, greatly reducing the cost and time of sample collection and preparation; the image conversion method can effectively extract the feature information of the spectral data and convert it into an image form that is easy to process. On this basis, the few-shot method can extract the feature vector of the picture through the convolution network and measure the similarity, avoiding the defects of noise sensitivity and redundant calculation of using original image pixel comparison. And the metric relationship constructed in the embedding space can improve the generalization ability and classification robustness in the scene of few samples; it has stronger adaptability to the changes of sample source, preparation method and measurement condition. When encountering new unknown categories or sample characteristics change, it does not need to re-perform complex modeling process, only needs to update the support set to realize the discrimination of new categories, has high flexibility; after converting the spectral data into images, the spectral features can be observed and analyzed more intuitively, which is convenient for professionals to explain and understand the discrimination results, and also provides convenience for further analysis and research.

[0094] Embodiment two

[0095] The second embodiment of the present application also provides a near-infrared spectrum qualitative discrimination system, please refer to Figure 4 , which is a near-infrared spectrum qualitative discrimination system in the second embodiment of the present application, the system comprises:

[0096] The acquisition and conversion module 10 is used for acquiring a near-infrared spectrum data set, and converting one-dimensional spectrum sequences in the near-infrared spectrum data set into polar coordinate images based on Circle Mapping;

[0097] The construction processing module 20 is configured to construct a lightweight convolutional network architecture to obtain a feature extraction network, and process the polar coordinate image based on the feature extraction network;

[0098] The division module 30 is configured to divide the near-infrared spectrum data set into a training set and a test set by using a hierarchical sampling strategy.

[0099] The extraction construction module 40 is configured to dynamically extract K samples of each class from the training set, construct a support set based on the K samples and a few-shot strategy, and construct a query support similarity matrix by using a cosine similarity algorithm.

[0100] The discrimination module 50 is configured to discriminate the test set based on the query support similarity matrix, the support set, and a preset threshold, to obtain the highest similarity between the test set and the support set, and determine that the test set belongs to the corresponding class if the highest similarity exceeds the preset threshold.

[0101] In some optional embodiments, the collection conversion module 10 comprises:

[0102] The first conversion unit is configured to convert one-dimensional spectrum data in the near-infrared spectrum data set into a floating-point matrix, and perform dynamic normalization processing on each spectrum in the near-infrared spectrum data set.

[0103] The first construction unit is configured to construct a polar coordinate system on a preset pixel canvas, with the center point of the pixel canvas as the origin, and control the maximum radiation radius of the polar coordinate system.

[0104] The second conversion unit is configured to convert the spectrum point sequence of each processed spectrum into a geometric graph, and distribute the spectrum values on the polar coordinate system at a preset angle according to the wavelength sequence, wherein adjacent coordinate points on the polar coordinate system are connected by dynamically enhanced gradient lines, the viridis color system is used to realize the mapping of spectrum values to colors, the thickness of the gradient lines is positively correlated with the data intensity, and the floating-point matrix is embedded in the polar coordinate system to obtain a polar coordinate image.

[0105] In some optional embodiments, the construction processing module 20 comprises:

[0106] The second construction unit is configured to construct a lightweight convolutional network architecture based on a three-level convolutional pooling layer, and use the lightweight convolutional network architecture as a feature extraction network.

[0107] The first extraction unit is configured to use 32 3x3 convolutional kernels to extract primary spatial features of the polar coordinate image in the first layer of the feature extraction network, and compress the dimension by 2x2 maximum pooling.

[0108] The second extraction unit is configured to perform deep channel feature extraction on the polar coordinate image by expanding the second layer of the feature extraction network to 64 channels.

[0109] The capture unit is configured to capture high-level abstract features of the polar coordinate image by 128-channel convolution in the third layer of the feature extraction network, and output a 128-dimensional feature vector after unfolding via a Flatten layer.

[0110] In some optional embodiments, the extraction construction module 40 comprises:

[0111] The extraction unit is configured to dynamically extract K samples of each class from the training set by a random sampling strategy, and construct a support set based on the K samples and a few-shot strategy.

[0112] The third conversion unit is configured to convert the test set into a query feature vector, and construct a query support similarity matrix by a cosine similarity algorithm.

[0113] In some optional embodiments, the discrimination module 50 comprises:

[0114] The marking unit is configured to mark the test set as an unknown class if the highest similarity does not exceed the preset threshold.

[0115] The functions or operation steps realized when each of the above modules and units is executed are substantially the same as those of the above method embodiments, and thus will not be described herein.

[0116] The near-infrared spectrum qualitative discrimination system provided in the embodiments of the present application has the same implementation principle and technical effects as the above method embodiments. For brevity, the part of the system embodiments not mentioned can be referred to the corresponding contents in the above method embodiments.

[0117] Embodiment three

[0118] In the third embodiment of the present application, an electronic device is also provided. Please refer to FIG. 6, which shows the electronic device in the third embodiment of the present application. Figure 5

[0119] The electronic device can include a processor 61 and a memory 62 storing computer program instructions.

[0120] Specifically, the processor 61 can include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the present application.

[0121] ​The memory 62 can include a mass storage for data or instructions. By way of example, and without limitation, the memory 62 can include a Hard Disk Drive (HDD), a floppy disk drive, a Solid State Drive (SSD), a flash drive, a Compact Disc Read Only Memory (CD-ROM), a Digital Versatile Disk (DVD), a Blu-Ray, a magneto-optical disk, a magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. The memory 62 can be removable and / or non-removable (or fixed) as appropriate. The memory 62 can be internal or external as appropriate. In certain embodiments, the memory 62 is a Non-Volatile Memory. In certain embodiments, the memory 62 includes a Read-Only Memory (ROM) and a Random-Access Memory (RAM). The ROM can be a mask-programmed ROM, a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), an Electrically Alterable ROM (EAROM), or a FLASH memory, or a combination of two or more of these, as appropriate. The RAM can be a Static Random-Access Memory (SRAM) or a Dynamic Random-Access Memory (DRAM), which can be a Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), an Extended Data Output Dynamic Random-Access Memory (EDODRAM), a Synchronous Dynamic Random-Access Memory (SDRAM), or the like, as appropriate.

[0122] The memory 62 can be used to store or buffer various data files required for processing and / or communication, and possible computer program instructions executed by the processor 61.

[0123] The processor 61 realizes the near-infrared spectrum qualitative discrimination method of the above-mentioned embodiment one by reading and executing the computer program instructions stored in the memory 62.

[0124] In some embodiments, the electronic device can further include a communication interface 63 and a bus 60. As shown, the processor 61, the memory 62, and the communication interface 63 are connected through the bus 60 and complete communication with each other. Figure 3

[0125] The communication interface 63 is used to realize the communication between the modules, devices, units and / or equipment in the present application. The communication interface 63 can also realize data communication with other components, such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations, etc.

[0126] ​Bus 60 includes hardware, software, or both, to couple components of the device to each other and to couple components of the device to other devices. What is considered a component of the device can vary depending on the particular view of the device that is considered. By way of example, a bus 60 can be a Data Bus, an Address Bus, a Control Bus, an Expansion Bus, a Local Bus, or a combination of one or more of these buses. By way of example and not limitation, bus 60 can include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or another suitable bus or combination of two or more of these buses. Where appropriate, bus 60 can include one or more buses. Although the application is described and shown with respect to particular buses, the application contemplates any suitable bus or interconnect.

[0127] The electronic device can acquire the near-infrared spectrum qualitative discrimination system and execute the near-infrared spectrum qualitative discrimination method of the first embodiment.

[0128] In addition, in combination with the near-infrared spectrum qualitative discrimination method in the above-mentioned first embodiment, the application can provide a storage medium to realize. The storage medium has computer program instructions stored thereon; the computer program instructions are executed by the processor to realize the near-infrared spectrum qualitative discrimination method of the above-mentioned first embodiment.

[0129] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.

[0130] The above-described embodiments only express several implementation manners of the present application, which are described in a more specific and detailed manner, but cannot be understood as a limitation on the patent scope of the present application. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, which are all within the protection scope of the present application. Therefore, the protection scope of the patent of the present application should be subject to the appended claims.

Claims

1. A near-infrared spectral qualitative discrimination method, characterized in that, The method includes: Acquire a near-infrared spectral dataset and convert the one-dimensional spectral sequence in the near-infrared spectral dataset into a polar coordinate image based on Circle Mapping. This step specifically includes: The one-dimensional spectral data in the near-infrared spectral dataset is converted into a floating-point matrix, and each spectrum in the near-infrared spectral dataset is dynamically normalized. On a preset pixel canvas, a polar coordinate system is constructed with the center point of the pixel canvas as the origin, and the maximum radiation radius of the polar coordinate system is controlled. The spectral point sequence of each processed spectrum is converted into a geometric shape, and the spectral values ​​are distributed at preset angles on the polar coordinate system based on the wavelength sequence. Adjacent coordinate points on the polar coordinate system are connected by dynamically enhanced gradient lines. The Viridis color system is used to map spectral values ​​to colors, and the thickness of the gradient lines is positively correlated with the data intensity. A floating-point matrix is ​​embedded in the polar coordinate system to obtain a polar coordinate image. A lightweight convolutional network architecture is constructed to obtain a feature extraction network, and the polar coordinate image is processed based on the feature extraction network; The near-infrared spectroscopy dataset is divided into a training set and a test set using a stratified sampling strategy. K samples of each class are dynamically extracted from the training set. A support set is constructed based on the K samples and the few-sample strategy. A query support similarity matrix is ​​constructed using the cosine similarity algorithm. The test set is judged based on the query support similarity matrix, the support set, and a preset threshold to obtain the highest similarity between the test set and the support set. If the highest similarity exceeds the preset threshold, the test set is determined to be the corresponding category.

2. The near-infrared spectral qualitative discrimination method according to claim 1, characterized in that, The step of constructing a lightweight convolutional network architecture to obtain a feature extraction network, and processing the polar coordinate image based on the feature extraction network, includes: A lightweight convolutional network architecture is constructed based on a three-level convolutional pooling layer, and this lightweight convolutional network architecture has been used as a feature extraction network. The first layer of the feature extraction network uses 32 3×3 convolutional kernels to extract the primary spatial features of the polar coordinate image, and then compresses the dimensions using 2×2 max pooling. The second layer of the feature extraction network is extended to 64 channels to perform in-depth channel feature extraction on the polar coordinate image; The third layer of the feature extraction network captures high-level abstract features of the polar coordinate image through 128-channel convolution, and outputs a 128-dimensional feature vector after being unfolded by the Flatten layer.

3. The near-infrared spectral qualitative discrimination method according to claim 1, characterized in that, The steps of dynamically extracting K samples from each class from the training set, constructing a support set based on the K samples and a few-sample strategy, and constructing a query support similarity matrix using the cosine similarity algorithm include: K samples of each class are dynamically extracted from the training set using a random sampling strategy, and a support set is constructed based on the K samples and a few-sample strategy. The test set is converted into a query feature vector, and a query support similarity matrix is ​​constructed using the cosine similarity algorithm.

4. The near-infrared spectral qualitative discrimination method according to claim 1, characterized in that, After the step of obtaining the highest similarity between the test set and the support set, the method further includes: If the highest similarity does not exceed the preset threshold, the test set is marked as an unknown category.

5. A near-infrared spectral qualitative discrimination system, characterized in that, The system includes: The acquisition and conversion module is used to acquire near-infrared spectral datasets and convert the one-dimensional spectral sequences in the near-infrared spectral datasets into polar coordinate images based on Circle Mapping. The acquisition and conversion module includes: The first conversion unit is used to convert the one-dimensional spectral data in the near-infrared spectral dataset into a floating-point matrix, and to perform dynamic normalization processing on each spectrum in the near-infrared spectral dataset. The first construction unit is used to construct a polar coordinate system on a preset pixel canvas with the center point of the pixel canvas as the origin, and to control the maximum radiation radius of the polar coordinate system. The second conversion unit is used to convert the spectral point sequence of each processed spectrum into a geometric figure, and distribute the spectral values ​​at a preset angle on the polar coordinate system based on the wavelength sequence. Adjacent coordinate points on the polar coordinate system are connected by dynamically enhanced gradient lines. The Viridis color system is used to realize the mapping from spectral values ​​to colors, and the thickness of the gradient lines is positively correlated with the data intensity. A floating-point matrix is ​​embedded in the polar coordinate system to obtain a polar coordinate image. A processing module is constructed to build a lightweight convolutional network architecture to obtain a feature extraction network, and the polar coordinate image is processed based on the feature extraction network. A partitioning module is used to divide the near-infrared spectral dataset into a training set and a test set using a stratified sampling strategy. An extraction and construction module is used to dynamically extract K samples of each class from the training set, construct a support set based on the K samples and a few-sample strategy, and construct a query support similarity matrix through a cosine similarity algorithm. The discrimination module is used to discriminate the test set based on the query support similarity matrix, the support set, and a preset threshold to obtain the highest similarity between the test set and the support set. If the highest similarity exceeds the preset threshold, the test set is determined to be the corresponding category.

6. The near-infrared spectral qualitative discrimination system according to claim 5, characterized in that, The construction processing module includes: The second construction unit is used to construct a lightweight convolutional network architecture based on a three-level convolutional pooling layer, and the lightweight convolutional network architecture has been used as a feature extraction network. The first extraction unit is used in the first layer of the feature extraction network to extract the primary spatial features of the polar coordinate image using 32 3×3 convolutional kernels, and then compresses the dimensions using 2×2 max pooling. The second extraction unit is used to extend the second layer of the feature extraction network to 64 channels to perform in-depth channel feature extraction on the polar coordinate image. The capture unit, used as the third layer of the feature extraction network, captures high-level abstract features of the polar coordinate image through 128-channel convolution and outputs a 128-dimensional feature vector after being unfolded by the Flatten layer.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the near-infrared spectral qualitative discrimination method as described in any one of claims 1 to 4.

8. A storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the near-infrared spectral qualitative discrimination method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • One-dimensional spectrum classification method and system

    CN113313059A

  • Surface water classification method based on water sample total absorption spectrum data

    CN118861851A