A method and system for identifying nematode parameters based on intelligent algorithms

By introducing a reinforcement learning threshold decision mechanism, the binarization threshold is adaptively determined, which solves the segmentation drift problem caused by the threshold dependence on manual setting in nematode image parameter recognition, and improves the stability and accuracy of nematode parameter recognition.

CN122223749APending Publication Date: 2026-06-16NORTHEAST INST OF GEOGRAPHY & AGRIECOLOGY C A S +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTHEAST INST OF GEOGRAPHY & AGRIECOLOGY C A S
Filing Date
2026-02-28
Publication Date
2026-06-16

Smart Images

  • Figure CN122223749A_ABST
    Figure CN122223749A_ABST
Patent Text Reader

Abstract

The application provides a kind of nematode parameter identification method and system based on intelligent algorithm, it is related to computer vision technical field.The application carries out denoising processing to the nematode image collected by optical microscope, extracts brightness distribution feature and contrast feature, and the threshold discriminant feature is input into reinforcement learning threshold decision model to adaptively determine binary threshold parameter.Using the binary threshold parameter, the image is binarized and connected domain analysis is carried out, a binary connected domain mask image is generated, and it is combined with the target detection result to remove impurities and correct missed detection and wrong detection, to obtain the effective nematode target set, and then output the nematode number and body length, body width and biomass parameters.The application builds a closed-loop feedback mechanism for segmentation and detection, improves the stability and accuracy of nematode identification and parameter statistics under complex imaging conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer vision technology, and in particular to a method and system for identifying nematode parameters based on intelligent algorithms. Background Technology

[0002] In the culture and phenotypic analysis of model organisms such as *Caenorhabditis elegans*, it is often necessary to identify and statistically analyze the number of nematodes, their survival status, and parameters such as the length, width, and biomass of individual nematodes in microscopic images. Traditional manual identification usually requires sampling, microscopic examination, manual marking, and individual measurement, which suffers from problems such as subjective error, slow counting speed, cumbersome operation, low accuracy, and high cost.

[0003] To improve efficiency, existing solutions combine image processing with deep learning target detection, forming a process of "image preprocessing - nematode detection - post-detection processing - numerical statistics reporting". Image preprocessing includes image denoising, image binarization and image connected component solving. Nematode detection uses YOLOv8 as the target detection network. Post-detection processing is used to screen for nematode overlap, missed detection and false detection. Finally, important parameters such as body length, body width and biomass are output.

[0004] The key technological advancements in existing solutions lie in two aspects: firstly, achieving rapid counting and identification of multiple nematodes through deep learning-based target detection; and secondly, linking foreground segmentation with post-processing filtering to reduce interference from impurities and improve the stability of statistical results. The reference document explicitly uses YOLOv8 for nematode target detection and incorporates pre-processed binarized connected component mask images into the filtering process during post-processing to address issues such as overlapping nematodes, missed detections, and false detections. Furthermore, to adapt to rapid statistical analysis in multi-nematode scenarios, the solution also emphasizes "thresholding and intelligent classification of multiple nematodes" to enhance adaptability across images and batches.

[0005] In the above process, "image binarization-connected component analysis" directly determines the quality of the binarized connected component mask image, which is then used in the screening of nematode detection results. The reference document points out that the denoised image has a relatively uniform brightness distribution but low contrast, and nematodes are small, numerous in the same image, and difficult to detect in dark corners. Therefore, it is necessary to use OpenCV's threshold function and "set different thresholds" to binarize the input image to separate nematodes, impurities, and background.

[0006] However, when the threshold relies on manual setting or a fixed strategy, segmentation drift is prone to occur under conditions of vignetting, contrast variations, or interference from impurities. This can either incorporate background noise into the foreground or cause the nematode foreground to break or adhere, thus causing the mask image obtained from connected component analysis to deviate from the actual nematode region. Since this mask image is "applied as a mask in the nematode detection result screening step," mask bias will further amplify the instability of missed and false detection screening, ultimately affecting the reliability of statistical analysis of parameters such as nematode number, body length, and body width. Summary of the Invention

[0007] To overcome the shortcomings of existing technologies, the purpose of this invention is to provide a method and system for nematode parameter identification based on intelligent algorithms. By introducing a reinforcement learning threshold decision mechanism, the binarization threshold is adaptively determined, and the segmentation results and post-detection screening form a closed-loop feedback, thereby improving the stability and accuracy of nematode identification and parameter statistics under complex imaging conditions.

[0008] To achieve the above objectives, the present invention provides the following solution:

[0009] A method for identifying nematode parameters based on intelligent algorithms, comprising:

[0010] Acquire an image of the nematode to be tested using an optical microscope with a camera function, and perform image denoising processing on the image of the nematode to be tested to obtain a denoised image;

[0011] Threshold discrimination features are extracted based on the denoised image; the threshold discrimination features include at least brightness distribution features and contrast features;

[0012] The threshold discrimination features are input into the reinforcement learning threshold decision model, which outputs a binarized threshold parameter. The reinforcement learning threshold decision model uses the separation effect of nematodes, impurities and background, as well as the screening of missed detections and false detections, as feedback to adaptively determine the binarized threshold parameter.

[0013] The denoised image is binarized using the OpenCV threshold function based on the binarization threshold parameter to obtain a binarized image. Then, connected component analysis is performed on the binarized image to obtain a binarized connected component mask image.

[0014] The denoised image is input into YOLOv8 to obtain nematode detection results. The binarized connected component mask image is then used as a mask to filter the nematode detection results, in order to eliminate impurities that are similar to nematodes and screen for nematode overlap, missed detections, and false detections, thereby obtaining an effective nematode target set.

[0015] Numerical statistics are reported based on the effective nematode target set, outputting the number of nematodes and the body length, body width and biomass parameters of a single nematode.

[0016] Preferably, extracting threshold discrimination features based on the denoised image includes:

[0017] The denoised image is divided into a central region and an edge region, and the average gray value of the central region and the average gray value of the edge region are calculated respectively.

[0018] The brightness distribution feature is generated based on the average gray value of the central region and the average gray value of the edge region;

[0019] Calculate the grayscale dynamic range and grayscale standard deviation of the denoised image, and generate the contrast feature based on the grayscale dynamic range and the grayscale standard deviation.

[0020] Preferably, extracting threshold discrimination features based on the denoised image includes:

[0021] The denoised image is divided into multiple image sub-blocks according to a preset grid.

[0022] The average gray value of each image sub-block is calculated and aggregated to generate the brightness distribution feature that characterizes the spatial brightness unevenness.

[0023] The contrast value of each image sub-block is calculated and aggregated to generate the contrast feature that characterizes the local contrast change.

[0024] Preferably, the threshold discrimination features are input into a reinforcement learning threshold decision model, and the output is a binarized threshold parameter, including:

[0025] The threshold discrimination features are encoded according to a preset input format and then input into the reinforcement learning threshold decision model;

[0026] The reinforcement learning threshold decision model outputs candidate binarized threshold parameters based on the threshold discrimination features, and the candidate binarized threshold parameters are used to drive the image binarization process.

[0027] Preferably, the reinforcement learning threshold decision model adaptively determines the binarization threshold parameter based on feedback from the separation effect of nematodes, impurities, and background, as well as the screening results of missed detections and false detections, including:

