A method and system for identifying abnormal eggshell based on visual neural network

CN122737521BActive Publication Date: 2026-10-30TIANJIN VOCATIONAL INST +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202611216308.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-08-12
Publication Date
2026-10-30
Estimated Expiration
2046-08-12

AI Technical Summary

Technical Problem

人工筛查虽然操作直观,但容易受到人员经验、现场光照、卵茧堆叠密度以及拍摄角度等因素影响,存在识别效率低、判断标准不统一、轻微病态卵茧漏检率高等问题

Benefits of technology

[0015]本发明的有益效果在于:本发明通过将水产养殖中经标准化处理后的卵茧图像输入YOLO视觉神经网络模型,对卵茧进行自动识别和检测,避免了传统人工观察中受经验、光照、角度和卵茧堆叠情况影响较大的问题。相比人工筛查或简单图像比对,能够在批量卵茧图像中自动定位卵茧目标,并输出对应的正常或病态判断结果,提高病态卵茧筛查的效率和一致性。通过YOLO视觉神经网络模型中的主干网络对卵茧图像进行卷积特征提取,将卵茧的轮廓、纹理、形态等基础外观信息与色斑、褶皱、畸形、空洞等病态表现分别提取出来,使模型不再单纯依赖颜色阈值或固定规则进行判断,能够捕捉轻微病态卵茧中不明显的异常特征,减少正常纹理被误判为病态区域,或者轻微病态特征被忽略的情况。再通过C2f特征提取网络对卵茧基础特征和病态语义特征进行进一步处理,使卵茧的轮廓、纹理和形态信息能够被保留,同时增强色斑、褶皱、畸形、空洞等病态特征的表达能力。由此,在卵茧病态表现较轻、特征不明显的情况下,模型仍能够较好地区分正常卵茧和病态卵茧。通过SPPF空间金字塔池化网络对不同感受野下的卵茧特征进行池化融合,能够同时关注卵茧的局部纹理细节、局部形态异常以及密集卵茧之间的空间分布关系。有效改善卵茧目标尺寸小、数量多、排列密集时容易漏检的问题,提高对小目标卵茧和细微病态特征的识别能力。进一步通过特征融合网络对位置特征和病害语义特征进行双向融合,将卵茧的边界、轮廓位置等定位信息与病态响应信息结合起来,使病态区域能够更准确地对应到具体卵茧目标上。对于相邻卵茧贴合、重叠或者边界不清的情况,该方式能够减少病态区域串扰到相邻卵茧造成的误判,也能降低病态响应定位不准导致的漏检。通过对卵茧融合检测特征进行位置回归、目标置信度预测和类别概率预测,得到卵茧目标检测结果,实现能够同时给出卵茧的位置、是否存在卵茧目标以及该卵茧属于正常或病态的判断结果。本方案能够实现水产养殖场景下病态卵茧的自动化、批量化识别,提升筛查效率和识别稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122737521B_ABST
    Figure CN122737521B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of aquaculture disease egg identification, and particularly relates to a disease egg identification method and system based on a visual neural network, wherein a standardized egg image in aquaculture is input into a YOLO visual neural network model, the contour, texture, morphological features of the egg, as well as the color spot, wrinkle, deformity and hollow disease semantic features are extracted through a backbone network, the subtle disease features are enhanced through a C2f feature extraction network, and the egg features under different receptive fields are fused through an SPPF spatial pyramid pooling network. The position features and disease semantic features are bidirectionally fused through a feature fusion network, so that the disease area is more accurately corresponding to the specific egg target. Finally, the egg target detection result is obtained through position regression, target confidence prediction and class probability prediction, the automatic and batch identification of the disease egg is realized, and the screening efficiency and identification stability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of aquatic diseased egg cocoon identification technology, and more particularly to a method and system for identifying diseased egg cocoons based on visual neural networks. Background Technology

[0002] In aquaculture, the health of egg cocoons directly affects subsequent hatching rates, seedling survival rates, and the quality of the entire batch. Normal egg cocoons typically have a stable appearance, surface texture, and color distribution, while diseased egg cocoons often exhibit characteristics such as discoloration, wrinkles, deformities, cavities, surface abnormalities, or abnormal development. If diseased egg cocoons are not identified in time during screening or hatching management, it can easily lead to ineffective hatching, decreased batch quality, or increased aquaculture management costs.

[0003] Currently, assessing the health status of egg cocoons in aquaculture farms relies on manual observation or simple image comparison. While manual screening is intuitive, it is easily affected by factors such as personnel experience, ambient lighting, cocoon stacking density, and shooting angle, resulting in low identification efficiency, inconsistent judgment standards, and a high rate of missed detection of slightly diseased egg cocoons. Especially in batch screening scenarios, where egg cocoons are small in size, numerous, and densely distributed, manual identification of each one is insufficient to meet the real-time and stability requirements of large-scale aquaculture management. Existing image recognition methods can manually set thresholds or fixed feature rules to judge egg cocoon images, but they struggle to reliably extract effective features, easily misclassifying normal textures as diseased areas or ignoring subtle pathological features such as minor spots, wrinkles, and cavities. Summary of the Invention

[0004] To address the above problems, this invention provides a method and system for identifying pathological egg cocoons based on visual neural networks.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A method for identifying pathological egg cocoons based on visual neural networks includes the following steps: Standardized cocoon images from aquaculture are input into the YOLO visual neural network model; Convolutional feature extraction was performed on the egg cocoon image using a backbone network to obtain the basic features and pathological semantic features of the egg cocoon. The basic features and pathological semantic features of the egg cocoon are processed by feature reuse and gradient splitting through the C2f feature extraction network, and the egg cocoon features under different receptive fields are pooled and fused through the SPPF spatial pyramid pooling network to obtain multi-scale features of the egg cocoon. The location features and disease semantic features in the multi-scale features of the egg cocoon are bidirectionally fused using a feature fusion network to obtain the egg cocoon fusion detection features. The egg cocoon fusion detection features are subjected to location regression, target confidence prediction, and category probability prediction to obtain the egg cocoon target detection results.

[0006] Furthermore, the standardized egg cocoon image in the aquaculture is obtained through the following steps: Images of raw egg cocoons from several angles in an aquaculture farm were acquired using image acquisition equipment. The original cocoon images are subjected to image quality screening to remove invalid images that are excessively blurred, severely occluded, or abnormally exposed, so as to obtain valid cocoon images; The effective cocoon image is adaptively scaled according to the preset input size, and the original aspect ratio of the cocoon target is maintained during the scaling process to obtain a cocoon image with uniform size. Brightness correction, color gamut adjustment, and local contrast enhancement are performed on the uniformly sized cocoon images; The enhanced cocoon image is then subjected to pixel normalization to obtain the standardized cocoon image.

[0007] Furthermore, the backbone network includes a lightweight CSPDarknet structure.

[0008] Furthermore, the convolutional feature extraction of the cocoon image through the backbone network includes the following steps: Based on the standardized cocoon image, the contour, texture and morphological information of the cocoon target are extracted through the shallow convolutional units in the lightweight CSPDarknet structure to obtain the basic features of the cocoon. By extracting information on color spots, wrinkles, deformities, and cavities of egg cocoon targets in standardized egg cocoon images through deep convolutional units in the lightweight CSPDarknet structure, pathological semantic features of egg cocoons are obtained.

[0009] Furthermore, the feature reuse and gradient splitting processing of the basic features and pathological semantic features of the egg cocoon using the C2f feature extraction network includes the following steps: Based on the basic features of the egg cocoon and the pathological semantic features of the egg cocoon, feature scale alignment is performed to obtain the features of the egg cocoon to be reused; The features of the cocoon to be reused are input into the C2f feature extraction network, and the features of the cocoon to be reused are divided into first branch features and second branch features. The first branch features are preserved and passed on, retaining the outline, texture, and morphological information of the cocoon target; The second branch features are extracted by continuous convolution to enhance the expression of pathological features corresponding to spots, wrinkles, deformities and cavities in the egg cocoon target, thus obtaining pathological enhanced branch features; The first branch feature and the pathological enhancement branch feature are spliced ​​and fused to obtain the egg cocoon reuse enhancement feature.

[0010] Furthermore, the pooling and fusion of cocoon features under different receptive fields using the SPPF spatial pyramid pooling network includes: The egg cocoon reuse enhancement feature is input into the SPPF spatial pyramid pooling network; The egg cocoon reuse enhancement feature is subjected to first-scale pooling processing to obtain a first pooling feature, which retains the local texture and fine color spot information of the egg cocoon target; The first pooling feature is subjected to a second-scale pooling process to obtain a second pooling feature, which is used to characterize the wrinkles, cavities and local morphological anomalies of the egg cocoon target. The second pooling feature is subjected to a third-scale pooling process to obtain a third pooling feature, which is used to characterize the spatial distribution relationship and overall morphological differences among dense cocoon targets. The egg cocoon reuse enhancement feature, the first pooling feature, the second pooling feature, and the third pooling feature are spliced ​​and fused to obtain the spliced ​​pooling feature; The spliced ​​pooling features are convolved and integrated to obtain the multi-scale features of the egg cocoon.

