A method for identifying freshwater fish parasites based on hyperspectral images

By constructing a parasite grayscale fitting curve and grayscale image enhancement model, image enhancement of hyperspectral images of freshwater fish tissue sections is solved, which solves the problem of inaccurate parasite recognition caused by background interference and improves the accuracy of recognition and image quality.

CN119722657BActive Publication Date: 2025-06-06INST OF ANIMAL HEALTH GUANGDONG ACADEMY OF AGRI SCI
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510206061.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-02-25
Publication Date
2025-06-06
Estimated Expiration
2045-02-25

AI Technical Summary

Technical Problem

The existing hyperspectral image enhancement methods have background interference in freshwater fish tissue sections, resulting in inaccurate parasite identification results, affecting freshwater fish farming and food safety.

Method used

By obtaining the parasite grayscale histogram of standard parasite grayscale images, a parasite grayscale fitting curve is constructed, and a grayscale image enhancement model is constructed based on this to enhance the initial grayscale image to reduce background interference and highlight the characteristics of the parasite area.

Benefits of technology

It improves the accuracy of parasite recognition in freshwater fish tissue sections, reduces background interference, enhances image quality, can more accurately identify and classify parasites, and improves the safety and market competitiveness of freshwater fish products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119722657B_ABST
    Figure CN119722657B_ABST
Patent Text Reader

Abstract

The present application relates to a method for identifying freshwater fish parasites based on hyperspectral images, comprising: constructing an initial grayscale image of the hyperspectral image based on a hyperspectral image of a freshwater fish tissue section to be identified; acquiring a known standard parasite grayscale image, and constructing a parasite grayscale fitting curve based on a parasite grayscale histogram of the standard parasite grayscale image; constructing a grayscale image enhancement model of the initial grayscale image based on the parasite grayscale fitting curve; and performing image enhancement on the initial grayscale image based on the grayscale image enhancement model to obtain a target grayscale image, so as to identify freshwater fish parasites based on the target grayscale image. The present application has the effect of improving the grayscale image enhancement effect of freshwater fish tissue sections, thereby improving the accuracy of parasite identification in freshwater fish tissue sections.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition technology, and in particular to a method for identifying freshwater fish parasites based on hyperspectral images. Background Art

[0002] In order to ensure food safety and public health, and to improve the market competitiveness of freshwater fish products, it is necessary to detect and identify possible parasites in freshwater fish tissues. Through effective detection and treatment, the quality and safety of freshwater fish products can be improved, the spread of parasitic diseases can be reduced, the health of consumers can be protected, and sustainable development can be promoted.

[0003] The invention patent with publication number CN114359539A discloses a method for intelligent identification of parasites in sashimi by hyperspectral images, which obtains the hyperspectral images of sashimi in the range of 300 to 1100 nm; extracts the grayscale image of the hyperspectral image at any wavelength value in the wavelength range of 437 to 446 nm; performs median filtering and binarization on the grayscale image to obtain the position range of fish meat in the image; extracts the spectral signals of the pixel points in the position range in the hyperspectral image, performs first-order derivative processing on the spectral signals to obtain the first-order derivative average spectral signal, and imports the first-order derivative average spectral signal into the preset first model, second model, and third model for analysis, so as to realize the identification and detection of parasites, which can be used for the prevention and control of freshwater fish parasites.

[0004] However, since the hyperspectral response values ​​of different parasites are different, parasite identification is greatly interfered with. Therefore, it is necessary to enhance the acquired grayscale image to improve the accuracy of parasite identification.

[0005] The existing histogram equalization method can perform image enhancement on grayscale images converted from hyperspectral images to improve image contrast. However, since the histogram equalization algorithm is affected by the background (other tissues in freshwater fish tissue sections) during image enhancement, the image enhancement effect is not good, which may lead to inaccurate parasite identification results, resulting in poor parasite prevention and control effects on freshwater fish, thereby affecting the growth of freshwater fish farming. Summary of the invention

[0006] In order to improve the grayscale image enhancement effect of freshwater fish tissue sections, thereby improving the accuracy of parasite identification in freshwater fish tissue sections, the present application provides a freshwater fish parasite identification method based on hyperspectral images.

[0007] The present application provides a method for identifying freshwater fish parasites based on hyperspectral images, which adopts the following technical solutions:

[0008] A method for identifying freshwater fish parasites based on hyperspectral images, comprising:

[0009] Based on the acquired hyperspectral image of the tissue section of the freshwater fish to be identified, constructing an initial grayscale image of the hyperspectral image;

[0010] Acquire a known standard parasite grayscale image, and construct a parasite grayscale fitting curve based on a parasite grayscale histogram of the standard parasite grayscale image;