[0028] The binarized image is generated based on the binarization threshold parameter, and connected component analysis is performed on the binarized image to obtain a set of foreground connected components;

[0029] A first feedback quantity is obtained based on the set of foreground connected regions to characterize the separation effect of the nematode, impurities and background; the first feedback quantity includes the number of foreground connected regions, the area distribution of foreground connected regions and the fine length of the foreground connected regions.

[0030] Based on the binarized connected component mask image and the nematode detection results, a second feedback quantity is obtained to characterize the missed detection and false detection situation in the screening; the second feedback quantity includes the overlap consistency index between the detection area corresponding to the nematode detection results and the foreground area in the binarized connected component mask image.

[0031] The first feedback quantity and the second feedback quantity are used together as the feedback, and the reinforcement learning threshold decision model is updated based on the feedback to adjust the output of the binarized threshold parameter.

[0032] Preferably, updating the reinforcement learning threshold decision model based on the feedback to adjust the output of the binarized threshold parameter includes:

[0033] The binarized image is generated using the initial binarization threshold parameter, and the foreground connected component set is obtained, thereby obtaining the initial first feedback quantity. The initial second feedback quantity is obtained based on the binarized connected component mask image and the nematode detection result, so as to form the initial feedback.

[0034] When the feedback does not meet the preset convergence condition, the reinforcement learning threshold decision model is updated according to the feedback, and the updated reinforcement learning threshold decision model outputs the new binarized threshold parameter.

[0035] The binarized image is regenerated based on the new binarization threshold parameter, and the new feedback is obtained until the feedback meets the preset convergence condition or the number of iterations reaches the preset upper limit.

[0036] Preferably, it further includes:

[0037] Obtain a training image set; perform image denoising processing on the training images in the training image set to obtain denoised images for training, and extract training threshold discrimination features from the denoised images for training;

[0038] The training threshold discrimination features are input into the reinforcement learning threshold decision model to output training binarized threshold parameters, and a training binarized image, a training foreground connected component set, and a training binarized connected component mask image are generated based on the training binarized threshold parameters.

[0039] The denoised training image is input into YOLOv8 to obtain the nematode detection results for training, and the nematode detection results for training are filtered based on the binarized connected component mask image for training.

[0040] The training feedback is formed based on the first feedback quantity and the second feedback quantity used for training, and the reinforcement learning threshold decision model is trained and updated based on the training feedback.

[0041] Preferably, the binarization threshold parameter includes a threshold value and a binarization type parameter; the binarization type parameter is used to indicate the output method of the OpenCV threshold function when performing binarization on the input image; and, performing image binarization on the denoised image using the OpenCV threshold function based on the binarization threshold parameter includes: inputting the threshold value and the binarization type parameter together into the OpenCV threshold function to obtain the binarized image.

[0042] Preferably, the binarized connected component mask image is used as a mask for filtering the nematode detection results, including:

[0043] For each detection target in the nematode detection results, the detection region corresponding to the detection target is determined, and the set of foreground pixels corresponding to the detection region is extracted in the binarized connected component mask image;

[0044] The overlap ratio is calculated based on the pixel set of the detection region and the foreground pixel set; the overlap ratio is the ratio of the number of pixels in the intersection of the pixel set of the detection region and the foreground pixel set to the number of pixels in the detection region;

[0045] When the overlap ratio is lower than a preset threshold, the detected target is identified as an impurity similar to a nematode and removed; when the overlap ratio is not lower than the preset threshold, the detected target is retained and included in the effective nematode target set.

[0046] A nematode parameter identification system based on intelligent algorithms, comprising:

[0047] The image acquisition and denoising unit is used to acquire images of the nematode to be tested from an optical microscope with a photographic function, and to perform image denoising processing on the images of the nematode to be tested to obtain a denoised image.

[0048] A threshold discrimination feature extraction unit is used to extract threshold discrimination features based on the denoised image; the threshold discrimination features include at least brightness distribution features and contrast features;

[0049] The reinforcement learning threshold decision unit is used to input the threshold discrimination features into the reinforcement learning threshold decision model and output a binarized threshold parameter. The reinforcement learning threshold decision model uses the separation effect of nematodes, impurities and background, as well as the screening of missed detections and false detections as feedback to adaptively determine the binarized threshold parameter.

[0050] The image binarization and connected component analysis unit is used to perform image binarization on the denoised image using the OpenCV threshold function based on the binarization threshold parameter to obtain a binarized image, and to perform connected component analysis on the binarized image to obtain a binarized connected component mask image.

[0051] The nematode detection and mask screening unit is used to input the denoised image into YOLOv8 to obtain nematode detection results, and to apply the binarized connected component mask image as a mask to the nematode detection results screening, so as to exclude impurities similar to nematodes and screen for nematode overlap, missed detection, and false detection, so as to obtain an effective nematode target set.

[0052] The nematode parameter statistics and reporting unit is used to perform numerical statistics and reporting based on the effective nematode target set, and output the number of nematodes as well as the body length, body width and biomass parameters of a single nematode.

[0053] The present invention discloses the following technical effects:

[0054] (1) In view of the problem that the binarization threshold in the existing nematode image parameter recognition process depends on manual setting and has poor adaptability across imaging conditions, the present invention introduces a reinforcement learning threshold decision mechanism between image preprocessing and target detection, so that the binarization threshold parameter can be adaptively determined according to the brightness distribution characteristics and contrast characteristics of the denoised image, thereby avoiding the foreground segmentation drift caused by the fixed threshold under conditions of uneven lighting, dark corner interference or complex background, and improving the accuracy of the binarized connected component mask image in depicting the real nematode region.

[0055] (2) This invention uses the separation effect of nematodes, impurities and background, as well as the missed detection and false detection after detection, as the feedback basis for the reinforcement learning threshold decision model. This makes the adjustment of the binarization threshold parameter no longer depend solely on the image grayscale statistics, but forms a closed loop with the subsequent nematode detection and screening results. This allows for continuous optimization of the threshold selection strategy under different sample densities, different nematode postures and multiple nematode overlapping scenarios, thereby enhancing the stability and robustness of the entire recognition process.

[0056] (3) After binarization, the present invention introduces connected component analysis and generates a binarized connected component mask image, and uses the binarized connected component mask image as a mask to screen the nematode detection results. This effectively suppresses impurity targets with similar morphology to nematodes from entering the subsequent statistical process, reduces false detections caused by background noise or culture medium texture, improves the purity of the effective nematode target set, and provides a reliable data basis for subsequent parameter calculation.

[0057] (4) The present invention combines the deep learning-based nematode detection results with the binary connected component mask image optimized by reinforcement learning to perform collaborative constraints. While screening for overlapping, missed detections and false detections of nematodes, it also takes into account the target localization capability of the detection model and the spatial consistency of the image segmentation results. Thus, even when multiple nematodes are densely distributed or the nematode morphology is curved and complex, it can still maintain high detection integrity and screening accuracy.

[0058] (5) Based on the effective nematode target set, the present invention statistically reports the parameters of nematode number, body length, body width and biomass, so that the output nematode parameters are based on a high-quality target set that has undergone adaptive threshold optimization and multiple screening constraints. Compared with the existing schemes that rely on fixed thresholds or single detection models, it can significantly reduce parameter statistical errors and improve the consistency and reliability of nematode parameter identification results under different batch experimental conditions. Attached Figure Description