[0011] Furthermore, the egg-cocoon fusion detection features are obtained through the following steps: Based on the multi-scale features of the egg cocoon, shallow location features and deep disease semantic features are determined according to feature resolution. Based on the pathological response region of the deep disease semantic features, the egg and cocoon boundary region in the shallow location features is semantically labeled to obtain semantically enhanced location features; Based on the integrity of the egg-cocoon boundary and the degree of overlap between adjacent egg-cocoons in the shallow location features, the pathological response region of the deep disease semantic features is positionally constrained to generate location-enhanced disease semantic features. By weightedly fusing the semantically enhanced location features and the location-enhanced disease semantic features based on the response intensity of the pathological response region, the integrity of the egg-cocoon boundary, and the degree of overlap between adjacent egg-cocoons, the egg-cocoon fusion detection features are obtained.

[0012] Furthermore, determining the shallow location features and deep disease semantic features according to feature resolution includes: Based on the feature resolution and downsampling factor of each scale feature map in the multi-scale features of the egg cocoon, shallow candidate feature maps with high feature resolution and low downsampling factor, and deep candidate feature maps with low feature resolution and high downsampling factor are determined. The shallow candidate feature map extracts the egg cocoon boundary response, contour position response, and local texture response to obtain the shallow position features. The deep candidate feature map extracts the color spot response, wrinkle response, deformity response, and cavity response to obtain the deep disease semantic features.

[0013] Furthermore, the location regression, target confidence prediction, and category probability prediction of the cocoon fusion detection features include: The egg-cocoon fusion detection features are input into the decoupled detection head, and the position regression branch in the decoupled detection head is used to perform regression calculation on the target boundary position of the egg-cocoon to obtain the target position prediction result of the egg-cocoon. The target existence prediction and the normal / abnormal category prediction of the egg cocoon fusion detection feature are respectively performed by the confidence prediction branch and the category prediction branch in the decoupled detection head to obtain the target confidence and category probability. The predicted location of the egg cocoon target, the confidence level of the target presence, and the category probability are combined to obtain the egg cocoon target detection result.

[0014] A pathological cocoon identification system based on a visual neural network, employing a pathological cocoon identification method based on a visual neural network as described in any of the preceding claims, comprising: The image input module is used to input standardized cocoon images from aquaculture into the YOLO visual neural network model; The backbone feature extraction module is used to perform convolutional feature extraction on the egg cocoon image through the backbone network to obtain the basic features of the egg cocoon and the pathological semantic features of the egg cocoon, respectively. The multi-scale feature generation module is used to perform feature reuse and gradient splitting on the basic features and pathological semantic features of the egg cocoon through the C2f feature extraction network, and to perform pooling and fusion of egg cocoon features under different receptive fields through the SPPF spatial pyramid pooling network to obtain multi-scale features of the egg cocoon. The bidirectional feature fusion module is used to bidirectionally fuse the location features and disease semantic features in the multi-scale features of the egg cocoon through a feature fusion network to obtain the egg cocoon fusion detection features; The detection output module is used to perform position regression, target confidence prediction, and category probability prediction on the egg cocoon fusion detection features to obtain the egg cocoon target detection results.

[0015] The beneficial effects of this invention are as follows: By inputting standardized cocoon images from aquaculture into the YOLO visual neural network model, this invention automatically identifies and detects cocoons, avoiding the problems of traditional manual observation being greatly affected by experience, lighting, angle, and cocoon stacking. Compared to manual screening or simple image comparison, it can automatically locate cocoon targets in batches of cocoon images and output corresponding normal or pathological judgment results, improving the efficiency and consistency of pathological cocoon screening. Through convolutional feature extraction of the cocoon images using the backbone network in the YOLO visual neural network model, basic appearance information such as the cocoon's outline, texture, and shape, as well as pathological manifestations such as spots, wrinkles, deformities, and cavities, are extracted separately. This allows the model to move beyond simply relying on color thresholds or fixed rules for judgment, enabling it to capture subtle abnormal features in slightly pathological cocoons, reducing the possibility of normal textures being misjudged as pathological areas or slight pathological features being ignored. The C2f feature extraction network further processes the basic features and pathological semantic features of the cocoons, preserving their contour, texture, and morphological information while enhancing the expression of pathological features such as spots, wrinkles, deformities, and cavities. Thus, even when the pathological manifestations of the cocoons are mild and the features are not obvious, the model can still distinguish between normal and pathological cocoons relatively well. The SPPF spatial pyramid pooling network fuses cocoon features from different receptive fields, simultaneously focusing on local texture details, local morphological anomalies, and the spatial distribution relationships between densely packed cocoons. This effectively improves the problem of missed detection when the cocoons are small, numerous, and densely arranged, enhancing the ability to identify small cocoons and subtle pathological features. Furthermore, a feature fusion network performs bidirectional fusion of location features and pathological semantic features, combining the boundary and contour positions of the cocoons with pathological response information, enabling pathological regions to more accurately correspond to specific cocoon targets. For cases where adjacent cocoons are closely packed, overlapping, or have unclear boundaries, this method can reduce misjudgments caused by crosstalk from pathological areas to adjacent cocoons, and also reduce missed detections due to inaccurate localization of pathological responses. By performing position regression, target confidence prediction, and category probability prediction on the cocoon fusion detection features, the method obtains the cocoon target detection results, enabling the simultaneous assessment of the cocoon's location, the presence of the target cocoon, and whether the cocoon is normal or pathological. This solution enables automated and batch identification of pathological cocoons in aquaculture scenarios, improving screening efficiency and identification stability. Attached Figure Description

[0016] Figure 1 This is a flowchart of the steps of a method for identifying pathological egg cocoons based on visual neural networks in this invention.

[0017] Figure 2 This is a flowchart illustrating the steps of pooling and fusing cocoon features under different receptive fields using the SPPF spatial pyramid pooling network in this invention.

[0018] Figure 3 This is a flowchart of the steps in this invention to perform location regression, target confidence prediction, and category probability prediction on the egg cocoon fusion detection features.

[0019] Figure 4 This is a schematic diagram of the structure of a pathological egg cocoon identification system based on a visual neural network in this invention.

[0020] Figure 5 This is a detection image of pathological egg cocoons involved in the application of this invention. Detailed Implementation

[0021] Please see Figures 1-5 As shown, the present invention relates to a method and system for identifying pathological egg cocoons based on a visual neural network.

[0022] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present invention.

[0023] The cocoon images described in this invention refer to images containing cocoons acquired through image acquisition equipment during cocoon screening, hatching observation, or aquaculture management in aquaculture farms. The image acquisition equipment can be an industrial camera, a high-definition camera, or an image acquisition device positioned above or to the side of a screening platform, hatching tray, or aquaculture observation station. During acquisition, the cocoons to be tested can be placed on a tray, screening conveyor belt, or hatching observation area, and images can be acquired from a fixed angle or multiple angles to cover as much of the cocoon's outline, surface texture, color changes, wrinkled areas, and localized abnormal areas as possible.

[0024] Current methods for screening aquatic egg cocoons rely on manual observation or fixed image rules, which are easily affected by factors such as personnel experience, ambient lighting, dense stacking of egg cocoons, and unclear pathological characteristics, resulting in low identification efficiency, unstable judgment, and a high rate of missed detection of slightly pathological egg cocoons.

[0025] This scheme inputs standardized cocoon images into a YOLO visual neural network model, sequentially performing backbone feature extraction, C2f feature reuse enhancement, SPPF multi-scale pooling fusion, and bidirectional fusion of location features and disease semantic features. Based on the fused cocoon detection features, it performs location regression, target confidence prediction, and category probability prediction to finally obtain the cocoon target detection result. This enables automatic location of cocoon targets in batches of cocoon images and determination of their normal or pathological state, improving the accuracy, stability, and screening efficiency of pathological cocoon identification in aquaculture scenarios.

[0026] It should be noted that pathological cocoon identification is not a direct detection of ordinary regular targets. Taking a standardized image of 640×640 pixels as an example, the width of a single cocoon target is usually 18 to 45 pixels and the height is 16 to 42 pixels. The area occupied by slight discoloration, narrow wrinkles or local holes is usually only 3% to 20% of the cocoon candidate area, and they are easily covered by background texture or normal surface reflections after continuous downsampling.

[0027] Meanwhile, cocoons in the hatching tray are usually densely packed, with intersection-over-union ratios (IoU) of adjacent candidate boxes reaching 0.20 to 0.55. Ill-formed response regions may span two adjacent cocoons. Water film reflection, natural shell textures, and shooting shadows can also produce pseudo-abnormal responses similar to spots or cavities. Therefore, this solution needs to simultaneously address three interrelated technical issues: enhancement of weak ill-formed features, attribution of dense target boundaries, and suppression of pseudo-abnormal responses, rather than simply applying the general YOLO model to cocoon image classification.