[0011] Based on the parasite grayscale fitting curve, constructing a grayscale image enhancement model of the initial grayscale image;

[0012] Based on the grayscale image enhancement model, the initial grayscale image is enhanced to obtain a target grayscale image, so as to identify freshwater fish parasites based on the target grayscale image.

[0013] The beneficial effects are as follows: by obtaining the parasite grayscale histogram of the standard parasite grayscale image and constructing a parasite grayscale image fitting curve, the typical grayscale distribution characteristics of the parasite can be digitized; according to the parasite grayscale distribution characteristics, the grayscale values ​​corresponding to the parasite areas in the initial grayscale image that meet the parasite distribution characteristics can be retained through the constructed grayscale image enhancement model, and the grayscale values ​​corresponding to the remaining non-parasite areas can be set to highlight the characteristics of the parasite areas in the initial grayscale image, thereby reducing the background interference in the initial grayscale image and achieving image enhancement of the initial grayscale image, so as to distinguish between parasite areas and non-parasite areas, thereby improving the accuracy of parasite identification, which is beneficial to the prevention and control of freshwater fish parasites.

[0014] Optionally, constructing a parasite grayscale fitting curve based on the parasite grayscale histogram of the standard parasite grayscale image includes:

[0015] Based on the least squares method, a polynomial fitting is performed on the parasite grayscale histogram of the standard parasite grayscale image to construct a parasite image fitting curve;

[0016] The horizontal coordinate of the parasite image fitting curve is the fitting gray value, and the vertical coordinate is the occurrence frequency of the fitting gray value.

[0017] The beneficial effects are as follows: by constructing a parasite image fitting curve, the grayscale distribution characteristics of the parasite in the initial grayscale image can be extracted and described, which is convenient for subsequent parasite identification and classification; polynomial fitting is used to simplify complex histogram data into one or several mathematical formulas, reducing the complexity and amount of calculation of data processing.

[0018] Optionally, constructing a grayscale image enhancement model of the initial grayscale image based on the parasite grayscale fitting curve includes:

[0019] Normalizing the parasite grayscale fitting curve to obtain the ratio between the frequency of occurrence of each of the fitting grayscale values ​​and the peak value of all occurrence frequencies;

[0020] Based on the ratio, an objective function is constructed, the solution of the objective function is a target grayscale value sequence composed of target grayscale values ​​after each initial grayscale value in the initial grayscale image is enhanced, and the objective function is used as a grayscale image enhancement model.

[0021] The beneficial effects are as follows: by normalizing, the complex parasite grayscale fitting curve data is simplified into a ratio form, reducing the complexity and amount of calculation of data processing; by constructing an objective function as a grayscale image enhancement model and generalizing the processing flow, the enhanced target grayscale value sequence can be obtained through the solution of the objective function, thereby improving the quality of the grayscale image, highlighting the characteristics of the parasite more accurately, reducing background noise and other interference, and thus improving the accuracy of parasite identification.

[0022] Optionally, the objective function is expressed as:

[0023]

[0024] In the formula, is a low grayscale target function, used to set the target grayscale value corresponding to the fitting grayscale value whose ratio is less than 1 to the first grayscale value;

[0025] is a high grayscale objective function, used to set the target grayscale value corresponding to the fitting grayscale value whose ratio is greater than or equal to 1 to a second grayscale value, and the first grayscale value is less than the second grayscale value.

[0026] The beneficial effects are: through and The two functions can adjust the grayscale values ​​of other non-parasites near the grayscale value of the parasite to be very low or very high, which can highlight the grayscale characteristics of the parasite and thus improve the accuracy of parasite identification; at the same time, the complex grayscale value mapping relationship is simplified to the sum of two functions, reducing the complexity and calculation amount of data processing.

[0027] Optionally, the low grayscale objective function The expression is:

[0028]

[0029] In the formula, the first Fitting gray value The ratio is , For the Fitting gray value Corresponding to the target grayscale value obtained by solution, if the ratio The closer it is to 1, the The closer the value of is to 1, the The smaller it is than 1, the The larger the value of Must be less than or equal to , cannot be greater than ,Right now ;

[0030] Indicates when The smaller it is than 1, The larger the value of The larger the value of The larger the value, It is to prevent A value of 0;

[0031] in, Indicates the number, refers to the fitted grayscale value corresponding to the peak value of the frequency of occurrence, where This is because the fitting grayscale value range is 0~255, and the total number is 256, indicating The value is a target grayscale value that is smaller than all fitting grayscale values ​​corresponding to the peak value.

[0032] Optionally, the high grayscale objective function The expression is:

[0033]

