Trachinotus ovatus malformation and injury automatic detection method based on deep learning
By using the YOLO11 model based on deep learning and the "segmentation-driven classification + dual optimization" method, the problem of high-precision automation in detecting deformities and damage in golden pomfret was solved, achieving efficient and accurate identification of fish defects, which is suitable for the real-time detection needs of aquaculture and processing enterprises.
Patent Information
- Application Number
- CN202511403543.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-29
- Publication Date
- 2025-12-23
AI Technical Summary
Existing technologies are insufficient for high-precision, rapid, and automatic detection of deformities and injuries in golden pomfret. Manual detection is inefficient, and traditional image processing methods lack accuracy in complex backgrounds, resulting in a high rate of missed detections.
Using the YOLO11 model based on deep learning, combined with the "segmentation-driven classification + dual optimization" method, and through data augmentation and Focal Loss loss function optimization, high-precision segmentation and classification of fish body contours and defect regions are achieved, and the detection capability of small targets is enhanced by using a high-resolution segmentation head.
It enables simultaneous and efficient detection of deformities and injuries in golden pomfret, significantly reducing the false negative and false positive rates, and improving the robustness and detection accuracy of the model in complex environments.
Smart Images

Figure CN121190744A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of intelligent detection of aquaculture, and relates to a deep learning-based automatic detection method for deformities and injuries of golden pompano. BACKGROUND
[0002] Golden pompano is an important economic fish for aquaculture, widely distributed in coastal areas, with the advantages of fast growth and strong disease resistance. However, during the process of aquaculture, transportation and grading and sorting, fish body deformities (such as abnormal body shape, asymmetric structure, etc.) and injuries (such as scratches, damage, bruises, etc.) often occur. These defects not only reduce the market value of golden pompano, but also affect subsequent processing and sales, causing direct economic losses to aquaculture enterprises and aquatic processing plants. Therefore, accurate and rapid detection and grading of fish body defects are important links to ensure the quality and safety of aquatic products and improve economic benefits. Currently, fish body defect detection mainly relies on manual inspection, which has the following shortcomings: (1) low efficiency of manual detection: in the flow line, fish bodies are checked one by one by manual inspection, which is labor-intensive and inefficient, and cannot meet the real-time detection needs of large-scale aquaculture and processing enterprises. (2) insufficient accuracy of traditional image processing methods: traditional image segmentation and classification methods such as edge detection and threshold segmentation are used, but in complex backgrounds, fish body postures are variable, and injury features are not obvious, the recognition accuracy is obviously insufficient, and the missed detection rate is high.
[0003] In summary, the existing detection methods cannot meet the requirements of high precision, small target detection capability and real-time performance at the same time, and an intelligent detection technology capable of automatically, quickly and accurately identifying deformities and injuries of golden pompano is needed to replace traditional manual detection methods. SUMMARY
[0004] The purpose of the present application is to provide a deep learning-based automatic detection method for deformities and injuries of golden pompano, which realizes high-precision automatic identification of fish body deformities (overall contour abnormalities) and injuries (local area abnormalities) through innovative network structure optimization and loss function improvement, and solves the technical problems of low efficiency of manual detection, insufficient accuracy of traditional algorithms, and high missed detection rate of small target injuries.
[0005] The technical scheme of the present application is as follows:
[0006] A deep learning-based automatic detection method for deformities and injuries of golden pompano, the steps are as follows:
[0007] Step 1: Construction of image data set of golden pompano;
[0008] Firstly, by comparing the morphological characteristics of normal and abnormal Pampus argenteus, the fish body contour is determined as the basis for determining abnormalities. To reduce the influence of fish fin posture difference on recognition accuracy, a fin removal labeling strategy is proposed: in the labeling process, the dorsal fin and ventral fin are removed, and only the trunk and tail are retained for closed polygon labeling; the defect area is labeled with an independent closed polygon to separate the fish body contour and the defect area.
[0009] To improve the robustness of the model in complex scenes, data augmentation is performed on the labeled Pampus argenteus images, including flipping, sharpening, brightness and contrast adjustment, salt and pepper noise injection, and red channel enhancement. The salt and pepper noise simulates image interference, and the red channel enhancement is used to highlight the damage features. Considering the uneven number of samples in each category, a hierarchical expansion strategy is adopted: normal Pampus argenteus and abnormal Pampus argenteus are expanded once, and damaged Pampus argenteus is expanded multiple times to construct an image dataset containing normal Pampus argenteus, abnormal Pampus argenteus, and damaged Pampus argenteus. This step provides a high-quality, structured data foundation for subsequent fish body abnormality determination and damage recognition.
[0010] Step two: based on the YOLO11 model, a one-stop defect detection method of "segmentation-driven classification + double optimization" is proposed, the specific process is as follows:
[0011] (1) Fish body contour segmentation and defect area extraction;
[0012] In fish body defect detection, abnormality determination mainly depends on whether the overall contour of the fish body maintains the standard spindle shape, such as whether there are large area protrusions, depressions or morphological distortions on the back or abdomen; while damage determination depends on whether there are small area abnormalities such as breakage, scratches, and scale loss in local areas. The receptive field of these two types of defect features is completely different, the former requires global features to judge the overall structure of the fish body, and the latter requires local high-resolution features to identify small defects. A single classifier cannot simultaneously consider global and local features, which may cause false positives or false negatives. Based on the above problems, the invention proposes a one-stop defect detection method of "segmentation-driven classification + double optimization", the core idea of which is to accurately extract the fish body area and defect area through a segmentation model.
[0013] YOLOv1 model is selected as the core network of the segmentation framework, and a three-stage structure of "Backbone main network-Neck feature fusion network-Head segmentation head" is adopted, which can not only ensure real-time performance, but also output high-quality segmentation results. The image of the gold pompano to be detected is input into the YOLOv1 model; the YOLOv1 model is composed of a backbone network, a feature fusion neck network and a segmentation head; the backbone network performs multi-scale feature extraction on the input gold pompano image, and gradually obtains feature information related to the fish body contour and potential defects; the neck network fuses the shallow detail information and the deep semantic information through the feature pyramid structure, which not only retains the edge features of the fish body shape, but also captures the potential damage features; the segmentation head outputs two pixel-level segmentation results: a fish body contour mask, which is used to completely separate the fish body region from the background region and eliminate background interference such as debris, light and shadow; a candidate defect region mask, which is used to mark the possible defect region on the fish body surface, including damaged, scratched and other regions;
[0014] (2) Segmentation-guided dual-channel classification discrimination;
[0015] Through the segmentation process, the YOLOv1 model not only obtains a complete and clean fish body region, but also preliminarily locates the suspected defects, providing a structured input for subsequent classification and ensuring that the classification is only analyzed for the fish body region.
[0016] After segmentation is completed, the fish body region and the defect region are input into the classification discrimination module; the classification discrimination module includes two independent channels, which are used to determine different types of defects and realize complementary use of global and local information. The classification discrimination module is located at the output end of the YOLOv1 model and includes the following two discrimination channels:
[0017] The overall contour feature channel is used for deformity discrimination: the fish body contour mask is overlaid on the feature map output by the YOLOv1 model, all background pixels are removed, and only the pixel information of the fish body region is retained; whether the fish body region conforms to the spindle structure is determined according to the fish body region, and if the tail is missing, the fish body is twisted, the head is deformed, or there is a large area of convex-concave change, a deformity discrimination result is output;
[0018] The local defect feature channel is used for damage discrimination: the local defect detail features are automatically extracted for the high-confidence regions in the candidate defect region mask; the local defects are analyzed, and if the fish skin is damaged or scratched, a damage discrimination result is output;
[0019] Finally, the discrimination results of the overall contour feature channel and the local defect feature channel are fused to output the fish body defect category, including the following four categories: no defect, only deformity, only damage, and deformity and damage coexist; the two discrimination channels realize task decoupling, ensure that deformity and damage detection do not interfere with each other, and improve the stability of the overall recognition.
[0020] (3) The introduction of a double optimization strategy;
[0021] In the preliminary experiment, it is found that the micro damage is easy to lose details after sampling under deep features, causing missed detection; at the same time, due to the small number of damage samples, the model has a class imbalance problem in the training process, which is manifested as a high prediction for the non-defect or deformity class and insufficient recognition for the damage class. To solve the above problems, the present application proposes a double optimization strategy:
[0022] 1) Focal Loss loss function optimization;
[0023] In the training process of the YOLO11 model, the original standard cross-entropy loss function is replaced by the Focal Loss loss function, and the focusing parameter γ=2.0 and the class balance factor α=0.25 are set. The introduction of Focal Loss can dynamically adjust the weights of easy and difficult classification samples, reduce the proportion of easy classification samples in the loss, and improve the learning ability of the model for difficult-to-detect samples (such as slight damage and fuzzy boundary defects). At the same time, the class balance factor α can alleviate the class imbalance problem caused by the insufficient number of fish damage samples, so that the YOLO11 model pays more attention to the minority class and improves the damage detection accuracy.
[0024] 2) High-resolution segmentation branch enhances small target detection;
[0025] To further retain the detailed features of micro damage, an innovative 160x160 high-resolution segmentation branch is added to the original three-scale segmentation structure (80x80, 40x40, 20x20) of the YOLO11 model. The specific implementation steps are as follows: 80x80 shallow feature maps are extracted from the Backbone to obtain high-resolution detailed information of the fish surface; the deep feature maps at the end of the Neck are upsampled twice and fused with the 80x80 shallow feature maps; the fused features are input into the C3k2 feature refining module to further remove noise and enhance key boundary features through cross-layer convolution operation; finally, the refined features are output to the newly added 160x160 high-resolution segmentation head to realize more precise detection and positioning of micro damage areas.
[0026] This structure significantly improves the perception ability of small area defects while maintaining the overall real-time performance of the YOLO11 model, and is especially suitable for detecting fish scale slight damage, small scratches and other difficult-to-identify micro defects.
[0027] (4) Model training and reasoning;
[0028] The improved YOLO11 model is trained. The following hyperparameter settings are adopted during the training process: learning rate 0.01, batch size 16, training round 200, weight decay 0.0005. These parameters ensure that the training is fully convergent while avoiding the problem of overfitting of the improved YOLO11 model. Through the double optimization of Focal Loss and high-resolution segmentation head, the final fish defect categories are output, including no defect, only deformity, only damage, and coexistence of deformity and damage.
[0029] The beneficial effects of the present application are:
[0030] (1) Realize synchronous and efficient detection of deformity and damage: the present application realizes synchronous detection of deformity and damage of golden pomfret by constructing a complete data set containing normal fish, deformed fish and damaged fish, and adopting fin removal annotation strategy combined with the optimized YOLO11 model.
[0031] (2) Optimization for small target defect and sample imbalance problem, improve the detection ability of micro damage: introduce Focal Loss loss function and 160x160 high-resolution segmentation head on the basis of YOLO11 structure, realize the key optimization of small target damage and few class defect samples. Focal Loss dynamically adjusts the sample weight, so that the model pays more attention to the difficult-to-detect micro damage and a small amount of damage class samples in the training; the new high-resolution segmentation head can retain more shallow detail features, significantly enhance the detection ability of micro damage on the surface of fish body. After optimization, the model can effectively reduce the miss rate and false detection rate, realize high-precision detection of fish deformity and damage, and provide reliable technical support for fish grading and quality control. BRIEF DESCRIPTION OF DRAWINGS
[0032] Figure 1 The block module flowchart of the present application.
[0033] Figure 2 (a) is the normal annotation of golden pomfret, Figure 2 (b) is the deformity annotation, Figure 2 (c) is the damage annotation.
[0034] Figure 3 (a) is the original image of golden pomfret, Figure 3 (b) is the image flipping, Figure 3 (c) is the image sharpening image sharpening, Figure 3 (d) is the brightness contrast adjustment, Figure 3 (e) injects pepper and salt noise, Figure 3 (f) is the red channel enhancement.
[0035] Figure 4 The YOLO11 model structure diagram adopted by the present application.
[0036] Figure 5 The model detection result visualization diagram, wherein: (a) normal fish detection result; (b) fish detection result of deformity; (c) fish detection result of injury; (d) fish of composite defects. DETAILED DESCRIPTION
[0037] The specific embodiments of the present application are further illustrated in the following combined with the drawings and technical solutions.
[0038] (1) The image data set construction of gold pomfret includes the following steps:
[0039] First, the gold pomfret image acquisition: the gold pomfret to be detected is placed on a flat scale, and the image acquisition device is used to capture the complete shape of the fish body synchronously. In order to ensure the accuracy and consistency of the experiment, all samples are collected under standardized conditions to ensure the representativeness and accuracy of the image data. Then, background processing and experimental environment control: in the experiment, in order to avoid background interference during shooting and highlight the fish body, black matte paper is used to cover the scale surface and background, reducing reflected light and interference. All experiments are carried out under natural light conditions to simulate the actual application environment and ensure the universality of the experimental results.
[0040] Then, hardware configuration and experimental environment: the resolution of the image acquisition device is set to 5184x3456 pixels to ensure clear and detailed images. Fish body samples: all gold pomfret samples come from actual fishing to ensure that the experimental data have actual representativeness. Through the above experimental steps, more than 5000 original image data are successfully obtained, covering different types of normal gold pomfret, deformity gold pomfret and injury gold pomfret. In order to ensure the effectiveness and accuracy of the data, all images are strictly screened during post-processing, and images that are overexposed, blurred or not completely in the field of view are removed. Data set construction: after screening and cleaning, 3578 normal gold pomfret images, 1002 deformity gold pomfret images and 289 injury gold pomfret images are finally retained, and a high-quality gold pomfret image data set is constructed. These data will serve as the basis for model training to ensure diversity and comprehensiveness during the training process.
[0041] Next is the morphological analysis and labeling strategy: in the process of morphological analysis of goldfish, by comparing the geometric profile characteristics of normal and abnormal goldfish, it is found that the normal fish body is typically spindle-shaped, while the abnormal fish has obvious protrusions or depressions on the back or abdomen. Therefore, the fish body profile is the basis for determining the deformity in this invention. Profile labeling: using the closed polygon labeling method, the fish body profile of normal and abnormal goldfish is accurately labeled. The protrusions or depressions on the back or abdomen of abnormal goldfish are considered as defect areas, which are separately labeled by different colored closed polygons on the image to distinguish between fish morphology and damage information. Fin removal labeling strategy: considering the difference in the spread state of fish fins under different shooting angles, especially the spread way of dorsal and ventral fins, which can cause measurement error in morphological measurement, this invention proposes a fin removal labeling strategy. The specific operation is to exclude the fin area during labeling, and only the core part of the fish body (trunk and tail) is profiled. This strategy effectively avoids the measurement error caused by the change of fish fin posture, ensuring the accurate extraction of morphological features.
[0042] Finally, data augmentation and sample expansion: in order to improve the robustness of the model in the actual environment, various data augmentation techniques are implemented in the image data processing process to simulate common image degradation and interference in real environment, and to enhance the model's learning ability for low-quality images. The data augmentation techniques used include: image flipping: flip the image horizontally or vertically to increase sample diversity. Image sharpening: improve image details to enhance model learning of edges and textures. Brightness and contrast adjustment: simulate images under different lighting conditions to increase the model's ability to adapt to lighting changes. Salt and pepper noise injection: simulate image interference to improve the model's robustness in noisy environments. Red channel enhancement: highlights fish damage features to help the model better learn and identify abnormal areas. In addition, due to the large number of normal and abnormal goldfish samples in the data set, and the small number of damaged goldfish samples, a hierarchical expansion strategy is adopted to randomly expand the normal and abnormal goldfish once, and to expand the damaged goldfish multiple times, effectively balancing the number of samples of each category and making up for the lack of data.
[0043] After the above data processing and enhancement, a goldfish data set containing 10605 images is finally constructed, with 7156 normal goldfish, 2004 abnormal goldfish and 1445 damaged goldfish. This data set provides a solid data support for subsequent YOLO11 model-based automatic detection of goldfish deformity and damage, ensuring the diversity and generalization ability of model training.
[0044] Based on the YOLO11 model, a "segmentation-driven classification + dual optimization" defect detection method is proposed:
[0045] The application discloses a segmentation-guided classification method combined with deep learning, aiming at solving the problems of large background interference, complex fish body features and insufficient accuracy of traditional classifiers in the detection task of deformity and damage of golden pompano.
[0046] The YOLO11 model adopts a three-stage structure of "main network-neck network-detection head": the main network is used for feature extraction of an input image, and fish body contour and damage-related information are obtained layer by layer; the neck network fuses features of different scales, facilitating detection of large-scale overall deformity features and small-scale local damage features; the segmentation head outputs two pixel-level segmentation results: a fish body contour mask that completely separates the fish body from the background and eliminates background interference; and a candidate defect region mask that marks possible damage, scratch and deformity regions on the surface of the fish body. After segmentation, the model enters the classification and discrimination stage, and defect recognition is realized through a segmentation-guided classification strategy. The classification module includes two discrimination paths: an overall contour feature path (deformity discrimination): the fish body contour mask is overlaid on the model output feature map, and only the fish body pixel information is retained; if obvious protrusions, depressions or morphological defects are detected on the back or abdomen, the fish body is determined to be deformed. The local defect feature path (damage discrimination): for the regions with high confidence in the candidate defect mask, local features are extracted for analysis; if the fish body skin is damaged or scratched, the fish body is determined to be damaged. Finally, the discrimination results of the two paths are fused to output the fish body defect category, including the following four categories: no defect, only deformity, only damage and coexistence of deformity and damage.
[0047] To realize the above functions, the YOLO11 model is trained by using a labeled data set, and the data set used for training is derived from the labeled images constructed in step one and includes four categories of normal golden pompano, deformed golden pompano, damaged golden pompano and compound defect golden pompano. Each image contains fish body contour and corresponding defect region annotation information; the annotation adopts a polygon frame, and the contour and the defect are separately annotated, which is used for the segmentation training task of the model. The model gradually learns to distinguish the features of normal golden pompano, deformed golden pompano and damaged golden pompano in the training process. In the inference stage, the model first performs fish body segmentation and removes background interference; then, candidate defect regions are recognized and extracted, which are input into the classification module to realize classification and defect type output, so as to obtain the overall contour of the fish body, the defect position and the final category.
[0048] The application discloses a segmentation-guided classification method combined with deep learning, aiming at solving the problems of large background interference, complex fish body features and insufficient accuracy of traditional classifiers in the detection task of deformity and damage of golden pompano.
[0049] Although the segmentation-guided classification method can effectively reduce background interference and improve overall detection effect, there are still problems such as missing small damage and misjudgment in edge fuzzy area. Analysis shows that these problems are mainly caused by the fact that the standard loss function pays insufficient attention to a small number of difficult classification samples, and the resolution of the model segmentation head is insufficient to accurately capture subtle defects. Therefore, on the basis of the segmentation-guided classification model, a double optimization strategy is proposed to further improve the detection accuracy and robustness of the model for fish body defects from the aspects of loss function optimization and segmentation structure enhancement.
[0050] A double optimization strategy based on loss function optimization and small target detection structure enhancement is proposed. In this embodiment, aiming at the problems of small target missing and class imbalance in the identification of gold pompano deformity and damage, the YOLO11 model is optimized in structure and training method. The optimization includes the introduction of Focal Loss loss function and the addition of 160x160 small target detection segmentation head, and the integration is completed through specific steps, finally realizing high-precision detection and classification of small size fish body damage and deformity.
[0051] Introduction of Focal Loss loss function: In fish body defect detection, especially damage defects, due to small proportion and unobvious features in the image, it belongs to difficult classification samples, while large area fish body background or non-defect samples belong to easy classification samples. The traditional cross-entropy loss function treats all samples equally during training, which causes the model to pay more attention to large samples during training, ignoring small targets and minority class defects, and thus causing missing and detection bias. To solve this problem, the original cross-entropy loss in the loss function module of YOLO11 is replaced, and Focal Loss is introduced to make the model pay more attention to small target damage and minority class samples by dynamically adjusting the sample weight. The formula of Focal Loss is as follows:
[0052]
[0053] Among them: is the probability predicted by the model, for positive samples, is the probability predicted as a positive sample, for negative samples, ; is a balance factor to balance the importance of positive and negative samples, and by adjusting , the contributions of positive and negative samples in the loss function can be balanced according to their proportion and importance; is a focusing parameter to control the degree of weight adjustment of difficult and easy samples, and reasonable selection of can control the degree of suppression of easy classification samples, when , for easy classification samples, samples close to 1, the values of these easily classified samples will be small, thus reducing the loss weight of these easily classified samples, while for the difficult-to-classify samples close to 0.5, the values will be relatively large, thus increasing the loss weight of these difficult-to-classify samples.
[0054] Model integration step: first, replace the loss function module, replace the original classification loss function of YOLO11 with Focal Loss, so that the training process gives higher weight to a small number of defect samples such as damage and deformity. Then parameter setting: balance factor , focusing parameter , other training hyperparameters remain unchanged. Finally, training update, at each backpropagation, use Focal Loss to calculate the loss value and update the gradient, so that the model pays more attention to small target defect samples during training, thereby reducing missed detection.
[0055] Add a 160x160 small target detection segmentation head: the YOLO11 model has undergone multiple downsampling in the Backbone, although the deep feature map has strong semantic information, but the details of a large number of small targets are lost, which leads to the model cannot accurately identify small size damage area. Therefore, based on the original three scale segmentation heads (20x20, 40x40, 80x80), a 160x160 high resolution segmentation head is added, which is specially used to capture small damage and other micro features on fish bodies. The feature map with a scale of 80x80 at the end of Backbone is spliced with the feature map after two times of upsampling at the end of Neck, and the feature layer with small target feature information is obtained after C3k2 layer processing, then used for subsequent feature fusion and detection, and finally the result is sent to the newly added segmentation head to enhance the small target detection capability.
[0056] During training, set the initial learning rate to 0.01, the batch size to 16, the iteration number to 200, and introduce a weight decay parameter of 0.0005 to control the model complexity and reduce the risk of overfitting. Through multiple rounds of iterative training, the model gradually learns the contour features and local defect features of the fish body. After training is completed, the model is evaluated using the validation set, and the weight with the best performance is selected as the final model. In the inference stage, the image of the gold pompano to be detected is input into the trained model, which first outputs the fish body contour mask and the candidate defect region mask, realizes the complete separation of the fish body and the background, and marks out the possible damaged, scratched and deformed areas. Then, combined with the segmentation result, the classification is distinguished, and the final fish body defect category is output, including no defect, only deformity, only damage, and deformity and damage coexistence. Through this process, automatic segmentation and accurate identification of fish body defects can be realized.
[0057] It should be understood that the matters described herein are not detailed in order to avoid obscuring the present application. It should be apparent to those skilled in the art that modifications can be made to the embodiments described without departing from the spirit and scope of the application.
Claims
1. A method for automatic detection of deformities and injuries in golden pomfret based on deep learning, characterized in that, The steps are as follows: Step 1: Constructing the image dataset of golden pomfret; First, by comparing the morphological characteristics of normal and deformed golden pomfret, the fish body outline is determined as the basis for judging deformity. Then, a fin removal labeling strategy is adopted: during the labeling process, the dorsal and pelvic fins are removed, and only the fish body outline of the trunk and tail is retained for closed polygon labeling. Finally, the defective area is labeled with an independent closed polygon to achieve the separation labeling of the fish body outline and the defective area. Data augmentation was performed on the labeled golden pomfret images, including flipping, sharpening, brightness and contrast adjustment, injection of salt and pepper noise, and red channel enhancement. Considering the uneven number of samples of golden pomfret in different categories, a hierarchical expansion strategy was adopted: normal golden pomfret and deformed golden pomfret were randomly expanded once, and damaged golden pomfret were expanded multiple times; thus constructing an image dataset containing normal golden pomfret, deformed golden pomfret and damaged golden pomfret. Step 2: Based on the YOLO11 model, an integrated defect detection method of "segmentation-driven classification + dual optimization" is proposed. The specific process is as follows: (1) Fish body contour segmentation and defect region extraction; The image of the golden pomfret to be detected is input into the YOLO11 model. The YOLO11 model consists of a backbone network, a feature fusion neck network, and a segmentation head. The backbone network performs multi-scale feature extraction on the input golden pomfret image, and obtains the feature information related to the fish body contour and potential defects layer by layer. The neck network fuses shallow detail information and deep semantic information through a feature pyramid structure, which not only preserves the edge features of the fish body shape, but also captures potential damage features. The segmentation head outputs two pixel-level segmentation results: a fish body contour mask, used to completely separate the fish body region from the background region and remove background interference; Candidate defect area mask, used to mark possible defect areas on the surface of the fish, including damage and abrasions; (2) Segmentation-guided dual-pathway classification; After segmentation, the fish body region and defect region are input into the classification and discrimination module; the classification and discrimination module is located at the output of the YOLO11 model and includes the following two discrimination pathways: Overall contour feature path for deformity detection: The fish body contour mask is overlaid on the feature map output by the YOLO11 model, all background pixels are removed, and only the pixel information of the fish body area is retained; the fish body area is judged to determine whether it conforms to the spindle structure. If obvious protrusions, depressions or missing shapes are detected on the back or abdomen, the deformity judgment result is output. Local defect feature pathway for damage assessment: Automatically extract detailed features of local defects from high-confidence regions in the candidate defect area mask; analyze these local defects, and output damage assessment results if fish skin damage or abrasions are detected; Finally, the discrimination results of the overall contour feature pathway and the local defect feature pathway are fused to output the fish body defect category, including the following four categories: no defect, only deformity, only damage, and both deformity and damage. (3) Introduction of a dual optimization strategy; A dual optimization strategy is proposed: Focal Loss loss function optimization; during the training of the YOLO11 model, the standard cross-entropy loss function is replaced with the Focal Loss loss function, and the focusing parameter γ=2.0 and the class balance factor α=0.25 are set; based on the three-scale segmentation structure of the YOLO11 model, a 160×160 high-resolution segmentation branch is added: an 80×80 shallow feature map is extracted from the backbone network, the feature map output from the neck network is upsampled twice and then concatenated with it, the fused features are input into the C3k2 module for refinement, and then output to the newly added 160×160 segmentation head; (4) Model training and inference; For the optimized YOLO11 model, the training hyperparameters were set as follows: initial learning rate 0.01, batch size 16, number of iterations 200, and weight decay 0.0005. During the training phase, the Focal Loss loss function ensured class balance, and a new segmentation head was added to improve the detection capability of small targets. During the inference phase, the optimized YOLO11 model achieved end-to-end output of fish body segmentation, defect localization, and defect classification.