Multi-category aquatic product general detection platform based on transfer learning
Patent Information
- Application Number
- CN202611111759.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-24
- Publication Date
- 2026-10-13
AI Technical Summary
如果采用常规的卷积神经网络或图像分类器对混合多品类数据进行统一学习,模型极易对显著的品类背景特征产生过拟合,难以剥离并捕捉到跨品类共通的腐败演变视觉模式,导致模型在多类别场景下的识别精度与鲁棒性下降
1.通过预先构建包含品类属性、腐败阶段与感官表型节点的视觉语义知识图谱,并在属性-阶段相关性先验边上附加波段注意力先验数据,为多品类特征演进提供了明确的物理拓扑关联。该结构将离散的高光谱响应区间与实际理化指标测量值在图节点层面进行了映射,使得模型在计算并汇总腐败阶段原型参照系时,能够遵循阶段时序边定义的演变路径。这种基于图结构的原型排列方式,在多维特征空间中固化了水产品腐败变质的自然时序轨迹,为后续系统进行跨品类的状态比对与视觉偏移定位提供了标准化的比对基准与锚点。
Smart Images

Figure CN122906451A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection technology, specifically a universal detection platform for multiple categories of aquatic products based on transfer learning. Background Technology
[0002] With the development of computer vision and hyperspectral imaging technologies, non-destructive testing technologies based on image recognition and understanding have been widely applied in many fields such as agriculture, forestry, and fisheries. Hyperspectral images not only contain visual phenotypic information such as the spatial texture of target objects, but also contain extremely rich continuous spectral features. This provides massive data support for automatically analyzing multi-dimensional features and intelligently identifying target states using deep learning and pattern recognition algorithms. Currently, visual models based on hyperspectral images have been preliminarily applied to the quality monitoring and spoilage classification of various aquatic products such as fish.
[0003] However, in complex visual recognition scenarios involving multiple species (such as fish, shrimp, and crabs with diverse forms and attributes), existing image understanding models face serious challenges of "feature distribution shift" and "visual-semantic entanglement." Different species of target objects exhibit significant inherent visual differences in the high-dimensional feature space of images. When models extract image features, "species-specific visual features" representing species differences and "decomposition evolution visual features" representing the deterioration process become deeply coupled and mutually interfere with each other. If conventional convolutional neural networks or image classifiers are used to uniformly learn mixed multi-species data, the model is prone to overfitting to significant category background features, making it difficult to isolate and capture common decomposition evolution visual patterns across categories, leading to a decrease in the model's recognition accuracy and robustness in multi-category scenarios. Furthermore, practical application systems often need to incorporate newly added categories (such as new fish species). Requiring visual recognition systems to annotate and train independently from scratch for massive amounts of images of each new category not only incurs extremely high computational and data costs but also fails to effectively reuse visual feature extraction experience.
[0004] In summary, how to reduce the coupling interference between category and state features in image feature extraction and achieve cross-category universal visual recognition at low cost is a technical problem that urgently needs to be solved in this field.
[0005] To address this, a universal testing platform for multiple categories of aquatic products based on transfer learning is proposed. Summary of the Invention
[0006] The purpose of this invention is to provide a universal detection platform for multiple categories of aquatic products based on transfer learning. Through feature decoupling and localization, it achieves universal detection for multiple categories. This includes acquiring hyperspectral images and a reference system for the prototype of the spoilage stage arranged temporally; extracting shared feature maps, category-specific feature components, and spoilage evolution feature components through a ternary visual decoupling encoder to reduce feature coupling interference; subsequently, performing interactive encoding based on category features to extract interactive feature components and retrieve the initial spoilage stage prototype; finally, using the offset vector output by the locator and combining it with the initial prototype to obtain a corrected position vector; and after verifying the temporal consistency between the projection direction of this vector in the directed graph structure and the natural evolution direction, outputting the final spoilage stage.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A multi-category aquatic product testing platform based on transfer learning includes: The data acquisition module acquires hyperspectral images of the aquatic products to be inspected and a pre-constructed reference system of prototyping stages of spoilage. The reference system contains multiple prototyping stages of spoilage arranged in a directed graph structure according to temporal edges. The decoupling extraction module inputs the hyperspectral image into the ternary visual decoupling encoder to extract the shared feature map, the category-specific feature components, and the spoilage evolution feature components. The interactive coding module, using the inherent feature components of the category as conditions, performs conditional coding together with the shared feature map in the interactive branch to extract the category-corruption interactive feature components; it calculates the similarity between the corruption evolution feature components and the prototypes of each corruption stage, and retrieves the prototype of the initial corruption stage. The offset positioning module inputs the category-corruption interaction feature components into the locator and outputs an offset vector. It adds the offset vector to the reference vector of the initial corruption stage prototype to obtain the corrected position vector. It also verifies the temporal consistency between the projection direction of the corrected position vector in the directed graph structure and the natural evolution direction. When the temporal consistency is satisfied, it calculates the cosine similarity with each corruption stage prototype and outputs the corruption stage corresponding to the corruption stage prototype with the highest cosine similarity.
[0008] Preferably, the acquisition of hyperspectral images of the aquatic products to be inspected includes multiple single-band spectral images acquired at preset wavelength intervals within the visible-near-infrared band.
[0009] Preferably, the pre-constructed corruption stage prototype reference system is determined based on a pre-constructed visual semantic knowledge graph: the visual semantic knowledge graph includes category attribute nodes, corruption stage nodes, and sensory phenotype nodes, as well as attribute-stage correlation prior edges pointing from category attribute nodes to corruption stage nodes, stage-phenotype causal edges pointing from corruption stage nodes to sensory phenotype nodes, and stage temporal edges pointing from one corruption stage node to another corruption stage node, and each attribute-stage correlation prior edge is appended with band attention prior data; for each known category in the known aquatic product category set, at each corruption stage, the corruption evolution feature components of multiple samples are extracted using a trained ternary visual decoupling encoder, and the mean vector of the corruption evolution feature components of all samples under that corruption stage is calculated as the reference vector of the corruption stage prototype of that category at that corruption stage; the corruption stage prototypes of all corruption stages of all known categories are summarized to form the corruption stage prototype reference system, and the corruption stage prototypes are arranged in a directed graph structure according to the corruption evolution direction defined by the stage temporal edges.
[0010] Preferably, the ternary visual decoupling encoder includes a shared convolutional backbone network, a category visual feature extraction branch, a decay stage visual feature extraction branch, an interaction visual feature extraction branch, and a decay stage visual locator; the shared convolutional backbone network receives hyperspectral images and outputs a shared feature map; the category visual feature extraction branch receives the shared feature map and outputs category-inherent feature components; the decay stage visual feature extraction branch receives the shared feature map and outputs decay evolution feature components; the interaction visual feature extraction branch receives category-inherent feature components and the shared feature map for conditional encoding and outputs category-decay interaction feature components; the decay stage visual locator includes a fully connected layer, which receives the category-decay interaction feature components and outputs an offset vector.
[0011] Preferably, the training loss of the ternary visual decoupling encoder includes: inputting the hyperspectral image of the labeled sample into a shared convolutional backbone network to obtain a shared feature map, and obtaining the category-specific feature component and the spoilage evolution feature component through the category visual feature extraction branch and the spoilage stage visual feature extraction branch, respectively; calculating the category classification loss of the category-specific feature component and the labeled category label, and inverting the gradient generated by the category classification loss through a gradient inversion layer during backpropagation before backpropagating it to the shared convolutional backbone network; calculating the spoilage evolution feature component and the spoilage stage classification loss of the labeled spoilage label, and calculating the mutual information between the two to generate a first mutual information loss term; based on visual semantic knowledge... The band attention prior data on the attribute-stage correlation prior edge in the image recognition spectrum is used to calculate the band attention constraint loss term. Its value is equal to the ratio of the sum of the feature channel activation values of the corruption evolution feature component outside the band interval specified by the band attention prior data to the sum of the feature channel activation values within the band interval. The global mutual information between the category-inherent feature component and the corruption evolution feature component is calculated to generate the second mutual information loss term. The category classification loss, corruption stage classification loss, band attention constraint loss term, first mutual information loss term and second mutual information loss term are weighted and summed to obtain the total loss function, and the network parameters of the three-element visual decoupling encoder are updated accordingly.
[0012] Preferably, it also includes a category incremental access module: acquiring a labeled sample set and category attribute description data for newly added aquatic product categories, the category attribute description data including quantitative attribute values of the newly added aquatic product categories in the dimensions of free amino acid content, polyunsaturated fatty acid content, water content, and tissue enzymatic features; in the high-level representation space of the shared convolutional backbone network, assigning visual feature subspace partitions to the newly added aquatic product categories based on the visual semantic similarity between the category attribute description data of the newly added aquatic product categories and the category attribute data of each known aquatic product category; constructing a common visual template across the category spoilage stage; and combining the quantitative attribute values in the dimensions of free amino acid content, polyunsaturated fatty acid content, water content, and tissue enzymatic features as input. A lightweight conditional adaptation network is input, and the output is mapped to scaling and deflection factors corresponding to each spoilage stage. The scaling factor is multiplied by the magnitude of the visual change direction vector between each spoilage stage in the common visual template to obtain the adjusted magnitude. The normalized visual change direction vector is multiplied by the orthogonal rotation matrix constructed from the deflection factor to obtain the adjusted direction vector, thus completing the scaling and deflection adjustment of the common visual template. The adjusted common visual template is injected into the visual feature subspace partition of the newly added aquatic product category. All parameters in the three-element visual decoupling encoder corresponding to each known aquatic product category are locked. The parameters in the visual feature subspace partition of the newly added aquatic product category and the corresponding spoilage stage visual locator are incrementally trained using the labeled sample set.
[0013] Preferably, the interactive encoding module concatenates the inherent feature components of the product category with the shared feature map, and inputs the concatenated features into the mapping layer of the interactive branch for conditional encoding to extract the product category-corruption interactive feature components; calculates the cosine similarity between the corruption evolution feature components and the reference vectors of the prototypes of each corruption stage, and uses the corruption stage prototype with the largest cosine similarity as the initial corruption stage prototype retrieval output.
[0014] Preferably, the process of outputting the corruption stage corresponding to the corruption stage prototype with the highest cosine similarity includes: inputting the category-corruption interaction feature components into the fully connected layer of the locator and outputting an offset vector; adding the offset vector to the reference vector of the initial corruption stage prototype to obtain the corrected stage position vector; in the directed graph structure, verifying whether the projection direction of the corrected stage position vector is consistent with the natural evolution direction of the corruption stage; when the projection direction changes in the opposite direction, applying a temporal penalty term to the offset vector, and re-adding the offset vector after applying the temporal penalty term to the reference vector of the initial corruption stage prototype to obtain the updated stage position vector, until the projection direction of the updated stage position vector is consistent with the natural evolution direction; calculating the cosine similarity between the stage position vector consistent with the natural evolution direction and the reference vectors of each corruption stage prototype in the corruption stage prototype reference system; and outputting the corruption stage corresponding to the corruption stage prototype with the highest cosine similarity as the final corruption stage identification result.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: 1. By pre-constructing a visual semantic knowledge graph containing nodes of product category attributes, spoilage stages, and sensory phenotypes, and by attaching band attention prior data to the attribute-stage correlation prior edges, a clear physical topological relationship is provided for the evolution of multi-category features. This structure maps discrete hyperspectral response ranges to actual physicochemical index measurements at the graph node level, enabling the model to follow the evolutionary path defined by the stage temporal edges when calculating and summarizing the prototype reference system for spoilage stages. This prototype arrangement method based on graph structure solidifies the natural temporal trajectory of aquatic product spoilage in a multi-dimensional feature space, providing a standardized comparison benchmark and anchor point for subsequent cross-category state comparison and visual offset localization in the system.
[0016] 2. By jointly configuring and weighting multiple specialized loss terms during the training phase of the ternary visual decoupled encoder, the parameter update preferences of each branch network during backpropagation were adjusted. A mutual information neural estimator was used to construct the first and second mutual information loss terms, forcibly distancing the statistical correlation between category-specific features and spoilage evolution features in the latent space; combined with a mask-based band attention constraint loss term, the feature responses were guided to concentrate on highly correlated spectral channels. The superposition of multiple mechanisms enabled the effective separation of independent semantic feature components from the same image input.
[0017] 3. By setting up an incremental category access module and applying a lightweight conditional adaptation network, the multidimensional physicochemical quantitative attribute numerical mappings of newly accessed aquatic products are transformed into independent scaling and deflection factors. Targeted adjustments are made to the direction and modulus of the cross-category common visual templates extracted based on the global mean. This mechanism delineates isolated visual feature subspaces for the new categories within the high-dimensional representation layer of the existing network and injects the reconstructed template vectors as initial parameter values. While locking all known category-related network parameters, the system only performs local incremental parameter updates on the newly defined subspace partitions, completing the splicing and access of the new category feature distribution while maintaining the original recognition system. Attached Figure Description
[0018] Figure 1 A schematic diagram of the structure of the universal detection platform for multiple categories of aquatic products based on transfer learning provided by the present invention; Figure 2 This is a schematic diagram of the process of the universal testing platform for multiple categories of aquatic products based on transfer learning provided by the present invention; Figure 3 This is a schematic diagram of the incremental category access process provided by the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Please see Figures 1 to 3 This invention provides a universal testing platform for multiple categories of aquatic products based on transfer learning. The technical solution is as follows: A universal testing platform for multiple categories of aquatic products based on transfer learning, specifically as follows: Figure 1 and Figure 2 As shown, it includes: The data acquisition module acquires hyperspectral images of the aquatic products to be inspected and a pre-constructed reference system of prototyping stages of spoilage. The reference system contains multiple prototyping stages of spoilage arranged in a directed graph structure according to temporal edges. The decoupling extraction module inputs the hyperspectral image into the ternary visual decoupling encoder to extract the shared feature map, the category-specific feature components, and the spoilage evolution feature components. The interactive coding module, using the inherent feature components of the category as conditions, performs conditional coding together with the shared feature map in the interactive branch to extract the category-corruption interactive feature components; it calculates the similarity between the corruption evolution feature components and the prototypes of each corruption stage, and retrieves the prototype of the initial corruption stage. The offset positioning module inputs the category-corruption interaction feature components into the locator and outputs an offset vector. It adds the offset vector to the reference vector of the initial corruption stage prototype to obtain the corrected position vector. It also verifies the temporal consistency between the projection direction of the corrected position vector in the directed graph structure and the natural evolution direction. When the temporal consistency is satisfied, it calculates the cosine similarity with each corruption stage prototype and outputs the corruption stage corresponding to the corruption stage prototype with the highest cosine similarity.
[0021] Example 1: Furthermore, the acquisition of hyperspectral images of the aquatic products to be inspected includes multiple single-band spectral images acquired at preset wavelength intervals within the visible-near-infrared band.
[0022] The stage carrying the aquatic products to be tested is controlled to move through the line-field scanning area of the hyperspectral camera at a set push-scan speed. During the push-scan process, the hyperspectral camera receives the light signal reflected from the surface of the aquatic products. Within the visible-near-infrared band range of 400nm to 1000nm, the hyperspectral camera performs synchronous photoelectric conversion on the light signal according to a preset spectral resolution, acquiring the light intensity response values of the aquatic products at different physical spatial positions and corresponding to multiple subdivided bands line by line. The spatial dimension data and wavelength dimension data acquired by the scan are combined to form an initial three-dimensional hyperspectral data cube. Under the same light source and camera parameters, the total internal reflection reference data of a standard diffuse reflection white board is pre-acquired, and the dark current reference data of the camera is recorded under conditions of no external light penetration. The relative reflectance calculation formula is then used to calculate the data. For each spatial location in the initial data cube and various spectral bands Perform pixel-by-pixel, band-by-band, element-by-element correction; where The corrected relative reflectance has a theoretical range of [0, 1]. The light intensity response values in the initial three-dimensional hyperspectral data cube; This is the reference data for total internal reflection; This is the reference data for dark current; The preset stable minimum value (preferably set to [value] in this embodiment) This is used to avoid numerical calculation anomalies when the denominator approaches zero due to noise disturbances; among which and All are of shape The three-dimensional tensor and These represent the spatial height and width (in pixels) of the hyperspectral image, respectively. The total number of spectral bands collected is used to eliminate light source distribution and dark current interference through this correction process, and the final output is a dataset containing multiple single-band spectral images, which serves as the input for subsequent algorithm models.
[0023] Furthermore, the pre-constructed corruption stage prototype reference system is determined based on a pre-constructed visual semantic knowledge graph: the visual semantic knowledge graph includes category attribute nodes, corruption stage nodes, and sensory phenotype nodes, as well as attribute-stage correlation prior edges pointing from category attribute nodes to corruption stage nodes, stage-phenotype causal edges pointing from corruption stage nodes to sensory phenotype nodes, and stage temporal edges pointing from one corruption stage node to another corruption stage node, and each attribute-stage correlation prior edge is appended with band attention prior data; for each known category in the known aquatic product category set, at each corruption stage, the trained ternary visual decoupling encoder is used to extract the corruption evolution feature components of multiple samples, and the mean vector of the corruption evolution feature components of all samples under that corruption stage is calculated as the reference vector of the corruption stage prototype of that category at that corruption stage; the corruption stage prototypes of all corruption stages of all known categories are summarized to form the corruption stage prototype reference system, and the corruption stage prototypes are arranged according to the corruption evolution direction defined by the stage temporal edges to form a directed graph structure.
[0024] Construct a visual semantic knowledge graph. Define three levels of node sets in the data structure: a set of category attribute nodes representing the inherent physicochemical indicators of aquatic products (e.g., nodes containing free amino acids, polyphenol oxidase, etc.), a set of spoilage stage nodes representing the deterioration state (e.g., nodes containing the initial stage, the second fresh stage, the spoilage stage, etc.), and a set of sensory phenotype nodes representing external manifestations such as appearance and odor. Establish topological connection edges between these nodes: establish attribute-stage correlation prior edges from category attribute nodes to spoilage stage nodes, establish stage-phenotype causal edges from spoilage stage nodes to sensory phenotype nodes, and establish stage temporal edges between spoilage stage nodes with temporal evolutionary relationships.
[0025] Prior band attention data is extracted and appended to each attribute-stage correlation prior edge. Specifically, for a specific category attribute node (such as a specific physicochemical indicator), the Pearson correlation coefficient between the spectral reflectance of existing samples in each sub-band of the visible-near-infrared band and the actual measured value of the physicochemical indicator is calculated. Band intervals with absolute Pearson correlation coefficients greater than a first preset threshold are extracted as spectral high-frequency response band intervals, with the first preset threshold set to 0.6. To control the false positive rate of multiple tests caused by concurrent multi-band calculations, the correlation coefficients are subjected to significance tests and multiple comparison corrections (such as FDR correction), retaining only statistically significant bands with corrected q values (or corrected p values) less than 0.05. For different physicochemical indicators, their respective thresholds can be set. The values of each threshold are determined based on the pre-experimental data on the correlation between the corresponding indicator and spectral reflectance. The correlation coefficients of each band are normalized to form a set of numerical vectors containing weight distributions, which are the aforementioned prior band attention data.
[0026] A sample dataset consisting of known aquatic product categories is obtained. Each sample in the dataset has a pre-labeled category label and a spoilage stage label. The hyperspectral images corresponding to each sample in the sample dataset are input into the trained ternary visual decoupled encoder for forward inference, and the high-dimensional spoilage evolution feature components corresponding to each sample are output.
[0027] The output spoilage evolution feature components are grouped according to category labels and spoilage stage labels. For any category in the known set of aquatic product categories... and any stage of corruption Extraction belongs to the category And it is in a corrupt stage. All The corruption evolution characteristic components of each sample form a set. Calculate the mean vector of all eigencomponents within the set using the following formula. : ; The calculated mean vector Recorded as category During the corruption stage The reference vector of the prototype of the corruption stage.
[0028] The algorithm iterates through all known aquatic product categories and all their spoilage stages, performing the above calculation process to obtain all corresponding reference vectors. The set of all reference vectors is defined as the spoilage stage prototype reference system. Using each reference vector in the reference system as a graph node, and based on the source and target node relationships defined by the stage temporal edges in the visual semantic knowledge graph, directed edges are established between the corresponding graph nodes. At the algorithm's underlying level, an adjacency matrix is constructed to record the connectivity and evolution direction between each graph node. Finally, a directed graph structure representing the evolutionary trajectory of multi-category features is constructed and stored in the system memory for subsequent retrieval and matching.
[0029] Furthermore, the ternary visual decoupling encoder includes a shared convolutional backbone network, a category visual feature extraction branch, a decay stage visual feature extraction branch, an interaction visual feature extraction branch, and a decay stage visual locator. The shared convolutional backbone network receives hyperspectral images and outputs a shared feature map. The category visual feature extraction branch receives the shared feature map and outputs category-inherent feature components. The decay stage visual feature extraction branch receives the shared feature map and outputs decay evolution feature components. The interaction visual feature extraction branch receives category-inherent feature components and the shared feature map, performs conditional encoding, and outputs category-decay interaction feature components. The decay stage visual locator includes a fully connected layer, which receives category-decay interaction feature components and outputs an offset vector.
[0030] Obtain a three-dimensional hyperspectral image tensor containing spatial and spectral dimensions, and convert it to a spatial resolution of [missing value]. A network input tensor with C feature channels is used, where each of the C feature channels is mapped one-to-one with a continuous discrete band of a hyperspectral image in the visible-near-infrared range. This input tensor is then fed into the shared convolutional backbone network of the ternary visual decoupling encoder. This backbone network contains multiple layers of alternating cascaded convolutional layers, batch normalization layers, and nonlinear activation function layers.
[0031] Specifically, in this embodiment, the shared convolutional backbone network adopts a five-stage deep feature extraction architecture, comprising one input backbone layer and four alternately cascaded residual convolutional modules. The input backbone layer uses a 3×3 two-dimensional convolutional kernel with a stride of 1 and padding of 1 to initially fuse the spectral features of C consecutive discrete bands in the hyperspectral image without sacrificing spatial resolution. In the subsequent four residual convolutional modules, the stride of the convolutional layers is alternately set to 1 and 2 to expand the feature receptive field while performing spatial dimensionality reduction. The number of feature channels output by each residual convolutional module is sequentially increased to 64, 128, 256, and 512. After each convolutional operation of the backbone network, a two-dimensional batch normalization layer is cascaded to normalize and align the feature channels, and a LeakyReLU nonlinear activation function layer (with its negative half-axis slope set to 0.1).
[0032] Through multi-layer forward propagation, spatial dimensionality reduction and spectral channel feature aggregation are performed on the input hyperspectral image to extract the shared feature map containing basic spectral phenotype and spatial texture information. This shared feature map is synchronously input into the parallel category visual feature extraction branch and the decay stage visual feature extraction branch in the network structure. In the category visual feature extraction branch, global average pooling and multi-layer perceptron mapping are sequentially performed on the input shared feature map to compress the high-dimensional feature tensor and project it onto the category latent space of a preset dimension, outputting a one-dimensional category-inherent feature component, the specific feature dimension of which is... In this embodiment The preferred setting is 256 dimensions; in the visual feature extraction branch of the corruption stage, an independently initialized pooling layer and fully connected network parameters are used to project the same input shared feature map to an independent corruption evolution latent space, and output a one-dimensional corruption evolution feature component.
[0033] Combine the inherent feature components of the product category with shared features Figure 1 The interactive visual feature extraction branch is then used for conditional encoding. During conditional encoding, the one-dimensional category-specific feature components are first broadcast and copied spatially to align their spatial resolution with the size of the shared feature map. Specifically, the tensor shape of the shared feature map is set to (H, W, C), where C is the number of channels in the shared feature map, preferably set to 128 in this embodiment; the shape of the one-dimensional category-specific feature components is (H, W, C). First, the feature component is deformed into a shape (1, 1, ...) using a reshape operation. The tensor is then copied and expanded into a shape (H, W, ...) in spatial dimensions using the tile operation. The category condition tensor is then generated. Subsequently, this category condition tensor is concatenated with the shared feature map along the feature channel dimension to obtain a shape of (H, W, C+). The fused feature tensor is then input into the interaction branch containing the concatenated fused feature tensor. Cross-channel feature interaction and dimensionality reduction are performed in the convolutional layer, and then information is extracted through the pooling layer to output a one-dimensional category-corruption interaction feature component.
[0034] The category-corruption interaction feature components are input into a corruption stage visual locator. This locator contains multiple cascaded fully connected layers. Through a learnable weight matrix that is randomly initialized and jointly trained and updated with the overall network model, it performs linear transformations and nonlinear activation mappings on the input one-dimensional category-corruption interaction feature components. The fully connected layer at the end of the locator outputs a continuous offset vector. The dimension of this offset vector is consistent with the dimension of the corruption stage prototype reference vector in the visual semantic knowledge graph, so as to represent the state transition direction and displacement scale of the current sample feature in the corruption latent space under specific category constraints.
[0035] Further, the training loss of the ternary visual decoupling encoder includes: inputting the hyperspectral image of the labeled sample into a shared convolutional backbone network to obtain a shared feature map, which is then processed through a category visual feature extraction branch and a spoilage stage visual feature extraction branch to obtain category-specific feature components and spoilage evolution feature components, respectively; calculating the category classification loss of the category-specific feature components and the labeled category tags, and inverting the gradient generated by the category classification loss through a gradient inversion layer during backpropagation before backpropagating it to the shared convolutional backbone network; calculating the spoilage evolution feature components and the spoilage stage classification loss of the labeled spoilage tags, and calculating the mutual information between the two to generate a first mutual information loss term; and based on visual semantics... The band attention prior data on the attribute-stage correlation prior edges in the knowledge graph are used to calculate the band attention constraint loss term. Its value is equal to the ratio of the sum of the feature channel activation values of the corruption evolution feature component outside the band interval specified by the band attention prior data to the sum of the feature channel activation values within the band interval. The global mutual information between the category-inherent feature component and the corruption evolution feature component is calculated to generate the second mutual information loss term. The category classification loss, corruption stage classification loss, band attention constraint loss term, first mutual information loss term, and second mutual information loss term are weighted and summed to obtain the total loss function, and the network parameters of the ternary visual decoupling encoder are updated accordingly.
[0036] A set of labeled hyperspectral images with true category labels and true spoilage stage labels was constructed and obtained. The specific training dataset construction process is as follows: M common aquatic product categories (including but not limited to large yellow croaker, sea bass, ribbonfish, and whiteleg shrimp) were selected, and hyperspectral images were acquired at 0 hours (initial stage), 24 hours (secondary fresh stage), 48 hours (early spoilage stage), and 72 hours (spoilage stage) under 4℃ refrigeration conditions. A set of labeled hyperspectral images with true category labels and true spoilage stage labels was constructed and obtained. The specific training dataset construction process is as follows: Select M common aquatic product categories (including but not limited to large yellow croaker, sea bass, ribbonfish, and whiteleg shrimp) and collect hyperspectral images at 0 hours (initial stage), 24 hours (secondary fresh stage), 48 hours (early spoilage stage), and 72 hours (spoilage stage) under 4℃ refrigeration conditions. The spoilage stage labels of the corresponding samples are manually evaluated by a professional sensory evaluation team based on the sensory indicators in the currently effective national food safety standards. At the same time, the physicochemical test results of volatile basic nitrogen (TVB-N) values are used as an objective auxiliary reference for joint calibration. In the joint calibration process, the TVB-N concentration threshold ranges corresponding to the initial stage, secondary fresh stage, early spoilage stage, and spoilage stage are pre-set, and the corresponding judgment rules of each spoilage stage label, TVB-N limit, and sensory indicators are listed. The acquired hyperspectral images are first corrected for black and white based on total internal reflection using dark current and a white board. Then, random spatial cropping (e.g., cropping the spatial resolution to 128×128 pixels) and random spectral channel dropout processing (e.g., randomly setting the response position of a specific spectral band to zero with a 10% probability) are performed as data augmentation to form the final hyperspectral image sample set. This sample set is then divided into a training set and a validation set at a ratio of 80% and 20%, respectively. These are input into a shared convolutional backbone network to obtain a shared feature map. The feature maps are then mapped and output as one-dimensional category-specific feature components and corruption evolution feature components through category visual feature extraction branches and corruption stage visual feature extraction branches, respectively. The cross-entropy algorithm is used to calculate the category classification loss between the category-specific feature components and the true category label, and the corruption stage classification loss between the corruption evolution feature components and the true corruption stage label, respectively.
[0037] During the backpropagation phase of the network, the gradient tensor of the category classification loss generated by the category visual feature extraction branch is calculated relative to the network parameters. Before backpropagating this gradient tensor to the shared convolutional backbone network, it passes through a pre-defined gradient inversion layer. Within this layer, the received gradient tensor is multiplied by a negative scaling factor. ,in initial value Set to 0.1, and dynamically adjust according to the set exponential growth annealing strategy during network training to balance the adversarial decoupling intensity with the number of training rounds. The specific dynamic growth formula is as follows: The upper limit of the maximum scaling factor in the formula The growth rate adjustment coefficient is set to 1.0. The gradient is set to 0.05. Then, this inverted and dynamically scaled gradient tensor is backpropagated to the shared convolutional backbone network for parameter updates. The gradient of the category classification loss is propagated positively when backpropagated to the category visual feature extraction branch, ensuring that the parameters of this branch are guided by a clear classification objective, thereby stably extracting high-purity category-specific feature components. The gradient inversion layer is strictly set only at the boundary between this branch and the shared convolutional backbone network. Its purpose is to prevent the shared convolutional backbone network from overfitting to easily distinguishable shallow category background noise.
[0038] The first mutual information loss term between the corruption evolution feature components and the actual corruption stage labels is calculated. Based on the mutual information neural estimation algorithm, an auxiliary estimation network containing a multilayer perceptron is constructed. The one-hot encodings corresponding to the corruption evolution feature components and the actual corruption stage labels are concatenated as inputs to the joint distribution sample, and the two are randomly shuffled and paired as negative samples of the marginal distribution product. The auxiliary estimation network maximizes the KL divergence between the joint distribution and the marginal distribution product, outputs the lower bound estimate of mutual information, and takes its negative value as the first mutual information loss term. The auxiliary estimation network consists of three fully connected layers with 512, 256 and 1 neurons respectively. The first two layers are followed by ReLU activation functions, and the last layer directly outputs a scalar value without activation function. When training the auxiliary estimation network, a mixed batch input of joint distribution samples (a concatenation of the corruption evolution feature components and the one-hot encoding of the corresponding corruption stage labels) and marginal distribution product samples (randomly shuffled and paired within the current training batch) is used to calculate the lower bound of the KL divergence under the Donsker-Varadhan representation, and the parameters of the auxiliary estimation network are alternately updated with the main network parameters of the ternary visual decoupled encoder.
[0039] Band attention prior data on attribute-stage correlation prior edges in the visual semantic knowledge graph are extracted and parsed into a binary mask matrix with the same dimension as the feature channels. In the corruption evolution feature components, this mask matrix is used to perform channel masking on the feature tensors, separating feature channels outside the band interval from those within the band interval. The absolute values of the L1 norm are summed for both parts of the channel tensor according to the spatial and channel dimensions to obtain the sum of activation values outside the interval and the sum of activation values within the interval. Specifically, the band attention constraint loss term... The calculation formula is: ,in The activation values for feature channels outside the band interval specified in the band attention prior data. The activation value of the feature channel within the specified interval. To prevent the smoothing constant with a denominator of zero (preferably set to 1e-6 in this embodiment), the design goal of this loss term is to minimize the percentage of zero in the total loss function. This approach forces the redundant response outside the range to approach zero, thereby encouraging the model to concentrate more feature activation energy in the band range that is highly correlated with the spectral response of the physicochemical index.
[0040] The decoupling independence between the category-specific feature components and the corruption evolution feature components is calculated to generate a second mutual information loss term. Specifically, for the category-specific feature components and corruption evolution feature components extracted from the same hyperspectral image sample, the absolute value of their cosine similarity in the feature space is first calculated as an individual orthogonality penalty term, forcing the two sets of feature vectors representing different semantics to tend to be perpendicular to each other in geometric space. At the same time, at the level of the entire training batch, the cross-covariance matrix of the category feature set matrix and the corruption feature set matrix is calculated, and the mean square value of each element in the matrix is extracted as a global independence penalty term. By weighted summing of the individual orthogonality penalty term and the global independence penalty term, the second mutual information loss term representing the degree of information overlap and coupling between the two is directly output. The specific design and determination method of the first and second internal weight coefficients is as follows: In the first forward propagation calculation of the first round of model training, the initial values of the unweighted individual orthogonal penalty term and the initial values of the global independent penalty term are extracted; the first internal weight coefficient is set to a fixed baseline value of 1.0, and the value of the second internal weight coefficient is set to the ratio of the initial value of the individual orthogonal penalty term to the initial value of the global independent penalty term. Through this initial order-of-magnitude inverse alignment rule, the contributions of the two penalties to the total gradient are on the same order of magnitude at the beginning of training. During the optimization of the total loss function, by minimizing this loss, the linear and nonlinear statistical correlation between the two feature latent spaces is forcibly severed, thereby achieving true visual semantic decoupling.
[0041] Classification loss for the aforementioned categories Classification of losses during the corruption stage Band attention constraint loss term First mutual information loss item Second mutual information loss term Preset hyperparameter weighting coefficients are assigned to each parameter. In this embodiment, each weighting coefficient is preferably set as follows: The weight coefficients are chosen based on the following: the numerical magnitudes of each loss term in the first training epoch are normalized and aligned to ensure that the contributions of each loss term to the total gradient are of the same order of magnitude, thus preventing some small-scale regularization terms from failing during backpropagation. The weighted loss terms are then linearly summed to generate the total loss function for network training, the specific calculation formula of which is as follows: Based on the total loss function, the gradient of the learnable parameters of the entire network is calculated using the Adam or SGD algorithm, and the network parameters of the three-element visual decoupled encoder are updated according to the preset learning rate until the total loss function converges or the maximum number of iterations is reached.
[0042] To avoid gradient conflicts during multi-objective joint optimization, the parameter updates of the ternary visual decoupled encoder in this embodiment follow the following explicit gradient flow direction isolation principle:
[0043] Shared convolutional backbone network: It receives the gradients of the classification loss and band attention constraint loss in the positive direction and the inverted category classification loss gradient in the negative direction, so that it focuses on extracting the basic spectral and spatial phenotypes that are common across categories.
[0044] Category visual feature extraction branch: It only receives the gradient of the category classification loss in the positive direction, so that it independently undertakes the high-dimensional mapping of category semantics;
[0045] The visual feature extraction branch for the corruption stage: It receives the gradient of the classification loss for the corruption stage in the positive direction and the penalty gradient of the mutual information loss term, forcibly stripping away the category leakage information.
[0046] Furthermore, it also includes a category incremental access module: acquiring labeled sample sets and category attribute description data for newly added aquatic product categories. The category attribute description data includes quantitative attribute values of the newly added aquatic product categories in the dimensions of free amino acid content, polyunsaturated fatty acid content, water content, and polyphenol oxidase activity. In the high-level representation space of the shared convolutional backbone network, based on the visual semantic similarity between the category attribute description data of the newly added aquatic product categories and the category attribute data of each known aquatic product category, a visual feature subspace partition is assigned to the newly added aquatic product category. A common visual template for cross-category spoilage stages is constructed. The quantitative attribute values in the dimensions of free amino acid content, polyunsaturated fatty acid content, water content, and polyphenol oxidase activity are combined into an input vector. The lightweight conditional adaptation network is input, and its output is mapped to scaling and deflection factors corresponding to each spoilage stage. The scaling factor is multiplied by the magnitude of the visual change direction vector between each spoilage stage in the common visual template to obtain the adjusted magnitude. The normalized visual change direction vector is then multiplied by the orthogonal rotation matrix constructed from the deflection factor to obtain the adjusted direction vector, thus completing the scaling and deflection adjustments of the common visual template. The adjusted common visual template is then injected into the visual feature subspace partition of the newly added aquatic product category. All parameters corresponding to each known aquatic product category in the ternary visual decoupling encoder are locked. Incremental training is performed on the parameters within the visual feature subspace partition of the newly added aquatic product category and the corresponding spoilage stage visual locator using the labeled sample set. The specific process is as follows: Figure 3 As shown.
[0047] A labeled sample set of newly added aquatic product categories and corresponding category attribute description data are obtained. This category attribute description data is acquired through physicochemical testing or retrieval from standard databases, specifically represented as a set of quantitative attribute vectors containing four fixed dimensions of general biochemical evolutionary features, corresponding to the protein degradation feature dimension, lipid oxidation feature dimension, physical water-holding feature dimension, and tissue enzymatic feature dimension of the newly added aquatic product category. The four fixed dimensions are dynamically mapped to specific physicochemical indicators based on the specific species characteristics of the aquatic product to be included. For example, for fish, the tissue enzymatic feature dimension maps to extract tissue protease activity or K value; while for shrimp and crabs, the tissue enzymatic feature dimension maps to extract polyphenol oxidase activity. In the high-level representation space of a shared convolutional backbone network, the visual semantic similarity between the category attribute description data of the newly added aquatic product category and the category attribute data of each known aquatic product category is calculated. Specifically, the quantitative attribute values of each dimension are normalized, and the Euclidean distance or cosine similarity between the newly added category attribute vector and each known category attribute vector is calculated as the visual semantic similarity. Based on the magnitude of the visual semantic similarity, in the matrix representation of the high-dimensional feature space, an independent visual feature subspace partition is allocated and segmented for the newly added aquatic product category. This partition is used to store and update the exclusive visual feature parameters belonging to the newly added category. Specifically, the allocation and segmentation in the tensor structure is as follows: at the end of the feature extraction network of the ternary visual decoupling encoder, the category output dimension of the weight matrix is expanded, and an exclusive trainable parameter feature slot bound to the category number of the newly added aquatic product category is added by matrix concatenation, which serves as the visual feature subspace partition of the newly added aquatic product category.
[0048] Construct a common visual template for the spoilage stages across product categories. Specifically, during calculation, for each spoilage stage in the known set of aquatic product categories... First, calculate the global arithmetic mean of the reference vectors for all known categories at this stage, and then generate the global mean feature vector corresponding to this stage. Subsequently, the global mean eigenvectors of adjacent corruption stages are subtracted, i.e., according to the formula... The visual change direction vector as the corruption progresses from the current stage to the next adjacent stage is calculated. The common visual template is formed by the combination of visual change direction vectors between adjacent stages, which constitutes the basic framework representing the trajectory of corruption evolution.
[0049] The quantitative attribute values of the free amino acid content, polyunsaturated fatty acid content, water content, and polyphenol oxidase activity of the newly added aquatic product category are combined into a one-dimensional input vector in a preset order and then input into a pre-constructed lightweight conditional adaptation network. This lightweight conditional adaptation network consists of multiple cascaded fully connected layers. The one-dimensional input vector undergoes a linear transformation through the fully connected layers and a nonlinear mapping through the activation function, ultimately outputting two sets of numerical sequences, which serve as scaling and deflection factors corresponding to each corruption stage, respectively. This lightweight conditional adaptation network consists of three cascaded fully connected layers, with the number of neurons in each layer being 32, 64, and 2K, respectively, where K is the total number of corruption stages. The first two layers are followed by a ReLU activation function. The output layer is divided into two groups: the first K outputs are activated by the Sigmoid function and used as scaling factors (within the range of (0,1)), and the last K outputs are activated by the Tanh function and used as deflection factors (within the range of (-1,1)). The parameters of this lightweight conditional adaptation network are updated synchronously with the parameters within the visual feature subspace during the incremental training phase, sharing the same incremental training loss function.
[0050] The common visual template is scaled and deflected. Specifically, the visual change direction vectors between adjacent stages of decay in the common visual template are extracted during the calculation. Its feature dimension is D. First, this vector is processed... Norm normalization yields the unit direction vector. And extract its initial modulus. The corresponding scaling factor Multiply by the initial module length to obtain the adjusted module length. For deflection adjustment, the unit direction vector is... Orthogonal rotation matrix corresponding to the deflection factor Perform matrix multiplication to obtain the adjusted direction vector. , wherein the orthogonal rotation matrix The construction process is as follows: In a preferred embodiment of this example, the deflection factor sequence output by the lightweight conditional adaptation network is first used to generate a linear mapping layer. Each parameter is an independent parameter, and these parameters are filled into a predefined... Antisymmetric matrix (i.e., satisfying) Subsequently, based on the Cayley transform principle, through the formula... The mapping generates a D-dimensional orthogonal matrix. To ensure numerical stability, a small regularization term is introduced during the transformation process. (Value) ), to ensure the matrix Satisfying the invertibility condition allows for rigid body rotation in high-dimensional feature space while maintaining vector magnitude decoupling. Finally, the adjusted magnitude... With the adjusted direction vector Perform the scalar multiplication again to obtain the updated visual change direction vector. This allows for the reconstruction and updating of common visual templates.
[0051] The common visual templates, after scaling and deflection adjustments, are injected as initial parameter values into the visual feature subspace partitions allocated to the newly added aquatic product category. In the subsequent incremental training process, all network parameters in the ternary visual decoupled encoder corresponding to each known aquatic product category are locked, preventing them from receiving gradient updates during backpropagation. While keeping the known category parameters frozen, the labeled sample set of the newly added aquatic product category is input into the network. Forward propagation and backward gradient updates are performed only on the parameters within the visual feature subspace partitions of the newly added aquatic product category, and the learnable parameters in the connected spoilage stage visual locator. In specific implementation, the incremental total loss function in the incremental training phase includes: the spoilage stage classification cross-entropy loss of the newly added category. Band attention constraint loss term The classification loss for the decay stage only calculates the cross-entropy between the output of the visual feature extraction branch for the newly labeled category samples and the actual decay stage label. The optimizer for incremental training uses the SGD algorithm, with an initial learning rate set to 1 / 10 of the learning rate in the main training stage. To prevent catastrophic forgetting in the model, the momentum coefficient is set to 0.9. An early stopping protection mechanism is introduced into the incremental training process. When the incremental total loss function decreases less than the preset tolerance threshold or stops decreasing within 5 consecutive training rounds, the iteration is automatically stopped, thereby completing the incremental access training of the category.
[0052] Furthermore, the interactive encoding module concatenates the category-inherent feature components with the shared feature map, and inputs the concatenated features into the mapping layer of the interactive branch for conditional encoding to extract the category-corruption interactive feature components; it calculates the cosine similarity between the corruption evolution feature components and the reference vectors of the prototypes of each corruption stage, and uses the corruption stage prototype with the highest cosine similarity as the initial corruption stage prototype retrieval output.
[0053] The extracted one-dimensional category-specific feature components are expanded in spatial dimension. Specifically, the one-dimensional feature vector is continuously broadcast and copied in the length and width spatial dimensions to force its spatial resolution to align with the spatial resolution of the three-dimensional shared feature map. Then, the copied and expanded category feature tensor and the shared feature map are concatenated in the feature channel dimension. For example, if the number of channels in the shared feature map is C and the length of the one-dimensional category-specific feature component is D, the concatenation will form a fused feature tensor with a total number of channels of C+D. This tensor fully contains the category prior information and the original spectral spatial information.
[0054] The fused feature tensor is input into the mapping layer of the interaction branch to perform conditional encoding. The mapping layer adopts a cascaded network structure. First, it uses a 1×1 convolutional kernel to linearly combine and interact with the fused feature tensor across channels, reducing the channel dimension from C+D back to the number of channels C. This allows for deep reorganization of the band and spatial response features in the shared feature map under the constraint of the inherent features of the product category. Next, global average pooling is used to aggregate and compress the reorganized spatial features along the width and height dimensions of the feature map, generating a one-dimensional spatial aggregation vector of length C. This aggregation vector is then input into a multilayer perceptron. Specifically, the multilayer perceptron contains two cascaded fully connected layers. The first fully connected layer reduces the vector dimension to the preset hidden layer dimension and performs feature filtering using the ReLU nonlinear activation function. The second fully connected layer then maps it to the target feature dimension, finally extracting a one-dimensional product category-pollution interaction feature component.
[0055] One-dimensional corruption evolution feature components are extracted from the corruption feature branches output by the decoupled encoder in parallel, and a pre-constructed corruption stage prototype reference system is invoked. The reference vectors of each corruption stage prototype in this reference system are traversed, and the cosine similarity between the corruption evolution feature component and each reference vector in the feature space is calculated one by one. The specific mathematical calculation process is as follows: the one-dimensional corruption evolution feature component is multiplied by the current reference vector, and the L2 norm of both is calculated in the feature space. The result of the inner product is divided by the product of the L2 norms of both, thereby generating a similarity scalar value representing the size of the angle between the vectors for each corruption stage prototype in the reference system.
[0056] All calculated cosine similarity scalar values are compared numerically, and the largest cosine similarity value is identified and extracted. The corresponding corruption stage prototype is then identified as the node in the feature space closest to the current sample's evolutionary state. This node with the largest value is used as the initial corruption stage prototype for retrieval and output, along with its reference vector coordinates. This provides a baseline coordinate anchor for subsequent offset positioning calculations and state transition verification.
[0057] Further, the process of outputting the corruption stage corresponding to the corruption stage prototype with the highest cosine similarity includes: inputting the category-corruption interaction feature components into the fully connected layer of the locator and outputting an offset vector; adding the offset vector to the reference vector of the initial corruption stage prototype to obtain the corrected stage position vector; in the directed graph structure, verifying whether the projection direction of the corrected stage position vector is consistent with the natural evolution direction of the corruption stage; when the projection direction changes in the opposite direction, applying a temporal penalty term to the offset vector, and using the offset vector after applying the temporal penalty term to re-add the reference vector of the initial corruption stage prototype to obtain the updated stage position vector, until the projection direction of the updated stage position vector is consistent with the natural evolution direction; calculating the cosine similarity between the stage position vector consistent with the natural evolution direction and the reference vectors of each corruption stage prototype in the corruption stage prototype reference system; and outputting the corruption stage corresponding to the corruption stage prototype with the highest cosine similarity as the final corruption stage identification result.
[0058] One-dimensional category-corruption interaction feature components are extracted and input into a corruption stage visual locator. This locator consists of a single fully connected layer containing a pre-trained linear weight matrix and a bias term vector. The number of rows in the linear weight matrix matches the feature dimension of the preset corruption stage prototype reference vector, and the number of columns matches the feature dimension of the input category-corruption interaction feature components. By performing matrix multiplication on the input category-corruption interaction feature components and the linear weight matrix, and then accumulating the bias term vector, the input feature components are directly mapped to a continuous offset vector. The feature dimension of this offset vector matches the feature dimension of the corruption stage prototype reference vector. Subsequently, element-wise addition is used to add the offset vector to the previously retrieved initial corruption stage prototype reference vector to calculate the preliminarily corrected stage position vector.
[0059] In the pre-constructed directed graph structure, the specific category to which the aquatic product to be inspected belongs is first identified. Following the temporal evolution trajectory corresponding to this category, the unique next temporal neighbor node of the initial spoilage stage prototype is obtained based on the stage temporal edge. The reference vector of this neighbor node is extracted. The reference vector of the current initial spoilage stage prototype is subtracted from the reference vector of the next temporal neighbor node to calculate the natural evolution direction vector representing the state transition. Simultaneously, the reference vector of the initial spoilage stage prototype is subtracted from the initially corrected stage position vector to calculate the actual displacement vector. The dot product algorithm is then used to calculate the actual displacement vector. with natural evolution direction vector normalized inner product scalar value This is used to verify the timing consistency of the projection direction; if Greater than or equal to the preset consistency threshold (The included angle in the corresponding high-dimensional feature space does not exceed 60°), and the projection direction of the actual offset is determined to be basically consistent with the natural evolution direction; if If the actual displacement projection direction deviates too much from the natural evolution direction, it means that the feature extracted in the feature latent space has an abnormal reverse jump that is inconsistent with the stage progression direction estimated in the training set.
[0060] When an abnormal reverse jump in the projection direction is detected (i.e., the currently calculated normalized inner product scalar value is less than the preset consistency threshold), the system automatically triggers a joint iteration mechanism of timing redirection and decay, and initializes the iteration counter. And set a maximum iteration threshold. (In this embodiment, it is preferably set to 5 times). In the t-th iteration, the system performs a joint correction on the direction and magnitude of the original output offset vector. Specifically, the offset vector from the previous round... (When t=1, That is, the initial actual displacement vector Apply dynamic decay weights And introduce the natural evolution direction vector. The normalized guiding term and the iterative update formula for correcting the offset vector are as follows: ; in, The decay weight, which decreases with the number of iterations, is calculated using the following formula: The attenuation coefficient Based on the maximum number of iterations Compared with the preset minimum retention weight The specific relationship is derived from dynamic calculation: ; In this embodiment, It is preferable to set it to 0.1 to ensure that the original non-uniform noise components are sufficiently suppressed in the last iteration; The modulus alignment coefficient is used to ensure that the scale of the introduced natural evolution direction guiding term in the feature space matches the current state. Its value is dynamically obtained from the L2 norm of the offset vector in the previous iteration, i.e., set... .
[0061] Through this dynamic, self-consistent weighted fusion of data, the offset vector is corrected. In each iteration, not only is the amplitude of the abnormal noise attenuated and suppressed, but its spatial direction is also gradually forced to deflect towards the natural evolution direction defined by the preset graph structure. Subsequently, the corrected offset vector... The updated stage position vector is obtained by adding it to the reference vector of the initial corruption stage prototype; the normalized inner product scalar value between the updated stage position vector and the natural evolution direction vector is then recalculated. If the new inner product scalar value reaches a preset consistency threshold, the direction redirection correction is considered successful, the iteration terminates, and the current stage position vector is output; otherwise, if the threshold is not reached and the iteration count is exceeded, the process is considered complete. Then increment the iteration counter t by 1 and repeat the above iteration process. If the iteration reaches... If the convergence fails (i.e., the inner product scalar value has not yet reached the threshold), it indicates that the category-decay interaction features of the current hyperspectral image are subject to severe noise interference or are in an unbelievable cross-domain drift state. At this point, the system triggers a Bayesian prior degradation protection mechanism based on high uncertainty noise, stops relying on the current offset vector, assigns it a zero vector (i.e., degradation mechanism), and instead adopts the global mean prior with the highest system confidence, that is, directly outputs the reference vector of the initial decay stage prototype as the final stage position vector, thereby effectively preventing extreme abnormal features from causing out-of-bounds misjudgments in the graph structure.
[0062] Obtain the final stage position vector after time-series verification, and call the aforementioned spoilage stage prototype reference system again. Traverse the reference vector of the final stage position vector with the reference vectors of each spoilage stage prototype belonging to the current category and all other known categories in the reference system. In the feature space, calculate the cosine similarity scalar value between the final stage position vector and each reference vector one by one. Compare all the cosine similarity scalar values, retrieve and select the one with the largest value, and extract the spoilage stage prototype node corresponding to the maximum value from the directed graph structure. Finally, the inherent spoilage stage category label of the node (such as initial stage, secondary fresh stage, or deterioration stage) is used as the final spoilage stage identification result of the aquatic product to be inspected and output in a unified standard.
[0063] Example 2: Specifically, this embodiment demonstrates a rapid integration and online quality grading detection process for newly added aquatic product categories. It showcases how to introduce new aquatic product categories at low cost without disrupting existing model features, and how to achieve non-destructive identification of spoilage stages on the actual processing line. First, incremental integration and initialization of the new category are performed. The system acquires a labeled sample set of the new aquatic product category and its corresponding category attribute description data. This attribute description data covers multiple quantitative dimensions reflecting the physicochemical properties of aquatic products. Subsequently, in the high-level representation space of the shared convolutional backbone network of the ternary visual decoupled encoder, the system evaluates the visual semantic similarity between the category attribute description data of the new aquatic product category and the category attribute data of each known aquatic product category. Based on this visual semantic similarity, the system allocates a visual feature subspace partition for the new aquatic product category to store its unique visual feature parameters.
[0064] Next, the system constructs a common visual template for the spoilage stages across product categories. Multiple quantitative attribute values of the newly added product categories are combined into an input vector and fed into a lightweight conditional adaptation network. The output is mapped to scaling and deflection factors corresponding to each spoilage stage. The scaling and deflection factors are used to adjust the magnitude and direction of the common visual template's orientation vector, completing the scaling and deflection adjustments. The adjusted common visual template is then injected into the visual feature subspace partition of the newly added aquatic product category. All parameters in the ternary visual decoupling encoder corresponding to each known aquatic product category are locked so that they do not receive gradient updates during backpropagation. Only the parameters within the visual feature subspace partition of the newly added aquatic product category and the corresponding spoilage stage visual locator are incrementally trained using the labeled sample set.
[0065] In the online detection stage of the actual processing line, the stage carrying the aquatic products to be inspected is controlled to pass through the scanning area of the hyperspectral camera. In the visible-near infrared band, the system acquires the light intensity response signal of the aquatic products to be inspected. Then, the initial data is corrected by the pre-collected total reflection reference data and dark current reference data to eliminate environmental and equipment interference and output a dataset containing multiple single-band spectral images.
[0066] Subsequently, feature decoupling and extraction are performed. The corrected hyperspectral image is input into a shared convolutional backbone network and outputs a shared feature map. This feature map is simultaneously input into the category visual feature extraction branch and the spoilage stage visual feature extraction branch. The category branch maps and outputs the category-specific feature components, and the spoilage branch maps and outputs the spoilage evolution feature components.
[0067] The system further concatenates the inherent feature components of the product category with the shared feature map, and inputs the concatenated features into the mapping layer of the interaction branch for conditional encoding to extract the product category-corruption interaction feature components. At the same time, it calculates the cosine similarity between the corruption evolution feature components and the reference vectors of the prototypes of each corruption stage. The corruption stage prototype with the highest cosine similarity is used as the initial corruption stage prototype retrieval output. The product category-corruption interaction feature components are input into the fully connected layer of the locator to output the offset vector, and the offset vector is added to the reference vector of the initial corruption stage prototype to obtain the corrected stage position vector.
[0068] Finally, in the directed graph structure, the system verifies whether the projection direction of the corrected stage position vector is consistent with the natural evolution direction of the corruption stage. When it is confirmed that the projection direction has not undergone a reverse jump that violates the time sequence and satisfies the time sequence consistency, the system calculates the cosine similarity between the stage position vector consistent with the natural evolution direction and the reference vector of each corruption stage prototype in the corruption stage prototype reference system. The corruption stage corresponding to the corruption stage prototype with the largest cosine similarity is output as the final corruption stage identification result, and the pipeline is guided to complete the subsequent quality grading accordingly.
[0069] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A universal testing platform for multiple categories of aquatic products based on transfer learning, characterized in that: include: The data acquisition module acquires hyperspectral images of the aquatic products to be inspected and a pre-constructed reference system of prototyping stages of spoilage. The reference system contains multiple prototyping stages of spoilage arranged in a directed graph structure according to temporal edges. The decoupling extraction module inputs the hyperspectral image into the ternary visual decoupling encoder to extract the shared feature map, the category-specific feature components, and the spoilage evolution feature components. The interactive coding module, using the inherent feature components of the product category as conditions, performs conditional coding together with the shared feature map in the interactive branch to extract the product category-spoilage interactive feature components. Calculate the similarity between the corruption evolution feature components and the prototypes of each corruption stage, and retrieve the prototype of the initial corruption stage. The offset positioning module inputs the category-corrosion interaction feature components into the locator and outputs an offset vector. The offset vector is then added to the reference vector of the prototype in the initial corruption stage to obtain the corrected position vector. It also verifies the temporal consistency between the projection direction of the corrected position vector in the directed graph structure and the natural evolution direction. When the temporal consistency is satisfied, it calculates the cosine similarity with the prototype of each corruption stage and outputs the corruption stage corresponding to the prototype of the corruption stage with the largest cosine similarity.
2. The universal detection platform for multiple categories of aquatic products based on transfer learning according to claim 1, characterized in that, The acquisition of hyperspectral images of the aquatic products to be inspected includes multiple single-band spectral images acquired at preset wavelength intervals within the visible-near-infrared band.
3. The universal detection platform for multiple categories of aquatic products based on transfer learning according to claim 1, characterized in that, The pre-constructed corruption stage prototype reference system is determined based on a pre-constructed visual semantic knowledge graph: the visual semantic knowledge graph includes category attribute nodes, corruption stage nodes, and sensory phenotype nodes, as well as attribute-stage correlation prior edges pointing from category attribute nodes to corruption stage nodes, stage-phenotype causal edges pointing from corruption stage nodes to sensory phenotype nodes, and stage temporal edges pointing from one corruption stage node to another corruption stage node, with band attention prior data attached to each attribute-stage correlation prior edge; for each known category in the known aquatic product category set, at each corruption stage, the trained ternary visual decoupling encoder is used to extract the corruption evolution feature components of multiple samples, and the mean vector of the corruption evolution feature components of all samples under that corruption stage is calculated as the reference vector of the corruption stage prototype of that category at that corruption stage; the corruption stage prototypes of all corruption stages of all known categories are summarized to form the corruption stage prototype reference system, and the corruption stage prototypes are arranged in a directed graph structure according to the corruption evolution direction defined by the stage temporal edges.
4. The universal detection platform for multiple categories of aquatic products based on transfer learning according to claim 1, characterized in that, The ternary visual decoupling encoder includes a shared convolutional backbone network, a category visual feature extraction branch, a decay stage visual feature extraction branch, an interaction visual feature extraction branch, and a decay stage visual locator; the shared convolutional backbone network receives hyperspectral images and outputs a shared feature map; the category visual feature extraction branch receives the shared feature map and outputs category-specific feature components; The visual feature extraction branch for the corruption stage receives the shared feature map and outputs the corruption evolution feature components; The interactive visual feature extraction branch receives category-inherent feature components and shared feature maps for conditional encoding, and outputs category-corrosion interactive feature components; the corruption stage visual locator contains a fully connected layer, which receives category-corrosion interactive feature components and outputs an offset vector.
5. The universal detection platform for multiple categories of aquatic products based on transfer learning according to claim 1, characterized in that, The training loss of the ternary visual decoupled encoder includes: inputting the hyperspectral image of the labeled sample into a shared convolutional backbone network to obtain a shared feature map, and then obtaining the category-specific feature component and the spoilage evolution feature component through the category visual feature extraction branch and the spoilage stage visual feature extraction branch, respectively; calculating the category classification loss of the category-specific feature component and the labeled category label, and inverting the gradient generated by the category classification loss through a gradient inversion layer during backpropagation before backpropagating it to the shared convolutional backbone network; calculating the spoilage evolution feature component and the spoilage stage classification loss of the labeled spoilage label, and calculating the mutual information between the two to generate the first mutual information loss term; and based on the visual semantic knowledge graph... The band attention prior data on the attribute-stage correlation prior edge in the spectrum is used to calculate the band attention constraint loss term; its value is equal to the ratio of the sum of the feature channel activation values of the corruption evolution feature component outside the band interval specified by the band attention prior data to the sum of the feature channel activation values within the interval; the global mutual information between the category-inherent feature component and the corruption evolution feature component is calculated to generate the second mutual information loss term; the category classification loss, corruption stage classification loss, band attention constraint loss term, first mutual information loss term and second mutual information loss term are weighted and summed to obtain the total loss function, and the network parameters of the ternary visual decoupling encoder are updated accordingly.
6. The universal detection platform for multiple categories of aquatic products based on transfer learning according to claim 5, characterized in that, It also includes a category incremental access module: acquiring labeled sample sets and category attribute description data for newly added aquatic product categories. The category attribute description data includes quantitative attribute values of the newly added aquatic product categories in the dimensions of free amino acid content, polyunsaturated fatty acid content, water content, and tissue enzymatic features. In the high-level representation space of the shared convolutional backbone network, based on the visual semantic similarity between the category attribute description data of the newly added aquatic product categories and the category attribute data of each known aquatic product category, visual feature subspace partitions are assigned to the newly added aquatic product categories. A common visual feature across the spoilage stages of each category is constructed. Template; Quantitative attribute values on the dimensions of free amino acid content, polyunsaturated fatty acid content, water content, and tissue enzymatic characteristics are combined into an input vector and input into a lightweight conditional adaptation network, mapping the output to scaling factors and deflection factors corresponding to each putrefaction stage; The scaling factor is multiplied by the magnitude of the visual change direction vector between each putrefaction stage in the common visual template to obtain the adjusted magnitude, and the normalized visual change direction vector is multiplied by the orthogonal rotation matrix constructed by the deflection factor to obtain the adjusted direction vector, thus completing the scaling and deflection adjustment of the common visual template; The adjusted common visual template is injected into the visual feature subspace partition of the newly added aquatic product category; all parameters in the three-element visual decoupling encoder corresponding to each known aquatic product category are locked, and incremental training is performed on the parameters in the visual feature subspace partition of the newly added aquatic product category and the corresponding visual locator for the spoilage stage is carried out using the labeled sample set.
7. The universal detection platform for multiple categories of aquatic products based on transfer learning according to claim 1, characterized in that, The interactive encoding module concatenates the inherent feature components of the product category with the shared feature map, and inputs the concatenated features into the mapping layer of the interactive branch for conditional encoding to extract the product category-corruption interactive feature components; it calculates the cosine similarity between the corruption evolution feature components and the reference vectors of the prototypes of each corruption stage, and uses the corruption stage prototype with the largest cosine similarity as the initial corruption stage prototype retrieval output.
8. The universal detection platform for multiple categories of aquatic products based on transfer learning according to claim 1, characterized in that, The process of identifying the corruption stage corresponding to the corruption stage prototype with the highest output cosine similarity includes: inputting the category-corruption interaction feature components into the fully connected layer of the locator and outputting an offset vector; adding the offset vector to the reference vector of the initial corruption stage prototype to obtain the corrected stage position vector; in the directed graph structure, verifying whether the projection direction of the corrected stage position vector is consistent with the natural evolution direction of the corruption stage; when the projection direction undergoes a reverse jump, applying a temporal penalty term to the offset vector, and re-adding the offset vector after applying the temporal penalty term to the reference vector of the initial corruption stage prototype to obtain the updated stage position vector, until the projection direction of the updated stage position vector is consistent with the natural evolution direction; calculating the cosine similarity between the stage position vector consistent with the natural evolution direction and the reference vectors of each corruption stage prototype in the corruption stage prototype reference system; and outputting the corruption stage corresponding to the corruption stage prototype with the highest cosine similarity as the final corruption stage identification result.