[0034] In the formula, the parasite image fitting curve is defined as Fitting gray value The ratio is , For the Fitting gray value Corresponding to the target grayscale value obtained by solution, if the ratio The closer it is to 1, the The closer the value of is to 1, the The smaller it is than 1, the The larger the value of Must be greater than or equal to , cannot be less than ,Right now ;

[0035] express The smaller it is than 1, The larger the value of The larger the value of The larger the value, It is to prevent The value is 0.

[0036] Optionally, the objective function is further expressed as:

[0037]

[0038] In the formula, To evaluate the and The smoothness of the target gray value sequence obtained to reduce the distortion of the target gray value sequence;

[0039] Said The calculation steps include:

[0040] Based on the low grayscale target function and the high grayscale target function, a target grayscale value sequence is obtained;

[0041] Obtaining a curvature value of each target grayscale value in the target grayscale value sequence;

[0042] Performing Gaussian fitting on the curvature value to obtain a Gaussian function of the target grayscale value;

[0043] Based on the curvature value and the Gaussian function, a Gaussian probability value corresponding to the target gray value is calculated;

[0044] Based on the Gaussian probability value and the curvature value, it is calculated that .

[0045] The beneficial effect is: by calculating The value can evaluate the smoothness of the target gray value sequence, thereby reducing the distortion of the image during the gray value adjustment process; by reducing image distortion and maintaining the continuity of parasite features, the accuracy of parasite recognition can be improved and the cases of misidentification and missed identification can be reduced; the robustness of the image enhancement algorithm is enhanced, so that the algorithm can better adapt to different image qualities and parasite features.

[0046] Optionally, the The calculation expression is:

[0047]

[0048] In the formula, Indicates Fitting gray value The ratio of

[0049] Indicates the current The Gaussian probability value of the curvature value corresponding to the target gray value is obtained by: Substitute the curvature value corresponding to the target gray value into the Gaussian function of the target gray value to obtain the Gaussian probability value ;

[0050] For the The actual frequency of occurrence of the curvature value corresponding to the target gray value;

[0051] Defined as hour, ,when , ;

[0052] Represents the tolerance for smoothness and is defined as a hyperparameter.

[0053] Optionally, performing image enhancement on the initial grayscale image based on the grayscale image enhancement model to obtain a target grayscale image includes:

[0054] Based on the group optimization intelligent algorithm, the minimum value of the objective function is solved to obtain the target gray value sequence;

[0055] Based on the target grayscale value sequence, the initial grayscale image is enhanced to obtain a target grayscale image.

[0056] The beneficial effects are: by solving the minimum value of the objective function through the group optimization intelligent algorithm, the optimal target grayscale value sequence can be obtained, which helps to highlight the characteristics of the parasite and make it more obvious in the enhanced image; the target grayscale image after image enhancement has higher quality, the parasite characteristics are more obvious, and the background noise and irrelevant grayscale values ​​are effectively suppressed.

[0057] This application has the following technical effects:

[0058] 1. By obtaining the parasite grayscale histogram of the standard parasite grayscale image, a parasite grayscale image fitting curve is constructed, which can digitize the typical grayscale distribution characteristics of the parasite.

[0059] 2. According to the grayscale distribution characteristics of parasites, the grayscale image enhancement model constructed can retain the grayscale values ​​corresponding to the parasite areas in the initial grayscale image that meet the distribution characteristics of the parasites, and set the grayscale values ​​corresponding to the remaining non-parasite areas to highlight the characteristics of the parasite areas in the initial grayscale image, thereby reducing the background interference in the initial grayscale image.

[0060] 3. By constructing the objective function as a grayscale image enhancement model and generalizing the processing flow, the enhanced target grayscale value sequence can be obtained through the solution of the objective function, thereby improving the quality of the grayscale image, highlighting the characteristics of the parasite more accurately, reducing background noise and other interference, and thus improving the accuracy of parasite identification. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easily understood. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-restrictive manner, and the same or corresponding numbers represent the same or corresponding parts.

[0062] Figure 1 It is a flow chart of steps S101-S104 in a method for identifying freshwater fish parasites based on hyperspectral images in an embodiment of the present application.

[0063] Figure 2 It is a flow chart of steps S201-S202 in a method for identifying freshwater fish parasites based on hyperspectral images in an embodiment of the present application.

[0064] Figure 3 It is a flowchart of steps S301-S305 in a method for identifying freshwater fish parasites based on hyperspectral images in an embodiment of the present application.

[0065] Figure 4 It is a flow chart of steps S401-S402 in a method for identifying freshwater fish parasites based on hyperspectral images in an embodiment of the present application. DETAILED DESCRIPTION

