Prawn wild and cultured non-destructive identification method and system based on YOLO segmentation and hyperspectral imaging
Patent Information
- Application Number
- CN202611057856.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-16
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2046-07-16
AI Technical Summary
当前主流方案多提取整鱼平均光谱开展分析与建模,但大黄鱼不同解剖部位(头部、眼部、背部、腹部、鱼鳍等)在体表色素、组织结构、脂质分布、散射特性上存在明显异质性;整鱼平均光谱会平滑、掩盖局部关键差异信息,导致鉴别模型特征辨识度下降、可解释性差
[0049](1)解决整鱼光谱信息丢失问题,判别精度更高
Smart Images

Figure CN122574912B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of intelligent detection of aquatic products, computer vision and hyperspectral non-destructive testing technology, specifically to an automated non-destructive identification method and system for wild and farmed large yellow croaker that combines a lightweight YOLO instance segmentation model with hyperspectral feature analysis. Background Technology
[0002] Currently, the identification of wild / farmed large yellow croaker mainly relies on manual visual judgment. Practitioners distinguish them based on their experience in body color, body shape, and appearance. This method is highly subjective, inefficient, and lacks standardized judgment criteria. Furthermore, it is prone to misjudgment over a long period of time and cannot meet the needs of batch testing and routine market supervision.
[0003] Among existing non-destructive testing technologies, hyperspectral imaging technology can simultaneously acquire spatial images and continuous band spectral information of samples. With its advantages of being non-destructive, rapid, and rich in feature information, it has been gradually applied to fields such as fish quality inspection and species identification. Current mainstream methods mostly extract the average spectrum of the whole fish for analysis and modeling. However, different anatomical parts of the large yellow croaker (head, eyes, back, abdomen, fins, etc.) exhibit significant heterogeneity in surface pigmentation, tissue structure, lipid distribution, and scattering characteristics. The average spectrum of the whole fish can smooth out and mask key local differences, leading to decreased feature recognition and poor interpretability of the identification model. Furthermore, traditional hyperspectral region of interest (ROI) extraction often employs manual selection and fixed threshold segmentation, which is greatly affected by the fish's posture, surface reflection, and the operator's subjective factors. This results in low standardization and poor repeatability of region extraction, making it difficult to achieve industrialized and automated batch testing.
[0004] In the field of computer vision, instance segmentation technology can achieve pixel-level accurate division of target regions. Existing two-stage / Transformer segmentation models such as Mask R-CNN and Mask2Former have high segmentation accuracy, but they have a large number of model parameters, slow inference speed, and high deployment threshold, making them unsuitable for edge application scenarios such as portable detection devices and rapid on-site screening. Meanwhile, lightweight instance segmentation solutions for fish body parts are still lacking and cannot form efficient linkage with hyperspectral systems.
[0005] In summary, existing technologies suffer from drawbacks such as low efficiency of manual detection, loss of local differences in spectral features of traditional whole fish, non-standard ROI extraction, and difficulty in lightweighting and implementing segmentation models. There is an urgent need to develop a non-destructive identification solution for wild / farmed large yellow croaker that is highly automated, has excellent discrimination accuracy, strong interpretability, and is easy to deploy on-site. Summary of the Invention
[0006] This invention provides a non-destructive identification method and system for wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging. It integrates lightweight YOLO instance segmentation and hyperspectral feature analysis technology to achieve automated and standardized extraction of key anatomical parts of the fish. Based on the spectral differences of different parts, it can accurately distinguish between wild and farmed large yellow croaker. This method is non-destructive throughout the process, has a fast detection speed, and strong feature interpretability. It balances lightweight model and detection accuracy, can be deployed on portable devices, and is suitable for various application scenarios such as laboratories, aquatic product markets, and processing workshops.
[0007] This invention is achieved through the following technical solution:
[0008] A non-destructive method for identifying wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging includes the following steps:
[0009] Step 1: Sample Collection and Multimodal Dataset Construction. Wild and farmed large yellow croaker samples were collected. A visible-near-infrared hyperspectral imaging system was used to simultaneously acquire hyperspectral images containing large yellow croaker and standard white plates. The hyperspectral images were converted into corresponding RGB preview images. Instance-level polygon annotations were performed on the RGB images. The annotation categories included head, eyes, back, abdomen, pectoral fin, caudal fin, and standard white plate. After annotation, training and validation sets were obtained, and a large yellow croaker body part instance segmentation dataset was constructed.
[0010] Step 2: Training the lightweight YOLO instance segmentation model. A lightweight YOLO instance segmentation model is trained based on the instance segmentation dataset. The model consists of an input end, a backbone network, a feature fusion network, and a detection and segmentation output end. After training, the optimal model is selected to achieve automatic recognition and binary mask output of various anatomical parts of the large yellow croaker and the standard white plate area.
[0011] Step 3: Same-image whiteboard radiometric calibration and regional spectral extraction. Using the standard whiteboard mask output by the model, the reflectance of the entire hyperspectral image is calibrated using the same whiteboard mask to obtain the true spectral reflectance of each pixel in the image. Valid spectral bands are selected, and the masks of each part of the fish body are mapped pixel by pixel to the calibrated hyperspectral image. The average reflectance spectra of the head, eyes, back, abdomen, pectoral fin, and caudal fin are extracted respectively.
[0012] Step 4: Spectral preprocessing and differential feature analysis. The average reflectance spectra of each extracted part are preprocessed by standard normal variable transformation; the spectral difference and Cohen's d effect of the same part of wild large yellow croaker and farmed large yellow croaker are calculated respectively, and the spectral feature dimensionality reduction and visualization analysis are completed by combining principal component analysis to determine the key fish parts with high discrimination ability.
[0013] Step 5: Classification model training and automated identification. Using the spectral features of the key parts selected as input, a binary classification identification model is constructed, and the model training is completed by group cross-validation. For the large yellow croaker to be detected, hyperspectral image acquisition, part instance segmentation, spectral extraction, and feature inference are performed in sequence, and finally the identification result of whether the large yellow croaker to be detected is wild or farmed is output.
[0014] In a preferred embodiment, the working wavelength of the hyperspectral imaging system in step 1 is 400-1000nm; a halogen lamp is used as a supplementary light source, the light source is symmetrically arranged on both sides of the hyperspectral camera, the angle between the light source and the surface of the large yellow croaker sample is 45°, the distance between the light source and the sample is set to 30cm, the light source is preheated for 5-10 minutes before use, and only the halogen lamp is turned on as the sole illumination source during the imaging process.
[0015] As a preferred embodiment, the instance segmentation dataset constructed in step 1 contains 289 RGB images converted from hyperspectral images. 100 of these images are selected for fine manual annotation. The training set and validation set are divided in an 8:2 ratio. The annotation process unifies the boundary definition of each part of the fish body. The annotation range of the head is from the snout to the gill cover area. The annotation range of the eyes is the complete outline of the eyes. The back and abdomen correspond to the upper and lower main body areas of the fish body, respectively. The pectoral fins and caudal fins are annotated according to the natural outline of the fin rays to avoid the problems of overlapping areas, missing annotations, and mis-annotation.
[0016] In a preferred embodiment, the backbone network of the lightweight YOLO instance segmentation model in step 2 integrates C3k2, SPPF, and C2PSA modules; after training, the model performance metrics meet the following requirements: detection box metrics Precision ≥ 0.976, Recall ≥ 0.983, mAP50 ≥ 0.981, mAP50-95 ≥ 0.700; mask segmentation metrics Mask-Precision ≥ 0.969, Mask-Recall ≥ 0.976, Mask-mAP50 ≥ 0.972, Mask-mAP50-95 ≥ 0.669.
[0017] In a preferred embodiment, in step 3, during the data processing stage, a standard whiteboard area is first selected in the hyperspectral image, and the average digital response value of this area in each band is calculated. Subsequently, the digital response values or average spectra of the target area in each band are compared with those of the standard whiteboard area. The formula for calculating the reflectance of the target area is: ,
[0018] In the formula, For the target region at wavelength Reflectance at that location; For standard whiteboards at wavelength The known reflectivity at that location; For the target region at wavelength The digital response value at the location; For the standard whiteboard area at wavelength The digital response value at the location; For dark field at wavelength The digital response value at the location, if no separate dark-field image is acquired, is calculated using a whiteboard normalization method, and the formula is simplified as follows: (2), After segmenting and extracting the regional spectra of different body parts of the large yellow croaker, the average reflectance spectra of different parts of each sample were further processed and analyzed. The original hyperspectral images were normalized using a whiteboard and constrained by body part masks to obtain the regional average spectra of each sample at different body parts. This resulted in a wide-table format spectral data file, where each row corresponds to a single body part of a sample, and each column represents the average reflectance at a given wavelength. The data table includes the sample name, category, body part category, and reflectance values at each wavelength. Let the average spectrum of the (i)th sample at the (m)th body part of the fish be: (3), In the formula, Indicates the first The first sample The fish body part in the first Average reflectance at each spectral band; This represents the total number of bands in the original spectrum. The sample category is recorded according to the file name prefix and the category field in the data table. Among them, farmed large yellow croaker and wild large yellow croaker are used as the research objects for difference analysis and classification modeling, respectively.
[0019] In a preferred embodiment, the effective spectral band range selected in step 3 is 450–950 nm; for small target areas such as the eyes and pectoral fins, morphological denoising is performed on the mask output by the model to eliminate edge noise pixels before average reflectance spectrum extraction.
[0020] The effective spectral band range is located in the visible to near-infrared region, which can retain the main spectral information related to fish surface color, pigment absorption, tissue scattering, and water content, while reducing the impact of short-wavelength and long-wavelength noise on the interpretation of results. Formula 3 is obtained after band selection:
[0021] (4),
[0022] in, ,(t) represents the number of valid bands retained after screening. All subsequent spectral statistical analyses and graphical plots are based on the valid bands after screening.
[0023] To compare the spectral differences between different parts of the fish, the average spectra were grouped according to the type of fish part. The average reflectance at each wavelength was calculated for the head, eyes, pectoral fins, back, abdomen, and tail fin. For the (m)th part, the formula for calculating its average reflectance at wavelength is:
[0024] (5),
[0025] In the formula, Indicates the first Each part of the fish body at wavelength Average reflectance at; This indicates the number of valid spectral samples corresponding to that region; Indicates the first The sample in the first individual fish body parts, wavelength Average reflectance after screening at the location; Number the samples; Number the parts of the fish's body; The selected valid band numbers are: This indicates the number of valid bands retained after filtering.
[0026] To reflect the degree of dispersion among different samples, the standard deviation of each part at each wavelength was calculated, and the overall trend of the spectrum of different parts was displayed by the method of "mean curve ± standard deviation shading".
[0027] To analyze the spectral differences between wild and farmed large yellow croaker at different body parts, the samples were divided into two groups based on category and body part. The average reflectance spectra of farmed and wild samples at the same body part were calculated separately. For the m-th body part, the average reflectance of farmed and wild samples at the same wavelength is expressed as follows:
[0028] (6),
[0029] In the formula, and These represent the farmed and wild large yellow croakers in the [number]th [year]. individual fish body parts, wavelength Average reflectance at; Indicates aquaculture samples, Indicates wild-type sample; and They represent the first The number of effective spectral samples from cultured and wild samples in each part of the fish body; and They represent the first The first breeding sample and the first The wild sample in the first individual fish body parts, wavelength Average reflectance after screening.
[0030] To further observe the direction of the difference, the average reflectance difference between the farmed and wild samples was calculated:
[0031] In the formula, Indicates the first Each part of the fish body at wavelength The difference in average reflectance between farmed and wild samples. When, it indicates that the average reflectance of the cultured sample at that location and in that wavelength band is higher than that of the wild sample; when When the mean is higher, it indicates that the average reflectance of the wild sample at that location and wavelength is higher than that of the cultured sample. By plotting the difference spectra of different parts of the fish, the distribution characteristics of the differences in different fish regions and wavelengths can be analyzed.
[0032] In a preferred embodiment, step 4 uses Cohen's d effect size to measure the intensity of differences between wild and cultured samples in each band. Parts and wavelengths The formula for calculating Cohens d is:
[0033] (7),
[0034] In the formula, Indicates the first Each part of the fish body at wavelength Standardized differences between cultured and wild samples; and These represent the cultured and wild samples at the [number]th [year]. individual fish body parts, wavelength Average reflectance at; It represents the combined standard deviation of the two types of samples at this location and wavelength.
[0035] Combined standard deviation The calculation formula is:
[0036] (8),
[0037] In the formula, and They represent the first The number of effective spectral samples from cultured and wild samples in each part of the fish body; and These represent the cultured and wild samples at the [number]th [year]. individual fish body parts, wavelength The standard deviation at that point. Since this study focuses on the contribution of different wavelengths to distinguishing wild and farmed large yellow croaker, the standard deviation is used in the results presentation. This represents the absolute value of the effect size. The larger the absolute value of the effect size, the more significant the contribution of this band to distinguishing wild and farmed samples at the corresponding body part of the fish.
[0038] In a preferred embodiment, after spectral difference analysis, effect size analysis, and principal component analysis in step 4, the head, eyes, and back are identified as key areas for distinguishing wild and farmed large yellow croaker. A comprehensive identification feature set is constructed by integrating the spectral characteristics of these three areas.
[0039] To observe the distribution of different fish body parts and different samples in the overall spectral feature space, principal component analysis (SNV) was used to reduce the dimensionality of the high-dimensional spectral data for visualization. Before PCA analysis, each spectrum was first transformed using a standard normal variable to reduce the influence of baseline shift and overall intensity differences on the principal component distribution. The SNV processing formula is as follows:
[0040] (9),
[0041] In the formula, Indicates the first The spectrum in the first Reflectance at each effective band; and These represent the mean and standard deviation of the spectrum across all effective bands, respectively. After SNV processing, the spectral features are standardized, and PCA is used to extract the first two principal components for display in a two-dimensional scatter plot.
[0042] In a preferred embodiment, step 5 uses a logistic regression algorithm to construct a binary classification model; it employs GroupKFold cross-validation, using a single large yellow croaker sample as the grouping unit, and introduces a class weight balancing strategy to optimize model training, avoiding data leakage and sample imbalance. The coefficient of determination (R²) and root mean square error (RMSE) are calculated using equations. RMSE is used to measure the proportion of observed variation explained by the model, reflecting the average magnitude of the prediction error.
[0043] (10),
[0044] Multiple regression analysis :
[0045] (11).
[0046] A non-destructive identification system for wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging is used to execute the non-destructive identification method, including a hyperspectral image acquisition module, an image segmentation and inference module, a spectral calibration and extraction module, a spectral analysis module, and a classification and identification module;
[0047] The hyperspectral image acquisition module is used to acquire hyperspectral images containing large yellow croaker samples and standard white boards; the image segmentation and inference module has a built-in lightweight YOLO instance segmentation model that has been trained, and is used to output instance masks of various parts of the large yellow croaker and the standard white board; the spectral calibration and extraction module is used to complete radiometric calibration of the white board in the same image, effective band selection, and extraction of the average reflectance spectrum of various parts of the fish; the spectral analysis module is used to perform spectral preprocessing, spectral difference calculation, effect size calculation, and principal component analysis; the classification and identification module has a built-in binary classification and identification model that has been trained, and outputs the final identification result of whether the large yellow croaker is wild or farmed based on the input spectral features.
[0048] Beneficial effects: Compared with the prior art, the present invention has the following outstanding advantages:
[0049] (1) Solve the problem of loss of spectral information of whole fish and achieve higher discrimination accuracy.
[0050] This invention abandons the traditional whole-fish average spectrum scheme and uses instance segmentation to accurately separate multiple anatomical parts such as the head, eyes, back, abdomen, and fins, fully exploring the local spectral heterogeneity characteristics of the fish body. Experiments have shown that the spectral differences between wild and farmed large yellow croaker have significant site-dependent characteristics. The site-specific features can retain more discrimination information, and the identification accuracy is greatly improved compared with the whole-fish spectral model.
[0051] (2) Standardizes regional extraction, making it highly automated and repeatable.
[0052] The trained YOLO instance segmentation model automatically extracts the ROI of each part, replacing traditional methods such as manual selection and fixed segmentation. It is not affected by the fish's posture, surface reflection, or human operation. The region extraction standard is uniform and highly repeatable, and it is suitable for automated detection of large batches of samples.
[0053] (3) The model is lightweight and easy to deploy on site.
[0054] The lightweight YOLO instance segmentation architecture is adopted, which has fewer parameters and faster inference speed compared to models such as Mask R-CNN and Mask2Former. It can be deployed in portable hyperspectral devices and embedded terminals, eliminating the limitations of large laboratory equipment and supporting rapid on-site detection in aquatic product markets, mobile inspections, and processing workshops.
[0055] (4) The entire testing process is non-destructive, highly efficient, and highly interpretable.
[0056] This non-contact, non-destructive testing method, based on hyperspectral imaging, requires no chemical reagents or sample dissection and has a simple testing process. By combining the analysis of spectral differences in biological parts, the judgment criteria are traceable and interpretable, which is different from the traditional "black box" model and meets the application requirements of market supervision and quality traceability.
[0057] (5) Good versatility and expandability
[0058] The technical framework of this invention can be applied to other scenarios such as species identification, origin tracing, and freshness detection of marine and freshwater fish. At the same time, based on this solution, key characteristic bands can be screened to further simplify it into a low-cost multispectral detection system, reducing the cost of industrial application. Attached Figure Description
[0059] Figure 1 This is a schematic diagram of the technical route for distinguishing wild and farmed large yellow croaker based on the spectral characteristics of biological parts in this invention.
[0060] Figure 2 This is a schematic diagram of the ATH2000 handheld visible-near-infrared hyperspectral imaging system of the present invention.
[0061] Figure 3 This is a schematic diagram of the halogen light source arrangement equipment in the hyperspectral imaging system for large yellow croaker of the present invention.
[0062] Figure 4 This is a schematic diagram of the biological part segmentation results of the large yellow croaker based on the YOLO model in this invention.
[0063] Figure 5 This is a schematic diagram of the YOLO segmentation model structure in this invention.
[0064] Figure 6 This is a schematic diagram of the white reference area marking in the hyperspectral image of the large yellow croaker in this invention.
[0065] Figure 7 This is a graph showing the changes in training and validation metrics of the large yellow croaker body part segmentation model in this invention.
[0066] Figure 8 This is a graph showing the average reflectance spectrum of different biological parts of the large yellow croaker in this invention.
[0067] Figure 9 This is a schematic diagram comparing the average reflectance spectra of different biological parts of wild and farmed large yellow croaker in this invention.
[0068] Figure 10 This is a schematic diagram illustrating the spectral differences between different biological parts of wild and farmed large yellow croaker in this invention.
[0069] Figure 11 This is a schematic diagram illustrating the discriminant effect size analysis of different biological parts of wild and farmed large yellow croaker in this invention.
[0070] Figure 12 This is a graph showing the average reflectance spectrum of different biological parts of the large yellow croaker in this invention.
[0071] Figure 13 A schematic diagram of principal component analysis of large yellow croaker based on the spectral characteristics of different biological parts in this invention. Detailed Implementation
[0072] The embodiments of the present invention will be described in detail below with reference to the accompanying drawings: These embodiments are implemented based on the technical solution of the present invention, and provide detailed implementation methods and specific operation processes, but the protection scope of the present invention is not limited to the following embodiments.
[0073] Example 1: Non-destructive identification method for wild / farmed large yellow croaker:
[0074] 1. Experimental Environment and Equipment
[0075] Hardware: The hyperspectral camera selected is the ATH2000 from Opto Tech, the handheld visible-near infrared hyperspectral imaging system (band 400-1000nm), Osram halogen supplemental light, standard Spectralon whiteboard, high-performance training server, and portable embedded detection terminal.
[0076] Software: Deep learning training framework, hyperspectral data processing software, image annotation tools, spectral analysis and machine learning modeling tools.
[0077] 2. Sample and Dataset Preparation
[0078] In this experiment, 42 wild-caught and 56 farmed large yellow croakers were collected, and all fish were cleaned of water stains and impurities. The light source and equipment were arranged according to step 1 of this invention, and 3-5 hyperspectral images of each fish in different poses were collected, resulting in a total of 289 sets of valid hyperspectral data. Figure 1 As shown.
[0079] Hyperspectral data was converted into RGB preview images. A polygon annotation tool was used to perform pixel-level annotations on seven regions: head, eyes, back, abdomen, pectoral fins, caudal fins, and white body surface. Finally, 100 annotated images were selected to construct a segmentation dataset, divided into a training set (80 images) and a validation set (20 images) in an 8:2 ratio. The annotation process strictly defined the boundaries of each part: the head was defined as the area from the snout to the gill cover; the eyes as the complete outline of the eye; the back and abdomen as the upper and lower main body areas, respectively; and the pectoral and caudal fins were annotated according to the natural outline of the fin rays. Figure 2 , 3 As shown.
[0080] 3. Training the YOLO instance segmentation model
[0081] A lightweight YOLO segmentation model was adopted, with the backbone network integrating C3k2, SPPF, and C2PSA modules. The input image size was uniformly set to 640×640. Pre-trained weights were loaded, with 300 iterations, a batch size of 16, an initial learning rate of 0.01, and a weight decay of 0.0005. Figure 4 , 5 As shown.
[0082] The training process involves real-time monitoring of detection and segmentation metrics, and the optimal model metrics are determined after training.
[0083] Detection box metrics: Precision=0.976, Recall=0.983, mAP50=0.981, mAP50-95=0.700;
[0084] Mask segmentation metrics: Mask-Precision=0.969, Mask-Recall=0.976, Mask-mAP50=0.972, Mask-mAP50-95=0.669.
[0085] The trained model is exported as a lightweight inference format and deployed to a hyperspectral device terminal.
[0086] 4. Hyperspectral calibration and fractional spectral extraction
[0087] 4.1 Whiteboard calibration: Using the whiteboard area identified by the model, the reflectance of the entire hyperspectral image is corrected according to the calibration formula to eliminate illumination interference.
[0088] 4.2 Band selection: Select the effective band of 450-950nm and remove data with low signal-to-noise ratio at both ends.
[0089] 4.3 Geographical Spectrum Extraction: The model automatically outputs masks for six types of fish body parts. Morphological noise reduction is performed on small target masks such as the eyes and pectoral fins. The masks are mapped onto hyperspectral images, and the average reflectance spectrum is calculated for each region to obtain six sets of spectral data for each fish part. Figure 6 As shown.
[0090] The specific operational steps are as follows: Based on the completed whiteboard radiometric calibration, to further improve the on-site accuracy and operational efficiency of reflectance calculation, the "scene-based reflectance calibration" method is used for spectral data conversion. This method achieves real-time correction of illumination conditions by simultaneously including both the target and standard whiteboard regions in a single hyperspectral image, thereby obtaining stable and reliable reflectance results.
[0091] During the imaging process, a standard Spectralon white board is placed within the same field of view as the target, ensuring it is under the same lighting conditions and geometrically aligned with the sample. To avoid specular reflection interference, the white board and sample surface are positioned approximately perpendicular to the camera's optical axis, with the incident and observed light angles approximately 45°. The camera acquires a hyperspectral image cube with fixed exposure time and gain parameters, ensuring that the target area and the white board area appear simultaneously in the same frame. This arrangement guarantees that both are imaged under the same incident irradiance, thus achieving consistent illumination control.
[0092] In the data processing stage, a white area (Region of Interest, ROI) is first selected in the image, and the average digital value Iwhite(λ) of each band is calculated. Then, the ratio of each pixel or average spectrum Itarget(λ) of the target area is converted to that of the white area. The calculation formula is as follows:
[0093] (1),
[0094] Where Rtarget(λ) is the reflectance of the target in each band, Rwhite(λ) is the known reflectance of the standard white board, and Itarget(λ), Iwhite(λ), and Idark(λ) are the digital response values of the target, the white board, and the dark field, respectively. If no separate dark field image is acquired, it can be simplified to a relative ratio form:
[0095] (2),
[0096] This method offers advantages such as ease of operation, high illumination consistency, and applicability to field environments. Since the whiteboard and target are within the same field of view, their illumination intensity, incident angle, and atmospheric conditions are completely identical, effectively eliminating radiation errors caused by environmental changes. Compared to the traditional "time-division calibration" method, "same-map whiteboard calibration" significantly improves data repeatability and on-site processing efficiency, making it particularly suitable for hyperspectral reflectance measurements under field or mobile imaging experimental conditions.
[0097] To ensure calibration accuracy, the white board area was maintained at approximately 3% or more of the total image pixels during the experiment, and it was avoided being located at the image edges to reduce spectral distortion. The resulting reflectance data, after spectral smoothing and noise suppression, was then used for subsequent feature extraction and parameter analysis.
[0098] After segmenting and extracting the regional spectra of different body parts of the large yellow croaker, this embodiment further organizes and analyzes the average reflectance spectra of different parts of each sample. The original hyperspectral images are normalized using a whiteboard and constrained by body part masks to obtain the regional average spectra of each sample at different body parts. This results in a wide-table format spectral data file, where each row corresponds to a body part of a sample, and each column of band variables corresponds to the average reflectance at a specific wavelength. The data table mainly includes sample name, category, body part category, and reflectance values at each wavelength.
[0099] Let the average spectrum of the (i)th sample at the (m)th body part of the fish be:
[0100] (3),
[0101] In the formula ( () represents the average reflectance of this part of the sample at the (k)th band; (K) represents the original spectral band number. The sample category is recorded according to the file name prefix and the category field in the data table. Among them, farmed large yellow croaker and wild large yellow croaker are used as the research objects for differential analysis and classification modeling, respectively.
[0102] Compared to using the average spectrum of the whole fish directly, averaging the spectrum based on different body parts can preserve the local spectral differences of different anatomical regions. Since the head, eyes, back, abdomen, pectoral fins, and caudal fins of the large yellow croaker differ in terms of surface color, tissue structure, thickness, and reflectance properties, organizing the spectral data by body part helps to further analyze the contribution of different regions to the identification of wild and farmed fish.
[0103] The original hyperspectral data ranges from approximately 397.15 to 1005.85 nm. Considering the inherent instability, low signal-to-noise ratio, and large curve fluctuations at the spectral ends of hyperspectral sensors, this embodiment filters the band range before subsequent analysis, retaining only the effective band within the 450–950 nm range for spectral curve plotting, difference analysis, principal component analysis, and classification modeling. This effective spectral band range lies in the visible to near-infrared region, preserving spectral information related to fish surface color, pigment absorption, tissue scattering, and water content, while reducing the impact of short-wavelength and long-wavelength noise on result interpretation. Equation 3, after band filtering, yields:
[0104] (4),
[0105] in, ,(t) represents the number of valid bands retained after screening. All subsequent spectral statistical analyses and graphical plots are based on the valid bands after screening.
[0106] To compare the spectral differences between different parts of the fish, the average spectra were grouped according to the type of fish part. The average reflectance at each wavelength was calculated for the head, eyes, pectoral fins, back, abdomen, and tail fin. For the (m)th part, the formula for calculating its average reflectance at wavelength is:
[0107] (5),
[0108] In the formula, Indicates the first Each part of the fish body at wavelength Average reflectance at; This indicates the number of valid spectral samples corresponding to that region; Indicates the first The sample in the first individual fish body parts, wavelength Average reflectance after screening at the location; Number the samples; Number the parts of the fish's body; The selected valid band numbers are: This indicates the number of valid bands retained after filtering.
[0109] Meanwhile, to reflect the degree of dispersion among different samples, this embodiment calculates the standard deviation of each part at each wavelength and uses the "mean curve ± standard deviation shading" method to display the overall trend of spectral variation of different parts. This method can intuitively reflect the reflectance intensity, curve shape, and internal fluctuation of different parts of the fish, providing a basis for subsequent identification of key parts and sensitive wavelengths.
[0110] 5. Spectral preprocessing and feature analysis
[0111] SNV standard normal transformation was performed on all spectral data to eliminate baseline bias. Statistical analysis results:
[0112] 1) Spectral characteristics of different parts: The abdomen has the highest overall reflectance, while the eye has the lowest reflectance, and the spectral curves of different parts show significant differences in shape.
[0113] 2) Category differences: Wild large yellow croaker has higher reflectance in the head, eye, and back areas than farmed large yellow croaker; farmed large yellow croaker has higher reflectance in the abdomen and tail fin areas than wild large yellow croaker; pectoral fin wavelengths are highly dependent, and the differences fluctuate greatly.
[0114] 3) Effect size and PCA analysis: Cohen's d effect size was generally high for the eyes, back, and head, which are the core discriminant sites; PCA dimensionality reduction results showed that the partial spectra can effectively distinguish the fish body regions and sample categories.
[0115] The specific operation is as follows: To analyze the spectral differences between wild and farmed large yellow croaker at different body parts, this embodiment further groups the samples by category and body part, and calculates the average reflectance spectra of farmed and wild samples at the same body part. For the (m)th body part, the average reflectance of farmed and wild samples at the wavelength is expressed as follows:
[0116] (6)
[0117] In the formula, and These represent the farmed and wild large yellow croakers in the [number]th [year]. individual fish body parts, wavelength Average reflectance at; Indicates aquaculture samples, Indicates wild-type sample; and They represent the first The number of effective spectral samples from cultured and wild samples in each part of the fish body; and They represent the first The first breeding sample and the first The wild sample in the first individual fish body parts, wavelength Average reflectance after screening.
[0118] To further observe the direction of the difference, this embodiment calculates the average reflectance difference between farmed and wild samples:
[0119] when When, it indicates that the average reflectance of the cultured sample at that location and in that wavelength band is higher than that of the wild sample; when At this time, it indicates that the wild sample has a higher reflectance. By plotting the difference spectra of different parts, the distribution characteristics of the differences in different fish body regions and different wavelengths can be analyzed.
[0120] Comparing only the differences in means may be affected by the degree of sample dispersion; therefore, this embodiment further uses Cohen's effect size to measure the intensity of differences between wild and farmed samples in each band. For the first... Parts and wavelengths The formula for calculating Cohens d is:
[0121] (7)
[0122] In the formula, Indicates the first Each part of the fish body at wavelength Standardized differences between cultured and wild samples; and These represent the cultured and wild samples at the [number]th [year]. individual fish body parts, wavelength Average reflectance at; It represents the combined standard deviation of the two types of samples at this location and wavelength.
[0123] Combined standard deviation The calculation formula is:
[0124] (8),
[0125] In the formula, and They represent the first The number of effective spectral samples from cultured and wild samples in each part of the fish body; and These represent the cultured and wild samples at the [number]th [year]. individual fish body parts, wavelength The standard deviation at that point. Since this study focuses on the contribution of different wavelengths to distinguishing wild and farmed large yellow croaker, the standard deviation is used in the results presentation. This represents the absolute value of the effect size. The larger the absolute value of the effect size, the more significant the contribution of this band to distinguishing wild and farmed samples at the corresponding body part of the fish.
[0126] To observe the distribution of different fish body parts and samples in the overall spectral feature space, this embodiment uses principal component analysis (SNV) to reduce the dimensionality of the high-dimensional spectral data for visualization. Considering the differences in overall reflectance intensity among different samples, a standard normal transformation is first performed on each spectrum before PCA analysis to weaken the influence of baseline shift and overall intensity differences on the principal component distribution. The SNV processing formula is as follows:
[0127] (9)
[0128] In the formula, Indicates the first The spectrum in the first Reflectance at each effective band; and These represent the mean and standard deviation of the spectrum across all effective bands, respectively. After SNV processing, the spectral features are standardized, and the first two principal components are extracted using PCA for display in a two-dimensional scatter plot.
[0129] 6. Classification model training and on-site identification testing
[0130] Using the spectra of three core body parts—eyes, back, and head—as input, a logistic regression binary classification model was constructed. GroupKFold cross-validation (using individual fish as the grouping unit) was employed to balance the class weights. Twenty wild-caught and 25 farmed large yellow croakers (not involved in model training) were selected as the test set for blind field testing.
[0131] Single-part models: Eye model AUC=0.942, Back model AUC=0.935, Head model AUC=0.911;
[0132] The three-part fusion model achieves an overall identification accuracy of 96.4%, with a total time of ≤2 seconds from image acquisition to output of identification results for a single sample.
[0133] The specific operation is as follows: To further evaluate the ability of the spectra of different fish parts to distinguish between wild and farmed fish, this embodiment uses the average spectrum of each part as input features to construct a binary classification model to distinguish between wild and farmed large yellow croaker. Classification analysis is performed separately for each fish part; that is, the classification model is trained independently within each part, and the corresponding ROC curve and AUC value are calculated. This design allows for comparison of the differences in the contribution of different anatomical parts to identification.
[0134] Considering that the same fish may correspond to multiple spectral parts, directly and randomly dividing the training and test sets according to spectral rows could lead to different parts of the same sample appearing in both sets simultaneously, resulting in data leakage. To avoid this problem, this embodiment employs the GroupKFold cross-validation method with sample name as the grouping variable. In each fold of cross-validation, all relevant spectra of the same fish will only appear on one side of the training or test set, ensuring that the model evaluation more closely approximates the prediction scenario of real independent samples.
[0135] The classification model employs a machine learning process consisting of standardization and logistic regression. For each fish body part, the input spectral features are first standardized, and then a logistic regression model with balanced class weights is trained to reduce the impact of class imbalance on model training. The model outputs the predicted probability of the wild class, and the ROC curve and AUC value are calculated based on the prediction results of the test set after cross-validation. The closer the AUC is to 1, the stronger the ability of the spectrum of that body part to distinguish between wild and farmed fish.
[0136] In addition to classification, this embodiment further analyzes whether different fish body parts possess distinguishable spectral characteristics. Using the average spectrum of all body parts as input and the fish body part category as the output label, a multi-classification model is constructed to identify the head, eyes, pectoral fins, back, abdomen, and caudal fin. The purpose of this analysis is to verify whether different anatomical regions have stable spectral differences, and to provide auxiliary evidence for location-based spectral interpretation.
[0137] The body part identification model employs a random forest classifier and GroupKFold cross-validation, using sample names as grouping variables to avoid information leakage between the training and test sets for different parts of the same fish. Model performance is evaluated using the confusion matrix, overall accuracy, and recall for each body part. The confusion matrix displays the correspondence between true and predicted body parts, while recall reflects the proportion of correctly identified parts. A high recall for a particular body part indicates stable spectral features and significant differences from other body parts; a low recall may indicate strong spectral similarity between that body part and other regions, or that differences in its segmentation boundaries and within samples have influenced spectral extraction.
[0138] like Figure 7 As shown, a binary classification model is constructed using the logistic regression algorithm; the GroupKFold cross-validation method is adopted, with a single large yellow croaker sample as the grouping unit, and a class weight balancing strategy is introduced to optimize model training, avoiding data leakage and sample imbalance problems. The coefficient of determination (R2) and root mean square error (RMSE) are calculated using equations. RMSE is used to measure the proportion of observed variation explained by the model, reflecting the average magnitude of the prediction error.
[0139] (10),
[0140] Multiple regression analysis :
[0141] (11).
[0142] After whiteboard normalization, effective band screening, and regional average spectrum extraction, the average reflectance spectra of six parts of the large yellow croaker—head, eyes, pectoral fins, back, abdomen, and caudal fin—in the range of 450–950 nm were obtained. Figure 8 It is evident that the spectral curves of different parts of the fish exhibit significant regional differences, indicating that different anatomical parts of the large yellow croaker differ in terms of surface structure, pigment deposition, tissue composition, and light scattering characteristics.
[0143] Overall, the spectral curves of all parts showed a significant decrease in reflectance around 480–500 nm, followed by a rapid increase after 520 nm, gradually leveling off or continuing to rise after entering the visible long-wavelength and near-infrared regions. This common trend indicates that the large yellow croaker's body surface exhibits strong absorption characteristics near blue-green light, while possessing high reflectance in the red to near-infrared regions. The differences in reflectance intensity between different parts are quite pronounced. The abdomen has the highest overall reflectance, maintaining a high level within the 600–850 nm range; the pectoral fins also have relatively high reflectance, gradually stabilizing after 650 nm; the head and back have moderate reflectance; the eyes have the lowest overall reflectance, exhibiting strong absorption, especially in the visible light region; the caudal fin has low reflectance in the short-wavelength band, but it continuously increases with increasing wavelength, gradually approaching the reflectance of the back and head in the near-infrared region.
[0144] The abdominal spectral curve is significantly higher than that of other parts in most bands, which may be related to the lighter color of the abdominal surface, tissue thickness, and local scattering characteristics. Both the pectoral and caudal fins are fin structures, but their spectral morphologies are not entirely consistent. The pectoral fin rises rapidly after 550 nm and forms a high plateau in the near-infrared region; the caudal fin shows a more sustained upward trend, indicating that there are still differences in tissue structure, thickness, and light transmittance among different fin regions. The eye curve is generally low and has a wide standard deviation range, suggesting that the eye region is more affected by pigmentation, surface reflection, and small target segmentation errors, and its spectral stability is weaker than that of larger areas such as the abdomen and pectoral fins.
[0145] Figure 9The average spectra and their standard deviation ranges for six body parts are shown. Different body parts exhibit not only different average reflectance levels but also variations in intra-group variability. The head, eye, and back show wider standard deviation ranges in certain bands, indicating significant individual variability between different samples in these regions. The head region, including the snout, head skin, and tissues near the gill covers, has complex local morphology and is easily affected by posture, surface reflectance, and tissue boundary differences, thus its spectral fluctuations are relatively significant. The eye region is relatively small and has strong curved reflectance and local pigment characteristics, making its average spectrum more susceptible to the influence of segmentation boundaries and a small number of anomalous pixels.
[0146] In contrast, the abdominal and pectoral fins exhibit relatively continuous curve morphology across the main wavelength range, showing a stable average trend despite high reflectance. The abdominal fin forms a broad high-reflectance plateau in the 600–850 nm range, indicating relatively stable reflectance characteristics in this region. The pectoral fins show a distinct absorption trough in the short wavelength range, followed by a rapid increase, resulting in a clear overall morphological characteristic. The standard deviation of the caudal fin gradually increases in the near-infrared region, possibly related to the thinner caudal fin tissue, more pronounced edge structure, and variations in the degree of caudal fin spread among individuals.
[0147] The results indicate that the average spectra of different parts not only reflect the spectral properties of the tissue itself, but are also influenced by the area of the part, surface morphology, and segmentation stability. Therefore, in subsequent identification analysis, simply using the average spectrum of the whole fish may mask the differences between local parts, while extracting spectra from different parts can more accurately preserve relevant discrimination information.
[0148] like Figure 10 , 11 As shown, the average spectra of wild and farmed large yellow croaker at six body parts were compared. It can be seen that the two types of samples exhibit not entirely consistent patterns of difference at different parts, indicating that the differences are not uniformly distributed throughout the fish, but rather show a clear location dependence.
[0149] In the head region, the average reflectance of wild-caught large yellow croaker was generally higher than that of farmed large yellow croaker, especially in the 550–900 nm range where the difference remained relatively stable. This suggests that the head region may contain differences related to surface color, tissue structure, or scattering. The differences were even more pronounced in the eye region, with wild samples showing higher reflectance than farmed samples in most wavelengths, and the gap between the two curves persisting in the long-wavelength visible light and near-infrared regions. Although the spectrum of the eye is significantly affected by local reflectance due to its small size, the mean curves show that it is somewhat sensitive to differences between wild and farmed species.
[0150] The dorsal region also showed higher reflectance in wild-caught samples than in farmed samples, with the difference mainly concentrated after 550 nm. The dorsal region is a relatively direct indicator of body color and pigment deposition, and its spectral differences may be related to differences in surface color, scale arrangement, and pigment composition between wild and farmed environments. Unlike the head and dorsal region, the ventral region showed the opposite trend, with farmed large yellow croaker exhibiting higher reflectance in most wavelengths than wild large yellow croaker, especially in the 600–850 nm range. This suggests that the information contained in the ventral region may reflect more about body fullness, abdominal tissue thickness, or lipid / water-related scattering differences.
[0151] In the pectoral fin region, the reflectance curves of wild and farmed samples were quite similar, with some overlap in certain wavelength bands. In the short wavelength range up to approximately 600 nm, the differences between the two types of samples fluctuated significantly; however, in the longer wavelength range, the reflectance of farmed samples was slightly higher or close to that of wild samples. In the caudal fin region, after 600 nm, the reflectance of farmed samples was higher than that of wild samples, and the difference gradually increased with increasing wavelength. This indicates that although the caudal fin is a relatively thin tissue, its near-infrared reflectance changes can still convey differential information.
[0152] Overall, the head, eyes, and back areas tended to show higher reflectance in wild samples, while the abdomen and caudal fin showed higher reflectance in farmed samples. The pectoral fins showed more complex differences, exhibiting some band dependence. These results suggest that the differences between wild and farmed large yellow croaker are not simply a matter of overall enhanced or weakened reflectance, but rather that different tissue parts exhibit different response patterns in the visible-near-infrared range.
[0153] To further observe the direction and intensity of the differences between wild and cultured samples, this embodiment calculated the spectral differences of "cultured sample mean minus wild sample mean" at different locations, and further used effect sizes to evaluate the discriminative contribution of each band. Figure 11 It is evident that the difference curves at different locations exhibit significant differences.
[0154] The difference curves for the head, eyes, and back are generally negative, indicating that the reflectance of wild samples is generally higher than that of farmed samples in these regions. The negative difference is most pronounced in the eyes, widening further after 600 nm, suggesting a strong response of the eye spectrum to these differences. The back difference is also relatively stable, maintaining a significant negative value, especially in the mid-to-long wavelength range, indicating that the back spectrum can effectively reflect the differences in body surface characteristics between wild and farmed fish. The difference in the head is slightly smaller than that in the eyes and back, but maintains a consistent direction over a wide wavelength range, suggesting it has some diagnostic value.
[0155] The abdominal difference curve is predominantly positive, indicating that the abdominal reflectance of farmed large yellow croaker is higher than that of wild large yellow croaker. This difference gradually increases after 550 nm and remains stable over a relatively wide wavelength range. The caudal fin region also shows predominantly positive differences after 600 nm, indicating that the overall caudal fin reflectance of farmed samples is higher. The pectoral fin difference curve, however, exhibits strong fluctuations, showing positive and negative changes in the short and mid-wavelength bands, suggesting that the differences in the pectoral fins may be concentrated in specific wavelength bands rather than representing a stable difference across the entire wavelength range.
[0156] The effect size results further illustrate the differences in discriminative contributions across different body parts. The eyes and back exhibited high effect sizes over longer wavelengths, indicating a strong contribution to distinguishing wild from farmed samples. The head's effect size was generally moderate, gradually increasing with wavelength. The abdomen's effect size was high in some wavelengths but generally lower than that of the eyes and back. The caudal fin contributed somewhat to the visible-near-infrared transition region, but its effect size gradually decreased over longer wavelengths. The pectoral fin's effect size showed localized peaks, suggesting that its discriminative information may be concentrated in a few sensitive wavelengths.
[0157] To observe the distribution of different parts and samples in the overall spectral feature space, this embodiment performs principal component analysis on the screened spectral data. Figure 12 It is evident that the first two principal components can explain a large proportion of the spectral variation. Among them, PC1 and PC2 of the overall spectral data have a high cumulative explanation rate, indicating that there is a strong low-dimensional structure in the original high-dimensional spectrum.
[0158] The PCA results, chromatic by body part, show a certain degree of separation in the principal component space for different fish parts. Abdominal samples are mainly distributed in the negative PC1 region, while caudal fin samples are more located in the positive PC1 region. The dorsal samples are somewhat similar to the caudal fin but still exhibit different distribution ranges. The head, eyes, and pectoral fins partially overlap in the middle region, but their overall aggregation positions still differ. This indicates that the spectral differences between different parts are not only reflected in the reflectance of individual bands but also in the overall morphology of the spectral curve.
[0159] After coloring by category, there is some overlap between wild and farmed samples in the overall PCA space, but local distributions still show differences. Since this PCA includes six body parts, the significant spectral differences between different parts may mask some of these differences. Therefore, based solely on the PCA distribution after mixing all parts, the categories do not form clear boundaries. This also indicates that in identification, it is necessary to combine part information for grouping modeling or feature fusion, rather than simply mixing the spectra of all parts for direct judgment.
[0160] like Figure 13As shown, further observation of the PCA distribution of the eye spectrum reveals a certain degree of separation between wild and farmed samples in the principal component space of the eye, although some overlap remains. This result is largely consistent with the aforementioned average spectrum and effect size analysis: the eye region is relatively sensitive to differences, but due to the small eye area, significant local reflectivity, and individual variations, relying solely on a single site may still be affected by sample fluctuations. Therefore, while the eye spectrum can serve as an important discrimination region, it is more suitable as a component in a multi-site fusion discrimination system.
[0161] In summary, the results show significant differences in hyperspectral reflectance characteristics among different body parts of the large yellow croaker, with a strong location-dependent variation between wild and farmed specimens. The head, eyes, and back regions exhibit higher reflectance primarily in wild samples, while the abdomen and caudal fin show higher reflectance in farmed samples. PCA results further indicate that locational differences are a crucial factor influencing the distribution of hyperspectral data, and the identification model should fully consider the spectral contributions of different anatomical regions. The region-based spectral extraction method based on body part segmentation can preserve local difference information, providing a more interpretable spectral feature basis for the identification of wild and farmed large yellow croaker.
[0162] Example 2: Portable on-site testing application:
[0163] The trained lightweight YOLO model, spectral processing algorithm, and classification model are integrated into the embedded system of a handheld hyperspectral device to build an integrated portable detection terminal. The steps include the following:
[0164] 1) Place the large yellow croaker to be tested on site, put the standard white board and the fish body within the camera's field of view, and turn on the fill light;
[0165] 2) The device can acquire hyperspectral images with one click, and the terminal can automatically complete part segmentation, whiteboard calibration, and spectral extraction;
[0166] 3) Call the fusion classification model to display the identification results of "wild large yellow croaker" or "farmed large yellow croaker" on the device screen in real time, and store the detection data.
[0167] This terminal does not require an external server and can independently complete the entire testing process. It is suitable for scenarios such as aquatic product market inspection, wholesale market sampling, and on-site law enforcement for fishery supervision.
[0168] This invention demonstrates through examples that the spectral differences between wild and farmed large yellow croaker are site-specific. Wild samples show higher reflectance in the head, eyes, and back, while farmed samples show superior reflectance in the abdomen and caudal fin. These differences stem from factors such as growth environment, movement, pigmentation, and tissue structure. Compared to traditional whole-fish spectral analysis, regional detection combined with YOLO instance segmentation avoids the problem of local feature loss, resulting in more interpretable and repeatable detection results. This invention integrates computer vision and hyperspectral imaging, differing from conventional detection methods, and can be applied to aquatic product market supervision and quality screening.
[0169] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.
Claims
1. A non-destructive method for identifying wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging, characterized in that, Specifically, the following steps are included: Step 1: Sample collection and multimodal dataset construction. Wild and farmed large yellow croaker samples were collected, and hyperspectral images containing large yellow croaker and standard white boards were acquired simultaneously using a visible-near-infrared hyperspectral imaging system. The hyperspectral image was converted into the corresponding RGB preview image. Instance-level polygon annotation was performed on the RGB image. The annotation categories included head, eyes, back, abdomen, pectoral fin, caudal fin, and standard white plate. After the annotation was completed, the training set and validation set were obtained, and the large yellow croaker body part instance segmentation dataset was constructed. Step 2: Training the lightweight YOLO instance segmentation model. A lightweight YOLO instance segmentation model is trained based on the instance segmentation dataset. The model consists of an input end, a backbone network, a feature fusion network, and a detection and segmentation output end. After training, the optimal model is selected to achieve automatic recognition and binary mask output of various anatomical parts of the large yellow croaker and the standard white plate area. Step 3: Same-image whiteboard radiometric calibration and regional spectral extraction. Using the standard whiteboard mask output by the model, the reflectance of the entire hyperspectral image is calibrated using the same whiteboard mask to obtain the true spectral reflectance of each pixel in the image. Valid spectral bands are selected, and the masks of each part of the fish body are mapped pixel by pixel to the calibrated hyperspectral image. The average reflectance spectra of the head, eyes, back, abdomen, pectoral fin, and caudal fin are extracted respectively. Step 4: Spectral preprocessing and differential feature analysis, the average reflectance spectra of each extracted part are preprocessed by standard normal variable transformation; The spectral differences and Cohen's d effect of the same part of wild and farmed large yellow croaker were calculated respectively. Principal component analysis was used to complete spectral feature dimensionality reduction and visualization analysis to identify key fish parts with high discrimination ability. Step 5: Classification model training and automated identification. Using the spectral features of the key parts selected as input, a binary classification identification model is constructed, and the model training is completed by group cross-validation. For the large yellow croaker to be detected, hyperspectral image acquisition, part instance segmentation, spectral extraction, and feature inference are performed in sequence, and finally the identification result of whether the large yellow croaker to be detected is wild or farmed is output.
2. The method for non-destructive identification of wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging according to claim 1, characterized in that, The hyperspectral imaging system described in step 1 operates in the 400–1000 nm band. Halogen lamps are used as supplementary light sources, which are symmetrically arranged on both sides of the hyperspectral camera. The angle between the light source and the surface of the large yellow croaker sample is 45°. The distance between the light source and the sample is 30 cm. The light source is preheated for 5–10 minutes before use, and only halogen lamps are turned on as the sole illumination source during the imaging process.
3. The method for non-destructive identification of wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging according to claim 1, characterized in that, The instance segmentation dataset constructed in step 1 contains 289 RGB images converted from hyperspectral images. 100 of these images are selected for fine manual annotation. The training set and validation set are divided in an 8:2 ratio. The annotation process unifies the boundary definition of each part of the fish body. The annotation range of the head is from the snout to the gill cover area. The annotation range of the eyes is the complete outline of the eyes. The back and abdomen correspond to the upper and lower main body areas of the fish, respectively. The pectoral fins and caudal fins are annotated according to the natural outline of the fin rays to avoid the problems of overlapping areas, missing annotations, and mis-annotation.
4. The method for non-destructive identification of wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging according to claim 1, characterized in that, In step 2, the backbone network of the lightweight YOLO instance segmentation model integrates C3k2, SPPF, and C2PSA modules. After training, the model performance metrics meet the following requirements: detection box metrics Precision ≥ 0.976, Recall ≥ 0.983, mAP50 ≥ 0.981, mAP50-95 ≥ 0.700; mask segmentation metrics Mask-Precision ≥ 0.969, Mask-Recall ≥ 0.976, Mask-mAP50 ≥ 0.972, Mask-mAP50-95 ≥ 0.
669.
5. The method for non-destructive identification of wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging according to claim 1, characterized in that, In step 3, during the data processing stage, a standard whiteboard area is first selected in the hyperspectral image, and the average digital response value of this area in each band is calculated. Subsequently, the digital response values or average spectra of the target area in each band are compared with those of the standard whiteboard area. The formula for calculating the reflectance of the target area is: , In the formula, For the target region at wavelength Reflectance at that location; For standard whiteboards at wavelength The known reflectivity at that location; For the target region at wavelength The digital response value at the location; For the standard whiteboard area at wavelength The digital response value at the location; For dark field at wavelength The digital response value at the location, if no separate dark-field image is acquired, is calculated using a whiteboard normalization method, and the formula is simplified as follows: (2), After segmenting and extracting the regional spectra of different body parts of the large yellow croaker, the average reflectance spectra of different parts of each sample were further processed and analyzed. The original hyperspectral images were normalized using a whiteboard and constrained by body part masks to obtain the regional average spectra of each sample at different body parts. This resulted in a wide-table format spectral data file, where each row corresponds to a single body part of a sample, and each column represents the average reflectance at a given wavelength. The data table includes the sample name, category, body part category, and reflectance values at each wavelength. Let the average spectrum of the i-th sample at the m-th body part of the fish be: (3), In the formula, Indicates the first The first sample The fish body part in the first Average reflectance at each spectral band; This represents the total number of bands in the original spectrum. The sample category is recorded according to the file name prefix and the category field in the data table. Among them, farmed large yellow croaker and wild large yellow croaker are used as the research objects for difference analysis and classification modeling, respectively.
6. The method for non-destructive identification of wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging according to claim 5, characterized in that, The effective spectral band range selected in step 3 is 450–950 nm; for small target areas such as the eyes and pectoral fins, morphological denoising is performed on the mask output by the model to eliminate edge noise pixels before average reflectance spectrum extraction. The effective spectral band range is located in the visible to near-infrared region, which can retain spectral information related to fish surface color, pigment absorption, tissue scattering, and water content, while reducing the impact of short-wavelength and long-wavelength noise on the interpretation of results. Formula 3 is obtained after band selection: (4), in, t represents the number of valid bands retained after screening. All subsequent spectral statistical analyses and graphical plots are based on the selected valid bands. To compare the spectral differences between different parts of the fish, the average spectra were grouped according to the body part category. The average reflectance at each wavelength was calculated for the head, eyes, pectoral fins, back, abdomen, and tail fin. For the m-th part, the formula for calculating its average reflectance at wavelength is: (5), In the formula, Indicates the first Each part of the fish body at wavelength Average reflectance at; This indicates the number of valid spectral samples corresponding to that region; Indicates the first The sample in the first individual fish body parts, wavelength Average reflectance after screening at the location; Number the samples; Number the parts of the fish's body; The selected valid band numbers are: This indicates the number of valid bands retained after filtering; To reflect the degree of dispersion among different samples, the standard deviation of each part at each wavelength was calculated, and the overall trend of the spectrum of different parts was shown by the shaded mean curve ± standard deviation. To analyze the spectral differences between wild and farmed large yellow croaker at different body parts, the samples were double-grouped according to category and body part. The average reflectance spectra of farmed and wild samples at the same body part were calculated separately. For the (m)th body part, the average reflectance of farmed and wild samples at the same wavelength is expressed as follows: (6), In the formula, and These represent the farmed and wild large yellow croakers in the [number]th [year]. individual fish body parts, wavelength Average reflectance at; Indicates aquaculture samples, Indicates wild-type sample; and They represent the first The number of effective spectral samples from cultured and wild samples in each part of the fish body; and They represent the first The first breeding sample and the first The wild sample in the first individual fish body parts, wavelength Average reflectance after screening at the location; To further observe the direction of the difference, the average reflectance difference between the farmed and wild samples was calculated: In the formula, Indicates the first Each part of the fish body at wavelength The difference in average reflectance between farmed and wild samples, when When, it indicates that the average reflectance of the cultured sample at that location and in that wavelength band is higher than that of the wild sample; when When the mean is higher, it indicates that the average reflectance of wild samples in that part and in that band is higher than that of farmed samples. By plotting the difference spectrum of different parts of the fish, the distribution characteristics of the difference in different fish regions and in different bands can be analyzed.
7. The method for non-destructive identification of wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging according to claim 1, characterized in that, Step 4 uses the Cohen's d effect size to measure the intensity of differences between wild and farmed samples across different wavelengths. Parts and wavelengths The formula for calculating Cohen's d is: (7), In the formula, Indicates the first Each part of the fish body at wavelength Standardized differences between cultured and wild samples; and These represent the cultured and wild samples at the [number]th [year]. individual fish body parts, wavelength Average reflectance at; This represents the pooled standard deviation of the two types of samples at this location and wavelength. Combined standard deviation The calculation formula is: (8), In the formula, and They represent the first The number of effective spectral samples from cultured and wild samples in each part of the fish body; and These represent the cultured and wild samples at the [number]th [year]. individual fish body parts, wavelength The standard deviation at which the results are presented is used. The absolute value of the effect size is indicated. The larger the absolute value of the effect size, the more significant the contribution of this band to distinguishing wild and farmed samples at the corresponding body part of the fish.
8. The method for non-destructive identification of wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging according to claim 1, characterized in that, In step 4, after spectral difference analysis, effect size analysis, and principal component analysis, the head, eyes, and back were identified as the key areas for distinguishing wild and farmed large yellow croaker. A comprehensive identification feature set was constructed by integrating the spectral characteristics of these three areas. To observe the distribution of different fish body parts and different samples in the overall spectral feature space, principal component analysis (SNV) was used to reduce the dimensionality of the high-dimensional spectral data for visualization. Before PCA analysis, each spectrum was first transformed using a standard normal variable to reduce the influence of baseline shift and overall intensity differences on the principal component distribution. The SNV processing formula is as follows: (9), In the formula, Indicates the first The spectrum in the first Reflectance at each effective band; and These represent the mean and standard deviation of the spectrum across all effective bands, respectively. After SNV processing, the spectral features are standardized, and PCA is used to extract the first two principal components for a two-dimensional scatter plot. The selected valid band numbers are: This indicates the number of valid bands retained after filtering.
9. The method for non-destructive identification of wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging according to claim 1, characterized in that, In step 5, a logistic regression algorithm is used to construct a binary classification model; GroupKFold cross-validation is employed, using a single large yellow croaker sample as the grouping unit, and a class weight balancing strategy is introduced to optimize model training, avoiding data leakage and sample imbalance. The coefficient of determination R² and root mean square error RMSE are calculated using equations. RMSE is used to measure the proportion of observed variation explained by the model, and reflects the average magnitude of the prediction error. (10), Multiple regression analysis : (11)。 10. A non-destructive identification system for wild and farmed large yellow croaker based on YOLO segmentation and hyperspectral imaging, characterized in that, The method for performing the non-destructive identification method according to any one of claims 1-9 includes a hyperspectral image acquisition module, an image segmentation and reasoning module, a spectral calibration and extraction module, a spectral analysis module, and a classification and identification module; The hyperspectral image acquisition module is used to acquire hyperspectral images containing large yellow croaker samples and standard white boards; the image segmentation and inference module has a built-in lightweight YOLO instance segmentation model that has been trained, and is used to output instance masks of various parts of the large yellow croaker and the standard white board; the spectral calibration and extraction module is used to complete radiometric calibration of the white board in the same image, effective band selection, and extraction of the average reflectance spectrum of various parts of the fish; the spectral analysis module is used to perform spectral preprocessing, spectral difference calculation, effect size calculation, and principal component analysis; the classification and identification module has a built-in binary classification and identification model that has been trained, and outputs the final identification result of whether the large yellow croaker is wild or farmed based on the input spectral features.