Fish Pathological Detection Method and System Based on Image Segmentation and Visual Phenotypic Analysis
By combining the SAM2 model with rasterized scanning and local contrast analysis algorithms, real-time segmentation and pathological feature extraction of fish bodies are achieved, solving the problems of accuracy and timeliness in fish pathological diagnosis in existing technologies. This enables fine-grained assessment and early warning at the individual level, making it suitable for large-scale applications.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN TIANYAN ZHIQING TECHNOLOGY CO LTD
- Filing Date
- 2025-12-10
- Publication Date
- 2026-06-30
AI Technical Summary
Existing technologies lack the accuracy and timeliness of diagnosis in fish health monitoring. They lack detailed assessment at the individual level, and insufficient image segmentation accuracy limits the extraction of pathological features. Furthermore, they have poor generalization ability and strong data dependence, making it difficult to achieve early and accurate disease diagnosis.
The SAM2 model was used for real-time segmentation and identification of fish bodies. The rasterization scanning and local contrast analysis algorithms were combined to identify lesion areas, and texture anomaly analysis and morphological feature extraction were performed to generate phenotypic lesion features. Finally, individual-level pathological detection was performed through a pathological detection model.
It enables early, accurate, and automated pathological warning and diagnosis of fish, improving diagnostic accuracy and timeliness, reducing monitoring costs, and is suitable for large-scale applications. It can conduct independent health status assessments for each fish, reducing the spread of infectious diseases and economic losses.
Smart Images