[0059] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are 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.

[0060] Figure 1 A flowchart of the method provided in an embodiment of the present invention;

[0061] Figure 2 This is a schematic diagram of the system structure provided in an embodiment of the present invention. Detailed Implementation

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

[0063] The purpose of this invention is to provide a method and system for nematode parameter identification based on intelligent algorithms. By using reinforcement learning-driven threshold optimization and connected component masking to constrain nematode detection results, it effectively reduces missed detections and false detections, making the calculation of nematode quantity and parameters such as body length, body width, and biomass more reliable and consistent.

[0064] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0065] Figure 1The method flowchart provided in the embodiments of the present invention is as follows: Figure 1 As shown, this invention provides a method for identifying nematode parameters based on intelligent algorithms, including:

[0066] Step 100: Acquire the image of the nematode to be tested from an optical microscope with a camera function, and perform image denoising processing on the image of the nematode to be tested to obtain a denoised image;

[0067] Step 200: Extract threshold discrimination features based on the denoised image; the threshold discrimination features include at least brightness distribution features and contrast features;

[0068] Step 300: Input the threshold discrimination features into the reinforcement learning threshold decision model and output the binarized threshold parameters; The reinforcement learning threshold decision model uses the separation effect of nematodes, impurities and background and the screening of missed detections and false detections as feedback to adaptively determine the binarized threshold parameters;

[0069] Step 400: Use OpenCV's threshold function to binarize the denoised image according to the binarization threshold parameter to obtain a binarized image, and perform connected component analysis on the binarized image to obtain a binarized connected component mask image.

[0070] Step 500: Input the denoised image into YOLOv8 to obtain the nematode detection results, and use the binarized connected component mask image as a mask to filter the nematode detection results in order to eliminate impurities that are similar to nematodes and screen for nematode overlap, missed detection, and false detection, so as to obtain an effective nematode target set.

[0071] Step 600: Perform numerical statistics reporting based on the effective nematode target set, and output the number of nematodes as well as the body length, body width and biomass parameters of a single nematode.

[0072] Specifically, in step 100 of this embodiment, an image of the nematode to be tested, acquired by an optical microscope with photographic capabilities, is first obtained. The image of the nematode to be tested is a digital image obtained by imaging the field of view of the nematode culture dish. Preferably, the resolution of the image of the nematode to be tested is 1920×1080 to ensure that the slender structure of the nematode has resolvable boundary information at the pixel level. The image of the nematode to be tested includes the nematode target, the culture medium background, and impurity targets similar in morphology to the nematode. To ensure the stability of subsequent threshold discrimination feature extraction and image binarization processing, this embodiment performs image denoising processing on the image of the nematode to be tested after acquisition to suppress imaging noise and fine texture interference while maintaining the continuity of the nematode contour boundary. The image denoising process preferably employs a similarity block-based denoising method. Specifically, a local image block is selected from the nematode image to be tested as the processing target; preferably, the side length of the local image block is 8. Based on a preset similarity criterion, image blocks with similar grayscale textures are searched within the spatial neighborhood; preferably, the side length of the search range of the spatial neighborhood is 21. The searched similar image blocks are merged to form a similarity block set, and joint filtering is performed on the similarity block set to reduce random noise components; preferably, the number of similarity block sets is 16. Finally, the joint filtering results are backfilled to the corresponding pixel positions, and overlapping areas are fused to obtain a denoised image. The aforementioned "similarity block set" refers to a set of multiple image blocks within the preset search range that satisfy the similarity criterion with the target image block. It is used to suppress noise while preserving structural information, thereby preventing the nematode's slender structure from breaking or sticking together due to noise.

[0073] In performing the image denoising process, this embodiment preferably employs a grouping, collaborative filtering, and aggregation process: In the grouping stage, image blocks are grouped based on grayscale differences and texture consistency to ensure that image blocks within the same group have similar structural features; in the collaborative filtering stage, image blocks within each group are jointly processed to reduce noise and preserve nematode edges; in the aggregation stage, the processed image blocks from each group are mapped back to the nematode image according to their spatial location, and overlapping areas are weighted and fused to obtain the denoised image. Preferably, the weighting coefficient for the overlapping areas is 0.7, thereby reducing noise disturbance to edges while preserving nematode contour details. Through the above processing, this embodiment can improve the uniformity of image brightness distribution and reduce background noise density without introducing intrusive operations, providing a reliable input basis for extracting the brightness distribution features and contrast features based on the denoised image in subsequent steps.

[0074] Optionally, after obtaining the denoised image output in step 100, this embodiment performs step 200 to extract threshold discrimination features. The threshold discrimination features characterize the imaging state of the denoised image in terms of brightness distribution and contrast, providing input for the reinforcement learning threshold decision model to output binary threshold parameters in subsequent steps. To avoid threshold drift caused by uneven brightness or vignetting in different fields of view, this embodiment preferably divides the denoised image into a central region and an edge region according to a preset spatial partitioning rule. The central region is a rectangular region located at the geometric center of the image, preferably occupying 60% of the total area of ​​the denoised image; the edge region is the remaining region excluding the central region. Based on the partitioning results, this embodiment performs grayscale statistics on the central region and the edge region respectively to obtain the average grayscale value of the central region and the average grayscale value of the edge region, thereby providing basic data for the generation of brightness distribution features.

[0075] In generating the brightness distribution feature, this embodiment uses the difference between the average gray value of the central region and the average gray value of the edge region as a representation of brightness spatial unevenness, and uses the combination of the two as the brightness distribution feature. Here, "brightness distribution feature" refers to a feature quantity used to reflect the difference in gray level at different spatial locations within the same denoised image. Its function is to characterize whether there is a significant brightness shift between the central and edge regions, so that subsequent threshold selection can take into account both vignetting and edge attenuation. Preferably, when the difference between the average gray value of the central region and the average gray value of the edge region exceeds 20, this embodiment determines that the denoised image has significant brightness unevenness, and reflects this determination result in the brightness distribution feature to improve the adaptability of subsequent binarization threshold parameters to brightness unevenness scenarios.

[0076] In generating the contrast feature, this embodiment constructs it based on the global grayscale statistics of the denoised image. Specifically, this embodiment first traverses the pixel grayscale values ​​of the denoised image, determines the maximum and minimum grayscale values, and uses the difference between them as the grayscale dynamic range to characterize the size of the image's grayscale span. Subsequently, based on the dispersion of all pixel grayscale values ​​of the denoised image relative to its average grayscale value, the grayscale standard deviation is calculated to characterize the intensity of grayscale fluctuation. Here, "contrast feature" refers to a feature quantity used to reflect the strength of grayscale separability between the foreground and background in the denoised image, and its function is to characterize the difficulty of separating the nematode from the background at the grayscale level. Preferably, when the grayscale dynamic range is less than 80 and the grayscale standard deviation is less than 15, this embodiment determines the denoised image as a low-contrast image and reflects this determination result in the contrast feature, so that the subsequent binarization threshold parameter can be adaptively adjusted for low-contrast scenes.