[0028] Example 1 See Figure 1 This invention includes a method for identifying pathological egg cocoons based on visual neural networks, comprising the following steps: S1. Input standardized egg cocoon images from aquaculture into the YOLO visual neural network model; Specifically, the standardized cocoon image refers to an image obtained by performing image quality screening, size standardization, brightness correction, color gamut adjustment, local contrast enhancement, and pixel normalization on original cocoon images collected in aquaculture scenarios. The cocoon image may include a single cocoon or multiple densely distributed cocoon targets.

[0029] In this step, the standardized cocoon image is input into the YOLO visual neural network model, which enables the model to perform subsequent recognition based on a unified image scale and stable image quality, reducing recognition errors caused by shooting angle, ambient lighting, image blur, or changes in cocoon proportion.

[0030] S2. Convolutional feature extraction is performed on the egg cocoon image through the backbone network to obtain the basic features and pathological semantic features of the egg cocoon. It should be noted that in the YOLO visual neural network model, the backbone network is used to perform multi-layer convolution operations on the input cocoon image. The basic features of the cocoon refer to the image features used to characterize the outline, boundary, texture, and overall shape of the cocoon; the pathological semantic features of the cocoon refer to the deep features used to characterize abnormal manifestations such as spots, wrinkles, deformities, and cavities in pathological cocoons.

[0031] The backbone network first extracts edges, contours, and textures from the cocoon image, enabling the model to determine the basic shape of the cocoon target in the image. It then further extracts deeper pathological features such as discoloration, wrinkles, deformities, and cavities, allowing the model to make judgments independent of manual thresholds or fixed image rules. By obtaining the basic features and pathological semantic features of the cocoon respectively, the model's ability to identify subtle differences between slightly pathological cocoons and normal cocoons can be improved.

[0032] S3. The basic features and pathological semantic features of the egg cocoon are processed by feature reuse and gradient splitting through the C2f feature extraction network, and the egg cocoon features under different receptive fields are pooled and fused through the SPPF spatial pyramid pooling network to obtain multi-scale features of the egg cocoon. The C2f feature extraction network is used to reuse and enhance cocoon features at different levels, enabling the basic appearance information and pathological semantic information of the cocoon to participate in subsequent recognition. The SPPF spatial pyramid pooling network is used to extract and fuse cocoon features under different receptive fields, allowing the model to simultaneously focus on local details and spatial distribution over a larger area.

[0033] S4. The location features and disease semantic features in the multi-scale features of the egg cocoon are bidirectionally fused using a feature fusion network to obtain the egg cocoon fusion detection features. The location features refer to those used to characterize the boundaries, outlines, and dense distribution of cocoons; the disease semantic features refer to those used to characterize the pathological response areas of cocoons. The bidirectional fusion refers to transmitting disease semantic information to the location features while simultaneously feeding back location boundary information to the disease semantic features, allowing the two to mutually correct each other.

[0034] In this step, the feature fusion network, on the one hand, semantically enhances the boundary region of the egg cocoon based on the pathological response region in the semantic features of the disease, enabling the model to identify which egg cocoon location is near a suspected pathological manifestation; on the other hand, it imposes positional constraints on the pathological response region based on the integrity of the egg cocoon boundary and the overlap of adjacent egg cocoons in the positional features, allowing the pathological features to more accurately correspond to specific egg cocoon targets. This step can reduce misjudgments and missed detections caused by adjacent egg cocoons being close together, overlapping, or having unclear boundaries.

[0035] S5. Perform position regression, target confidence prediction, and category probability prediction on the egg cocoon fusion detection features to obtain the egg cocoon target detection results.

[0036] Specifically, location regression refers to determining the location range of the cocoon target in the image based on the cocoon fusion detection features; target confidence prediction refers to determining whether a cocoon target exists in the corresponding region; and category probability prediction refers to determining the probability that the cocoon target belongs to a normal cocoon or a pathological cocoon.

[0037] Through the above steps, automated identification of batches of egg cocoon images can be achieved in aquaculture scenarios. This allows for both locating the egg cocoons and determining whether they exhibit pathological characteristics. Compared to manual observation or simple image rule-based judgment, this invention improves the accuracy, stability, and screening efficiency of identifying pathological egg cocoons, and is particularly suitable for detection scenarios where the egg cocoons are small in size, numerous, densely distributed, and lack obvious pathological features.

[0038] Further, in step S1, the standardized egg cocoon image in aquaculture is obtained through the following steps: S11. Acquire raw cocoon images from several angles in an aquaculture farm using an image acquisition device; Specifically, the image acquisition device can be an industrial camera, a high-definition camera, or an image acquisition device positioned above or to the side of the cocoon screening platform, hatching tray, or aquaculture observation station. The various angles can include top-down, side-down, or tilt angles, used to acquire the overall outline, surface texture, color distribution, and appearance information such as localized wrinkles, spots, and cavities of the cocoons. Multi-angle acquisition can reduce the problems of cocoon occlusion, overlap, or localized anomalies remaining invisible from a single shooting angle.

[0039] S12. Perform image quality screening on the original cocoon images to remove invalid images that are excessively blurred, severely occluded, or abnormally exposed, and obtain valid cocoon images; Invalid images refer to those that cannot clearly reflect the boundaries, texture, or pathological appearance of the cocoon target. Directly inputting such images into the model can easily lead to inaccurate cocoon boundary localization, incorrect identification of pathological regions, or missed target detection. Therefore, quality screening retains images that meet the recognition requirements in terms of sharpness, exposure, and target integrity, making subsequent feature extraction more stable.

[0040] S13. Adaptively scale the effective cocoon image according to the preset input size, and maintain the original aspect ratio of the cocoon target during the scaling process to obtain a cocoon image with uniform size; The preset input size refers to the input image size required by the YOLO visual neural network model. Maintaining the original aspect ratio of the cocoon target during adaptive scaling can prevent distortion of the cocoon outline, wrinkled state, or deformed features due to image stretching.

[0041] S14. Perform brightness correction, color gamut adjustment and local contrast enhancement processing on the uniformly sized cocoon images; Brightness correction is used to reduce the impact of excessively strong or dim lighting at the breeding site on the image; color gamut adjustment is used to reduce color deviations caused by shooting equipment or ambient light; and local contrast enhancement is used to highlight the texture, spots, wrinkles, cavities, and boundary details on the surface of the egg cocoons. This step can improve the recognizability of minor pathological features in the image and reduce confusion between normal egg cocoon textures and abnormal areas.

[0042] S15. Perform pixel normalization processing on the enhanced cocoon image to obtain the standardized cocoon image.

[0043] The pixel normalization process is used to adjust the image pixel values ​​to the numerical range suitable for the model, so as to unify the differences in brightness, color and pixel distribution between different images. After the above processing of S11 to S15, the obtained standardized cocoon image can be input into the YOLO visual neural network model more stably, which is beneficial to improving the accuracy of subsequent cocoon target localization, pathological feature extraction and normal / pathological classification.

[0044] Furthermore, the backbone network includes a lightweight CSPDarknet structure.

[0045] It should be noted that because cocoons are small in size, numerous, and typically exhibit weak pathological features, excessively deep downsampling and convolution in the backbone network can easily weaken features such as small spots, local wrinkles, and tiny holes in the deep network. CSPDarknet preserves shallow details through cross-stage partial connections and enhances deep representation through residual feature extraction, thereby reducing the loss of small target features and improving the ability to distinguish subtle differences between normal and pathological cocoons.

[0046] The lightweight CSPDarknet structure reduces redundant convolutional layers, channels, and repetitive feature extraction units compared to CSPDarknet, allowing the backbone network to maintain cross-stage feature fusion capabilities while reducing parameter and computational load. Since aquaculture scenarios typically require batch screening of large numbers of cocoon images, the lightweight structure improves model inference speed, reduces the computational burden on field equipment or edge computing terminals, and meets the application requirements for rapid detection of pathological cocoons.

[0047] Furthermore, the convolutional feature extraction of the cocoon image through the backbone network includes the following steps: Based on the standardized cocoon image, the contour, texture and morphological information of the cocoon target are extracted through the shallow convolutional units in the lightweight CSPDarknet structure to obtain the basic features of the cocoon. By extracting information on color spots, wrinkles, deformities, and cavities of egg cocoon targets in standardized egg cocoon images through deep convolutional units in the lightweight CSPDarknet structure, pathological semantic features of egg cocoons are obtained.

[0048] Specifically, the standardized cocoon image is input into the lightweight CSPDarknet as input image data. It then passes through an initial convolutional layer, a normalization layer, and an activation layer in a shallow convolutional unit for low-level visual feature extraction, resulting in a shallow cocoon feature map. This shallow cocoon feature map retains the edge grayscale variations, surface texture variations, and shape contour variations of the cocoon target.

[0049] In one embodiment, the standardized cocoon image has a size of 640×640×3. After the standardized cocoon image is input into a lightweight CSPDarknet structure, it first undergoes feature extraction via shallow convolutional units. Each shallow convolutional unit includes a first convolutional layer and a second convolutional layer. The first convolutional layer uses a 3×3 kernel, a stride of 2, and 32 output channels to convert the standardized cocoon image into a 320×320×32 first shallow cocoon feature map. The second convolutional layer uses a 3×3 kernel, a stride of 2, and 64 output channels to convert the first shallow cocoon feature map into a 160×160×64 second shallow cocoon feature map.