Figure CN121459147B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of artificial intelligence technology, specifically relating to a method and system for detecting fish pathology based on image segmentation and visual phenotypic analysis. Background Technology
[0002] Currently, fish health monitoring and disease diagnosis in aquaculture largely rely on manual observation and regular sampling tests. This means that aquaculture workers observe the fish's body surface for visual clues such as lesions and judge whether there are health problems based on experience. Once a suspected diseased fish is found, it is often necessary to catch it for laboratory testing. This method not only lacks diagnostic accuracy and timeliness, but also suffers from high monitoring costs and low efficiency. Therefore, it is difficult to achieve early warning and large-scale monitoring, and cannot meet the needs of modern aquaculture.
[0003] In recent years, computer vision technology has been initially applied in aquaculture, such as for fish counting, feeding behavior analysis, and uneaten feed detection. However, these applications are mostly focused on macroscopic or specific target identification. Public reports on systems and methods for pixel-level precise segmentation of individual fish to extract multi-dimensional fine phenotypic features and achieve real-time, non-invasive disease diagnosis are still rare. Furthermore, existing computer vision technologies applied to aquaculture have the following shortcomings:
[0004] (1) Lack of detailed assessment at the individual level; existing technologies focus more on the overall fish population, making it difficult to conduct timely and comprehensive health status assessments of individual fish, which is not conducive to the detailed identification and intervention of diseases.
[0005] (2) Insufficient image segmentation accuracy leads to limited extraction of pathological features, i.e., it is impossible to obtain a high-precision individual fish body segmentation mask, making it difficult to accurately extract subtle phenotypic features such as color, texture, and morphology from the fish body surface, which in turn reduces the accuracy of pathological identification.
[0006] (3) Poor generalization ability: Existing image analysis methods based on specific models and datasets are poorly adaptable to new fish species, unknown disease types or ever-changing aquaculture environments, requiring frequent retraining and adjustment.
[0007] (4) Strong data dependence: Traditional deep learning models require large-scale labeled datasets for training, which is costly to build and difficult to cope with the diversity of lesion morphology and the differences in development stage.
[0008] Therefore, given the aforementioned shortcomings, how to provide a technical solution that can segment each individual fish in the aquaculture environment in real time with high precision and strong versatility, and extract multi-dimensional visual phenotypic features on this basis, thereby achieving early, accurate, and automated pathological warning and diagnosis, has become an urgent problem to be solved. Summary of the Invention
[0009] The purpose of this invention is to provide a fish pathological detection method and system based on image segmentation and visual phenotypic analysis, in order to solve the problems of insufficient diagnostic accuracy and timeliness, high monitoring cost and low efficiency, lack of detailed individual-level assessment, insufficient image segmentation accuracy leading to limited extraction of pathological features, poor generalization ability and strong data dependence in the existing technology.
[0010] To achieve the above objectives, the present invention adopts the following technical solution:
[0011] Firstly, a method for detecting fish pathology based on image segmentation and visual phenotypic analysis is provided, including:
[0012] Acquire real-time images and environmental data of the fish population in the rearing tank;
[0013] The SAM2 model is used to perform real-time fish body segmentation and recognition processing on the real-time image to obtain the fish body contour image of each fish in the real-time image.
[0014] Based on the rasterization scanning and local contrast analysis algorithm, lesion identification is performed on the fish body contour image of each fish to obtain the lesion area corresponding to each fish, and feature extraction is performed on the lesion area of each fish to obtain the lesion features of each fish.
[0015] Texture anomaly analysis and morphological and body feature analysis were performed on the fish outline image of each fish to obtain the surface texture features and morphological and body feature features of each fish.
[0016] Using the real-time environmental data, as well as the lesion characteristics, surface texture characteristics, and morphological and physical characteristics of each fish, the phenotypic lesion characteristics of each fish are generated.
[0017] The phenotypic pathological characteristics of each fish are input into the pathological detection model for pathological detection processing, and the pathological detection results of each fish are obtained. Based on the pathological detection results of each fish, early warning of fish pathology is given.
[0018] Based on the aforementioned disclosure, this invention first acquires real-time images of the fish population in the rearing tank and real-time environmental data. Then, it utilizes the SAM2 model as a high-precision contour extraction tool to perform real-time fish body segmentation and recognition, thereby segmenting the fish body contour image of each fish in the real-time image. Thus, by leveraging the high-precision contour segmentation capability of the SAM2 model, the problem of limited pathological feature extraction caused by the inability to obtain accurate contours in existing technologies can be solved. Simultaneously, its zero-sample and few-sample segmentation capabilities allow this invention to adapt to different fish species without requiring extensive annotation, addressing the pain points of weak model generalization ability and strong data dependence. After completing the fish body contour segmentation for each fish, phenotypic lesion features can be extracted; that is, this invention employs an algorithm based on rasterized scanning and local contrast analysis. This invention identifies lesions in each fish's outline image, obtaining the lesion region for each fish. Then, features are extracted to obtain the lesion features for each fish. Texture anomaly analysis and morphological and body shape feature analysis are performed on each fish's outline image to obtain the surface texture features, morphological and body shape features for each fish. Next, using the extracted features and real-time environmental data, phenotypic lesion features for each fish are generated. Finally, the phenotypic lesion features for each fish are input into a pathological detection model to obtain the pathological detection results for each fish. Based on this, individual-level fish pathological early warning can be achieved according to the pathological detection results of each fish. Through the above design, this invention achieves early, accurate, and automated pathological early warning and diagnosis of fish, making it highly suitable for large-scale application and promotion.
[0019] In one possible design, based on rasterized scanning and local contrast analysis algorithms, lesion identification is performed on the fish body contour image of each fish, including:
[0020] For any fish's body outline image, a k×k pixel grid is superimposed on the fish's body outline image to obtain a fish body outline grid image, where k is a positive integer.
[0021] From the fish body outline grid image, select the grid cells that are on the fish body outline image of any one fish as the target grid;
[0022] Calculate the first average brightness value of all pixels in each target grid;
[0023] For any target grid, obtain multiple neighboring grids of the target grid and calculate the second average brightness value of all neighboring grids of the target grid;
[0024] Calculate the brightness difference between the first average brightness value and the second average brightness value, and determine whether the absolute value of the brightness difference is greater than a preset threshold.
[0025] If so, then any target grid is taken as a lesion cell, and after all target grids have been polled, several lesion cells are obtained, and the lesion area of any fish is formed by using several lesion cells.
[0026] In one possible design, feature extraction is performed on the lesion region of each fish to obtain the lesion features of each fish, including:
[0027] For any given fish, count the number of pixels with a brightness value greater than a brightness threshold in the lesion area of that fish to obtain the number of abnormal pixels.
[0028] Obtain the total number of pixels in the outline image of any one of the fish;
[0029] The ratio between the number of abnormal pixels and the total number of pixels is calculated, and the ratio is used as the lesion feature of any fish.
[0030] In one possible design, texture anomaly analysis is performed on the fish body contour image of each fish to obtain the surface texture features of each fish, including:
[0031] Calculate the variance of the gray values of all pixels in the fish outline image of each fish to serve as the texture variance of each fish.
[0032] Calculate the gray-level co-occurrence matrix of the fish body outline image for each fish;
[0033] Based on the gray-level co-occurrence matrix of each fish, the texture descriptor of each fish is determined. The texture descriptor of any fish includes the contrast and homogeneity of the gray-level co-occurrence matrix of that fish.
[0034] By utilizing the texture variance and texture descriptor of each fish, the surface texture features of each fish are constructed.
[0035] In one possible design, the morphological and body shape features of each fish's outline image are analyzed to obtain the morphological and body shape characteristics of each fish, including:
[0036] For any given fish, the outline of the fish body is determined based on the fish body outline image of that fish.
[0037] Calculate the curvature of each point on the fish body outline, and determine the number of abnormal points on the edge of the fin rays of any fish based on the curvature of each point;
[0038] Based on the polygon approximation and maximum deviation distance protrusion recognition algorithm, the fish body outline of any fish is processed to identify abnormal protrusions on the body surface in order to obtain the number of abnormal protrusions on the body surface.
[0039] Using the fish outline, the length-to-width ratio and body tilt deviation of any one fish can be determined;
[0040] Obtain a standard outline image of a healthy fish and calculate the shape similarity between the outline image of any fish and the standard outline image of the healthy fish.
[0041] The morphological and physical characteristics of any fish are generated by using the number of abnormal points on the edge of the fin rays, the number of abnormal protrusions on the body surface, the length-to-width ratio of the body, the tilt deviation of the fish body, and the shape similarity.
[0042] In one possible design, a protrusion recognition algorithm based on polygon approximation and maximum deviation distance is used to identify abnormal protrusions on the body contour of any fish, including:
[0043] The Douglas-Puk algorithm is used to perform polygon approximation on the fish body outline to generate multiple baseline edges representing the outline baseline of any one of the fish.
[0044] For any given baseline, calculate the maximum vertical deviation distance from each point on the fish body outline to that baseline.
[0045] Points with a maximum vertical deviation greater than a distance threshold are taken as abnormal protrusions on the body surface. After polling all baseline edges, the number of abnormal protrusions on the body surface of any fish is obtained.
[0046] In one possible design, the aspect ratio and body tilt deviation of any given fish are determined using the fish's outline, including:
[0047] The fish body outline is fitted with a minimum bounding ellipse to obtain the minimum bounding ellipse of the fish body outline.
[0048] The ratio between the major and minor axes of the smallest circumscribed ellipse is taken as the aspect ratio of the body shape.
[0049] Calculate the angle between the major axis of the smallest circumscribed ellipse and the horizontal direction, and use it as the angle of inclination of the fish body;
[0050] The angle difference between the fish body tilt angle and the standard tilt angle is calculated, and the angle difference is used as the fish body tilt deviation.
[0051] In one possible design, before performing real-time fish body segmentation and recognition processing on the real-time image, the method further includes:
[0052] The real-time image is dehazed to obtain a dehazed image;
[0053] The dehazed image is subjected to nonlocal mean filtering to obtain a denoised image;
[0054] The denoised image is color-corrected to obtain a corrected image, which is then processed using the SAM2 model for real-time fish body segmentation and recognition to obtain the fish body contour image of each fish in the real-time image.
[0055] In one possible design, the pathological test result of any fish represents the probability of that fish being diseased. Based on the pathological test results of each fish, a fish pathology early warning system is implemented, including:
[0056] For any given fish, determine whether the probability of that fish being diseased is greater than the minimum probability threshold.
[0057] If so, an early warning notification is generated and sent to the terminal corresponding to the breeding personnel;
[0058] The warning level is determined based on the probability of disease in any one of the fish.
[0059] Based on the warning level, any one of the fish is marked on the monitoring interface to complete the warning of any one of the fish's pathological conditions. The color of the fish mark corresponds to different warning levels.
[0060] Secondly, a fish pathological detection system based on image segmentation and visual phenotypic analysis is provided, including:
[0061] The image acquisition unit is used to acquire real-time images of the fish in the breeding tank and real-time environmental data.
[0062] The data processing unit is used to perform real-time fish body segmentation and recognition processing on the real-time image using the SAM2 model, so as to obtain the fish body contour image of each fish in the real-time image.
[0063] The data processing unit is used to identify lesions in the fish outline image of each fish based on rasterization scanning and local contrast analysis algorithms, obtain the lesion area corresponding to each fish, and extract features from the lesion area of each fish to obtain the lesion features of each fish.
[0064] The data processing unit is also used to perform texture anomaly analysis and morphological and body feature analysis on the fish body outline image of each fish, so as to obtain the surface texture features and morphological and body features of each fish respectively.
[0065] The pathological analysis and diagnosis unit is used to generate phenotypic lesion characteristics for each fish by utilizing the real-time environmental data, as well as the lesion characteristics, surface texture characteristics, and morphological and physical characteristics of each fish.
[0066] The pathological analysis and diagnosis unit is also used to input the phenotypic lesion characteristics of each fish into the pathological detection model for pathological detection processing, obtain the pathological detection results of each fish, and provide early warning of fish pathology based on the pathological detection results of each fish.
[0067] Thirdly, a fish pathological detection device based on image segmentation and visual phenotypic analysis is provided. Taking the device as an electronic device as an example, it includes a memory, a processor, and a transceiver that are connected in sequence. The memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the fish pathological detection method based on image segmentation and visual phenotypic analysis as described in the first aspect or any possible design of the first aspect.
[0068] Fourthly, a storage medium is provided, on which instructions are stored, which, when executed on a computer, perform the fish pathological detection method based on image segmentation and visual phenotypic analysis as described in the first aspect or any possible design of the first aspect.
[0069] Fifthly, a computer program product containing instructions is provided, which, when executed on a computer, causes the computer to perform the fish pathological detection method based on image segmentation and visual phenotypic analysis as described in the first aspect or any possible design of the first aspect.
[0070] Beneficial effects:
[0071] (1) This invention uses the SAM2 model as the basic tool for high-precision contour extraction to perform real-time segmentation and recognition of each fish body, which solves the problem of limited pathological feature extraction caused by the inability to obtain accurate contours in the prior art. At the same time, its zero-sample and few-sample segmentation capabilities enable this invention to adapt to different fish species without a large number of annotations, solving the pain points of weak model generalization ability and strong data dependence. Meanwhile, this invention realizes real-time and efficient automated pathological monitoring and early warning, which improves the accuracy, timeliness and efficiency of diagnosis and reduces monitoring costs compared with traditional manual detection. Moreover, this invention can perform independent health status assessment for each fish and can provide immediate early warning for abnormal individuals, thus realizing fine assessment at the individual level. Therefore, this invention realizes individual-level fish pathological detection and early warning, which is very suitable for large-scale application and promotion.
[0072] (2) High diagnostic accuracy and early warning; Through innovative raster scanning and local contrast analysis methods, this invention can perform fine scanning of the fish surface like medical imaging, effectively detecting early and small lesions that are difficult to detect by traditional whole analysis methods; Experimental results show that this invention can increase the early detection rate of common fish diseases by 20%-30%, thereby greatly increasing the success rate of treatment and preventing the spread of infectious diseases.
[0073] (3) Pathological diagnosis model with multi-dimensional feature fusion: This invention effectively integrates fish phenotypic features (color, texture, morphology, body shape) with aquaculture environment data and inputs them into the diagnosis model, thereby improving the comprehensive accuracy and robustness of pathological diagnosis.
[0074] (4) Non-invasive, reducing stress; the entire testing process does not require catching fish, avoiding physical contact and stress response with the fish, ensuring the healthy growth of the fish population and reducing the risk of secondary infection.
[0075] (5) It can improve the breeding environment and economic benefits; the present invention can detect and intervene in diseases in a timely manner, effectively control the spread of diseases, reduce the amount of drugs used, and avoid economic losses caused by large-scale mortality. Therefore, by maintaining the health of fish populations, the growth rate of fish and feed conversion rate can be improved, thereby improving the overall breeding profit margin. Attached Figure Description
[0076] Figure 1 A schematic flowchart illustrating the steps of the fish pathological detection method based on image segmentation and visual phenotypic analysis provided in an embodiment of the present invention;
[0077] Figure 2 This is an image showing the automatic identification, diagnosis, and local comparative analysis of lesion areas in fish provided in an embodiment of the present invention.
[0078] Figure 3 This is a comparison chart of disease detection rate and manual experience provided in an embodiment of the present invention;
[0079] Figure 4 This is a comparison chart of the timeliness of disease early warning provided in an embodiment of the present invention;
[0080] Figure 5 This is a structural diagram of a fish pathological detection system based on image segmentation and visual phenotypic analysis provided in an embodiment of the present invention.
[0081] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0082] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the present invention will be briefly introduced below in conjunction with the accompanying drawings and descriptions of the embodiments or the prior art. Obviously, the following description of the structure of the accompanying drawings is only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. It should be noted that the description of these embodiments is for the purpose of helping to understand the present invention, but does not constitute a limitation of the present invention.
[0083] It should be understood that although the terms first, second, etc., may be used herein to describe various units, these units should not be limited by these terms. These terms are only used to distinguish one unit from another. For example, a first unit may be referred to as a second unit, and similarly, a second unit may be referred to as a first unit, without departing from the scope of the exemplary embodiments of the invention.
[0084] It should be understood that the term "and / or" that may appear in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, B exists alone, and A and B exist simultaneously. The term " / and" that may appear in this document describes another relationship between related objects, indicating that two relationships can exist. For example, A / and B can mean: A exists alone, and A and B exist alone. In addition, the character " / " that may appear in this document generally indicates that the related objects before and after it are in an "or" relationship.
[0085] Example:
[0086] See Figure 1As shown in this embodiment, the fish pathological detection method based on image segmentation and visual phenotypic analysis first acquires real-time images of fish in a rearing tank and real-time environmental data. Then, using the SAM2 model as a high-precision contour extraction tool, real-time segmentation and recognition of the fish body are performed to segment the fish body contour image of each fish in the real-time image. Next, this method uses a rasterization scanning and local contrast analysis algorithm to identify lesions in each fish body contour image, obtaining the lesion region of each fish, and extracting features from it to obtain the lesion features of each fish. Furthermore, texture anomaly analysis and morphological and body shape feature analysis are performed on each fish body contour image to obtain the surface texture features and morphological and body shape features of each fish. Finally, using the aforementioned extracted multi-dimensional... This method uses several features and combines them with real-time environmental data to generate phenotypic lesion features for each fish. Finally, the phenotypic lesion features of each fish are input into the pathological detection model to obtain the pathological detection results for each fish. Based on this, individual-level fish pathological early warning can be achieved according to the pathological detection results of each fish. Thus, this method realizes early, accurate, and automated pathological early warning and diagnosis of fish, making it very suitable for large-scale application and promotion. For example, this method can be run on the data processing unit, pathological analysis and diagnosis unit, and system control and human-computer interaction unit of the fish pathological detection system. It is understood that the aforementioned execution entities do not constitute a limitation on the embodiments of this application. Accordingly, the operation steps of this method can be, but are not limited to, the steps S1 to S6 below.
[0087] S1. Acquire real-time images and environmental data of the fish in the rearing tank; In this embodiment, for example, but not limited to, an image acquisition unit can be arranged above or underwater in the rearing tank to continuously acquire high-definition video streams of the fish in the rearing tank, and then transmit them to the data processing unit for frame-by-frame processing to obtain real-time images of the fish in the rearing tank; Further, for example, the image acquisition unit can be, but not limited to, a high-resolution, high-frame-rate underwater camera, and can be equipped with an auxiliary light source (such as an infrared fill light) to cope with low-light environments; At the same time, the unit can also integrate water quality sensors (such as dissolved oxygen, pH, temperature, ammonia nitrogen, etc.) and light sensors to synchronously acquire real-time environmental data, thereby serving as auxiliary contextual information for pathological diagnosis.
[0088] After obtaining real-time images and environmental data of the fish in the breeding tank, individual-level fish segmentation can be performed, as shown in step S2 below.
[0089] S2. Using the SAM2 model, the real-time image is segmented and identified in real time to obtain the outline image of each fish in the real-time image. In specific applications, before performing real-time segmentation and identification of the fish, this embodiment also needs to preprocess the real-time image to effectively remove the scattering effect caused by water turbidity, suppress image noise, and restore the image color cast caused by the absorption of specific wavelengths of light by the water.
[0090] Optionally, this embodiment provides a multi-stage image enhancement method, the process of which may include, but is not limited to: first, performing dehazing processing on the real-time image to obtain a dehazed image; then, performing non-local mean filtering processing on the dehazed image to obtain a denoised image; finally, performing color correction processing on the denoised image to obtain a corrected image.
[0091] Furthermore, in specific applications, for example, but not limited to, using a dehazing algorithm based on dark channel priors, real-time images can be dehazed to effectively remove the scattering effect caused by water turbidity, thereby improving image contrast and clarity. Simultaneously, addressing underwater uneven lighting and noise issues, applying non-local mean filtering to the dehazed image can effectively suppress random noise while preserving fish edge and surface texture details to the maximum extent. Finally, this embodiment employs a color correction algorithm based on the grayscale world algorithm to correct the color of the denoised image, thereby restoring the image color cast caused by the absorption of specific wavelengths of light by the water, thus providing a foundation for subsequent accurate color feature analysis.
[0092] Thus, through the aforementioned multi-stage image enhancement, the influence of factors such as uneven lighting and water turbidity on subsequent fish contour segmentation can be reduced, thereby improving the accuracy of fish contour segmentation. Therefore, after completing the multi-stage image enhancement, the SAM2 model can be used to perform real-time fish body segmentation and recognition processing on the corrected image, thereby obtaining the fish contour image of each fish in the real-time image. In this embodiment, a temporary ID will be set for the fish contour image of each fish for subsequent data recording.
[0093] Among them, the SAM2 (Segment Anything Model 2) model is a new generation of contour segmentation model, which outperforms traditional segmentation models, especially in video segmentation. It can segment any object in any video and image, including previously unseen objects and visual domains. Therefore, this model surpasses traditional segmentation models in terms of image segmentation accuracy. Based on this, using the SAM2 model as a basic tool for high-precision contour extraction can solve the problem of limited extraction of pathological features caused by the inability to obtain accurate contours in existing technologies. Moreover, its zero-sample and few-sample segmentation capabilities allow this embodiment to adapt to different fish species without a large number of annotations. In this way, it can also solve the pain points of weak model generalization ability and strong data dependence in existing technologies.
[0094] After completing high-precision individual-level fish body contour segmentation, visual phenotypic health features can be extracted. Specifically, for each individual fish segmented by the image segmentation model (i.e., the SAM2 model), this embodiment proposes a multi-dimensional visual phenotypic health feature quantification algorithm. The key is to adopt a strategy based on rasterization scanning and local contrast analysis to perform region-by-region diagnosis on the fish body surface in order to identify local lesions.
[0095] Optionally, the lesion identification and feature extraction process is as shown in step S3 below.
[0096] S3. Based on the rasterization scanning and local contrast analysis algorithm, lesion identification is performed on the fish body contour image of each fish to obtain the lesion area corresponding to each fish, and feature extraction is performed on the lesion area of each fish to obtain the lesion features of each fish; in specific applications, this embodiment achieves lesion identification by rasterizing the surface of the fish body and then comparing and analyzing the brightness and other features of each grid cell and its neighborhood.
[0097] The process of lesion identification can be illustrated by taking any fish as an example, and may include, but is not limited to, the steps S31 to S36 below.
[0098] S31. For any fish body outline image, a k×k pixel grid is superimposed on the fish body outline image to obtain a fish body outline grid image, where k is a positive integer; in this embodiment, step S31 is the process of gridding the fish body outline image, that is, superimposing a grid on any fish body outline image to achieve the rasterization of the fish body outline image; for example, but not limited to superimposing a 16×16 pixel grid; of course, the size of the grid image can be specifically set according to actual use, and this embodiment is not limited to the foregoing example.
[0099] After obtaining the fish body outline grid image, local contrast anomaly analysis and lesion identification can be performed, as shown in steps S32 to S36 below.
[0100] S32. From the fish body outline grid image, select the grid cells located on the fish body outline image of any fish as the target grid; in this embodiment, it is equivalent to selecting the grid cells located on the submerged area of the fish body of any fish. Then, perform brightness analysis on the selected grid cells, the process of which is shown in the following steps S33 to S36.
[0101] S33. Calculate the first average brightness value of all pixels in each target grid; after calculating the first average brightness value of each target grid, the neighborhood features can be calculated, as shown in step S34 below.
[0102] S34. For any target grid, acquire multiple neighboring grids of the target grid and calculate the second average brightness value of all neighboring grids of the target grid; in specific applications, for example, but not limited to, acquiring eight neighboring grids of the target grid; then, calculate the second average brightness value of the eight neighboring grids; finally, the first average brightness value of the target grid can be combined to perform local contrast anomaly analysis, that is, calculate the local contrast anomaly score, the process of which is shown in step S35 below.
[0103] S35. Calculate the brightness difference between the first average brightness value and the second average brightness value, and determine whether the absolute value of the brightness difference is greater than a preset threshold. In this embodiment, the absolute value of the brightness difference between the first average brightness value of any target grid and the second average brightness value of its neighborhood is taken as its local contrast anomaly score. Thus, when the local contrast anomaly score of any target grid is greater than the preset threshold, the target grid is taken as a lesion cell, and the process is shown in step S36 below.
[0104] S36. If so, then any target grid is taken as a lesion cell, and after all target grids have been polled, several lesion cells are obtained, and the lesion area of any fish is formed by using the several lesion cells; in this embodiment, after the identification of whether any target grid is a lesion cell is completed, the remaining target grids can be processed in the same way, so as to extract all the lesion cells from the several target grids; finally, the lesion cells can be used to form the lesion area.
[0105] Thus, through the aforementioned steps S31 to S36, this embodiment can accurately locate local visual abnormalities such as white spot disease within the precisely segmented fish body outline by meshing and comparing neighborhood features unit by unit; then, lesion features can be extracted within the lesion area; wherein, this embodiment quantifies the severity of white spot disease by calculating the proportion of white spot pixels, that is, the proportion of bright abnormal pixels in the total pixels of the fish body, and the process can be, but is not limited to, as shown in steps S37 to S39 below.
[0106] S37. For any fish, count the number of pixels with brightness values greater than the brightness threshold in the lesion area of the fish to obtain the number of abnormal pixels. In this embodiment, after counting the number of bright abnormal pixels, the total number of pixels in the fish body outline image of the fish can be obtained. Then, by calculating the ratio of the two, the proportion of white pixels, that is, the lesion features, is obtained. The process is shown in steps S38 and S39 below.
[0107] S38. Obtain the total number of pixels in the outline image of any one of the fish.
[0108] S39. Calculate the ratio between the number of abnormal pixels and the total number of pixels, and use the ratio as the lesion feature of any fish; in this embodiment, the aforementioned ratio can be expressed as: In the formula, Indicates the number of abnormal pixels. Indicates the total number of pixels.
[0109] Thus, through the aforementioned steps S31 to S39, the lesion identification and lesion feature extraction for each fish can be completed; then, texture anomaly analysis and morphological and body feature analysis can be performed, as shown in step S4 below.
[0110] S4. Perform texture anomaly analysis and morphological and body feature analysis on the fish outline image of each fish to obtain the surface texture features and morphological and body feature features of each fish. In this embodiment, for example, but not limited to, the following steps S41 to S44 can be used to perform texture anomaly analysis on the fish outline image of each fish.
[0111] S41. Calculate the variance of the gray values of all pixels in the fish outline image of each fish, and use it as the texture variance of each fish; in specific applications, for example, but not limited to, the following formula can be used to calculate the texture variance of any fish.
[0112] ;
[0113] In the formula, This represents the texture variance of any one of the fish. This represents the total number of pixels in the outline image of any given fish. This represents the grayscale value of the pixel at coordinates (x, y) in the outline image of any given fish. This represents the average grayscale value of the fish's body outline image. This represents the outline image of any given fish.
[0114] Texture variance reflects the dispersion of pixel gray values on the fish's surface and is highly sensitive to drastic changes in texture caused by skin roughness, ulcers, etc. Therefore, in this embodiment, it is used as a texture feature.
[0115] Thus, after calculating the texture variance of each fish using the aforementioned formula, this embodiment calculates the gray-level co-occurrence matrix of the fish body outline image of each fish, so as to extract the texture descriptor of each fish for more detailed texture analysis; wherein, the process of extracting the texture descriptor is as shown in steps S42 and S43 below.
[0116] S42. Calculate the gray-level co-occurrence matrix (GLCM) of the fish body outline image for each fish. In practice, the GLCM is a statistical method used to describe the texture features of an image. It reflects the comprehensive information of the image in terms of direction, interval, magnitude of change, and speed by calculating the correlation between the gray levels of two points at a certain distance and direction in the image. The GLCM is a commonly used method for describing texture, and its calculation process will not be elaborated here. After obtaining the GLCM, the texture descriptor can be extracted, as shown in step S43 below.
[0117] S43. Based on the gray-level co-occurrence matrix of each fish, determine the texture descriptor of each fish. The texture descriptor of any fish includes the contrast and homogeneity of its gray-level co-occurrence matrix. In practical applications, contrast is an indicator that measures the degree of difference in gray-level values between adjacent pixel pairs in an image; it reflects the sharpness of the image and the depth of the texture grooves. The formula for calculating contrast is:
[0118] ;
[0119] In the formula, Let be the contrast of the gray-level co-occurrence matrix for any fish. Let n be the element in the i-th row and j-th column of the gray-level co-occurrence matrix of any fish, where n represents the number of rows or columns of the matrix (the number of rows and columns of the gray-level co-occurrence matrix are the same).
[0120] Similarly, homogeneity, also known as inverse difference moment, is an indicator of the degree of local variation in image texture. A higher value indicates less variation between different regions of the image texture, suggesting very uniform local texture. The formula for calculating homogeneity is:
[0121] ;
[0122] In the formula, This indicates the homogeneity of the gray-level co-occurrence matrix of any given fish.
[0123] Thus, based on the aforementioned formula, after calculating the contrast and homogeneity of each fish, the texture variance of each fish can be combined to form the surface texture features of each fish, as shown in step S44 below.
[0124] S44. Using the texture variance and texture descriptor of each fish, construct the surface texture features of each fish.
[0125] After completing the texture anomaly analysis for each fish through the aforementioned steps S41 to S44, morphological and body feature analysis can be performed. The process can be, but is not limited to, the steps S45 to S410 below.
[0126] S45. For any fish, the fish body outline is determined based on the fish body outline image of the fish; in this embodiment, this is equivalent to extracting the fish body outline from the fish body outline image; then, based on the curvature change of the outline, the defects or tears of the fin edges are identified, as shown in step S46 below.
[0127] S46. Calculate the curvature of each point on the fish body outline, and determine the number of abnormal points on the edge of the fin rays of any fish based on the curvature of each point. In this embodiment, for example, but not limited to, points on the fish body outline with curvature greater than the curvature threshold can be regarded as points with missing or torn fin rays, that is, abnormal points on the edge of the fin rays. In this way, after counting the number of abnormal points on the edge of the fin rays, abnormal protrusions on the body surface can be identified, and the process is shown in step S47 below.
[0128] S47. Based on the polygon approximation and maximum deviation distance protrusion recognition algorithm, perform abnormal protrusion recognition processing on the fish body outline of any fish to obtain the number of abnormal protrusion points on the body surface; in specific implementation, for example, but not limited to, the following steps S47a to S47c can be used to perform abnormal protrusion recognition on the body surface.
[0129] S47a. The Douglas-Puk algorithm is used to perform polygon approximation processing on the fish body outline to generate multiple baseline edges representing the outline baseline of any one of the fish; In this embodiment, the Douglas-Puk algorithm is an efficient algorithm for simplifying polygons or polylines. Its core idea is to recursively divide the polyline into two segments, and then remove those points that deviate from the straight line by less than the threshold according to the set threshold, thereby achieving the purpose of simplifying the polyline; Specifically, its basic steps are: (1) Select the starting point and the ending point: Connect the first point of the curve to the last point to obtain the line segment; (2) Calculate the farthest point: Find the point farthest from this line segment between the starting point and the ending point; (3) Determine the distance to the farthest point: If the distance from the farthest point to the line segment is greater than a set threshold, then the point is retained. The algorithm is then recursively applied to the portions between the starting point and the farthest point, and between the farthest point and the ending point, until the termination condition is met (i.e., the distance from the farthest point to the line segment is less than or equal to the threshold). At this point, all intermediate points can be removed. In this way, the Douglas-Puk algorithm can effectively reduce the number of points on the curve while maintaining the main features of the curve. The multiple baseline edges obtained are these retained polyline segments, which together constitute an approximate representation of the original contour curve. Of course, the Douglas-Puk algorithm is a commonly used technique for contour simplification, and its principle will not be elaborated here.
[0130] After obtaining several baseline edges, the abnormal protrusions on the body surface can be identified by calculating the vertical distance from the points on the contour line to the baseline edges, as shown in steps S47b and S47c below.
[0131] S47b. For any baseline edge, calculate the maximum vertical deviation distance from each point on the fish body outline to the baseline edge. In specific implementation, the vertical distance from each point on the fish body outline to the baseline edge is taken as the maximum vertical deviation distance from the baseline edge. Then, based on this distance, abnormal protrusions on the body surface can be identified, as shown in step S47c below.
[0132] S47c. Points with a maximum vertical deviation greater than a distance threshold are taken as abnormal protrusions on the body surface. After polling all baseline edges, the number of abnormal protrusions on the body surface of any fish is obtained. In this embodiment, for example, but not limited to, points with a maximum vertical deviation greater than a distance threshold can be taken as abnormal protrusions on the body surface. In this way, after processing the remaining baseline edges in the same manner as described above, all abnormal protrusions on the body surface of any fish can be obtained, thereby completing the statistics of the number of abnormal protrusions on the body surface.
[0133] After identifying the abnormal protrusions on the body surface of each fish through the aforementioned steps S47a to S47c, the body length-to-width ratio and tilt deviation of each fish can be extracted, as shown in step S48 below.
[0134] S48. Using the fish body outline, determine the length-to-width ratio and body tilt deviation of any one fish; in specific implementation, for example, but not limited to, first perform minimum bounding ellipse fitting on the fish body outline to obtain the minimum bounding ellipse of the fish body outline; then, take the ratio between the major axis and the minor axis of the minimum bounding ellipse as the length-to-width ratio; thus, the length-to-width ratio can be used to determine whether the fish body has abnormal abdominal swelling or emaciation.
[0135] Similarly, the principal axis direction vector (i.e., the major axis direction vector) of the smallest circumscribed ellipse directly reflects the tilt angle of the fish in the water and can be used to determine abnormal body postures such as side-crawling or inverted postures. Therefore, in this embodiment, the angle between the major axis of the smallest circumscribed ellipse and the horizontal direction is calculated as the fish tilt angle. Then, the angle difference between the fish tilt angle and the standard tilt angle is calculated. Finally, the angle difference can be used as the fish tilt deviation. Based on this, the fish tilt deviation can be used to quantify abnormal body postures.
[0136] After calculating the length-to-width ratio and body tilt deviation of any given fish, the overall shape features can be extracted, as shown in step S49 below.
[0137] S49. Obtain a standard outline image of a healthy fish and calculate the shape similarity between the outline image of any fish and the standard outline image of a healthy fish. In this embodiment, the outline image of any fish is matched with a pre-stored, size-normalized standard outline image of a healthy fish using shape context matching. The shape similarity is obtained by calculating the matching degree between the current fish outline pixels and the template (i.e., the standard outline image of a healthy fish). In this way, overall morphological distortions such as spinal curvature can be quantified. Hu moment matching, cosine similarity, and structural similarity can be used to calculate the similarity between outlines. These are common methods for calculating outline similarity, and the principles will not be elaborated here.
[0138] After extracting the shape similarity of any fish, the shape and body features extracted above can be combined to form the shape and body features of any fish, as shown in step S410 below.
[0139] S410. Using the number of abnormal points on the edge of the fish's fin rays, the number of abnormal protrusions on the body surface, the length-to-width ratio of the body, the tilt deviation of the fish body, and the shape similarity, generate the morphological and physical characteristics of any one fish.
[0140] Thus, through the aforementioned steps S41 to S410, the morphological and physical characteristics of each fish can be analyzed; then, by combining the aforementioned texture features, lesion features and real-time environmental data, the phenotypic lesion characteristics of each fish can be generated, as shown in step S5 below.
[0141] S5. Using the real-time environmental data, as well as the lesion characteristics, surface texture characteristics, and morphological and body shape characteristics of each fish, generate phenotypic lesion characteristics for each fish. In this embodiment, the aforementioned real-time environmental data, lesion characteristics, surface texture characteristics, and morphological and body shape characteristics are spliced together to form a high-dimensional digital feature vector, which serves as the phenotypic lesion characteristics. Then, a pathological detection model can be used to perform individual-level fish pathological detection, as shown in step S6 below.
[0142] S6. Input the phenotypic lesion features of each fish into the pathological detection model for pathological detection processing to obtain the pathological detection results of each fish, and make early warning of fish pathology based on the pathological detection results of each fish; in specific implementation, the pathological detection model learns from a large amount of feature data of healthy and diseased fish, performs real-time analysis on the input phenotypic lesion features, determines whether there are abnormalities in individual fish, and identifies possible pathological types (such as white spot disease, etc.); for example, the pathological detection model can, but is not limited to, use a trained gradient boosting decision tree classification model to output the disease probability of each fish, that is, the pathological detection result of any fish is the disease probability of that fish; in this way, early warning of fish pathology can be made based on the disease probability of each fish.
[0143] Optionally, using any fish as an example, we can illustrate the detailed process of early warning of fish pathology:
[0144] Step 1: For any fish, determine whether the probability of the fish being diseased is greater than the minimum probability threshold. In this embodiment, the minimum probability threshold may be set to 0.6, but is not limited to 0.6. When the probability of being diseased is greater than 0.6, an early warning can be issued, as shown in Step 2 below.
[0145] Step 2: If so, generate an early warning notification and send it to the corresponding terminal of the aquaculture personnel. In this embodiment, the content of the early warning notification may include, but is not limited to: "A fish suspected of having white spot disease (temporary ID: XXX) has been detected in the current screen. Please pay attention!" At the same time, the early warning notification can be sent to the terminal of the aquaculture personnel through various means such as mobile APP notification and email to notify the aquaculture personnel in a timely manner. In addition, an audible and visual alarm can also be set on the monitoring interface. Of course, the specific notification and alarm methods can be set according to actual use, and this embodiment is not limited to the above examples.
[0146] Furthermore, after issuing an early warning, this embodiment can also mark fish bodies at different levels, as shown in steps three and four below.
[0147] The third step is to determine the warning level based on the disease probability of any fish. In this embodiment, when the disease probability is greater than the minimum probability threshold and less than or equal to the maximum probability threshold (with a value of 0.8), the warning level is determined to be yellow. When the disease probability is greater than the maximum probability threshold, the warning level is determined to be red. At this time, different colors of fish can be marked according to different warning levels, as shown in the fourth step below.
[0148] Step 4: Based on the warning level, mark any one of the fish on the monitoring interface to complete the fish pathology warning for any one of the fish after marking. The fish marking color is different for different warning levels. In this embodiment, fish with yellow level can be marked yellow, and fish with red level can be marked red. In this way, fish pathology warning can be performed on the monitoring interface.
[0149] In addition, in this embodiment, the temporary ID, pathological type, occurrence time, location, and current health status data of the abnormal fish can also be recorded. At the same time, new images of diseased fish and diagnostic results can be collected periodically to iteratively train and optimize the pathological detection model, so as to continuously improve its diagnostic accuracy and ability to identify new lesions.
[0150] Therefore, the fish pathological detection method based on image segmentation and visual phenotypic analysis described in detail in steps S1 to S6 above has the following beneficial effects:
[0151] (1) High diagnostic accuracy and early warning: This invention uses innovative rasterization scanning and local contrast analysis methods to perform fine scanning of the fish surface like medical imaging, thereby effectively detecting early and small lesions that are difficult to detect by traditional whole analysis methods; thus, the success rate of treatment can be greatly increased and the spread of infectious diseases can be prevented.
[0152] (2) Strong generalization ability and wide adaptability: This invention utilizes the zero-sample and few-sample segmentation capabilities of SAM2, which can have stronger adaptability and generalization ability for fish species that have not been trained, different breeding environments and newly emerging disease types, significantly reducing the model deployment and maintenance costs, and eliminating the need for separate training for each fish or each disease, thus realizing the universal detection of fish diseases.
[0153] (3) Real-time monitoring and high efficiency automation: This invention can process video streams in real time with a response time of seconds, quickly identify abnormal individuals and issue warnings; thus, it realizes full-process automation from image acquisition to pathological diagnosis, significantly reducing the labor intensity of aquaculture personnel and their reliance on professional experience, and improving monitoring efficiency.
[0154] (4) Individual-level real-time fine assessment: This invention can independently assess the health status of each fish visible in the current frame, and instantly identify and warn abnormal individuals, which enables aquaculture personnel to quickly find sick fish and carry out targeted treatment.
[0155] (5) Non-invasive, reducing stress; the entire testing process does not require catching fish, avoiding physical contact and stress response with the fish, ensuring the healthy growth of the fish population and reducing the risk of secondary infection.
[0156] (6) It can improve the aquaculture environment and economic benefits; by early detection and timely intervention of diseases, this invention effectively controls the spread of diseases, reduces the amount of drugs used, and avoids economic losses caused by large-scale mortality; thus, by maintaining the health of fish populations, it improves the growth rate of fish and feed conversion rate, thereby improving the overall aquaculture profit margin.
[0157] (7) Pathological diagnosis model with multi-dimensional feature fusion: This invention effectively integrates fish phenotypic features (texture, morphology, body shape) with aquaculture environment data and inputs them into the pathological detection model, thereby improving the comprehensive accuracy and robustness of pathological diagnosis.
[0158] In one possible design, the second aspect of this embodiment provides instance data of the method provided in the first aspect of the embodiment.
[0159] Example of early warning target: Early warning of white spot disease in brooks raised in aquariums. The purpose is to verify the ability of the method provided by this invention to provide early warning of white spot disease in brooks raised in aquariums.
[0160] Aquaculture environment: Aquaculture tank measuring 1m × 0.5m × 0.5m.
[0161] Experimental subjects: Rainbow skirt fish, with an initial average weight of 20g and a total number of 100 fish.
[0162] Vision system: One 5-megapixel high-definition network camera, equipped with a wide-spectrum LED fill light, deployed at a depth of 0.8m underwater.
[0163] Computing Unit: Edge AI computing box (equipped with NVIDIA Jetson AGX Orin), featuring a built-in high-performance GPU and pre-installed with the SAM2 model inference engine and diagnostic model of this invention. The backend server is used for data storage and visualization.
[0164] Control parameters:
[0165] White spot disease diagnostic threshold: The area of white spots on the fish's body surface accounts for more than 0.5% of the total fish body area, or the size of a single white spot exceeds the preset threshold.
[0166] Warning levels: Yellow warning (mild abnormality), Red warning (high-risk lesion).
[0167] Experimental steps:
[0168] Visual model deployment and fine-tuning: Before the experiment, the pre-trained SAM2 model was deployed to the edge computing unit; in order to improve the segmentation accuracy and inference speed in the specific environment of the garterfish, the SAM2 Adapter part was lightly fine-tuned using a small number of garterfish images (about 500 images, including healthy fish and a small number of white spot disease fish).
[0169] Image acquisition and preprocessing: The system acquires 30 frames of high-definition video stream per second, and simultaneously obtains water temperature and dissolved oxygen data. The computing unit performs real-time noise reduction and color balancing on the video frames.
[0170] Real-time fish body segmentation and recognition:
[0171] SAM2 segmentation: The preprocessed video frames are fed into the SAM2 model, which segments each of the colorful skirt fish in the scene in real time to obtain an accurate mask.
[0172] Temporary ID assignment: The system assigns a temporary ID to each rainbow trout segmented in the current frame for real-time analysis.
[0173] Visual phenotypic health feature extraction:
[0174] Phenotypic pathological features of each trout were extracted using the method provided in the first aspect of the embodiments.
[0175] Diagnostic model judgment: fusion of feature vectors Input into a pre-trained gradient boosting decision tree classification model In the middle, output individual fish The probability of developing white spot disease The results are compared with a set threshold to determine whether the fish has white spot disease; the automatic identification and diagnosis of lesions on the fish body and the local comparative analysis are shown in the figure. Figure 2 As shown.
[0176] Furthermore, the early warning logic: when A red alert is triggered when A yellow alert is triggered at any time, preset. .
[0177] Warning notification: Once the alarm is triggered, an alert message will be immediately pushed to the fish farmer's mobile APP: "A fish suspected of having white spot disease (temporary ID: XXX) has been detected in the current screen. Please pay attention!" The fish will also be marked in yellow or red on the monitoring interface.
[0178] Results and Analysis:
[0179] Record the system's early warning status for 15 consecutive days, and manually sample to verify the accuracy. The comparison table is shown in Table 1 below.
[0180] Table 1 is a comparison table of system early warning situations.
[0181] Table 1
[0182]
[0183] Thus, as can be seen from Table 1 above, the method provided in this embodiment achieves real-time early warning, improves diagnostic accuracy, and has the ability to detect fish pathology at an early stage.
[0184] Furthermore, this embodiment also provides a comparison chart of disease detection rate and human experience for a certain farmed fish population during a specific farming cycle, such as... Figure 3 As shown, Figure 3 The invention demonstrates a comparison of the detection rates in the early stages of common fish diseases such as white spot disease between traditional manual observation methods and the system of this invention.
[0185] The blue bars represent the method proposed in this embodiment, which has an early disease detection rate of 90%. This is thanks to the system's ability to capture tiny lesions on the surface of fish through high-precision segmentation, enabling early detection.
[0186] The red bars represent the traditional manual observation method, which has a detection rate of only 35%. This method relies heavily on the experience and sense of responsibility of the farmers and is difficult to detect subtle early symptoms, resulting in a low detection rate.
[0187] Conclusion: Compared with traditional methods, this invention has an overwhelming advantage in the ability to detect diseases in their early stages, thus gaining a valuable time window for timely intervention and treatment.
[0188] In addition, this embodiment also provides a comparison chart of the timeliness of disease early warning, such as... Figure 4 As shown.
[0189] Figure 4 The average time delay from the appearance of detectable symptoms in fish to the issuance of an alert by the system or personnel was compared.
[0190] The blue curve represents the method provided in this embodiment, which greatly improves the diagnostic timeliness compared to human experience; this reflects the near real-time processing capability of the present invention, which can analyze and warn immediately after the lesion occurs.
[0191] The red lines represent traditional manual observation methods, which are significantly less timely in diagnosis. This is because manual rounds are usually conducted at set times (e.g., once a day), resulting in a large time lag between the onset of symptoms and their detection.
[0192] Conclusion: This invention improves the early warning timeliness from "days" to "hours", greatly shortening the response time and effectively preventing the rapid spread of diseases in livestock populations.
[0193] like Figure 5 As shown, the third aspect of this embodiment provides a hardware system for implementing the fish pathological detection method based on image segmentation and visual phenotypic analysis described in the first aspect of the embodiment, comprising:
[0194] The image acquisition unit is used to acquire real-time images of the fish in the breeding tank and real-time environmental data.
[0195] The data processing unit is used to perform real-time fish body segmentation and recognition processing on the real-time image using the SAM2 model, so as to obtain the fish body contour image of each fish in the real-time image.
[0196] The data processing unit is used to identify lesions in the fish outline image of each fish based on rasterization scanning and local contrast analysis algorithms, obtain the corresponding lesion area for each fish, and extract features from the lesion area of each fish to obtain the lesion features of each fish.
[0197] The data processing unit is also used to perform texture anomaly analysis and morphological and body feature analysis on the fish outline image of each fish, so as to obtain the surface texture features and morphological and body feature of each fish respectively.
[0198] The pathological analysis and diagnosis unit is used to generate phenotypic lesion characteristics for each fish by utilizing the real-time environmental data, as well as the lesion characteristics, surface texture characteristics, and morphological and physical characteristics of each fish.
[0199] The pathological analysis and diagnosis unit is also used to input the phenotypic lesion characteristics of each fish into the pathological detection model for pathological detection processing, obtain the pathological detection results of each fish, and provide early warning of fish pathology based on the pathological detection results of each fish.
[0200] In this embodiment, the system also includes a system control and human-computer interaction unit, which serves as the management and display platform for the entire system and provides a user-friendly interface. The aforementioned fish pathology early warning is implemented through this unit (the pathology analysis and diagnosis unit sends the pathology test results to the system control and human-computer interaction unit, thereby enabling the system to implement pathology early warning). This unit also supports system configuration, allowing users to customize early warning thresholds, diagnostic model parameters, camera working modes, etc., to adapt to different aquaculture needs.
[0201] The working process, working details and technical effects of the system provided in this embodiment can be found in the first aspect of the embodiment, and will not be repeated here.
[0202] like Figure 6 As shown, the fourth aspect of this embodiment provides an intelligent line allocation device based on multi-dimensional hierarchical scheduling and priority. Taking the device as an electronic device as an example, it includes: a memory, a processor, and a transceiver that are connected in sequence. The memory is used to store a computer program, the transceiver is used to send and receive messages, and the processor is used to read the computer program and execute the fish pathological detection method based on image segmentation and visual phenotypic analysis as described in the first aspect of the embodiment.
[0203] For specific examples, the memory may include, but is not limited to, random access memory (RAM), read-only memory (ROM), flash memory, first-in-first-out (FIFO) memory, and / or first-in-last-out (FILO) memory, etc.; specifically, the processor may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor may be implemented using at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), PLA (Programmable Logic Array). The processor may also include a main processor and a coprocessor. The main processor, also known as the CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state.
[0204] In some embodiments, the processor may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. For example, the processor may not be limited to microprocessors of the STM32F105 series, reduced instruction set computer (RISC) microprocessors, x86 architecture processors, or processors with integrated neural network processing units (NPUs). The transceiver may be, but is not limited to, a Wi-Fi transceiver, a Bluetooth transceiver, a General Packet Radio Service (GPRS) transceiver, a ZigBee (a low-power LAN protocol based on the IEEE 802.15.4 standard) transceiver, a 3G transceiver, a 4G transceiver, and / or a 5G transceiver. Furthermore, the device may also include, but is not limited to, a power module, a display screen, and other necessary components.
[0205] The working process, working details and technical effects of the electronic device provided in this embodiment can be found in the first aspect of the embodiment, and will not be repeated here.
[0206] The fifth aspect of this embodiment provides a storage medium that stores instructions for a fish pathological detection method based on image segmentation and visual phenotypic analysis as described in the first aspect of the embodiment. That is, the storage medium stores instructions that, when executed on a computer, perform the fish pathological detection method based on image segmentation and visual phenotypic analysis as described in the first aspect of the embodiment.
[0207] The storage medium refers to a carrier for storing data, which may include, but is not limited to, floppy disks, optical disks, hard disks, flash memory, USB flash drives, and / or memory sticks. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
[0208] The working process, working details and technical effects of the storage medium provided in this embodiment can be found in the first aspect of the embodiment, and will not be repeated here.
[0209] The sixth aspect of this embodiment provides a computer program product containing instructions that, when executed on a computer, cause the computer to perform the fish pathological detection method based on image segmentation and visual phenotypic analysis as described in the first aspect of this embodiment, wherein the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
[0210] Finally, it should be noted that the above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A method for detecting fish pathology based on image segmentation and visual phenotypic analysis, characterized in that, include: Acquire real-time images and environmental data of the fish population in the rearing tank; The SAM2 model is used to perform real-time fish body segmentation and recognition processing on the real-time image to obtain the fish body contour image of each fish in the real-time image. Based on the rasterization scanning and local contrast analysis algorithm, lesion identification is performed on the fish body contour image of each fish to obtain the lesion area corresponding to each fish, and feature extraction is performed on the lesion area of each fish to obtain the lesion features of each fish. Texture anomaly analysis and morphological and body feature analysis were performed on the fish outline image of each fish to obtain the surface texture features and morphological and body feature features of each fish. Using the real-time environmental data, as well as the lesion characteristics, surface texture characteristics, and morphological and physical characteristics of each fish, the phenotypic lesion characteristics of each fish are generated. The phenotypic pathological features of each fish are input into the pathological detection model for pathological detection processing to obtain the pathological detection results of each fish. Based on the pathological detection results of each fish, early warning of fish pathology is given. The morphological and body shape features of each fish are analyzed from its outline image to obtain its morphological and body shape characteristics, including: For any given fish, the outline of the fish body is determined based on the fish body outline image of that fish. Calculate the curvature of each point on the fish body outline, and determine the number of abnormal points on the edge of the fin rays of any fish based on the curvature of each point; Based on the polygon approximation and maximum deviation distance protrusion recognition algorithm, the fish body outline of any fish is processed to identify abnormal protrusions on the body surface in order to obtain the number of abnormal protrusions on the body surface. Using the fish outline, the length-to-width ratio and body tilt deviation of any one fish can be determined; Obtain a standard outline image of a healthy fish and calculate the shape similarity between the outline image of any fish and the standard outline image of the healthy fish. The morphological and physical characteristics of any fish are generated by using the number of abnormal points on the edge of the fin rays, the number of abnormal protrusions on the body surface, the length-to-width ratio of the body, the tilt deviation of the fish body, and the shape similarity.
2. The method according to claim 1, characterized in that, Based on rasterization scanning and local contrast analysis algorithms, lesion identification is performed on the fish body contour images of each fish, including: For any fish's body outline image, a k×k pixel grid is superimposed on the fish's body outline image to obtain a fish body outline grid image, where k is a positive integer. From the fish body outline grid image, select the grid cells that are on the fish body outline image of any one fish as the target grid; Calculate the first average brightness value of all pixels in each target grid; For any target grid, obtain multiple neighboring grids of the target grid and calculate the second average brightness value of all neighboring grids of the target grid; Calculate the brightness difference between the first average brightness value and the second average brightness value, and determine whether the absolute value of the brightness difference is greater than a preset threshold. If so, then any target grid is taken as a lesion cell, and after all target grids have been polled, several lesion cells are obtained, and the lesion area of any fish is formed by using several lesion cells.
3. The method according to claim 1, characterized in that, Feature extraction was performed on the lesion area of each fish to obtain the lesion features of each fish, including: For any given fish, count the number of pixels with a brightness value greater than a brightness threshold in the lesion area of that fish to obtain the number of abnormal pixels. Obtain the total number of pixels in the outline image of any one of the fish; The ratio between the number of abnormal pixels and the total number of pixels is calculated, and the ratio is used as the lesion feature of any fish.
4. The method according to claim 1, characterized in that, Texture anomaly analysis was performed on the fish outline image of each fish to obtain the surface texture features of each fish, including: Calculate the variance of the gray values of all pixels in the fish outline image of each fish to serve as the texture variance of each fish. Calculate the gray-level co-occurrence matrix of the fish body outline image for each fish; Based on the gray-level co-occurrence matrix of each fish, the texture descriptor of each fish is determined. The texture descriptor of any fish includes the contrast and homogeneity of the gray-level co-occurrence matrix of that fish. By utilizing the texture variance and texture descriptor of each fish, the surface texture features of each fish are constructed.
5. The method according to claim 1, characterized in that, Based on a polygon approximation and maximum deviation distance-based protrusion recognition algorithm, the fish body contour line of any one of the fish is processed to identify abnormal protrusions on the body surface, including: The Douglas-Puk algorithm is used to perform polygon approximation on the fish body outline to generate multiple baseline edges representing the outline baseline of any one of the fish. For any given baseline, calculate the maximum vertical deviation distance from each point on the fish body outline to that baseline. Points with a maximum vertical deviation greater than a distance threshold are taken as abnormal protrusions on the body surface. After polling all baseline edges, the number of abnormal protrusions on the body surface of any fish is obtained.
6. The method according to claim 1, characterized in that, Using the fish outline, the aspect ratio and body tilt deviation of any one fish are determined, including: The fish body outline is fitted with a minimum bounding ellipse to obtain the minimum bounding ellipse of the fish body outline. The ratio between the major and minor axes of the smallest circumscribed ellipse is taken as the aspect ratio of the body shape. Calculate the angle between the major axis of the smallest circumscribed ellipse and the horizontal direction, and use it as the angle of inclination of the fish body; The angle difference between the fish body tilt angle and the standard tilt angle is calculated, and the angle difference is used as the fish body tilt deviation.
7. The method according to claim 1, characterized in that, Before performing real-time fish body segmentation and recognition processing on the real-time image, the method further includes: The real-time image is dehazed to obtain a dehazed image; The dehazed image is subjected to nonlocal mean filtering to obtain a denoised image; The denoised image is color-corrected to obtain a corrected image, which is then processed using the SAM2 model for real-time fish body segmentation and recognition to obtain the fish body contour image of each fish in the real-time image.
8. The method according to claim 1, characterized in that, The pathological test result of any fish represents the probability of disease for that fish. Based on the pathological test results of each fish, early warning systems for fish pathology are implemented, including: For any given fish, determine whether the probability of that fish being diseased is greater than the minimum probability threshold. If so, an early warning notification is generated and sent to the terminal corresponding to the breeding personnel; The warning level is determined based on the probability of disease in any one of the fish. Based on the warning level, any one of the fish is marked on the monitoring interface to complete the warning of any one of the fish's pathological conditions. The color of the fish mark corresponds to different warning levels.
9. A fish pathological detection system based on image segmentation and visual phenotypic analysis, characterized in that, The apparatus is used to perform the fish pathological detection method based on image segmentation and visual phenotypic analysis according to any one of claims 1 to 8, wherein the apparatus comprises: The image acquisition unit is used to acquire real-time images of the fish in the breeding tank and real-time environmental data. The data processing unit is used to perform real-time fish body segmentation and recognition processing on the real-time image using the SAM2 model, so as to obtain the fish body contour image of each fish in the real-time image. The data processing unit is used to identify lesions in the fish outline image of each fish based on rasterization scanning and local contrast analysis algorithms, obtain the lesion area corresponding to each fish, and extract features from the lesion area of each fish to obtain the lesion features of each fish. The data processing unit is also used to perform texture anomaly analysis and morphological and body feature analysis on the fish body outline image of each fish, so as to obtain the surface texture features and morphological and body features of each fish respectively. The pathological analysis and diagnosis unit is used to generate phenotypic lesion characteristics for each fish by utilizing the real-time environmental data, as well as the lesion characteristics, surface texture characteristics, and morphological and physical characteristics of each fish. The pathological analysis and diagnosis unit is also used to input the phenotypic lesion characteristics of each fish into the pathological detection model for pathological detection processing, obtain the pathological detection results of each fish, and provide early warning of fish pathology based on the pathological detection results of each fish.