[0077] In this embodiment, after obtaining the denoised image output in step 100, step 200 is executed to extract threshold discrimination features. To more fully characterize the brightness unevenness and local contrast fluctuations of the denoised image at different spatial locations, this embodiment preferably uses a gridding method to partition the denoised image, that is, the denoised image is divided into multiple image sub-blocks according to a preset grid. Here, "image sub-block" refers to a local image region in the denoised image divided according to a fixed number of rows and columns or a fixed pixel size. Its function is to decompose the brightness and contrast changes of the global image into multiple local regions, which facilitates the extraction of threshold discrimination features that can reflect spatial differences. Preferably, the preset grid is 8×8, thus obtaining 64 image sub-blocks; more preferably, the size of each image sub-block is 64×64, to ensure that each image sub-block contains enough pixels for grayscale statistics without excessively smoothing local differences.

[0078] In generating the brightness distribution feature, this embodiment calculates the average gray value of each image sub-block and aggregates the average gray values ​​of each sub-block to form the brightness distribution feature characterizing spatial brightness unevenness. The "average gray value of a sub-block" refers to a statistical quantity obtained by averaging the gray values ​​of all pixels within the sub-block, which is used to characterize the brightness level of that sub-block. "Aggregation" refers to combining multiple average gray values ​​of sub-blocks into a feature quantity that can reflect the spatial difference in brightness across the entire image according to a preset statistical method. The preset statistical method preferably includes a maximum value, a minimum value, and a difference; for example, this embodiment can take the maximum and minimum values ​​among all the average gray values ​​of image sub-blocks and calculate their difference as a characterizing quantity of brightness unevenness. Preferably, when the difference exceeds 25, this embodiment determines that the denoised image has significant spatial brightness unevenness and reflects this determination in the brightness distribution feature, making subsequent threshold selection more sensitive to vignetting or local underexposure.

[0079] In generating the contrast features, this embodiment calculates the contrast value for each image sub-block and aggregates the contrast values ​​of each sub-block to form the contrast features characterizing local contrast changes. Here, "sub-block contrast value" refers to a statistical measure of the degree of pixel grayscale fluctuation within a sub-block, used to characterize the separability of the foreground and background within that sub-block. Preferably, the sub-block contrast value is obtained by calculating the grayscale standard deviation of the pixel grayscale values ​​within the sub-block. The "aggregation" preferably includes taking the average and maximum values ​​of the sub-block contrast values ​​to simultaneously reflect the overall contrast level and the contrast situation of the worst local region. Preferably, when the average value of the sub-block contrast values ​​is less than 12 or the minimum value of the sub-block contrast values ​​is less than 6, this embodiment determines that the denoised image contains a local low-contrast region and reflects this determination in the contrast features, thereby improving the adaptability of the subsequent binarization threshold parameters to local low-contrast scenes.

[0080] Further, in this embodiment, after obtaining the denoised image output in step 100, step 200 is executed to extract threshold discrimination features. To more fully characterize the brightness unevenness and local contrast fluctuations of the denoised image at different spatial locations, this embodiment preferably uses a gridding method to partition the denoised image, that is, the denoised image is divided into multiple image sub-blocks according to a preset grid. Here, "image sub-block" refers to a local image region in the denoised image divided according to a fixed number of rows and columns or a fixed pixel size. Its function is to decompose the brightness and contrast changes of the global image into multiple local regions, which facilitates the extraction of threshold discrimination features that can reflect spatial differences. Preferably, the preset grid is 8×8, thereby obtaining 64 image sub-blocks; more preferably, the size of each image sub-block is 64×64, so as to ensure that each image sub-block contains enough pixels for grayscale statistics without excessively smoothing local differences.

[0081] In generating the brightness distribution feature, this embodiment calculates the average gray value of each image sub-block and aggregates the average gray values ​​of each sub-block to form the brightness distribution feature characterizing spatial brightness unevenness. The "average gray value of a sub-block" refers to a statistical quantity obtained by averaging the gray values ​​of all pixels within the sub-block, which is used to characterize the brightness level of that sub-block. "Aggregation" refers to combining multiple average gray values ​​of sub-blocks into a feature quantity that can reflect the spatial difference in brightness across the entire image according to a preset statistical method. The preset statistical method preferably includes a maximum value, a minimum value, and a difference; for example, this embodiment can take the maximum and minimum values ​​among all the average gray values ​​of image sub-blocks and calculate their difference as a characterizing quantity of brightness unevenness. Preferably, when the difference exceeds 25, this embodiment determines that the denoised image has significant spatial brightness unevenness and reflects this determination in the brightness distribution feature, making subsequent threshold selection more sensitive to vignetting or local underexposure.

[0082] In generating the contrast features, this embodiment calculates the contrast value for each image sub-block and aggregates the contrast values ​​of each sub-block to form the contrast features characterizing local contrast changes. Here, "sub-block contrast value" refers to a statistical measure of the degree of pixel grayscale fluctuation within a sub-block, used to characterize the separability of the foreground and background within that sub-block. Preferably, the sub-block contrast value is obtained by calculating the grayscale standard deviation of the pixel grayscale values ​​within the sub-block. The "aggregation" preferably includes taking the average and maximum values ​​of the sub-block contrast values ​​to simultaneously reflect the overall contrast level and the contrast situation of the worst local region. Preferably, when the average value of the sub-block contrast values ​​is less than 12 or the minimum value of the sub-block contrast values ​​is less than 6, this embodiment determines that the denoised image contains a local low-contrast region and reflects this determination in the contrast features, thereby improving the adaptability of the subsequent binarization threshold parameters to local low-contrast scenes.

[0083] Specifically, in this embodiment, after obtaining the threshold discrimination features in step 200, step 300 is executed to determine the binarization threshold parameters used for image binarization processing. The threshold discrimination features include at least brightness distribution features and contrast features. To facilitate unified processing of input features by the reinforcement learning threshold decision model, this embodiment preferably encodes the threshold discrimination features using a preset input format before inputting them into the reinforcement learning threshold decision model. Here, "preset input format encoding" refers to the process of assembling the threshold discrimination features into a feature sequence in a fixed order and then normalizing it. Its function is to eliminate differences in the dimensions of different features and ensure consistency in the input dimensions between different samples. Preferably, the feature sequence length is 6, and the normalization process maps each feature value to the range of 0 to 1, thereby enabling the brightness distribution features and contrast features to participate in threshold decision-making at the same numerical scale.

[0084] When outputting the binarization threshold parameter, this embodiment uses the threshold discrimination feature as the decision basis for the reinforcement learning threshold decision model. The reinforcement learning threshold decision model outputs candidate binarization threshold parameters based on the threshold discrimination feature, and these candidate binarization threshold parameters are used to drive the image binarization processing in subsequent step 400. Here, the "binarization threshold parameter" refers to the parameter used to control the image binarization segmentation boundary, and its function is to initially separate the nematode target in the denoised image from the background and impurities. Preferably, the reinforcement learning threshold decision model outputs three candidate binarization threshold parameters in one decision and selects the one that provides the best feedback performance as the currently used binarization threshold parameter, thereby maintaining the flexibility of threshold adjustment while avoiding the adverse effects of single-decision fluctuations on segmentation quality.