[0050] After the second shallow cocoon feature map enters the shallow CSP feature unit, it is divided into preserved branch features and convolutional branch features. The preserved branch features are used to preserve the contour, boundary, and texture information of the cocoon target; the convolutional branch features are processed by 1×1 convolution kernels and 3×3 convolution kernels in sequence to extract the local texture and morphological changes of the cocoon. Subsequently, the preserved branch features and the convolutional branch features are concatenated and fused to obtain the basic cocoon features.

[0051] The basic features of the egg cocoon are further input into a deep convolutional unit. The deep convolutional unit includes a third convolutional layer and a fourth convolutional layer. The third convolutional layer uses a 3×3 convolutional kernel, a stride of 2, and 128 output channels to convert the 160×160×64 basic egg cocoon features into an 80×80×128 mid-level egg cocoon feature map. The fourth convolutional layer uses a 3×3 convolutional kernel, a stride of 2, and 256 output channels to convert the mid-level egg cocoon feature map into a 40×40×256 deep egg cocoon feature map.

[0052] After the deep cocoon feature map is entered into the deep CSP feature unit, some features retain the overall morphology and spatial location of the cocoon through cross-stage connections, while the other part of the features is further processed by 1×1 convolution kernels and 3×3 convolution kernels to extract abnormal responses such as spots, wrinkles, deformities, and cavities. After the two parts of features are spliced ​​and fused, the pathological semantic features of the cocoon are obtained.

[0053] Furthermore, the feature reuse and gradient splitting processing of the basic features and pathological semantic features of the egg cocoon using the C2f feature extraction network includes the following steps: Based on the basic features of the egg cocoon and the pathological semantic features of the egg cocoon, feature scale alignment is performed to obtain the features of the egg cocoon to be reused; The features of the cocoon to be reused are input into the C2f feature extraction network, and the features of the cocoon to be reused are divided into first branch features and second branch features. The first branch features are preserved and passed on, retaining the outline, texture, and morphological information of the cocoon target; The second branch features are extracted by continuous convolution to enhance the expression of pathological features corresponding to spots, wrinkles, deformities and cavities in the egg cocoon target, thus obtaining pathological enhanced branch features; The first branch feature and the pathological enhancement branch feature are spliced ​​and fused to obtain the egg cocoon reuse enhancement feature.

[0054] Specifically, in one embodiment, the basic features of the egg cocoon are 160×160×64 feature data, and the pathological semantic features of the egg cocoon are 40×40×256 feature data. The basic features of the egg cocoon are converted into 80×80×128 basic alignment features through a convolutional layer with a 3×3 convolutional kernel and a stride of 2. The pathological semantic features of the egg cocoon are converted into 80×80×256 semantic alignment features through upsampling processing, and their channel number is adjusted to 128 through a 1×1 convolutional kernel. Then, the basic alignment features and semantic alignment features are concatenated, and the channel data is integrated through a 1×1 convolutional kernel to obtain the egg cocoon features to be reused.

[0055] After the cocoon features to be reused are input into the C2f feature extraction network, they are first adjusted through 1×1 convolutional kernels, and then divided into first branch features and second branch features according to the channel dimension. The first branch features are preserved and passed along the shortcut branch to preserve the contour, texture and morphological information of the cocoon target, so as to avoid the boundary details of small target cocoons being weakened during continuous convolution.

[0056] The second branch feature is fed into a continuous convolutional structure in the C2f feature extraction network, where it is extracted sequentially through 1×1 and 3×3 convolutional kernels. The 1×1 kernel is used to compress and adjust the channel data, while the 3×3 kernel is used to extract local neighborhood blemishes, wrinkles, deformities, and holes, resulting in the ill-enhanced branch feature. Finally, the first branch feature and the ill-enhanced branch feature are concatenated along the channel dimension and fused using a 1×1 convolutional kernel to obtain the cocoon reuse enhancement feature.

[0057] Therefore, the C2f feature extraction network forms a data processing process of scale alignment, branch preservation, continuous convolution enhancement, and splicing fusion, which enables the basic appearance information and pathological semantic information of the egg cocoon to participate in subsequent detection simultaneously, thereby improving the stability of identifying slightly pathological egg cocoons.

[0058] In a C2f improvement method targeting pathological cocoons, an pathological response weighting matrix is ​​further established for the second branch features. Specifically, local color contrast, texture gradient dispersion, and morphological offset are calculated from the second branch features, and pathological enhancement coefficients are generated according to the following formula:

[0059] in, σ represents the ill-conditioned enhancement coefficient, whose value is normalized to 0 to 1 by the Sigmoid function; σ represents the Sigmoid activation function. This represents the normalized color contrast between the current local region and its neighborhood. This indicates the degree of dispersion of the texture gradient magnitude within the current local region; This represents the normalized offset of the current cocoon outline relative to the normal cocoon morphology baseline; , and These represent the weights corresponding to color contrast, texture gradient dispersion, and shape offset, respectively. These weights are obtained through model training or preset based on validation set results.

[0060] The ill-conditioned enhancement coefficients are mapped to the spatial location and channel dimension of the second branch feature, and the ill-conditioned response is enhanced according to the following formula:

[0061] in, The second branch feature tensor before enhancement; The table shows the second-branch feature tensor after the enhancement of the ill-conditioned response; ⊙ represents element-wise multiplication; 1 represents interaction with g via a broadcast mechanism. Dimensionally matched unit scalar or all-one tensor. Enhanced. Channel splicing with the first branch features enables regions with color abrupt changes, gradient disorder, or contour offset to obtain a higher response, while avoiding the indiscriminate amplification of normal shell surface stable textures.

[0062] Further, see Figure 2 The method of pooling and fusing cocoon features under different receptive fields using the SPPF spatial pyramid pooling network includes: The egg cocoon reuse enhancement feature is input into the SPPF spatial pyramid pooling network; The egg cocoon reuse enhancement feature is subjected to first-scale pooling processing to obtain a first pooling feature, which retains the local texture and fine color spot information of the egg cocoon target; The first pooling feature is subjected to a second-scale pooling process to obtain a second pooling feature, which is used to characterize the wrinkles, cavities and local morphological anomalies of the egg cocoon target. The second pooling feature is subjected to a third-scale pooling process to obtain a third pooling feature, which is used to characterize the spatial distribution relationship and overall morphological differences among dense cocoon targets. The egg cocoon reuse enhancement feature, the first pooling feature, the second pooling feature, and the third pooling feature are spliced ​​and fused to obtain the spliced ​​pooling feature; The spliced ​​pooling features are convolved and integrated to obtain the multi-scale features of the egg cocoon.

[0063] Specifically, in one embodiment, the egg cocoon reuse enhancement feature is 80×80×256 feature data, which is first processed through a 1×1 convolutional layer for channel adjustment to obtain input features for pooling processing. The input features are then subjected to a first-scale pooling process to obtain a first-pooled feature. In one embodiment, the first-scale pooling process uses max pooling with a kernel size of 5×5, a stride of 1, and a fill factor of 2, thereby expanding the local receptive field while maintaining the feature map size, enhancing the response to small color spots while preserving the local texture information of the egg cocoon. The first-scale pooling feature is then subjected to a second-scale pooling process with the same parameters to obtain a second-pooled feature, further enhancing the regional response corresponding to wrinkles, holes, and local morphological anomalies. Finally, the second-scale pooling feature is subjected to a third-scale pooling process with the same parameters to obtain a third-pooled feature, characterizing the spatial distribution relationship and overall morphological differences among dense egg cocoon targets.

[0064] The egg cocoon reuse enhancement features, first pooling features, second pooling features, and third pooling features are concatenated along the channel dimension to obtain concatenated pooling features; in one embodiment, the size of the concatenated features is 80×80×1024. Then, a 1×1 convolutional layer is used to integrate the channels of the concatenated pooling features to obtain the egg cocoon multi-scale features. Through the above processing, the SPPF spatial pyramid pooling network forms a data progression process of input features, multi-scale pooling features, concatenated pooling features, and egg cocoon multi-scale features, enabling the model to simultaneously utilize local detail information and large-scale spatial information, improving its ability to identify small target egg cocoons, dense egg cocoons, and subtle pathological features.

[0065] In the aforementioned continuous pooling process, three 5×5 pooling operations with a step size of 1 form equivalent receptive fields of 5×5, 9×9, and 13×13 on the feature map, respectively. When the input feature map resolution is 80×80 and the downsampling factor relative to the original image is 8, the three receptive fields correspond to observation ranges of approximately 40×40, 72×72, and 104×104 pixels in the original image. The first receptive field matches the fine color spots and local textures inside a single cocoon; the second receptive field covers a single cocoon and its edges, characterizing continuous wrinkles, cavity areas, and local deformities; the third receptive field further covers adjacent cocoons, characterizing the distance between cocoons, the direction of adhesion, and cross-target abnormal responses. By corresponding the pooling scale to the spatial size of the ill-conditioned features, the lack of specificity in ill-conditioned identification is avoided by simply expanding the receptive field.

