Near infrared spectrum qualitative discrimination method and system
By converting near-infrared spectral data into polar coordinate images and utilizing lightweight convolutional networks and cosine similarity algorithms, efficient detection of textile materials under limited sample conditions is achieved. This solves the problems of high sample dependence and poor flexibility in traditional methods, and improves detection efficiency and accuracy.
Patent Information
- Application Number
- CN202511367127.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-24
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2045-09-24
AI Technical Summary
In existing technologies, near-infrared spectroscopy analysis methods rely on a large number of labeled samples for model training, which makes it difficult to quickly and effectively detect textile materials in industrial settings. Furthermore, they are not applicable to small sample data, have limited model generalization ability, and exhibit poor flexibility and adaptability.
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 discrimination with fewer samples, simplifying the modeling process and improving flexibility.
It reduces sample collection and preparation costs, improves detection efficiency and accuracy, has the ability to flexibly distinguish new categories, and adapts to the rapid detection needs of industrial sites.
Smart Images

Figure CN120877026A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spectral analysis technology, and in particular to a near-infrared spectral qualitative discrimination method and system. Background Technology
[0002] Near-infrared spectroscopy, with its advantages of speed, non-destructive nature, and environmental friendliness, has been widely used in industrial testing, playing a crucial role in areas such as textile material composition identification, pharmaceutical active ingredient analysis, and food safety testing. Current mainstream spectral analysis methods primarily rely on traditional machine learning algorithms, such as partial least squares discriminant analysis (PLS-DA). While these methods are structurally simple, they have significant limitations: firstly, they require a large number of labeled samples for model training, posing a challenge in industrial applications where sample acquisition is difficult; secondly, they have limited ability to express the features of spectral data, making it difficult to fully uncover the complex patterns hidden in high-dimensional spectra.
[0003] In recent years, few-shot methods have shown promising research prospects in the field of spectral analysis, with their core being the learning of transferable feature representations through a limited number of samples. However, in the field of textile materials, the structural characteristics of one-dimensional spectral data limit their ability to effectively combine the spatial representation capabilities of visual features. Nevertheless, image processing techniques in feature extraction have become increasingly mature in recent years. By converting abstract data into two-dimensional images, the powerful spatial feature extraction capabilities of convolutional neural networks can be fully utilized, providing a new approach to improving the efficiency of spectral analysis. Nevertheless, how to efficiently transform spectral data into discriminative visual representations and, based on this, construct a robust classification system adapted to few-shot scenarios remains a pressing technical challenge in this field.
[0004] In summary, existing technologies suffer from several drawbacks. First, they are overly dependent on sample data. Traditional spectral classification methods (such as PLS-DA) require hundreds of labeled samples for model training, while industrial sites often only have a limited number of samples available, hindering effective model construction. For instance, in textile material testing, the sample acquisition period for new blended materials can be as long as 2-3 months, severely limiting testing efficiency. Second, the modeling process is complex and time-consuming. Traditional methods require tedious data preprocessing, feature extraction, model training, and optimization steps, which are not only time-consuming but also demand a high level of professional knowledge and experience from operators. Third, they are unsuitable for small sample datasets because they rely on learning the statistical characteristics of a large number of samples. When encountering new, unknown categories or when only a few samples are available for reference, traditional models often fail to make accurate distinctions. Fourth, their generalization ability is limited. If the source, preparation method, or measurement conditions of the samples change significantly, traditional models may need to be retrained to ensure accuracy, reducing the flexibility and adaptability of the method. Summary of the Invention
[0005] Therefore, the purpose of this invention is to provide a near-infrared spectral qualitative discrimination method and system to overcome the shortcomings of the prior art.
[0006] In a first aspect, the present invention provides a near-infrared spectral qualitative discrimination method, the method comprising: A near-infrared spectral dataset was collected, and the one-dimensional spectral sequence in the near-infrared spectral dataset was converted into a polar coordinate image based on Circle Mapping; 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.
[0007] Compared with existing technologies, the beneficial effects of this invention are as follows: by converting a one-dimensional spectral sequence into a polar coordinate image and constructing a support set using K samples and a few-sample strategy, it eliminates the need for complex modeling of a large number of samples required by traditional methods. Qualitative discrimination can be achieved with only a small number of samples, greatly reducing the cost and time of sample collection and preparation. Furthermore, by converting the image, the feature information of the spectral data can be effectively extracted, avoiding the defects of image pixel contrast being sensitive to noise and computational redundancy. It also allows for more intuitive observation and analysis of spectral features. Moreover, by using the support set for discrimination, there is no need to carry out a complex modeling process again. Only the support set needs to be updated to discriminate new categories, which has high flexibility.
[0008] Furthermore, the step of converting the one-dimensional spectral sequence in the near-infrared spectral dataset into a polar coordinate image based on Circle Mapping 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.
[0009] Furthermore, 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.
[0010] Furthermore, the step 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 a cosine similarity algorithm includes: 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.
[0011] Furthermore, 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.
[0012] Secondly, the present invention also provides a near-infrared spectral qualitative discrimination system, the system comprising: 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. 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.
[0013] Furthermore, 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.
[0014] Furthermore, 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.
[0015] Thirdly, the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the above-described near-infrared spectral qualitative discrimination method.
[0016] Fourthly, the present invention also provides a storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described near-infrared spectral qualitative discrimination method. Attached Figure Description
[0017] Figure 1 This is a flowchart of the near-infrared spectroscopy qualitative discrimination method in the first embodiment of the present invention; Figure 2 This is a spectral conversion diagram from the first embodiment of the present invention; Figure 3 This is a comparison chart of the model training results in the first embodiment of the present invention; Figure 4 This is a structural block diagram of the near-infrared spectroscopy qualitative discrimination system in the second embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of the electronic device in the third embodiment of the present invention.
[0018] Explanation of key component symbols: 10. Acquisition and Conversion Module; 20. Construction and Processing Module; 30. Segmentation Module; 40. Extraction and Construction Module; 50. Discrimination Module; 60. Bus; 61. Processor; 62. Memory; 63. Communication interface.
[0019] The following detailed description, in conjunction with the accompanying drawings, will further illustrate the present invention. Detailed Implementation
[0020] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Several embodiments of the invention are illustrated in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
[0021] It should be noted that when a component is said to be "fixed to" another component, it can be directly on the other component or there may be an intervening component. When a component is said to be "connected to" another component, it can be directly connected to the other component or there may be an intervening component. The terms "vertical," "horizontal," "left," "right," and similar expressions used in this document are for illustrative purposes only.
[0022] 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 invention pertains. The terminology used herein in the description of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. The term "and / or" as used herein includes any and all combinations of one or more of the associated listed items.
[0023] Example 1 Please see Figure 1 The figure shows a near-infrared spectral qualitative discrimination method in the first embodiment of the present invention, the method comprising steps S1 to S5: S1, acquire 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; Specifically, step S1 includes steps S11 to S13: S11, convert the one-dimensional spectral data in the near-infrared spectral dataset into a floating-point matrix, and perform dynamic normalization processing on each spectrum in the near-infrared spectral dataset. Understandably, one-dimensional spectral data is converted into a floating-point matrix, and equally spaced wavelength sequences are generated within the 900-1700nm range based on the number of spectral bands. Tag data is converted into a category index through numerical encoding, while the spectral data is standardized to eliminate dimensional differences. S12, 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. S13, 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. The floating-point matrix is embedded in the polar coordinate system to obtain a polar coordinate image. Understandably, dynamic normalization is applied to each spectrum, linearly mapping the original data to the [0,1] interval to eliminate amplitude differences. On a preset 256×256 pixel canvas, the system constructs a polar coordinate system with the center point as the origin, ensuring the waveform is fully represented within a limited space by controlling the maximum radiation radius. During the conversion process, the algorithm transforms the spectral point sequence into a geometric shape: based on the wavelength sequence, spectral values are distributed equidistantly around the circumference at angular intervals, with the radial length strictly proportional to the normalized value; adjacent coordinate points are connected by dynamically enhanced gradient lines—using the Viridis color system to map spectral values to colors, and making the line thickness positively correlated with data intensity, visually enhancing feature differences. Finally, a green anchor point is embedded at the center as a spatial reference, forming a circular spectrum that combines numerical accuracy and visual recognizability. This effectively preserves the topological features of the spectrum, such as... Figure 2 As shown, abstract spectral data is transformed into an image representation with spatial structure.
[0024] S2, Construct a lightweight convolutional network architecture to obtain a feature extraction network, and process the polar coordinate image based on the feature extraction network; Specifically, step S2 includes steps S21 to S24: S21, A lightweight convolutional network architecture is constructed based on a three-level convolutional pooling layer, and the lightweight convolutional network architecture has been used as a feature extraction network. S22, 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; S23, the second layer of the feature extraction network is expanded to 64 channels to perform in-depth channel feature extraction on the polar coordinate image; S24, the third layer of the feature extraction network captures the 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; Understandably, the feature extraction network employs a lightweight convolutional architecture to process the transformed image, comprising a three-stage convolutional-pooling layer structure: the first layer uses 32 3×3 convolutional kernels to extract primary spatial features, which are then compressed in dimension using 2×2 max pooling; the second layer expands to 64 channels to deepen feature extraction; and the third layer captures high-level abstract features through 128-channel convolution. Finally, after being unfolded by a Flatten layer, a 128-dimensional feature vector is output, forming a discriminative embedded representation. This design effectively controls the number of parameters while ensuring feature expressiveness, laying the foundation for efficient learning in scenarios with few samples.
[0025] It is worth noting that the lightweight convolutional network architecture is shown in Table 1: Table 1
[0026] S3, the near-infrared spectral dataset is divided into a training set and a test set using a stratified sampling strategy; Understandably, a stratified sampling strategy is employed to divide the dataset into training and test sets, maintaining consistency in category distribution. The entire process implements rigorous dimensionality verification and anomaly isolation to ensure standardized output of spectral matrices, encoded labels, and wavelength sequences, laying a solid data foundation for subsequent analysis.
[0027] S4, dynamically extract K samples from each class from the training set, construct a support set based on the K samples and the few-sample strategy, and construct a query support similarity matrix using the cosine similarity algorithm; Specifically, step S4 includes steps S41 to S42: S41, dynamically extract K samples of each class from the training set using a random sampling strategy, and construct a support set based on the K samples and a few-sample strategy; S42, the test set is converted into a query feature vector, and a query support similarity matrix is constructed using the cosine similarity algorithm; Understandably, K samples from each class are dynamically extracted from the training set to form a support set, and a random sampling strategy ensures the diversity of class representations. These samples are input into a convolutional feature extractor—containing cascaded convolutional-pooling layers with 32 / 64 / 128 channels—which ultimately compresses the 256×256 pixel circular map into a 128-dimensional feature vector. This achieves efficient dimensionality reduction while preserving spatial features. Here, the feature vector is used instead of the original image for similarity calculation because the original transformed image contains a large number of redundant background pixels, and direct comparison would 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, achieving lightweight modeling. After the feature space mapping is completed, the system performs a two-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 using the cosine similarity algorithm.
[0028] It is worth noting that the 128-dimensional feature vectors extracted by convolutional networks are abstract representations of high-order semantics in spectral images (such as texture and shape patterns), effectively filtering out instrument noise and brightness fluctuations, while direct pixel comparison is extremely sensitive to such perturbations. Furthermore, the computational complexity of similarity calculations for feature vectors on a 256×256 image is significantly reduced compared to full-image pixel-level comparison, meeting the real-time requirements of industrial applications. More importantly, in the embedding space, the feature distances of similar samples are close, while the distances of dissimilar samples are far apart. Even with only 3-5 non-aligned samples per class, a robust metric can still be constructed, whereas direct image comparison is prone to misjudgment due to minor deformations or brightness differences when samples are scarce.
[0029] S5, the test set is judged based on the query support similarity matrix, the support set and the 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. In addition, step S5 further includes step S51: S51, if the highest similarity does not exceed the preset threshold, then the test set is marked as an unknown category; Understandably, the prediction mechanism introduces an innovative threshold-based decision-making mechanism: for each test sample, the highest similarity value in the support set is selected. If it exceeds a preset threshold (0.81), it is classified as belonging to the corresponding category; otherwise, it is marked as an "unknown" category, achieving the open-set recognition capability urgently needed in industrial scenarios. Performance evaluation focuses on calculating the accuracy of samples with known categories, which typically significantly surpasses the traditional PLS-DA benchmark. Simultaneously, the similarity distribution histogram reveals the model's decision boundary through a visual interface. The entire process persistently saves the feature extractor in TensorFlow format to support incremental learning and ensures system integrity when support set construction fails through an anomaly isolation mechanism. This forms a hybrid architecture that integrates metric learning and threshold-based decision-making, achieving superior classification performance and unknown sample detection capability under limited sample conditions.
[0030] The specific process of the traditional classification method (PLS-DA) is as follows: After data preprocessing, the system immediately starts the training process of the Partial Least Squares Discriminant Analysis (PLS-DA) classifier. First, a PLS-DA model is initialized, with key parameters set to 5 principal components. This optimized value effectively captures the discriminative features of the spectral data while avoiding overfitting. The model uses one-hot encoded training labels as supervision signals, and is jointly trained with standardized spectral training data. During training, PLS-DA constructs a latent variable space by maximizing the covariance between the spectral data and the class labels, finding the optimal projection direction to effectively separate samples of different classes. After the model training converges, the system applies it to the test set for prediction. The prediction results are output in the form of a probability matrix, with each sample corresponding to a membership score for all classes. The system uses the argmax function to select the class corresponding to the highest score as the final prediction result. To evaluate model performance, the system calculates the accuracy of the prediction results against the true targets. This metric directly reflects the model's discriminative ability on unknown samples. Finally, the trained PLS-DA model and its accompanying data normalizer are serialized and saved to a designated directory, forming a deployable analysis module that provides a benchmark for subsequent comparative experiments. The entire training process employs strict random seed control to ensure experimental reproducibility, while real-time logs record key performance indicators, enabling analysts to accurately track the model's discriminative performance in the spectral feature space.
[0031] Table 2 shows a comparison of PLS-D and few-shot recognition results: Table 2
[0032] This approach, combining image transformation with a few-sample method, effectively reduces the required number of samples, simplifies the modeling process, and improves the applicability to limited data and the adaptability and flexibility of the model. It offers significant advantages in near-infrared spectral qualitative discrimination scenarios for textiles where the number of samples is limited and high efficiency and accuracy are required, and can be extended to other near-infrared spectral qualitative discrimination fields.
[0033] It is worth noting that after extracting features from the sample to be tested, the system calculates its cosine similarity with each sample in the support set. When the maximum similarity exceeds a preset threshold of 0.81, it is determined to be in the corresponding category; otherwise, it is marked as an "unknown" category. This dual-modal decision-making mechanism ensures accurate discrimination of known categories while also possessing open set recognition capabilities, effectively solving the key challenge of identifying new materials in industrial settings. Figure 3 The training results of the model shown indicate that the discriminative framework significantly outperforms traditional methods under conditions of few samples.
[0034] In summary, the near-infrared spectroscopy qualitative discrimination method in the above embodiments of the present invention, through image conversion and a few-sample approach, eliminates the need for complex modeling of large numbers of samples required by traditional methods. Qualitative discrimination can be achieved with only a small number of samples (e.g., 3-5 per class), significantly reducing the cost and time of sample collection and preparation. The image conversion method effectively extracts the feature information of spectral data and transforms it into an easily processed image format. Based on this, the few-sample approach can extract feature vectors from images using convolutional networks and perform similarity measurements, avoiding the defects of noise sensitivity and computational redundancy associated with using original image pixel comparison. Furthermore, the metric relationship constructed in the embedding space can improve the generalization ability and classification robustness in scenarios with a small number of samples; it also has stronger adaptability to changes in sample source, preparation method, and measurement conditions. When encountering new unknown categories or changes in sample characteristics, there is no need to re-perform complex modeling processes; simply updating the support set is sufficient to achieve discrimination of the new category, demonstrating high flexibility. After converting spectral data into images, spectral features can be observed and analyzed more intuitively, facilitating professional interpretation and understanding of the discrimination results, and also providing convenience for subsequent further analysis and research.
[0035] Example 2 The second embodiment of the present invention also provides a near-infrared spectral qualitative discrimination system, please refer to [link to relevant documentation]. Figure 4 The figure shows a near-infrared spectral qualitative discrimination system according to a second embodiment of the present invention. The system includes: The acquisition and conversion module 10 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 construction processing module 20 is used to construct a lightweight convolutional network architecture to obtain a feature extraction network, and to process the polar coordinate image based on the feature extraction network; The partitioning module 30 is used to divide the near-infrared spectral dataset into a training set and a test set using a stratified sampling strategy. The extraction and construction module 40 is used to dynamically extract K samples of each class from the training set, construct a support set based on the K samples and the few-sample strategy, and construct a query support similarity matrix through the cosine similarity algorithm. The discrimination module 50 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.
[0036] In some optional embodiments, the acquisition and conversion module 10 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.
[0037] In some alternative embodiments, the build processing module 20 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.
[0038] In some alternative embodiments, the extraction construction module 40 includes: The extraction unit is used to dynamically extract K samples of each class from the training set using a random sampling strategy, and to construct a support set based on the K samples and a few-sample strategy. The third conversion unit is used to convert the test set into a query feature vector and construct a query support similarity matrix using a cosine similarity algorithm.
[0039] In some optional embodiments, the discrimination module 50 includes: A labeling unit is used to label the test set as an unknown category if the highest similarity does not exceed the preset threshold.
[0040] The functions or operation steps implemented by the above modules and units are largely the same as those in the above method embodiments, and will not be repeated here.
[0041] The near-infrared spectroscopy qualitative discrimination system provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned method embodiment. For the sake of brevity, any parts not mentioned in the system embodiment can be referred to the corresponding content in the aforementioned method embodiment.
[0042] Example 3 The third embodiment of the present invention also proposes an electronic device, please refer to [link / reference]. Figure 5 The image shows an electronic device according to a third embodiment of the present invention.
[0043] The electronic device may include a processor 61 and a memory 62 storing computer program instructions.
[0044] Specifically, the processor 61 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the present application.
[0045] The memory 62 may include a large-capacity storage device for data or instructions. For example, and not limitingly, the memory 62 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), flash memory, an optical disk drive, a magneto-optical disk drive, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 62 may include removable or non-removable (or fixed) media. Where appropriate, the memory 62 may be internal or external to a data processing device. In a particular embodiment, the memory 62 is non-volatile memory. In a particular embodiment, the memory 62 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), an electrically alterable read-only memory (EAROM), or flash memory, or a combination of two or more of these. Where appropriate, the RAM can be Static Random-Access Memory (SRAM) or Dynamic Random-Access Memory (DRAM). DRAM can be Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), Extended Data Out Dynamic Random-Access Memory (EDODRAM), Synchronous Dynamic Random-Access Memory (SDRAM), etc.
[0046] The memory 62 can be used to store or cache various data files that need to be processed and / or communicated, as well as possible computer program instructions executed by the processor 61.
[0047] The processor 61 reads and executes the computer program instructions stored in the memory 62 to implement the near-infrared spectral qualitative discrimination method of the above embodiment 1.
[0048] In some embodiments, the electronic device may further include a communication interface 63 and a bus 60. For example, Figure 3 As shown, the processor 61, memory 62, and communication interface 63 are connected through bus 60 and complete communication with each other.
[0049] The communication interface 63 is used to enable communication between the various modules, devices, units, and / or equipment in this application. The communication interface 63 can also enable data communication with other components such as external devices, image / data acquisition devices, databases, external storage, and image / data processing workstations.
[0050] Bus 60 includes hardware, software, or both, that couples components of a device together. Bus 60 includes, but is not limited to, at least one of the following: data bus, address bus, control bus, expansion bus, and local bus. For example, and not as a limitation, bus 60 may 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 Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 60 may include one or more buses. Although this application describes and illustrates a specific bus, this application considers any suitable bus or interconnection.
[0051] The electronic device can acquire a near-infrared spectral qualitative discrimination system and execute the near-infrared spectral qualitative discrimination method of this embodiment.
[0052] Furthermore, in conjunction with the near-infrared spectral qualitative discrimination method in Embodiment 1 above, this application can provide a storage medium for implementation. This storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement the near-infrared spectral qualitative discrimination method of Embodiment 1 above.
[0053] In the description of this specification, references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this 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 may be combined in any suitable manner in one or more embodiments or examples.
[0054] The embodiments described above are merely illustrative of several implementations of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements all fall within the scope of protection of the present invention. Therefore, the scope of protection of this patent should be determined by the appended claims.
Claims
1. A near-infrared spectral qualitative discrimination method, characterized in that, The method includes: A near-infrared spectral dataset was collected, and the one-dimensional spectral sequence in the near-infrared spectral dataset was converted into a polar coordinate image based on Circle Mapping; 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 converting the one-dimensional spectral sequence in the near-infrared spectral dataset into a polar coordinate image based on CircleMapping 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.
3. 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.
4. 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.
5. 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.
6. 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. 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.
7. The near-infrared spectral qualitative discrimination system according to claim 6, characterized in that, 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.
8. The near-infrared spectral qualitative discrimination system according to claim 6, 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.
9. 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 5.
10. 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 5.
Citation Information
Patent Citations
One-dimensional spectrum classification method and system
CN113313059A
Spectrum qualitative modeling method based on GAF image and quaternion convolution
CN113607684A
Surface water classification method based on water sample total absorption spectrum data
CN118861851A
Linear attention system based on circular area
CN120580559A
Method for classifying hyperspectral images on basis of adaptive multi-scale feature extraction model
US20230252761A1
Cited By
Modeling-free mixture component intelligent identification method and system
CN121185941A
Eyelid tumor classification method and system
CN121545208A
A method and system for eyelid tumor classification
CN121545208B