[0085] Furthermore, to enable the binarization threshold parameter to adaptively determine according to imaging conditions and sample differences, this embodiment uses the reinforcement learning threshold decision model to adjust the binarization threshold parameter based on the separation effect of nematodes, impurities, and background, as well as the screening of missed and false detections. Here, "feedback" refers to the comprehensive evaluation information of the segmentation results and screening effects produced by the current binarization threshold parameter. Its function is to guide the reinforcement learning threshold decision model to update its decision preferences in a direction that is "more conducive to separating nematodes from the background and more conducive to subsequent screening." Preferably, this embodiment uses the following feedback constraints: the number of foreground connected components obtained in step 400 being within a reasonable range of 1 to 200; the average length of the foreground connected components being greater than 10; and the proportion of impurity targets removed after mask screening in step 500 being less than 0.3. This ensures that the reinforcement learning threshold decision model can still output a binarization threshold parameter with good generalization ability in scenes with dense nematodes, dark corners, and low contrast.

[0086] Furthermore, in this embodiment, to enable the binarization threshold parameter to adapt to changes in imaging conditions and sample differences, a feedback loop is introduced in step 300 to update the reinforcement learning threshold decision model. Specifically, after obtaining the binarization threshold parameter, this embodiment performs image binarization processing on the denoised image based on the binarization threshold parameter to generate a binarized image, and performs connected component analysis on the binarized image to obtain a foreground connected component set. Here, the "foreground connected component set" refers to a set of multiple connected regions formed by foreground pixels in the binarized image, whose function is to characterize the spatial aggregation morphology of nematode targets, impurity targets, and noise targets after binarized segmentation. Preferably, this embodiment uses the 8-neighborhood connectivity criterion to determine connectivity relationships and removes connected regions smaller than 50 pixels to reduce the interference of isolated noise points on feedback calculation, thereby making the foreground connected component set more reflective of the segmentation state of the real target.

[0087] When forming the first feedback quantity to characterize the separation effect of nematodes, impurities, and background, this embodiment calculates the number of foreground connected regions, the area distribution of foreground connected regions, and the fineness of foreground connected regions based on the set of foreground connected regions, and combines the above statistical results to form the first feedback quantity. Here, "area distribution of foreground connected regions" refers to the distribution characteristics formed after statistically analyzing the pixel areas of each connected region in the set of foreground connected regions. Its function is to reflect whether there are a large number of fragmented noise connected regions or abnormally large areas of adhered connected regions in the binarization result. "Fineness of foreground connected regions" refers to a morphological statistical quantity used to characterize the elongation of connected regions, and its function is to reflect whether the connected regions are closer to the elongated appearance of the nematode target. Preferably, this embodiment limits the number of foreground connected regions to a range of 1 to 200 as a reasonable segmentation constraint, and uses the proportion of connected regions with an area in the range of 50 to 5000 pixels as a key statistical quantity for area distribution. Simultaneously, the mean value of the fineness of the foreground connected regions is limited to not less than 10, so that the first feedback quantity can indicate a segmentation result that is more consistent with the morphology of nematodes.

[0088] In forming the second feedback quantity to characterize the screening for missed and false detections, this embodiment calculates an overlap consistency index based on the binarized connected component mask image and the nematode detection result, and uses the overlap consistency index as the second feedback quantity. The "overlap consistency index" refers to the degree of spatial consistency between the detection region corresponding to the nematode detection result and the foreground region in the binarized connected component mask image. Its function is to measure the degree of support of the binarized mask for the detection target, thereby reflecting the screening for missed and false detection risks. Preferably, this embodiment extracts the detection region for each detection target and extracts the foreground pixel set corresponding to the detection region in the binarized connected component mask image, calculating the ratio of the number of pixels in the intersection of the two to the number of pixels in the detection region as the overlap consistency index. When the overlap consistency index is less than 0.6, this embodiment includes the detection target in the false detection risk count; when the overlap consistency index is not less than 0.6, the detection target is included in the valid target count. Furthermore, in this embodiment, the first feedback quantity and the second feedback quantity are used together as the feedback, and the reinforcement learning threshold decision model is updated based on the feedback to adjust the binarized threshold parameter of the subsequent output, so that the separation effect and screening effect can still be taken into account in scenes with dense insects, low contrast or dark corners.

[0089] In this embodiment, after generating the binarized image based on the binarization threshold parameter and obtaining the foreground connected component set, this embodiment further performs statistical mapping on the foreground connected component set to form a first feedback quantity for characterizing the separation effect of nematodes, impurities, and background. Specifically, the first feedback quantity is obtained by jointly measuring the number of foreground connected components, the area distribution of foreground connected components, and the fineness of foreground connected components, and its calculation method is as follows:

[0090]

[0091] in, This is the first feedback quantity; The number of foreground connected components in the set of foreground connected components that satisfy the area constraint condition; For the first The thinness of a foreground connected component is used to characterize the thinness of the connected component; For the first The pixel area of ​​a foreground connected region; and These are the lower and upper limits of the area of ​​the foreground connected region, respectively, used to remove noisy connected regions and abnormally connected regions; This is an indicator function that takes a value of 1 when the condition within the parentheses is true, and a value of 0 otherwise. Preferably, the... Take 50, the aforementioned Take 5000, the aforementioned The value of is derived from the calculation result of the ratio of the length of the foreground connected component skeleton to the equivalent width, so that the first feedback quantity can simultaneously reflect the rationality of the number of connected components, the rationality of the area distribution, and the slenderness of the shape.

[0092] Based on the first feedback quantity, this embodiment further constructs a second feedback quantity to characterize the screening for missed and false detections based on the binarized connected component mask image and the nematode detection results. Specifically, for each detection region corresponding to the nematode detection result, the overlap consistency between it and the foreground region in the binarized connected component mask image is calculated and mapped to the second feedback quantity. The calculation method is as follows:

[0093]

[0094] in, This is the second feedback quantity; The number of targets detected in the nematode detection results; For the first The set of pixels in the detection region corresponding to each detection target; The set of foreground pixels in the binarized connected component mask image that corresponds to the detection region; The number of pixels at the intersection of the two; The total number of pixels in the detection area; This is the joint feedback quantity used to update the reinforcement learning threshold decision model.

[0095] Through the above joint feedback quantity This embodiment can map the foreground segmentation quality and the consistency of detection and screening into a single feedback signal without introducing additional artificial weighting factors, and update the reinforcement learning threshold decision model based on the feedback signal, so that the binarized threshold parameter output subsequently achieves an adaptive balance between separation effect and screening effect.

[0096] Further, in step 300 of this embodiment, in order to achieve "updating the reinforcement learning threshold decision model based on the feedback to adjust the output of the binarization threshold parameter", this embodiment first determines the initial binarization threshold parameter, and performs image binarization processing on the denoised image based on the initial binarization threshold parameter to generate a binarized image. Then, it performs connected component analysis on the binarized image to obtain a foreground connected component set, thereby obtaining an initial first feedback quantity. At the same time, this embodiment inputs the denoised image into the target detection network to obtain the nematode detection result, and calculates the initial second feedback quantity in combination with the binarized connected component mask image. Then, the initial first feedback quantity and the initial second feedback quantity are used together as the initial feedback. The "initial binarization threshold parameter" mentioned here refers to the threshold parameter used before the first feedback loop update. It is used to provide an initial segmentation result to trigger feedback calculation. Preferably, the initial binarization threshold parameter is 128, so that the binarized image has a usable foreground initial segmentation effect within the common microscopic imaging grayscale range. The initial feedback is used to characterize the separation and screening effect of the initial binarization threshold parameter on the current denoised image, providing a comparison benchmark for subsequent threshold adjustment.