[0066] Furthermore, the egg-cocoon fusion detection features are obtained through the following steps: Based on the multi-scale features of the egg cocoon, shallow location features and deep disease semantic features are determined according to feature resolution. Based on the pathological response region of the deep disease semantic features, the egg and cocoon boundary region in the shallow location features is semantically labeled to obtain semantically enhanced location features; Based on the integrity of the egg-cocoon boundary and the degree of overlap between adjacent egg-cocoons in the shallow location features, the pathological response region of the deep disease semantic features is positionally constrained to generate location-enhanced disease semantic features. By weightedly fusing the semantically enhanced location features and the location-enhanced disease semantic features based on the response intensity of the pathological response region, the integrity of the egg-cocoon boundary, and the degree of overlap between adjacent egg-cocoons, the egg-cocoon fusion detection features are obtained.

[0067] Furthermore, determining the shallow location features and deep disease semantic features according to feature resolution includes: Based on the feature resolution and downsampling factor of each scale feature map in the multi-scale features of the egg cocoon, shallow candidate feature maps with high feature resolution and low downsampling factor, and deep candidate feature maps with low feature resolution and high downsampling factor are determined. The shallow candidate feature map extracts the egg cocoon boundary response, contour position response, and local texture response to obtain the shallow position features. The deep candidate feature map extracts the color spot response, wrinkle response, deformity response, and cavity response to obtain the deep disease semantic features.

[0068] Specifically, the shallow location features can be high-resolution cocoon feature maps, such as 160×160 or 80×80 feature maps, which include cocoon boundary response values, center point coordinates, candidate box width and height, contour continuity, and distance data between adjacent cocoons; the deep disease semantic features can be low-resolution feature maps with stronger semantic expression, such as 40×40 feature maps, which include color spot response values, wrinkle response values, deformity response values, cavity response values, and diseased area area percentage data.

[0069] The semantic features of deep lesions are upsampled to the same resolution as the shallow location features, and the response values ​​of color spots, wrinkles, deformities, and cavities are mapped to the corresponding candidate boundary regions of cocoons. When the average value of the pathological response within a candidate boundary of a cocoon is greater than a preset response threshold, or when the area of ​​the pathological response region occupies a proportion greater than a preset proportion threshold, the candidate boundary is marked as a suspected pathological cocoon region, thus obtaining the semantically enhanced location features.

[0070] The integrity of the cocoon boundary can be determined based on the ratio of the continuous length of the boundary response to the perimeter of the candidate cocoon, and the degree of overlap between adjacent cocoons can be determined based on the ratio of the overlapping area of ​​adjacent candidate frames to the area of ​​the candidate frame. When a pathological response region falls into two adjacent cocoon candidate frames simultaneously, the attribution of the pathological response region is determined based on the overlapping area between the candidate frame and the pathological response region, the distance between the center points of the candidate frames, and the boundary integrity. For abnormal responses that exceed the cocoon boundary or fall into the overlapping area, they are truncated, suppressed, or redistributed to avoid misattributing a pathological response on one cocoon to an adjacent cocoon.

[0071] The semantically enhanced location features and location-enhanced disease semantic features are weighted and fused based on the response intensity of the pathological response region, the integrity of the cocoon boundary, and the degree of overlap between adjacent cocoons to obtain the cocoon fusion detection features. Specifically, when the pathological response intensity is high, the proportion of the pathological region is large, and the integrity of the cocoon boundary is high, the fusion weight of the location-enhanced disease semantic features is increased; when the degree of overlap between adjacent cocoons is high, the boundary continuity is poor, or the pathological response spans multiple candidate cocoon regions, the fusion weight of the boundary location data in the semantically enhanced location features is increased. The fused cocoon fusion detection features simultaneously include cocoon boundary coordinates, center position, degree of overlap, pathological response intensity, proportion of the pathological region, and category response data, which are used for subsequent location regression, target confidence prediction, and category probability prediction.

[0072] Through the above processing, the feature fusion network does not simply splice positional and semantic features, but uses data such as the integrity of the cocoon boundary, the degree of target overlap, the intensity of pathological response, and the proportion of abnormal regions to correct the correspondence between pathological regions and specific cocoon targets, thereby improving the accuracy of pathological cocoon identification in dense cocoon scenes.

[0073] In one specific implementation, an ill-conditioned response map and a cocoon boundary constraint map are generated based on the deep disease semantic features and the shallow location features, respectively, as shown below:

[0074] Where S represents the deep disease semantic feature tensor; P represents the shallow location feature tensor; This indicates a convolution operation using a 1×1 convolution kernel for channel mapping. P represents the convolution operation that uses a 3×3 convolution kernel to extract the local boundary response; σ represents the Sigmoid function; Up represents the upsampling operation; M represents the ill-conditioned response map upsampled to the same spatial resolution as P; B represents the cocoon boundary constraint map generated from shallow location features.

[0075] Based on the aforementioned pathological response map and cocoon boundary constraint map, the semantically enhanced location features and the location-enhanced semantic features of the disease are calculated according to the following formulas:

[0076] in, This represents semantically enhanced location features; Location-based enhancement of disease semantic features; This represents the enhancement intensity coefficient of the ill-conditioned response map to shallow location features; The constraint strength coefficient of the boundary constraint map on the semantic features of deep disease is represented by: Down indicates the operation of downsampling the boundary constraint map to the same spatial resolution as S; ⊙ indicates element-wise multiplication; 1 indicates a unit scalar or all-1 tensor. Through this processing, the egg-cocoon boundary region obtains the corresponding ill-conditioned semantics, while the ill-conditioned responses outside the boundary and in the gaps between adjacent egg-cocoons are suppressed relative to the responses inside the boundary.

[0077] For each candidate cocoon region, the ill-conditioned response intensity is taken as the average value of the ill-conditioned response map within the candidate region; the boundary integrity is taken as the ratio of the continuous boundary length to the perimeter of the candidate contour; and the overlap between adjacent cocoons is taken as the ratio of the overlap area between the current candidate box and the adjacent candidate box to the smaller of their respective areas. Based on the above data, the fusion coefficient is determined according to the following formula:

[0078] Where α represents the adaptive fusion coefficient between semantic features and positional features; R represents the ill-conditioned response intensity within the candidate region; C represents the boundary integrity of the candidate cocoon; O represents the degree of overlap between the current candidate cocoon and its neighboring cocoons; σ represents the Sigmoid function; , and These represent the fusion weights corresponding to the intensity of the ill-conditioned response, the integrity of the boundary, and the degree of overlap, respectively.

[0079] After aligning the feature scale and the number of channels, the cocoon fusion detection features are obtained according to the following formula:

[0080] Wherein, F represents the egg-cocoon fusion detection feature; This represents semantically enhanced location features; The location-enhanced semantic features of the disease are represented; α represents the adaptive fusion coefficient; 1 α represents the fusion ratio corresponding to the location feature; This indicates feature concatenation along the channel dimension; Conv represents a convolution operation that performs channel compression and local information integration on the concatenated features. Therefore, when the ill-conditioned response is clear and the boundary is complete, the proportion of semantic features related to the disease is increased; when the degree of overlap is high or the ill-conditioned response crosses boundaries, the constraint effect of positional features is enhanced.

[0081] Further, see Figure 3 The step of performing location regression, target confidence prediction, and category probability prediction on the cocoon fusion detection features includes: The egg-cocoon fusion detection features are input into the decoupled detection head, and the position regression branch in the decoupled detection head is used to perform regression calculation on the target boundary position of the egg-cocoon to obtain the target position prediction result of the egg-cocoon. The target existence prediction and the normal / abnormal category prediction of the egg cocoon fusion detection feature are respectively performed by the confidence prediction branch and the category prediction branch in the decoupled detection head to obtain the target confidence and category probability. The predicted location of the egg cocoon target, the confidence level of the target presence, and the category probability are combined to obtain the egg cocoon target detection result.

[0082] Specifically, the location regression branch maps the cocoon fusion detection features through convolutional layers and outputs the boundary offset of the cocoon candidate target relative to the feature map grid position. The boundary offset includes the center point offset, width parameter, and height parameter. Then, the bounding box is decoded according to the feature map grid coordinates, downsampling factor, and boundary offset to obtain the cocoon target position prediction result.

[0083] The confidence prediction branch outputs a target existence prediction value through a convolutional layer, and then normalizes this prediction value to a range of 0 to 1 using a sigmoid function to obtain the target existence confidence score. This confidence score represents the probability that a cocoon target exists within the corresponding candidate region. The category prediction branch outputs a category prediction vector through a convolutional layer, which includes a normal cocoon category score and a pathological cocoon category score. This vector is then normalized using either a softmax function or a sigmoid function to obtain the category probability prediction result.