[0066] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0067] It should be understood that when the terms "first", "second", etc. are used in the claims, specification and drawings of the present application, they are only used to distinguish different objects, rather than to describe a specific order. The terms "include" and "comprise" used in the specification and claims of the present application indicate the presence of the described features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or their collections.

[0068] The present application embodiment discloses a method for identifying freshwater fish parasites based on hyperspectral images. Figure 1 ,include:

[0069] S101, constructing an initial grayscale image of the hyperspectral image based on the acquired hyperspectral image of the tissue section of the freshwater fish to be identified;

[0070] S102, obtaining a known standard parasite grayscale image, and constructing a parasite grayscale fitting curve based on a parasite grayscale histogram of the standard parasite grayscale image;

[0071] S103, constructing a grayscale image enhancement model of the initial grayscale image based on the parasite grayscale fitting curve;

[0072] S104. Based on the grayscale image enhancement model, the initial grayscale image is enhanced to obtain a target grayscale image, so as to identify freshwater fish parasites based on the target grayscale image.

[0073] Step S101, slice the freshwater fish to be identified, and use a hyperspectral instrument to take a hyperspectral image of the sliced ​​freshwater fish tissue to obtain a hyperspectral image of the freshwater fish tissue slice to be identified. In this embodiment, the hyperspectral frequency band is selected as 484.88-655.95nm, and in other embodiments, the implementer can adjust it according to the specific implementation scenario.

[0074] Furthermore, after acquiring the hyperspectral image, the spectral response values ​​in the hyperspectral image are normalized using the maximum and minimum normalization method, and the normalized image is dot-multiplied with 255 to obtain the initial grayscale image of the hyperspectral image.

[0075] Since different parasites have different response intensities on the slices, different types of parasites have different grayscale distributions after being converted into grayscale images, which may lead to poor parasite imaging and affect the final parasite identification results. Therefore, in this embodiment, a method of image enhancement for grayscale images is used to reduce interference with parasite identification in grayscale images.

[0076] It is worth mentioning that the existing grayscale image enhancement methods generally use histogram equalization to improve the contrast of grayscale images, thereby improving the parasite recognition effect. However, since there are other fish bones, internal organs and other tissues in freshwater fish tissue slices, they may enhance the interference to the histogram, and the histogram equalization method cannot identify these interferences.

[0077] The grayscale image enhancement method used in this embodiment sets the grayscale value of the parasite to not change much after enhancement, and sets the grayscale value of the non-parasite to be darker or brighter, so that the grayscale value of the non-parasite is relatively consistent and distinguished from the grayscale value of the parasite, thereby reducing the interference with the parasite identification and ensuring the recognition rate of the parasite.

[0078] Step S102, before the initial grayscale image is enhanced, the types of parasites need to be stored in the database to identify the types of parasites in the freshwater fish tissue sections. In this embodiment, a standard parasite image is selected by a person with rich relevant experience, and the area where the parasites are located is marked in the image, and a grayscale image of the marked area in the standard parasite image is further obtained as the standard parasite grayscale image.

[0079] Specifically, the marking of the area where the parasite is located can be achieved through software such as Adobe Photoshop, ImageJ, MATLAB, etc., or software specially designed for hyperspectral image analysis, such as ENVI, ERDAS Imagine, etc.

[0080] Furthermore, parasite grayscale histograms of a plurality of parasites are obtained according to the standard parasite grayscale image, and a parasite grayscale fitting curve is constructed according to the parasite grayscale histogram.

[0081] Specifically, after the annotation is completed, the software will extract all pixel values ​​within the parasite annotated area and generate a grayscale histogram, which shows the number of pixels of each grayscale level in the annotated area.

[0082] In this embodiment, the parasite grayscale fitting curve is constructed by the least square method. The parasite grayscale fitting curve is the result obtained by polynomial fitting of multiple parasite grayscale histograms by the least square method. The specific shape of this curve depends on the following factors:

[0083] Type of parasite: Different types of parasites may have different grayscale distributions in the image, so the grayscale fitting curves of each parasite will also be different;

[0084] Histogram data: The fitted curve will reflect the distribution characteristics of the original histogram data, including the location, width, height of the peak and any abnormal distribution shape;

[0085] The order of the polynomial: The order of the polynomial used for fitting (i.e. the degree of the polynomial) affects the shape of the curve. Generally speaking, the higher the order, the more accurately the curve can capture the details of the histogram, but it may also lead to overfitting.

[0086] Here are some characteristics that the fitted curve might have:

[0087] Single peak or multi-peak: If the parasite grayscale histogram mainly contains one peak, the fitting curve will show a single peak shape; if the histogram has multiple obvious peaks, the fitting curve will show a multi-peak shape;