[0097] After obtaining the initial feedback, this embodiment determines whether the feedback meets a preset convergence condition. When the feedback does not meet the preset convergence condition, this embodiment updates the reinforcement learning threshold decision model based on the feedback, and the updated reinforcement learning threshold decision model outputs a new binarized threshold parameter. Here, the "preset convergence condition" refers to a criterion used to determine if the threshold decision output tends to be stable. Its function is to avoid invalid oscillations of the threshold parameter and control the number of updates. Preferably, the preset convergence condition includes that the difference between two adjacent feedbacks is not greater than 0.02, and that three consecutive updates satisfy the condition that the difference is not greater than 0.02, thus using "feedback stability" as the criterion for threshold parameter convergence. "Update" refers to adjusting the decision preference of the reinforcement learning threshold decision model based on the feedback, so that under subsequent input conditions of the same or similar threshold discrimination features, it is more inclined to output a binarized threshold parameter that can improve the feedback. Preferably, the change in the new binarized threshold parameter output in each update relative to the previous threshold parameter does not exceed 20, so as to suppress the impact of threshold jumps on the stability of the binarized image.

[0098] After obtaining the new binarization threshold parameter, this embodiment regenerates the binarized image based on the new threshold parameter and updates it to obtain new feedback. This new feedback is then used for the next round of convergence determination and model update until the feedback meets the preset convergence condition or the number of iterations reaches a preset upper limit. The "number of iterations reaching a preset upper limit" is used to prevent situations where long updates fail to converge in extremely low contrast or noisy scenes. Preferably, the preset upper limit is 10, thereby ensuring the threshold's adaptive capability while controlling the stability and repeatability of the computation process. Through the above iterative update mechanism, this embodiment can gradually adjust the output of the binarization threshold parameter under imaging conditions such as uneven brightness in different fields of view, vignetting attenuation, or multiple insect overlap, so that the binarization segmentation result and the detection and screening result achieve consistent improvement under feedback constraints.

[0099] Optionally, in this embodiment, in addition to performing threshold adaptive decision-making on a single nematode image to be tested, step 300 preferably also includes a training and updating process for the reinforcement learning threshold decision-making model, so that the reinforcement learning threshold decision-making model can form a stable threshold output pattern under different imaging conditions. Specifically, this embodiment obtains a training image set, which is a collection of nematode images acquired by an optical microscope under different field-of-view brightness, different background textures, and different nematode densities. It is used to cover the variation range of threshold discrimination features, thereby improving the model's generalization ability. Preferably, the training image set contains 300 training images, of which low-contrast images account for no less than 30%, and images with uneven brightness account for no less than 30%. For each training image in the training image set, this embodiment performs image denoising processing consistent with step 100 to obtain a denoised image for training, and further performs threshold discrimination feature extraction consistent with step 200 to obtain threshold discrimination features for training, thereby ensuring consistency in input caliber between the training and inference stages.

[0100] During the training and update process, this embodiment inputs the training threshold discrimination features into the reinforcement learning threshold decision model to output training binarized threshold parameters. Based on these parameters, image binarization processing is performed on the denoised training image to generate a training binarized image. Subsequently, connected component analysis is performed on the training binarized image to obtain a set of foreground connected components for training, and a training binarized connected component mask image is generated. This ensures that the training phase produces segmentation and masking results consistent with step 400. Here, the "training binarized connected component mask image" refers to the mask image generated from the connected component analysis results of the training binarized image, which provides spatial constraints for subsequent screening processes based on detection results. Preferably, this embodiment also uses the 8-neighborhood connectivity criterion to determine connectivity during the training phase and removes connected regions with a pixel area less than 50, thereby reducing noise interference with training feedback and maintaining the stability of feedback metrics.

[0101] Furthermore, to generate training feedback and update the reinforcement learning threshold decision model, this embodiment inputs the denoised training image into YOLOv8 to obtain the nematode detection results. Based on the training binarized connected component mask image, the training nematode detection results are then subjected to the same screening process as in step 500 to eliminate impurities similar to nematodes and screen for nematode overlap, missed detections, and false detections. Subsequently, this embodiment forms a first training feedback quantity based on the number of foreground connected components, the area distribution of the foreground connected components, and the thinness of the foreground connected components. A second training feedback quantity is formed based on the overlap consistency index between the detection region corresponding to the training nematode detection result and the foreground region in the training binarized connected component mask image. Both are used together as training feedback to update the reinforcement learning threshold decision model. Preferably, this embodiment uses the proportion of detection targets with an overlap consistency index of not less than 0.6 as a screening consistency constraint, and sets the number of training update iterations for each training image to 5, thereby ensuring training sufficiency while controlling the stability and repeatability of the training process.

[0102] In this embodiment, after outputting the binarization threshold parameter in step 300, step 400 is executed to binarize the denoised image and generate a binarized connected component mask image for subsequent filtering. Specifically, this embodiment splits the binarization threshold parameter into a threshold value and a binarization type parameter. The threshold value is used to determine the grayscale threshold segmentation boundary, and the binarization type parameter is used to indicate the output method of the OpenCV threshold function when performing binarization on the input image, so as to ensure that a suitable binarization output direction can be selected under different imaging contrast and background contrast conditions. Preferably, the threshold value is an integer in the range of 0 to 255, and the initial value can be 128; the candidate types of the binarization type parameter include at least two categories: "above the threshold is placed as foreground" and "below the threshold is placed as foreground", to adapt to different imaging situations where the nematode target appears as a bright target or a dark target in the microscopic image.

[0103] When performing image binarization, this embodiment inputs the threshold value and the binarization type parameter into the OpenCV threshold function to obtain the binarized image. Here, the "binarized image" refers to an image obtained by thresholding a denoised image, containing only foreground and background pixels. Its function is to perform preliminary foreground extraction of the nematode target and similar impurity targets, and to suppress interference from the background region on subsequent target selection. Preferably, this embodiment assigns a value of 255 to the foreground pixels and a value of 0 to the background pixels in the binarized image to form a binary mask basis that can be directly used for connected component analysis. Simultaneously, to avoid holes or breaks caused by thresholding affecting the morphology of connected components, this embodiment can also perform a morphological closing operation on the binarized image to enhance the connectivity of slender structures, wherein the size of the structuring element in the closing operation is preferably 3×3.

[0104] After obtaining the binarized image, this embodiment performs connected component analysis on the binarized image to obtain a binarized connected component mask image. Here, the "binarized connected component mask image" refers to a mask image output by marking the set of foreground pixels in the binarized image that satisfy the connectivity rules as the mask foreground. Its function is to organize the foreground region using connected components as basic units, thereby providing spatial constraints for the subsequent application of the mask to the screening process of nematode detection results. Preferably, this embodiment uses the 8-neighborhood connectivity criterion to determine the connectivity relationship of foreground pixels and removes connected regions with a pixel area less than 50 to suppress noise connected regions; more preferably, each connected region is marked as a foreground value of 255 in the mask image, and the remaining regions are marked as 0, thereby obtaining the binarized connected component mask image. Through the above processing, this embodiment transforms the decision result of the binarization threshold parameter into a connected component-level mask constraint that can be used for subsequent screening, improving the separability of nematode targets and impurity targets.