[0084] The predicted location of the cocoon target, the target presence confidence score, and the class probability prediction results are combined to obtain candidate detection results. A comprehensive confidence score is determined based on the product of the target presence confidence score and the class probability. The candidate detection results are then sorted and thresholded according to their comprehensive confidence scores. For overlapping candidate detection results, a non-maximum suppression method is used to remove duplicate bounding boxes, retaining the detection results with higher comprehensive confidence scores to obtain the final cocoon target detection results.

[0085] Through the above processing, the decoupled detection head calculates the location regression, target existence judgment and normal / illness classification separately, and then obtains the final detection result through confidence fusion and non-maximum suppression. This can reduce the problems of target box overlap, category judgment interference and duplicate detection in dense cocoon scenes.

[0086] In a decoupled detection head optimization method for cocoon detection, the position regression branch simultaneously receives 80×80 high-resolution fusion features and 40×40 deep fusion features. The high-resolution fusion features are used to correct the boundaries of small cocoons, while the deep fusion features are used to stabilize the overall contour. The category prediction branch appends a calibration value formed by ill-conditioned response intensity, boundary integrity, and overlap to the category vector. The comprehensive score of the candidate results is calculated according to the following formula:

[0087] Where Q represents the overall score of the candidate detection results; This indicates that the target has a confidence level; This represents the predicted probability of the corresponding normal or pathological category; Indicates the ill-conditioned response calibration coefficient; `Q` represents the intensity of ill-conditioned responses within the candidate region; `O` represents the degree of overlap between the current candidate box and its adjacent candidate boxes; `clip` represents the clipping function. Clipping constrains `Q` to between 0 and 1, reducing the excessive amplification of class scores by anomalous responses in highly overlapping regions.

[0088] Post-processing employs non-maximum suppression with boundary assignment constraints. When the intersection-union ratio (IU) of two candidate boxes is greater than a preset threshold, but their center points are located within two independent closed cocoon boundaries, both candidate boxes are retained. Candidate boxes with lower overall scores are suppressed only when they belong to the same boundary region and the IU is greater than 0.60. In one implementation, the initial screening threshold for pathological category candidate boxes is set to 0.45, and the initial screening threshold for normal category candidate boxes is set to 0.55, to reduce the probability of mildly pathological cocoons being prematurely filtered out due to weaker responses.

[0089] It should be noted that in YOLO model training, a training dataset of egg cocoon images is first constructed. Image samples of egg cocoons from different hatching batches, under different lighting conditions, with different egg cocoon densities, and with different degrees of pathology are collected from aquaculture farms. The original images include samples of normal egg cocoons, slightly discolored egg cocoons, wrinkled egg cocoons, abnormally hollow egg cocoons, and morphologically distorted egg cocoons. After collection, the images are cleaned, removing excessively blurred, severely occluded, abnormally exposed, and incompletely labeled images.

[0090] In one optional approach, 3000 valid cocoon images are first obtained, including approximately 36,000 normal cocoons and approximately 5200 pathological cocoons. Each cocoon is labeled with a bounding box using an annotation tool, and the target category is labeled as "normal cocoon" or "pathological cocoon". For difficult-to-identify samples such as slight discoloration, local wrinkles, and mild cavities, fine-grained annotations are performed according to the actual outer contour of the cocoon to avoid overly large annotation boxes that introduce background from adjacent cocoons. After annotation, the dataset is divided into training, validation, and test sets in an 8:1:1 ratio, with 2400 images in the training set, 300 in the validation set, and 300 in the test set. The number of categories is defined as 2 in the dataset configuration file, with the category names being normal cocoons and pathological cocoons, respectively.

[0091] The input images were uniformly scaled and normalized, with the image size set to 640×640×3, while maintaining the original aspect ratio of the cocoon target during scaling. To enhance the model's adaptability to complex on-site conditions, data augmentation techniques such as brightness perturbation, local contrast enhancement, slight noise, random rotation, random cropping, and texture fine-tuning were added to the training set. Specifically, the brightness perturbation ranged from 0.8 to 1.2 times the original image brightness, and the random rotation angle was controlled within ±10° to avoid destroying the true shape and pathological texture of the cocoon.

[0092] During model initialization, pre-trained weights based on the YOLO architecture were used for transfer learning, and the number of detection categories was modified to 2. Based on the statistical results of the bounding box width and height of cocoon targets in the training set, the anchor prior box size was adjusted. For example, statistics showed that the width of most cocoon targets in a 640×640 input image was concentrated between 18 and 45 pixels, and the height was concentrated between 16 and 42 pixels. Therefore, the prior box corresponding to the small target detection branch was set to a size closer to the aspect ratio of the cocoon target to improve the model's matching ability for small cocoons.

[0093] The training process consists of two phases: frozen training and global unfreezing fine-tuning training. In the frozen training phase, some pre-trained parameters of the lightweight CSPDarknet backbone are frozen, and only the parameters of the feature fusion network and the decoupled detection head are updated. This phase involves 50 epochs of training with a batch size of 16 and an initial learning rate of 0.001, allowing the model to adapt to the scale distribution, boundary morphology, and normal / illness class differences of the cocoon targets. Freezing training avoids early-stage gradient fluctuations that could corrupt the general edge, texture, and morphological features already learned by the backbone network.

[0094] After the training freeze, all network parameters were unfrozen for global fine-tuning training. The global fine-tuning phase consisted of 150 epochs, employing a cosine annealing learning rate strategy to gradually decrease the learning rate from 0.001 to 0.00001. In each training epoch, a batch of standardized cocoon images were input into the model, and the model output predicted bounding box locations, target presence confidence, and class probabilities. The training loss was then calculated based on the ground truth bounding boxes and class labels, and the model parameters were updated via backpropagation. During training, the recall, mAP, and false negatives of pathological cocoons in the validation set were closely monitored to prevent the model from biasing towards a larger number of normal cocoon samples.

[0095] The model training employs a weighted combined multi-task loss function, whereby the total loss includes bounding box regression loss, target confidence loss, and class classification loss, specifically:

[0096] Where L represents the total loss of model training; L_box represents the bounding box regression loss calculated using SIoU; L_obj represents the target confidence loss calculated using weighted binary cross-entropy; L_cls represents the classification loss between normal and pathological egg cocoons calculated using cross-entropy; λ_box, λ_obj, and λ_cls represent the weights of the bounding box regression loss, target confidence loss, and classification loss in the total loss, respectively, used to balance the three training tasks of target localization, target existence judgment, and category recognition.

[0097] The Loss_box function uses the SIoU loss function to calculate the overlap, center distance, width-to-height difference, and orientation angle difference between the predicted and ground truth bounding boxes. Since cocoon targets are small and adjacent targets easily overlap, SIoU loss improves the fit between the predicted and ground truth cocoon boundaries in dense cocoon scenes. The Loss_obj function uses a weighted binary cross-entropy loss to determine the presence of cocoon targets within candidate regions and increases the loss weight for positive cocoon samples, reducing the interference of numerous negative background samples on training. The Loss_cls function uses cross-entropy loss to distinguish between normal and pathological cocoons, assigning higher class weights to pathological cocoon categories to alleviate class imbalance caused by a small number of pathological samples.

[0098] During training, label smoothing, weight decay, and early stopping mechanisms are further employed to suppress overfitting. The label smoothing coefficient is set to 0.05 to reduce the impact of slightly pathological sample labeling errors on model training; the weight decay coefficient is set to 0.0005 to limit the model parameters from overfitting the training set; when the mAP of pathological cocoons on the validation set fails to improve for 20 consecutive rounds, training is stopped and the model weights that best perform on the validation set are retained.

[0099] After training, the model was validated using an independent test set. The test set included images of dense cocoons, images in low light, images of slightly pathological cocoons, and images of partially overlapping cocoons. In this embodiment, the model achieved an overall precision of 94.6% and an overall recall of 92.8% on the test set; specifically, the precision for the pathological cocoon category was 91.3%, and the recall was 89.7%. For cocoons with slight discoloration and local wrinkles, the model can make a comprehensive judgment based on shallow texture features, deep pathological semantic features, and multi-scale feature fusion results, reducing the possibility of missed detections that are easily caused by manual observation.

[0100] To verify the effects of the aforementioned ill-feature enhancement, scale-corresponding pooling, ill-position constraints, and detector head calibration, the original YOLOv8 model without these improvements was used as a control model under the same 3000-image dataset, 8:1:1 data partitioning, 640×640 input size, training epochs, and hardware environment. The original YOLOv8 model achieved an overall precision of 90.8%, an overall recall of 86.9%, and an mAP@0.5 of 89.6%. The ill-featured cocoon precision was 85.4%, the ill-featured cocoon recall was 81.2%, the recall of slightly ill-featured samples was 73.5%, the false negative rate in densely overlapping scenes was 16.8%, and the average inference time per image was 24.3 ms.