[0088] Smoothness: Polynomial fitting usually produces smooth curves, especially in the case of high-order polynomials, and the curves can adapt very flexibly to changes in the histogram;

[0089] Symmetric or asymmetric: The grayscale fitting curve of the parasite may present a symmetrical or asymmetric shape depending on the symmetry of the histogram;

[0090] Trend: In some cases, the parasite grayscale fitting curve may show a certain trend, such as a gradual increase or decrease, reflecting the overall change trend of the parasite grayscale value in the histogram.

[0091] In this embodiment, the horizontal coordinate of the parasite grayscale fitting curve can be set to the fitting grayscale value, and the vertical coordinate can be set to the occurrence frequency corresponding to the fitting grayscale value. After constructing the parasite grayscale fitting curve, the parasite grayscale fitting curve can be used as a parasite grayscale distribution model to construct a subsequent grayscale image enhancement model.

[0092] Step S103, after constructing the parasite grayscale fitting curve, construct a grayscale image enhancement model of the initial grayscale image according to the parasite grayscale fitting curve, so as to enhance the initial grayscale image based on the grayscale image enhancement model. Figure 2 ,The construction process of the grayscale image enhancement model includes:

[0093] S201, normalizing the parasite grayscale fitting curve to obtain the ratio between the occurrence frequency corresponding to each fitting grayscale value and the peak value of all occurrence frequencies;

[0094] S202, constructing an objective function based on the ratio, wherein the solution of the objective function is a target grayscale value sequence consisting of target grayscale values ​​after each initial grayscale value in the initial grayscale image is enhanced, and the objective function is used as a grayscale image enhancement model.

[0095] Specifically, the parasite grayscale fitting curve is normalized. The normalization method is to obtain the ratio between the occurrence frequency corresponding to each fitting grayscale value and the peak value of all occurrence frequencies, so that the peak value of the parasite grayscale fitting curve after normalization is 1. Grayscale value The ratio is .

[0096] A mathematical model is constructed based on the ratio to establish a mapping relationship between the parasite grayscale fitting curve and the initial grayscale image of the freshwater fish tissue section to be identified. The mapping relationship contains two dimensions, one is the grayscale value on the parasite grayscale fitting curve, and the other is the enhancement factor (e.g., brightness adjustment coefficient) of the corresponding grayscale value in the initial grayscale image.

[0097] For each pixel in the initial grayscale image, the corresponding target grayscale value in the parasite grayscale fitting curve mapped thereto is found, so as to adjust the grayscale value of the pixel, thereby achieving enhancement of the initial grayscale image.

[0098] Since the above-mentioned expected mathematical model is difficult to define, this embodiment solves an expected grayscale image enhancement model through an optimization method.

[0099] In this embodiment, the method adopted is to construct a target function, wherein a solution is set for each initial grayscale value of the histogram horizontal coordinate in the initial grayscale image, wherein the grayscale value range is 0-255, and a total of 256 solutions are set, wherein the sequence composed of the 256 solutions is the target grayscale value sequence.

[0100] Therefore, the solution of the objective function is a target grayscale value sequence composed of target grayscale values ​​after each initial grayscale value in the initial grayscale image is enhanced, and the initial grayscale value of each pixel in the initial grayscale image can be enhanced according to the target grayscale value sequence. In this embodiment, the objective function is used as a grayscale image enhancement model.

[0101] Specifically, the expression of the objective function constructed in this embodiment is:

[0102]

[0103] In the formula, is a low grayscale objective function, used to set the target grayscale value corresponding to the fitting grayscale value whose ratio is less than 1 to the first grayscale value;

[0104] is a high grayscale objective function, which is used to set the target grayscale value corresponding to the fitting grayscale value whose ratio is greater than or equal to 1 to the second grayscale value, and the first grayscale value is less than the second grayscale value.

[0105] For example, the fitting grayscale value where the ratio is close to 1 remains unchanged, the target grayscale value of the fitting grayscale value where the ratio is less than 1 is set to 0 or close to 0, and the target grayscale value of the fitting grayscale value where the ratio is greater than 1 is set to 255 or close to 255. Therefore, only the grayscale value of the parasite area remains unchanged, while the target grayscale value of the non-parasite area is set to 0 or 255, which can clearly distinguish the grayscale value of the parasite area from that of the non-parasite area.

[0106] Among them, the low grayscale target function set in this embodiment is The expression is:

[0107]

[0108] In the formula, the first Fitting gray value The ratio is , For the Fitting gray value Corresponding to the target grayscale value obtained by solution, if the ratio The closer it is to 1, the The closer the value of is to 1, the The smaller it is than 1, the The larger the value of Must be less than or equal to , cannot be greater than ,Right now ;