[0105] Furthermore, in this embodiment, after obtaining the binarized connected component mask image in step 400, step 500 is executed to obtain nematode detection results and complete mask screening, thereby eliminating impurities similar to nematodes and screening for nematode overlap, missed detections, and false detections. Specifically, in this embodiment, the denoised image is fed as input into a pre-trained target detection network to obtain nematode detection results. The nematode detection results include at least the target location and target confidence of each detected target, wherein the target location is preferably represented by an outer bounding box. To ensure that the detection results have the reliability to be used for subsequent statistics, this embodiment preferably performs threshold screening on the target confidence. Preferably, the detection targets with a target confidence of not less than 0.5 are retained, thereby reducing the probability of low-confidence false detections caused by background textures or culture medium particles entering the subsequent screening process. The "detected target" mentioned here refers to the candidate nematode target identified by the nematode detection results, which may include real nematode targets and impurity targets similar in nematode morphology. Therefore, spatial consistency screening is still required in conjunction with the binarized connected component mask image.

[0106] When applying the binarized connected component mask image as a mask to filter the nematode detection results, this embodiment first determines the detection region corresponding to each detection target in the nematode detection results, and then extracts the set of foreground pixels corresponding to the detection region in the binarized connected component mask image. Here, the "detection region" refers to the image region determined by the target position of the detection target, used to define the spatial range that needs to be verified by the mask; the "set of foreground pixels" refers to the set of mask foreground pixels in the binarized connected component mask image that overlap with the detection region, and its function is to characterize whether the detection target region is supported by the binarized connected component mask image. Preferably, in this embodiment, the inner region of the circumscribed rectangle is used as the detection region, and the number of mask foreground pixels is counted within the detection region to form the pixel set information required for subsequent overlap ratio calculation; more preferably, when the width or height of the detection region is less than 16, the detection target is recorded as a suspected noise target and directly enters the elimination candidate to reduce the impact of extremely small targets on the screening stability.

[0107] When calculating the overlap ratio and completing the screening, this embodiment calculates the overlap ratio based on the pixel set of the detection region and the foreground pixel set. The overlap ratio is the proportion of pixels in the detection region covered by the mask foreground to the total pixels in the detection region, used to measure the degree of spatial consistency support of the mask for the detected target. Preferably, the preset ratio threshold is 0.6. When the overlap ratio is less than 0.6, this embodiment judges the detected target as an impurity similar to a nematode and removes it; when the overlap ratio is not less than 0.6, this embodiment retains the detected target and includes it in the effective nematode target set. More preferably, when the overlap area of ​​the detection regions of two retained detected targets is not less than 0.5% of the area of ​​the smaller detection region, this embodiment judges it as a nematode overlap candidate and includes the overlap candidate in the subsequent overlap screening record so that the overlap situation can be marked or prompted in the statistical reporting in step 600. Through the above mask screening mechanism, this embodiment can verify the consistency between the target detection result and the binarized connected component mask constraint, thereby reducing false detections and improving the accuracy of the effective nematode target set.

[0108] Furthermore, in this embodiment, after obtaining the effective nematode target set in step 500, step 600 is executed to complete the numerical statistics and result reporting of nematode parameters. Specifically, the effective nematode target set is a set of nematode targets confirmed after target detection and binarized connected component masking. It serves as the sole data source for nematode quantity statistics and individual parameter calculation, thereby avoiding interference from impurity targets or falsely detected targets on the statistical results. Based on the effective nematode target set, this embodiment first counts the number of nematode targets contained therein to obtain the nematode quantity result; the nematode quantity is the number of nematode targets in the effective nematode target set, used to reflect the nematode density level in the current field of view or sample. Preferably, when the effective nematode target set is empty, this embodiment outputs a nematode quantity of 0 and marks the current field of view as "no effective nematodes" to ensure the completeness and consistency of the statistical results.

[0109] When statistically analyzing the body length, body width, and biomass parameters of a single nematode, this embodiment calculates morphological parameters for each nematode target in the effective nematode target set based on its corresponding detection region and a binary connected component mask image. Here, "body length" refers to the length of the nematode target along its principal axis, used to characterize the nematode's growth and development state; "body width" refers to the average width of the nematode target in the direction perpendicular to the principal axis, used to characterize the nematode's body size; and "biomass parameter" refers to a quantitative index estimated based on the combined body length and body width, used to characterize the overall biomass level of the nematode. Preferably, in this embodiment, the body length and body width are calculated by converting the pixel scale to the actual physical scale, wherein the conversion ratio between pixels and actual length is determined by the imaging magnification of the optical microscope, preferably, each pixel corresponds to 0.5 micrometers; more preferably, in this embodiment, when calculating the biomass parameters, the statistical results of the body length and body width are used as input for comprehensive estimation, and the obtained body length, body width and biomass parameters are reported and output in tabular form, thereby providing standardized numerical results for subsequent nematode growth assessment, experimental comparison or data analysis.

[0110] Corresponding to the above methods, such as Figure 2 As shown, this embodiment also provides a nematode parameter identification system based on intelligent algorithms, including:

[0111] The image acquisition and denoising unit is used to acquire images of the nematode to be tested from an optical microscope with a photographic function, and to perform image denoising processing on the images of the nematode to be tested to obtain a denoised image.

[0112] A threshold discrimination feature extraction unit is used to extract threshold discrimination features based on the denoised image; the threshold discrimination features include at least brightness distribution features and contrast features;

[0113] The reinforcement learning threshold decision unit is used to input the threshold discrimination features into the reinforcement learning threshold decision model and output a binarized threshold parameter. The reinforcement learning threshold decision model uses the separation effect of nematodes, impurities and background, as well as the screening of missed detections and false detections as feedback to adaptively determine the binarized threshold parameter.

[0114] The image binarization and connected component analysis unit is used to perform image binarization on the denoised image using the OpenCV threshold function based on the binarization threshold parameter to obtain a binarized image, and to perform connected component analysis on the binarized image to obtain a binarized connected component mask image.

[0115] The nematode detection and mask screening unit is used to input the denoised image into YOLOv8 to obtain nematode detection results, and to apply the binarized connected component mask image as a mask to the nematode detection results screening, so as to exclude impurities similar to nematodes and screen for nematode overlap, missed detection, and false detection, so as to obtain an effective nematode target set.

[0116] The nematode parameter statistics and reporting unit is used to perform numerical statistics and reporting based on the effective nematode target set, and output the number of nematodes as well as the body length, body width and biomass parameters of a single nematode.

[0117] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.

[0118] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for identifying nematode parameters based on intelligent algorithms, characterized in that, include: Acquire an image of the nematode to be tested using an optical microscope with a camera function, and perform image denoising processing on the image of the nematode to be tested to obtain a denoised image; Threshold discrimination features are extracted based on the denoised image; The threshold discrimination features include at least brightness distribution features and contrast features; The threshold discrimination features are input into the reinforcement learning threshold decision model, which outputs a binarized threshold parameter. The reinforcement learning threshold decision model uses the separation effect of nematodes, impurities and background, as well as the screening of missed detections and false detections, as feedback to adaptively determine the binarized threshold parameter. The denoised image is binarized using the OpenCV threshold function based on the binarization threshold parameter to obtain a binarized image. Then, connected component analysis is performed on the binarized image to obtain a binarized connected component mask image. The denoised image is input into YOLOv8 to obtain nematode detection results. The binarized connected component mask image is then used as a mask to filter the nematode detection results, in order to eliminate impurities that are similar to nematodes and screen for nematode overlap, missed detections, and false detections, thereby obtaining an effective nematode target set. Numerical statistics are reported based on the effective nematode target set, outputting the number of nematodes and the body length, body width and biomass parameters of a single nematode.