[0101] The proposed model achieved an overall precision of 94.6%, an overall recall of 92.8%, and an mAP@0.5 of 95.1% on the same test set. For pathological cocoons, the precision was 91.3%, the recall was 89.7%, the recall for slightly pathological samples was 86.9%, the false negative rate in densely overlapping scenes was 8.7%, and the average inference time per image was 21.6 ms. Compared to the original YOLOv8, this proposed model improved mAP@0.5 by 5.5 percentage points, the recall for pathological cocoons by 8.5 percentage points, the recall for slightly pathological samples by 13.4 percentage points, and the false negative rate in dense scenes by 8.1 percentage points. This indicates that the improvement is not merely a parallel combination of general YOLO modules, but rather a targeted improvement to the weak features of pathological cocoons and the attribution of dense boundaries. The above data represents test results under specific implementation conditions and does not constitute a limitation on model parameters or detection performance.

[0102] After training, the optimal model weights are deployed to the pathological cocoon identification system. During actual inference, the system inputs standardized cocoon images into the trained YOLO visual neural network model. After processing by the backbone network, C2f feature extraction network, SPPF spatial pyramid pooling network, feature fusion network, and decoupled detection head, the system outputs the cocoon target detection results. Through the above training method, the model can adapt to the detection characteristics of small, numerous, densely distributed cocoons with slight pathological features in aquaculture scenarios, as well as the imbalance between normal and pathological samples, thus improving the stability and generalization ability of pathological cocoon identification.

[0103] Example 2 In one specific application embodiment, an industrial camera is installed above the hatching trays in the breeding farm, and flexible supplementary lights are arranged on both sides of the camera to acquire images of the cocoons to be screened. Each hatching tray contains approximately 120 to 150 cocoons, and there are instances of partial adhesion, slight overlap, and insignificant differences in surface color among the cocoons.

[0104] During image acquisition, the image acquisition device photographed the hatching trays from both top-down and tilted angles. The original image resolution was 3840×2160, and the image format was RGB three-channel image. Ten hatching trays were considered as one batch for testing, resulting in 200 original cocoon images. Subsequently, the original cocoon images underwent quality screening. Images with a sharpness evaluation value below a preset sharpness threshold, cocoon occlusion area exceeding 30% of the target area, or average brightness values ​​that were too high or too low were discarded as invalid images. In this embodiment, 18 invalid images were discarded, retaining 182 valid cocoon images.

[0105] The retained valid cocoon images undergo adaptive scaling, unifying the input image size to 640×640×3 while maintaining the original aspect ratio of the cocoon target during scaling to avoid distortion of the cocoon outline, wrinkled state, or deformed features due to stretching. Then, brightness correction, color gamut adjustment, and local contrast enhancement are performed on the uniformly sized cocoon images to make the fine color spots, wrinkles, holes, and boundary textures on the cocoon surface clearer. Finally, the pixel values ​​are normalized to between 0 and 1 to obtain standardized cocoon images.

[0106] Standardized cocoon images are input into a pre-trained YOLO visual neural network model. The lightweight CSPDarknet structure in the model first extracts backbone features from the standardized cocoon images. In this embodiment, the standardized cocoon images are sequentially processed through shallow convolutional layers with 3×3 kernels and a stride of 2, forming shallow feature maps of 320×320×32 and 160×160×64. The shallow feature maps mainly retain the boundary response, contour position response, and local texture response of the cocoon target, thus obtaining the basic features of the cocoon. Subsequently, the basic features of the cocoon are further processed through deep convolutional units, forming deep feature maps of 80×80×128 and 40×40×256. The deep feature maps contain color spot response, wrinkle response, deformity response, and hole response, thus obtaining the pathological semantic features of the cocoon.

[0107] Furthermore, the basic features and pathological semantic features of the cocoon are input into the C2f feature extraction network for feature reuse and gradient splitting. Specifically, the 160×160×64 basic cocoon features are downsampled to 80×80×128, and the 40×40×256 pathological semantic features are upsampled to 80×80. The number of channels is adjusted using 1×1 convolutions to obtain cocoon features of consistent scale to be reused. These cocoon features are then divided into a first branch and a second branch after entering the C2f feature extraction network. The first branch retains the cocoon's outline, texture, and morphological information, while the second branch enhances pathological responses such as spots, wrinkles, deformities, and holes through continuous convolutions. The two types of branch features are then concatenated and fused to obtain the enhanced cocoon reuse features.

[0108] The egg-cocoon reuse enhancement features are input into the SPPF spatial pyramid pooling network. The SPPF network performs continuous pooling on the egg-cocoon reuse enhancement features, resulting in three pooling features: the first pooling feature, the second pooling feature, and the third pooling feature. The first pooling feature primarily preserves local texture variations and fine color spot responses on the egg-cocoon surface; the second pooling feature further characterizes wrinkle continuity, cavity response area, and local morphological anomalies; and the third pooling feature characterizes the spacing between adjacent egg-cocoons, boundary adhesion, overlap, and overall morphological differences. After concatenating and integrating the egg-cocoon reuse enhancement features with the above three pooling features, multi-scale egg-cocoon features are obtained.

[0109] In one test image of this embodiment, a total of 128 egg cocoons were identified, including 7 egg cocoons with slight discoloration, 5 shrunken egg cocoons, 3 egg cocoons with abnormal cavities, and 2 egg cocoons with morphological distortions. Through multi-scale feature analysis of the egg cocoons, the model extracted discoloration response intensities ranging from 0.71 to 0.86, fold response intensities ranging from 0.66 to 0.79, and cavity response intensities ranging from 0.74 to 0.88 in some suspected pathological egg cocoon areas; for normal egg cocoon areas, the pathological response intensities were mostly below 0.35.

[0110] The feature fusion network determines shallow location features and deep disease semantic features based on the resolution and downsampling factor of the multi-scale features of the cocoon. Shallow location features include data such as cocoon boundary response, center point location, candidate box width and height, boundary integrity, and overlap between adjacent cocoons. Deep disease semantic features include data such as color spot response, wrinkle response, deformity response, cavity response, and the proportion of abnormal areas. For a suspected diseased cocoon, its candidate boundary integrity is 0.91, the area of ​​the diseased response region accounts for 18.6% of the candidate box area, and the average diseased response is 0.78; therefore, this candidate region is marked as a suspected diseased region. For regions where the overlap between adjacent cocoons exceeds 0.35, the feature fusion network performs attribution correction on the diseased response region based on the distance between the candidate box center points, boundary integrity, and the overlapping area of ​​the diseased response region, avoiding incorrect association of an abnormal response on the surface of one cocoon with adjacent cocoons.

[0111] Finally, the cocoon fusion detection features are input into the decoupled detection head. The location regression branch outputs the bounding box coordinates of the cocoon target, the confidence prediction branch outputs the target existence confidence, and the category prediction branch outputs the category probabilities of normal and pathological cocoons. For candidate detection results with a confidence score greater than 0.50, the category probability is further calculated; when the pathological category probability is greater than the normal category probability and the overall confidence score is greater than 0.60, the corresponding cocoon is classified as a pathological cocoon. For overlapping candidate boxes, non-maximum suppression is used to remove duplicate detection boxes, retaining the detection results with higher overall confidence scores.

[0112] See Figure 5 The model output 128 cocoon detection results for the above test images, including 111 normal cocoons and 17 pathological cocoons. Each detection result includes the cocoon target bounding box, target presence confidence, normal category probability, pathological category probability, and category label. For example, the detection result of one pathological cocoon is as follows: the bounding box center point coordinates are (326, 214), the bounding box width is 38, the height is 31, the target presence confidence is 0.93, the normal category probability is 0.08, the pathological category probability is 0.92, and the output category label is "pathological cocoon".

[0113] Example 3 See Figure 4 The present invention also includes a pathological cocoon identification system based on a visual neural network, comprising: The image input module is used to input standardized cocoon images from aquaculture into the YOLO visual neural network model; The backbone feature extraction module is used to perform convolutional feature extraction on the egg cocoon image through the backbone network to obtain the basic features of the egg cocoon and the pathological semantic features of the egg cocoon, respectively. The multi-scale feature generation module is used to perform feature reuse and gradient splitting on the basic features and pathological semantic features of the egg cocoon through the C2f feature extraction network, and to perform pooling and fusion of egg cocoon features under different receptive fields through the SPPF spatial pyramid pooling network to obtain multi-scale features of the egg cocoon. The bidirectional feature fusion module is used to bidirectionally fuse the location features and disease semantic features in the multi-scale features of the egg cocoon through a feature fusion network to obtain the egg cocoon fusion detection features; The detection output module is used to perform position regression, target confidence prediction, and category probability prediction on the egg cocoon fusion detection features to obtain the egg cocoon target detection results.

[0114] It should be noted that the image acquisition component includes an industrial camera, a high-definition camera, or a multi-angle image acquisition device, installed above or to the side of the incubation tray, cocoon tray, or screening conveyor belt, for acquiring images of the cocoons. The supplementary lighting component includes a ring light source, a strip LED supplementary light, or a diffuse light source, for reducing the impact of uneven lighting, shadows, and reflections on image quality.

[0115] The image input module is deployed in the image processing terminal, which can be an industrial control computer, an edge computing box, or an embedded processing device. It is used to perform quality screening, size scaling, brightness correction, color gamut adjustment, local contrast enhancement, and pixel normalization on the original cocoon image to obtain a standardized cocoon image.