[0109] Indicates when The smaller it is than 1, The larger the value of The larger the value of The larger the value, It is to prevent A value of 0;

[0110] in, Indicates the number, refers to the fitted grayscale value corresponding to the peak value of the frequency of occurrence, where This is because the fitting grayscale value range is 0~255, and the total number is 256, indicating The value is a target grayscale value that is smaller than all fitting grayscale values ​​corresponding to the peak value.

[0111] Among them, the high grayscale target function set in this embodiment is The expression is:

[0112]

[0113] In the formula, the parasite image fitting curve is defined as Fitting gray value The ratio is , For the Fitting gray value Corresponding to the target grayscale value obtained by solution, if the ratio The closer it is to 1, the The closer the value of is to 1, the The smaller it is than 1, the The larger the value of Must be greater than or equal to , cannot be less than ,Right now ;

[0114] express The smaller it is than 1, The larger the value of The larger the value of The larger the value, It is to prevent The value is 0.

[0115] The principles for setting the low grayscale objective function and the high grayscale objective function are as follows:

[0116] Fit the parasite grayscale fitting curve to the The grayscale value corresponding to the position will not be processed, and the closer The grayscale value corresponding to the position becomes darker or brighter to reduce the interference of parasite identification. To judge the limit, The gray value at is compressed to be greater than Increase the gray value at.

[0117] Furthermore, through the above and The target grayscale value can be obtained, and the initial grayscale value can be adjusted according to the expected enhancement effect. However, because the parasite grayscale only occupies a part of the grayscale value, not the whole proportion, if the stretching is too large, the arc corresponding to the parasite will also be excessively distorted, that is, the target grayscale value will have most pixel grayscale values ​​of 0 or most pixel grayscale values ​​of 255. In order to solve the above problem, this embodiment introduces the definition , used to evaluate the and The smoothness of the target gray value sequence is obtained to reduce the distortion of the target gray value sequence.

[0118] Compared with the above objective function expression, the introduction The target expression is:

[0119]

[0120] Reference Figure 3 , The calculation steps include:

[0121] S301, obtaining a target grayscale value sequence based on a low grayscale target function and a high grayscale target function;

[0122] S302, obtaining the curvature value of each target gray value in the target gray value sequence;

[0123] S303, performing Gaussian fitting on the curvature value to obtain a Gaussian function of the target gray value;

[0124] S304, based on the curvature value and the Gaussian function, calculate and obtain the Gaussian probability value corresponding to the target gray value;

[0125] S305: Based on the Gaussian probability value and the curvature value, calculate .

[0126] Specifically, according to and The target grayscale value sequence L is obtained, wherein when the grayscale values ​​of most pixels are 0 or the grayscale values ​​of most pixels are 255, the same grayscale value of 0 or 255 will appear continuously in the target grayscale value sequence L, and after the continuous appearance of 0 grayscale value or 255 grayscale value, the grayscale value changes too fast, which may cause the grayscale image of the hyperspectral image after mapping enhancement to be distorted.

[0127] In order to reduce the possibility of the above situation and make the mapped target grayscale value sequence L relatively smooth, this embodiment chooses to use the curvature calculation method of discrete data to obtain the curvature value corresponding to each target grayscale value of the target grayscale value sequence L. The curvature value calculation method of discrete data points can be used for calculation.

[0128] Furthermore, Gaussian fitting is performed on the curvature values ​​of all target grayscale values ​​to obtain the Gaussian function corresponding to the target grayscale value (the Gaussian function of one-dimensional data is to calculate the mean and variance of the target grayscale value sequence L, and then substitute them into the one-dimensional Gaussian function formula).

[0129] If there is a target grayscale value whose corresponding curvature value is higher than its corresponding Gaussian function, it means that the target grayscale value is an obvious mutation value compared with other target grayscale values ​​in the target grayscale value sequence L, indicating that the smoothness of the current target grayscale value sequence L is not good, and the grayscale part corresponding to the parasite is more likely to have grayscale distortion.

[0130] Based on this, this embodiment provides a The calculation expression is:

[0131]

[0132] In the formula, Indicates the current The Gaussian probability value of the curvature value corresponding to the target gray value is obtained by: Substitute the curvature value corresponding to the target gray value into the Gaussian function of the target gray value to obtain the Gaussian probability value ;

[0133] For the The actual frequency of occurrence of the curvature value corresponding to the target gray value; if The larger the value of , the greater its occurrence frequency is than the probability that it should appear in the overall relatively smooth curvature distribution, indicating that its smoothness is lower, and then the maximum value of all target gray values ​​is taken as the smoothness evaluation result.