2. The nematode parameter identification method based on intelligent algorithms according to claim 1, characterized in that, Based on the denoised image, threshold discrimination features are extracted, including: The denoised image is divided into a central region and an edge region, and the average gray value of the central region and the average gray value of the edge region are calculated respectively. The brightness distribution feature is generated based on the average gray value of the central region and the average gray value of the edge region; Calculate the grayscale dynamic range and grayscale standard deviation of the denoised image, and generate the contrast feature based on the grayscale dynamic range and the grayscale standard deviation.

3. The nematode parameter identification method based on intelligent algorithms according to claim 1, characterized in that, Based on the denoised image, threshold discrimination features are extracted, including: The denoised image is divided into multiple image sub-blocks according to a preset grid. The average gray value of each image sub-block is calculated and aggregated to generate the brightness distribution feature that characterizes the spatial brightness unevenness. The contrast value of each image sub-block is calculated and aggregated to generate the contrast feature that characterizes the local contrast change.

4. The nematode parameter identification method based on intelligent algorithms according to claim 1, characterized in that, The threshold discrimination features are input into the reinforcement learning threshold decision model, and the output is a binarized threshold parameter, including: The threshold discrimination features are encoded according to a preset input format and then input into the reinforcement learning threshold decision model; The reinforcement learning threshold decision model outputs candidate binarized threshold parameters based on the threshold discrimination features, and the candidate binarized threshold parameters are used to drive the image binarization process.

5. The nematode parameter identification method based on intelligent algorithms according to claim 1, characterized in that, The reinforcement learning threshold decision model uses the separation effect of nematodes, impurities, and background, as well as the screening of missed and false detections, as feedback to adaptively determine the binarization threshold parameters, including: The binarized image is generated based on the binarization threshold parameter, and connected component analysis is performed on the binarized image to obtain a set of foreground connected components; A first feedback quantity is obtained based on the set of foreground connected regions to characterize the separation effect of the nematode, impurities and background; the first feedback quantity includes the number of foreground connected regions, the area distribution of foreground connected regions and the fine length of the foreground connected regions. Based on the binarized connected component mask image and the nematode detection results, a second feedback quantity is obtained to characterize the missed detection and false detection situation in the screening; the second feedback quantity includes the overlap consistency index between the detection area corresponding to the nematode detection results and the foreground area in the binarized connected component mask image. The first feedback quantity and the second feedback quantity are used together as the feedback, and the reinforcement learning threshold decision model is updated based on the feedback to adjust the output of the binarized threshold parameter.

6. The nematode parameter identification method based on intelligent algorithms according to claim 5, characterized in that, The reinforcement learning threshold decision model is updated based on the feedback to adjust the output of the binarized threshold parameter, including: The binarized image is generated using the initial binarization threshold parameter, and the foreground connected component set is obtained, thereby obtaining the initial first feedback quantity. The initial second feedback quantity is obtained based on the binarized connected component mask image and the nematode detection result, so as to form the initial feedback. When the feedback does not meet the preset convergence condition, the reinforcement learning threshold decision model is updated according to the feedback, and the updated reinforcement learning threshold decision model outputs the new binarized threshold parameter. The binarized image is regenerated based on the new binarization threshold parameter, and the new feedback is obtained until the feedback meets the preset convergence condition or the number of iterations reaches the preset upper limit.

7. The nematode parameter identification method based on intelligent algorithms according to claim 6, characterized in that, Also includes: Obtain the training image set; Image denoising processing is performed on the training images in the training image set to obtain denoised training images, and training threshold discrimination features are extracted from the denoised training images. The training threshold discrimination features are input into the reinforcement learning threshold decision model to output training binarized threshold parameters, and a training binarized image, a training foreground connected component set, and a training binarized connected component mask image are generated based on the training binarized threshold parameters. The denoised training image is input into YOLOv8 to obtain the nematode detection results for training, and the nematode detection results for training are filtered based on the binarized connected component mask image for training. The training feedback is formed based on the first feedback quantity and the second feedback quantity used for training, and the reinforcement learning threshold decision model is trained and updated based on the training feedback.

8. The nematode parameter identification method based on intelligent algorithm according to claim 1, characterized in that, The binarization threshold parameter includes a threshold value and a binarization type parameter; the binarization type parameter is used to indicate the output mode of the OpenCV threshold function when performing binarization on the input image; Furthermore, the denoised image is binarized using the OpenCV threshold function based on the binarization threshold parameter, including: inputting the threshold value and the binarization type parameter into the OpenCV threshold function to obtain the binarized image.

9. The method for identifying nematode parameters based on intelligent algorithms according to claim 1, characterized in that, The binarized connected component mask image is used as a mask to filter the nematode detection results, including: For each detection target in the nematode detection results, the detection region corresponding to the detection target is determined, and the set of foreground pixels corresponding to the detection region is extracted in the binarized connected component mask image; The overlap ratio is calculated based on the pixel set of the detection region and the foreground pixel set; the overlap ratio is the ratio of the number of pixels in the intersection of the pixel set of the detection region and the foreground pixel set to the number of pixels in the detection region; When the overlap ratio is lower than a preset threshold, the detected target is identified as an impurity similar to a nematode and removed; when the overlap ratio is not lower than the preset threshold, the detected target is retained and included in the effective nematode target set.

10. A nematode parameter identification system based on intelligent algorithms, characterized in that, include: The image acquisition and denoising unit is used to acquire images of the nematode to be tested from an optical microscope with a photographic function, and to perform image denoising processing on the images of the nematode to be tested to obtain a denoised image. A threshold discrimination feature extraction unit is used to extract threshold discrimination features based on the denoised image; The threshold discrimination features include at least brightness distribution features and contrast features; The reinforcement learning threshold decision unit is used to input the threshold discrimination features into the reinforcement learning threshold decision model and output a binarized threshold parameter. The reinforcement learning threshold decision model uses the separation effect of nematodes, impurities and background, as well as the screening of missed detections and false detections as feedback to adaptively determine the binarized threshold parameter. The image binarization and connected component analysis unit is used to perform image binarization on the denoised image using the OpenCV threshold function based on the binarization threshold parameter to obtain a binarized image, and to perform connected component analysis on the binarized image to obtain a binarized connected component mask image. The nematode detection and mask screening unit is used to input the denoised image into YOLOv8 to obtain nematode detection results, and to apply the binarized connected component mask image as a mask to the nematode detection results screening, so as to exclude impurities similar to nematodes and screen for nematode overlap, missed detection, and false detection, so as to obtain an effective nematode target set. The nematode parameter statistics and reporting unit is used to perform numerical statistics and reporting based on the effective nematode target set, and output the number of nematodes as well as the body length, body width and biomass parameters of a single nematode.