[0116] The backbone feature extraction module, multi-scale feature generation module, bidirectional feature fusion module, and detection output module are deployed in the model computing unit, which includes a server, GPU, NPU, or AI acceleration chip. The backbone feature extraction module extracts basic features and pathological semantic features of the cocoon; the multi-scale feature generation module generates multi-scale features of the cocoon; the bidirectional feature fusion module fuses location features and pathological semantic features; and the detection output module outputs the cocoon bounding box, target confidence score, normal / pathological category probability, and category label.

[0117] The display and alarm terminal is used to display the detection images, location, quantity, and confidence level of the abnormal cocoons; when the number or proportion of abnormal cocoons exceeds a preset threshold, an alarm is output. The data storage unit is used to save the original images, standardized images, detection results, and batch records.

[0118] The above embodiments are merely descriptions of preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made by those skilled in the art to the technical solutions of the present invention without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.

Claims

1. A method for identifying pathological egg cocoons based on visual neural networks, characterized in that, Includes the following steps: Standardized cocoon images from aquaculture are input into the YOLO visual neural network model; Convolutional feature extraction was performed on the egg cocoon image using a backbone network to obtain the basic features and pathological semantic features of the egg cocoon. The basic features and pathological semantic features of the egg cocoon are processed by feature reuse and gradient splitting through the C2f feature extraction network, and the egg cocoon features under different receptive fields are pooled and fused through the SPPF spatial pyramid pooling network to obtain multi-scale features of the egg cocoon. The location features and disease semantic features in the multi-scale features of the egg cocoon are bidirectionally fused by a feature fusion network, and the pathological response region is positionally constrained according to the integrity of the egg cocoon boundary and the degree of overlap of adjacent egg cocoons to obtain the egg cocoon fusion detection features. The egg cocoon fusion detection features are subjected to location regression, target confidence prediction, and category probability prediction to obtain the egg cocoon target detection results.

2. The method for identifying pathological egg cocoons based on visual neural networks according to claim 1, characterized in that, The standardized cocoon images used in aquaculture are obtained through the following steps: Images of raw egg cocoons from several angles in an aquaculture farm were acquired using image acquisition equipment. The original cocoon images are subjected to image quality screening to remove invalid images that are excessively blurred, severely occluded, or abnormally exposed, so as to obtain valid cocoon images; The effective cocoon image is adaptively scaled according to the preset input size, and the original aspect ratio of the cocoon target is maintained during the scaling process to obtain a cocoon image with uniform size. Brightness correction, color gamut adjustment, and local contrast enhancement are performed on the uniformly sized cocoon images; The enhanced cocoon image is then subjected to pixel normalization to obtain the standardized cocoon image.

3. The method for identifying pathological egg cocoons based on visual neural networks according to claim 2, characterized in that, The backbone network includes a lightweight CSPDarknet structure.

4. The method for identifying pathological egg cocoons based on visual neural networks according to claim 3, characterized in that, The step of extracting convolutional features from the cocoon image using a backbone network includes the following steps: Based on the standardized cocoon image, the contour, texture and morphological information of the cocoon target are extracted through the shallow convolutional units in the lightweight CSPDarknet structure to obtain the basic features of the cocoon. By extracting information on color spots, wrinkles, deformities, and cavities of egg cocoon targets in standardized egg cocoon images through deep convolutional units in the lightweight CSPDarknet structure, pathological semantic features of egg cocoons are obtained.

5. The method for identifying pathological egg cocoons based on visual neural networks according to claim 1, characterized in that, The step of performing feature reuse and gradient splitting on the basic features and pathological semantic features of the egg cocoon using a C2f feature extraction network includes the following steps: Based on the basic features of the egg cocoon and the pathological semantic features of the egg cocoon, feature scale alignment is performed to obtain the features of the egg cocoon to be reused; The features of the cocoon to be reused are input into the C2f feature extraction network, and the features of the cocoon to be reused are divided into first branch features and second branch features. The first branch features are preserved and passed on, retaining the outline, texture, and morphological information of the cocoon target; The second branch features are extracted by continuous convolution to enhance the expression of pathological features corresponding to spots, wrinkles, deformities and cavities in the egg cocoon target, thus obtaining pathological enhanced branch features; The first branch feature and the pathological enhancement branch feature are spliced ​​and fused to obtain the egg cocoon reuse enhancement feature.

6. The method for identifying pathological egg cocoons based on visual neural networks according to claim 5, characterized in that, The pooling and fusion of cocoon features under different receptive fields using the SPPF spatial pyramid pooling network includes: The egg cocoon reuse enhancement feature is input into the SPPF spatial pyramid pooling network; The egg cocoon reuse enhancement feature is subjected to first-scale pooling processing to obtain a first pooling feature, which retains the local texture and fine color spot information of the egg cocoon target; The first pooling feature is subjected to a second-scale pooling process to obtain a second pooling feature, which is used to characterize the wrinkles, cavities and local morphological anomalies of the egg cocoon target. The second pooling feature is subjected to a third-scale pooling process to obtain a third pooling feature, which is used to characterize the spatial distribution relationship and overall morphological differences among dense cocoon targets. The egg cocoon reuse enhancement feature, the first pooling feature, the second pooling feature, and the third pooling feature are spliced ​​and fused to obtain the spliced ​​pooling feature; The spliced ​​pooling features are convolved and integrated to obtain the multi-scale features of the egg cocoon.

7. The method for identifying pathological egg cocoons based on visual neural networks according to claim 1, characterized in that, The egg-cocoon fusion detection features are obtained through the following steps: Based on the multi-scale features of the egg cocoon, shallow location features and deep disease semantic features are determined according to feature resolution. Based on the pathological response region of the deep disease semantic features, the egg and cocoon boundary region in the shallow location features is semantically labeled to obtain semantically enhanced location features; Based on the integrity of the egg-cocoon boundary and the degree of overlap between adjacent egg-cocoons in the shallow location features, the pathological response region of the deep disease semantic features is positionally constrained to generate location-enhanced disease semantic features. By weightedly fusing the semantically enhanced location features and the location-enhanced disease semantic features based on the response intensity of the pathological response region, the integrity of the egg-cocoon boundary, and the degree of overlap between adjacent egg-cocoons, the egg-cocoon fusion detection features are obtained.

8. The method for identifying pathological egg cocoons based on visual neural networks according to claim 7, characterized in that, The process of determining shallow location features and deep disease semantic features according to feature resolution includes: Based on the feature resolution and downsampling factor of each scale feature map in the multi-scale features of the egg cocoon, shallow candidate feature maps with high feature resolution and low downsampling factor, and deep candidate feature maps with low feature resolution and high downsampling factor are determined. The shallow candidate feature map extracts the egg cocoon boundary response, contour position response, and local texture response to obtain the shallow position features. The deep candidate feature map extracts the color spot response, wrinkle response, deformity response, and cavity response to obtain the deep disease semantic features.

9. The method for identifying pathological egg cocoons based on visual neural networks according to claim 7, characterized in that, The process of performing location regression, target confidence prediction, and category probability prediction on the cocoon fusion detection features includes: The egg-cocoon fusion detection features are input into the decoupled detection head, and the position regression branch in the decoupled detection head is used to perform regression calculation on the target boundary position of the egg-cocoon to obtain the target position prediction result of the egg-cocoon. The target existence prediction and the normal / abnormal category prediction of the egg cocoon fusion detection feature are respectively performed by the confidence prediction branch and the category prediction branch in the decoupled detection head to obtain the target confidence and category probability. The predicted location of the egg cocoon target, the confidence level of the target presence, and the category probability are combined to obtain the egg cocoon target detection result.

10. A pathological cocoon identification system based on a visual neural network, employing the pathological cocoon identification method based on a visual neural network as described in any one of claims 1-9, characterized in that, include: The image input module is used to input standardized cocoon images from aquaculture into the YOLO visual neural network model; The backbone feature extraction module is used to perform convolutional feature extraction on the egg cocoon image through the backbone network to obtain the basic features of the egg cocoon and the pathological semantic features of the egg cocoon, respectively. The multi-scale feature generation module is used to perform feature reuse and gradient splitting on the basic features and pathological semantic features of the egg cocoon through the C2f feature extraction network, and to perform pooling and fusion of egg cocoon features under different receptive fields through the SPPF spatial pyramid pooling network to obtain multi-scale features of the egg cocoon. The bidirectional feature fusion module is used to bidirectionally fuse the location features and disease semantic features in the multi-scale features of the egg cocoon through a feature fusion network to obtain the egg cocoon fusion detection features; The detection output module is used to perform position regression, target confidence prediction, and category probability prediction on the egg cocoon fusion detection features to obtain the egg cocoon target detection results.

Citation Information

Patent Citations

  • Lightweight silkworm cocoon classification detection algorithm based on improved YOLOv8 network

    CN120563950A

  • Trachinotus ovatus image processing method and system based on machine vision

    CN121236799A