[0134] Defined as hour, ,when , , which means that when the probability of a target grayscale value appearing on the overall relatively smooth curvature distribution is lower than that of the target grayscale value, the effect of the curvature on the smoothness of the overall curvature distribution is no longer considered, because even if it is too low, it means that the frequency of occurrence of the curvature is low, which has little effect on image distortion and does not affect the final parasite identification result. The value indicates the attention paid to different smoothness. If The larger the value, the greater the requirement for smoothness. should be closer to 0, if , indicating that the curvature value corresponding to the gray value of the area is not concerned, because it will not interfere with the gray distribution of the parasite and will not affect the parasite identification result.

[0135] Represents the tolerance for smoothness and is defined as a hyperparameter. In this embodiment, set .

[0136] So far, the objective function in this embodiment has been constructed, that is, the grayscale image enhancement model of the initial grayscale image has been constructed.

[0137] Step S104: According to the grayscale image enhancement model, the initial grayscale image can be enhanced to obtain a target grayscale image. Figure 4 , specifically including:

[0138] S401, based on the group optimization intelligent algorithm, solving the minimum value of the objective function to obtain the target gray value sequence;

[0139] S402: Based on the target grayscale value sequence, perform image enhancement on the initial grayscale image to obtain a target grayscale image.

[0140] In the objective function After the construction is completed, it is necessary to find the minimum value of this function. This involves an optimization process. In this embodiment, a swarm optimization intelligent algorithm (such as a genetic algorithm, a particle swarm optimization algorithm, etc.) can be used to solve this minimum value, thereby obtaining a target gray value sequence.

[0141] Specifically, the general steps of the group optimization intelligent algorithm include:

[0142] Initialize the population: Create an initial solution set, i.e., the population, which contains multiple possible solutions. Each solution is usually represented as a series of parameter values ​​used to adjust the grayscale value of the initial grayscale image.

[0143] Evaluate the population: For each solution in the population, calculate the corresponding objective function value, and evaluate the quality of each solution based on the objective function value.

[0144] Selection and mutation: Select the better solution based on the objective function value to generate a new solution, and mutate the selected solution to generate a new solution. Mutation can include randomly adjusting certain parameter values ​​of the solution.

[0145] Iterative optimization: The evaluation, selection, and mutation steps are repeated until a stopping condition is met, such as reaching a maximum number of iterations or the objective function value is small enough.

[0146] Select the best solution: Select the solution with the smallest objective function value from the solutions obtained in the iterative process as the final optimal solution.

[0147] The optimal solution obtained by the group optimization intelligent algorithm is the target grayscale value sequence. The grayscale value of each pixel in the initial grayscale image is replaced by the target grayscale value in the target grayscale value sequence to obtain an enhanced target grayscale image.

[0148] Further, in this embodiment, freshwater fish parasite identification is performed based on the target grayscale image, and the following contents may be referred to:

[0149] Image collection: A large number of parasite images are collected by personnel with rich relevant experience;

[0150] Constructing a parasite sequence: Assuming there are N types of parasites, the constructed parasite sequence is a vector of length N. For example, if there are 5 types of parasites, the vector [1, 0, 1, 0, 0] indicates that the first and third types of parasites exist in the current sample, and other parasites do not exist.

[0151] Image annotation: Parasite annotation is performed by personnel with rich relevant experience, including identifying the types of parasites in the image and assigning a position to each parasite in the sequence. If a certain parasite exists in the image, the position corresponding to the parasite in the parasite sequence is marked as 1; if it does not exist, it is marked as 0.

[0152] Data preprocessing: This embodiment can use One-Hot encoding to process data and convert the labeled parasite sequence into One-Hot encoding. For N types of parasites, the One-Hot encoding of each sample will be an N-dimensional vector, in which only the corresponding parasite position is 1 and the rest are 0. For example, if the sequence is [1,0,1,0,0], the One-Hot encoding may be {[1,0,0], [0,1,0], [1,0,0], [0,1,0], [0,0,1]}.

[0153] Constructing a parasite neural network: In this embodiment, a convolutional neural network CNN can be used, and the cross entropy loss function is selected as the optimization target. The CNN is trained using labeled and One-Hot encoded image data, and the network weights are adjusted through the back propagation algorithm and the gradient descent optimization method to minimize the cross entropy loss.

[0154] Model validation and testing: Use validation and test sets to evaluate the performance of the model.

[0155] Parasite identification: The target grayscale image is input into the trained parasite neural network, which outputs a probability distribution indicating the possibility of the existence of various parasites in the image. Based on the output probability distribution, the types of parasites contained in the target grayscale image can be identified.

[0156] In other embodiments, other pre-trained parasite identification networks may also be used, and this embodiment does not impose any limitation on this.

[0157] Although this specification has shown and described a plurality of embodiments of the present application, it is obvious to those skilled in the art that such embodiments are provided by way of example only. Those skilled in the art will think of many changes, modifications and alternatives without departing from the thought and spirit of the present application. It should be understood that in the process of practicing the present application, various alternatives to the embodiments of the present application described herein may be adopted.

[0158] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.

Claims

1. A method for identifying freshwater fish parasites based on hyperspectral images, characterized in that: include: Based on the acquired hyperspectral image of the tissue section of the freshwater fish to be identified, constructing an initial grayscale image of the hyperspectral image; Acquire a known standard parasite grayscale image, perform polynomial fitting on the parasite grayscale histogram of the standard parasite grayscale image based on the least squares method, and construct a parasite image fitting curve, wherein the abscissa of the parasite image fitting curve is the fitting grayscale value, and the ordinate is the occurrence frequency of the fitting grayscale value; Normalizing the parasite grayscale fitting curve to obtain the ratio between the frequency of occurrence of each of the fitting grayscale values ​​and the peak value of all occurrence frequencies; Based on the ratio, construct an objective function, wherein the solution of the objective function is a target grayscale value sequence composed of target grayscale values ​​after each initial grayscale value in the initial grayscale image is enhanced, and the objective function is used as a grayscale image enhancement model; Based on the group optimization intelligent algorithm, the minimum value of the objective function is solved to obtain the target gray value sequence; Based on the target grayscale value sequence, the initial grayscale image is enhanced to obtain a target grayscale image, so as to identify freshwater fish parasites based on the target grayscale image.

2. The method according to claim 1, characterized in that The expression of the objective function is: In the formula, is a low grayscale target function, used to set the target grayscale value corresponding to the fitting grayscale value whose ratio is less than 1 to the first grayscale value; is a high grayscale objective function, used to set the target grayscale value corresponding to the fitting grayscale value whose ratio is greater than or equal to 1 to a second grayscale value, and the first grayscale value is less than the second grayscale value.

3. The method according to claim 2, characterized in that The low gray level objective function The expression is: In the formula, the first Fitting gray value The ratio is , For the Fitting gray value Corresponding to the target grayscale value obtained by solution, if the ratio The closer it is to 1, the The closer the value of is to 1, the The smaller it is than 1, the The larger the value of Must be less than or equal to , cannot be greater than ,Right now ; Indicates when The smaller it is than 1, The larger the value of The larger the value of The larger the value, It is to prevent A value of 0; in, Indicates the number, refers to the fitted grayscale value corresponding to the peak value of the frequency of occurrence, where This is because the fitting grayscale value range is 0~255, and the total number is 256, indicating The value is a target grayscale value that is smaller than all fitting grayscale values ​​corresponding to the peak value.

4. The method according to claim 3, characterized in that: The high grayscale objective function The expression is: In the formula, the parasite image fitting curve is defined as Fitting gray value The ratio is , For the Fitting gray value Corresponding to the target grayscale value obtained by solution, if the ratio The closer it is to 1, the The closer the value of is to 1, the The smaller it is than 1, the The larger the value of Must be greater than or equal to , cannot be less than ,Right now ; express The smaller it is than 1, The larger the value of The larger the value of The larger the value, It is to prevent The value is 0.

5. The method according to any one of claims 1 to 4, characterized in that: The objective function is further expressed as: In the formula, To evaluate the and The smoothness of the target gray value sequence obtained to reduce the distortion of the target gray value sequence; Said The calculation steps include: Based on the low grayscale target function and the high grayscale target function, a target grayscale value sequence is obtained; Obtaining a curvature value of each target gray value in the target gray value sequence; Performing Gaussian fitting on the curvature value to obtain a Gaussian function of the target grayscale value; Based on the curvature value and the Gaussian function, a Gaussian probability value corresponding to the target grayscale value is calculated; Based on the Gaussian probability value and the curvature value, it is calculated that .

6. The method according to claim 5, characterized in that Said The calculation expression is: In the formula, Indicates Fitting gray value The ratio of Indicates the current The Gaussian probability value of the curvature value corresponding to the target gray value is obtained by: Substitute the curvature value corresponding to the target gray value into the Gaussian function of the target gray value to obtain the Gaussian probability value ; For the The actual frequency of occurrence of the curvature value corresponding to the target gray value; Defined as hour, ,when , ; Represents the tolerance for smoothness and is defined as a hyperparameter.

Citation Information

Patent Citations

  • Hyperspectral image intelligent identification method for parasites in sashimi

    CN114359539A

  • Visual inspection method for surface defects of packaged IC (integrated circuit)

    CN117437238A

  • Intelligent extraction and identification method for pathogenic microorganisms based on image analysis

    CN117831033A