Parasite egg detection methods, devices, cloud equipment and systems
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-22
- Publication Date
- 2026-08-11
AI Technical Summary
检测结果多以离散形式呈现,无法对原始图像及历史数据进行系统性存储,难以支撑动物肠道健康的长期动态追踪与诊疗参考
[0013] Compared with existing technologies, the beneficial effects of this application include at least the following: by automatically completing image analysis using a trained parasite egg detection model, the detection time is shortened, significantly improving the screening efficiency of large-scale animal fecal samples and facilitating home testing for users. Simultaneously, channel information mixing and spatial information mixing operations are introduced into the multi-scale feature fusion network. Channel mixing automatically learns and strengthens key feature channels for parasite egg identification and suppresses background noise, while spatial mixing enhances the model's perception of the relationship between local features and global context. Thus, the model built based on this dual mixing mechanism effectively solves the problem of feature dilution for small targets, significantly improving the model's robustness in detecting small, overlapping, or blurry parasite eggs in complex fecal samples. Furthermore, enhanced multi-layer original feature maps enable the rapid generation of accurate parasite egg detection information. Finally, while ensuring real-time detection speed, the classification accuracy for different types of parasite eggs (such as nematodes, tapeworms, coccidia, etc.) is significantly improved.
Smart Images

Figure CN122551350A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of detection technology, and in particular to a method, apparatus, cloud device and system for detecting parasite eggs. Background Technology
[0002] With the increasing popularity of pet ownership, intestinal parasite infections caused by roundworms, hookworms, and tapeworms have become a significant threat to pet health and even public health safety. Fecal parasite egg detection is a core clinical diagnostic tool for such infections, and its accuracy and timeliness are crucial. However, existing animal fecal parasite egg detection technologies face significant technical bottlenecks and limitations in practical applications, failing to meet the current needs for animal health monitoring and rapid home screening. Specifically, these limitations manifest in the following aspects: First, the testing process is cumbersome and inefficient. Traditional testing relies heavily on manual microscopic examination by specialized medical institutions, which is time-consuming and limited by the distribution of regional medical resources, resulting in a severe lack of accessibility for sample delivery and diagnosis.
[0003] Secondly, the detection sensitivity and standardization are low. Existing simple detection products can only achieve rough qualitative analysis, making it difficult to accurately identify the types of eggs and the infection load; moreover, they lack standardized quality control and are highly susceptible to sample impurities and subjective human factors, leading to a high risk of misjudgment or missed detection.
[0004] Secondly, there is a lack of digital data traceability capabilities. Test results are mostly presented in discrete form, making it impossible to systematically store original images and historical data, which is insufficient to support long-term dynamic tracking of animal intestinal health and provide diagnostic references.
[0005] Finally, the operation requires a high level of technical expertise. Traditional microscopy requires operators to possess professional morphological identification and instrument operation skills, which are difficult for ordinary users to master, resulting in extremely low applicability in home-based self-testing scenarios.
[0006] In summary, there is an urgent need for a parasite egg detection technology that combines convenience, high sensitivity, and intelligence to address the technical shortcomings of traditional methods in terms of timeliness, accuracy, data management, and operational barriers. Summary of the Invention
[0007] In view of this, this application provides a method, device, cloud equipment and system for detecting parasite eggs, which can realize the automatic detection of parasite eggs quickly and accurately without complicated operation, and is suitable for home detection by users.
[0008] According to a first aspect of this application, a method for detecting parasite eggs is provided, comprising: acquiring multiple detection images collected by a microscope device for a fecal sample of an animal to be tested; detecting the multiple detection images using a parasite egg detection model to generate parasite egg detection information corresponding to the fecal sample of the animal to be tested, wherein the parasite egg detection information includes the type and quantity of parasite eggs corresponding to each detection image; wherein the parasite egg detection model comprises: a backbone feature extraction network, a multi-scale feature fusion network, and a head network connected in sequence; the backbone feature extraction network is used to extract features at different levels for each detection image to obtain a multi-layer original feature map of each detection image; the multi-scale feature fusion network is used to sample and fuse features at adjacent levels in the multi-layer original feature map of each detection image based on a feature extraction operation of channel information mixing operation and spatial information mixing operation to obtain a multi-layer feature enhancement fusion map of each detection image; the head network is used to generate parasite egg detection information corresponding to the fecal sample of the animal to be tested based on the multi-layer feature enhancement fusion map of each detection image.
[0009] According to a second aspect of this application, a parasite egg detection device is provided, comprising: an acquisition module for acquiring multiple detection images collected by a microscope device for a fecal sample of an animal to be tested; a detection module for detecting the multiple detection images using a parasite egg detection model to generate parasite egg detection information corresponding to the fecal sample of the animal to be tested, wherein the parasite egg detection information includes the type and quantity of parasite eggs corresponding to each detection image; wherein the parasite egg detection model comprises: a backbone feature extraction network, a multi-scale feature fusion network, and a head network connected in sequence; the backbone feature extraction network is used to extract features at different levels for each detection image to obtain a multi-layer original feature map of each detection image; the multi-scale feature fusion network is used to sample and fuse features at adjacent levels in the multi-layer original feature map of each detection image based on a feature extraction operation of channel information mixing operation and spatial information mixing operation to obtain a multi-layer feature enhancement fusion map of each detection image; and the head network is used to generate parasite egg detection information corresponding to the fecal sample of the animal to be tested based on the multi-layer feature enhancement fusion map of each detection image.
[0010] According to a third aspect of this application, a cloud device is provided, comprising: a processor and a memory storing computer program instructions; wherein the processor executes the computer program instructions to implement the steps of the parasite egg detection method described in any embodiment of this application.
[0011] According to a fourth aspect of this application, a parasite egg detection system is provided, comprising a cloud device, a microscope device, and a mobile electronic device as described in the embodiments of this application; wherein the microscope device is equipped with a camera of the mobile electronic device to acquire multiple detection images of feces of an animal to be tested using the camera.
[0012] According to a fifth aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the parasite egg detection method as described in any embodiment of this application.
[0013] Compared with existing technologies, the beneficial effects of this application include at least the following: by automatically completing image analysis using a trained parasite egg detection model, the detection time is shortened, significantly improving the screening efficiency of large-scale animal fecal samples and facilitating home testing for users. Simultaneously, channel information mixing and spatial information mixing operations are introduced into the multi-scale feature fusion network. Channel mixing automatically learns and strengthens key feature channels for parasite egg identification and suppresses background noise, while spatial mixing enhances the model's perception of the relationship between local features and global context. Thus, the model built based on this dual mixing mechanism effectively solves the problem of feature dilution for small targets, significantly improving the model's robustness in detecting small, overlapping, or blurry parasite eggs in complex fecal samples. Furthermore, enhanced multi-layer original feature maps enable the rapid generation of accurate parasite egg detection information. Finally, while ensuring real-time detection speed, the classification accuracy for different types of parasite eggs (such as nematodes, tapeworms, coccidia, etc.) is significantly improved. Attached Figure Description
[0014] To more clearly illustrate the specific embodiments of this application or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 A flowchart illustrating the parasite egg detection method provided in one embodiment of this application is shown. Figure 2 A schematic diagram of the structure of the parasite egg detection model provided in one embodiment of this application is shown; Figure 3 This diagram illustrates the structure of a multi-scale feature fusion network provided in one embodiment of this application. Figure 4 This diagram illustrates the structure of a multi-scale feature fusion network provided in another embodiment of this application. Figure 5 This diagram illustrates the structure of the core feature processing module provided in one embodiment of this application. Figure 6 A schematic diagram of the structure of a parasite egg detection model provided in another embodiment of this application is shown; Figure 7 A schematic diagram of the structure of a parasite egg detection model provided in another embodiment of this application is shown; Figure 8 A schematic diagram of the parasite egg detection device provided in one embodiment of this application is shown; Figure 9 This application shows a schematic diagram of the structure of a cloud device provided in one embodiment; Figure 10 A schematic diagram of the architecture of a parasite egg detection system provided in one embodiment of this application is shown; Figure 11 A schematic diagram showing the test results provided by one embodiment of this application is shown. Detailed Implementation
[0016] To make the above and other features and advantages of this application clearer, the application is further described below with reference to the accompanying drawings. It should be understood that the specific embodiments given herein are for the purpose of explanation to those skilled in the art, and are exemplary only, not restrictive.
[0017] In the following description, numerous specific details are set forth to provide a thorough understanding of this application. However, it will be apparent to those skilled in the art that the specific details are not required to practice this application. In other instances, well-known steps or operations have not been described in detail to avoid obscuring this application.
[0018] The following, in conjunction with the accompanying drawings, provides a detailed description of the parasite egg detection method, apparatus, cloud device, parasite egg detection system, and computer-readable storage medium provided in this application, through specific implementation schemes and application scenarios.
[0019] The implementation scheme of this application provides a method for detecting parasite eggs. Figure 1 The following is a flowchart illustrating the parasite egg detection method provided in one embodiment of this application, as shown below. Figure 1 As shown, this method for detecting parasite eggs includes the following steps.
[0020] S101, acquire multiple detection images of the fecal sample of the animal to be tested using a microscope device.
[0021] The imaging microscope device according to one embodiment of this application acquires and generates digital images of a specific field of view of an animal fecal sample under a specific magnification. Each imaging image corresponds one-to-one with a field of view and is used to characterize the microscopic morphological information of the sample within that field of view.
[0022] In one embodiment of this application, S101 can be specifically executed as follows: First, a microscope device is used to continuously collect data from the fecal sample of the animal to be tested, and video stream data containing multiple detection fields is obtained; second, the video stream data is split into frames to extract multiple candidate images; then, it is detected whether there are detection images in the candidate images that meet the preset number requirements and correspond to different detection fields; if the detection result is yes, that is, the number of qualified detection fields in the candidate images reaches the preset threshold (such as 100 detection fields), then multiple detection images are obtained from the candidate images; if the detection result is no, that is, the number of qualified detection fields in the candidate images is insufficient, then the currently collected video is determined to be unqualified, and a re-collection instruction is generated to indicate re-collection.
[0023] In some embodiments of this application, prior to step S102, the acquired detection image needs to undergo image quality assessment and screening. Specifically, this quality assessment process includes, but is not limited to: detecting the sharpness of the detection image, detecting whether the detection image meets preset microscopic imaging quality standards, and detecting the compliance of the animal feces sample corresponding to the detection image.
[0024] In one embodiment of this application, the sharpness detection of the detected image can specifically employ a variance evaluation method based on the Laplacian operator. This is implemented by performing a convolution operation on the detected image using the Laplacian operator to extract high-frequency edge detail information, and then calculating the variance of the convolution response. This variance serves as a quantitative indicator of image sharpness; a larger variance indicates richer edge details and higher sharpness, while a smaller variance suggests that the image may be blurry or out of focus.
[0025] In one embodiment of this application, to ensure that the detected image meets the quality standards of microscopic imaging, a comprehensive scoring algorithm based on gray-level histograms can be introduced for detection. Specifically, the gray-level histogram of the detected image is calculated, and it is determined whether the histogram's evaluation index is within the expected range. For qualified detected images, their histograms are usually not uniformly distributed, but rather exhibit specific peak values and distribution patterns.
[0026] The evaluation metrics for the histogram of the detected image may include, but are not limited to, the number of peaks, the percentage of peaks, the symmetry of the projection curve, the peak sharpness, the slit width, and the contrast.
[0027] In this way, through the above comprehensive scoring, images that meet the microscopic imaging quality standards can be automatically and accurately screened out, and inferior images caused by abnormal lighting, focal length deviation or improper sample preparation can be eliminated, thereby ensuring the accuracy and reliability of subsequent parasite egg detection.
[0028] In one embodiment of this application, in order to ensure the compliance of the preparation of the animal fecal sample to be tested and to avoid interference with the detection of parasite eggs due to the presence of large impurities in the sample, an impurity detection algorithm based on threshold binarization and connected component analysis can be introduced to detect the compliance of the animal fecal sample to be tested corresponding to the detection image.
[0029] Specifically, after binarizing the detection image, the area of each connected region is extracted and calculated. If the area of any connected region exceeds a preset threshold, it is determined that there is a large impurity in the field of view, and the acquired video or detection image is deemed unqualified, requiring a re-acquisition process.
[0030] S102, using a parasite egg detection model to detect multiple images and generate parasite egg detection information corresponding to the fecal sample of the animal to be detected.
[0031] The parasite egg detection information involved in one embodiment of this application includes the type and quantity of parasite eggs corresponding to each detection image.
[0032] In addition, the parasite egg detection information also includes the detection bounding box and confidence level for the location of the detected parasite eggs for each detection image.
[0033] The parasite egg detection model involved in one embodiment of this application can be constructed based on a target detection model (e.g., YOLO11). Figure 2 This application provides a schematic diagram of the structure of a parasite egg detection model according to one embodiment. Figure 2 As shown, the parasite egg detection model 20 may include a backbone feature extraction network 21, a multi-scale feature fusion network 22, and a head network 23 connected in sequence.
[0034] In one embodiment of this application, the backbone feature extraction network 21 can adopt the backbone feature extraction network structure in the YOLO11 model to extract features at different levels for each detection image, thereby obtaining multi-layer original feature maps for each detection image. Specifically, the backbone feature extraction network 21 performs progressive convolutional feature extraction on the input detection image to obtain multi-layer original feature maps containing information at different receptive field scales, with each layer of original feature map having a resolution that differs by a factor of two.
[0035] The multi-scale feature fusion network 22 is used for feature extraction based on channel information mixing operation and spatial information mixing operation. It samples and fuses features of adjacent layers in the multi-layer original feature map of each detection image to obtain a multi-layer feature enhancement fusion map of each detection image.
[0036] Channel information fusion refers to the interaction and fusion of information between different feature channels. Spatial information fusion refers to the interaction of information between adjacent or related pixels in the spatial dimension of the feature map.
[0037] The head network 23 can adopt the head network structure in the YOLO11 model to generate parasite egg detection information corresponding to the fecal sample of the animal to be detected based on the multi-layer feature enhancement fusion map of each detection image.
[0038] In some of the aforementioned implementation schemes, considering the varying sizes of parasite eggs in microscope images and their susceptibility to background interference, this application introduces channel information mixing and spatial information mixing operations into the multi-scale feature fusion network. By sampling and fusing features from adjacent layers, feature recalibration is achieved. Furthermore, the channel mixing operation automatically learns and strengthens key feature channels for parasite egg identification (such as specific color or texture channels), suppressing background noise. The spatial mixing operation enhances the model's ability to perceive the relationship between local features and global context. Thus, the model built based on this dual mixing mechanism effectively solves the problem of feature dilution for small targets, significantly improving the model's robustness in detecting small, overlapping, or blurred parasite eggs in complex fecal samples. In addition, the enhanced multi-layer original feature maps enable the rapid generation of accurate parasite egg detection information. Moreover, while maintaining real-time detection speed, the classification accuracy for different types of parasite eggs (such as nematodes, tapeworms, coccidia, etc.) is significantly improved.
[0039] Meanwhile, it automates and intelligently detects parasite eggs, greatly reducing visual fatigue and workload for veterinarians or laboratory personnel. High-precision automatic counting and classification reduces human error and improves the efficiency and standardization of parasite egg screening.
[0040] In some embodiments of this application, the multi-scale feature fusion network 22 includes a sampling group, a fusion group, and a core feature processing group. The core feature processing group includes multiple core feature processing modules, the sampling group includes multiple sampling modules, and the fusion group includes multiple fusion modules.
[0041] In one embodiment of this application, the sampling group, the fusion group, and the core feature processing group can constitute a unidirectional sampling and fusion path. Specifically, the number of sampling modules in the sampling group is equal to the number of fusion modules in the fusion group, and one less than the number of original feature maps; and the number of core feature processing modules in the core feature processing group is more than twice the number of sampling modules, plus one more.
[0042] Figure 3 This invention provides a schematic diagram of the structure of a multi-scale feature fusion network according to one embodiment of the present application. Figure 3 As shown, the core feature processing group includes a first core feature processing module 221a positioned before the sampling module, a second core feature processing module 221b positioned after the fusion module, and a third core feature processing module 221c positioned directly before the fusion module. The number of the first core feature processing module 221a and the second core feature processing module 221b is equal.
[0043] The first core feature processing module 221a is used to extract features from an original feature map of a multi-layer original feature map other than the highest or lowest layer based on channel information mixing operation and spatial information mixing operation, so as to obtain an initial feature enhancement map of other layers.
[0044] The sampling module 222 is located after the first core feature processing module 221a and is used to sample an initial feature enhancement map of another level so that the sampled initial feature enhancement map has the same resolution as the original feature map of the adjacent level.
[0045] The fusion module 223 is located after the sampling module 222 and is used to fuse an initial feature enhancement map of another level after sampling with the initial feature enhancement map of the adjacent level to obtain a feature fusion map of the adjacent level.
[0046] The second core feature processing module 221b can be used to extract features from the fused feature map based on channel information mixing operation and spatial information mixing operation to obtain a feature-enhanced fusion map of adjacent levels.
[0047] The third core feature processing module 221c is used to extract features from the lowest or highest level of the original feature map in the multi-layer original feature map based on channel information mixing operation and spatial information mixing operation, so as to obtain the lowest or highest level feature enhancement fusion map.
[0048] In one embodiment of this application, such as Figure 3As shown, when the sampling fusion path is a top-down sampling fusion path, the original feature maps of other levels (such as C3, C4, and C5) in the multi-layer original feature maps, except for the lowest level original feature map (such as C2), are respectively input into the first core feature processing module of the corresponding level. Furthermore, the original feature map of the lowest level is input into the third core feature processing module to obtain the initial feature map of the lowest level (such as C2').
[0049] The initial feature enhancement maps (such as C3', C4', and C5') output by the first core feature processing modules at different levels are input into the upsampling modules at the corresponding levels. The upsampling modules at different levels output the initial feature enhancement maps (such as C3'-, C4'-, and C5'-) after sampling at different levels. Among them, C3'- has the same resolution as C2, C4'- has the same resolution as C3, and C5'- has the same resolution as C4.
[0050] Input C3'-, C4'-, and C5'- into the fusion modules corresponding to different levels. In the fusion module corresponding to the third level, C3'- is fused with C2' to output the initial feature fusion map P02 of the second level. In the fusion module corresponding to the fourth level, C4'- is fused with C3' to output the initial feature fusion map P03 of the third level. In the fusion module corresponding to the fifth level, C5'- is fused with C4' to output the initial feature fusion map P04 of the fourth level.
[0051] The initial feature fusion maps of different levels are input into the second core feature processing module corresponding to different levels to obtain feature enhancement fusion maps of different levels (such as P2, P3 and P4).
[0052] Furthermore, the initial feature enhancement map of the highest level is used as the feature enhancement fusion map of the highest level.
[0053] In one embodiment of this application, when the sampling fusion path is a bottom-up sampling fusion path, the original feature maps of other levels (such as C2, C3, and C4) in the multi-layer original feature maps, except for the highest-level original feature map (such as C5), are respectively input into the first core feature processing module of the corresponding level. Furthermore, the original feature map of the highest level is input into the third core feature processing module to obtain the initial feature map of the highest level (such as C5').
[0054] The initial feature enhancement maps (such as C2', C3', and C4') output by the first core feature processing modules at different levels are input into the downsampling modules at the corresponding levels. The downsampling modules at different levels output the initial feature enhancement maps (such as C2'+, C3'+, and C4'+) after sampling at different levels. Among them, C2'+ and C3 have the same resolution, C3'+ and C4 have the same resolution, and C4'+ and C5 have the same resolution.
[0055] Input C2'+, C3'+, and C4'+ into the fusion modules corresponding to different levels. In the fusion module corresponding to the second level, C2'+ and C3' are fused to output the initial feature fusion map P03 for the third level. In the first fusion module corresponding to the third level, C3'+ and C4' are fused to output the initial feature fusion map P04 for the fourth level. In the first fusion module corresponding to the fourth level, C4'+ and C5' are fused to output the initial feature fusion map P05 for the fifth level.
[0056] The initial feature fusion maps of different levels are input into the second core feature processing module corresponding to different levels to obtain feature enhancement fusion maps of different levels (such as P3, P4 and P5).
[0057] In addition, the initial feature enhancement map of the lowest level is used as the feature enhancement fusion map of the lowest level.
[0058] In some of the above embodiments, by deploying core feature processing modules before sampling and after fusion, a closed-loop enhancement mechanism of "extraction-sampling-fusion-re-extraction" is formed, reducing the transmission of background noise across levels and effectively eliminating the semantic gap and noise interference caused by cross-scale fusion. At the same time, independent core processing modules are set up specifically for edge levels (highest or lowest levels) to ensure that the detailed features and macroscopic distribution features of small targets (such as parasite eggs) are fully preserved.
[0059] In one implementation scheme of the application, the sampling group, the fusion group, and the core feature processing group can constitute a bidirectional sampling and fusion path. Figure 4 This illustration shows a schematic diagram of the structure of a multi-scale feature fusion network provided in another embodiment of this application, such as... Figure 4 As shown, the sampling group includes an equal number of upsampling modules 222a and downsampling modules 222b, and the fusion group includes a first fusion module 223a positioned after the upsampling modules and a second fusion module 223b positioned after the downsampling modules 222b. The number of upsampling modules 222a is equal to the number of the first fusion modules 223a, and the number of downsampling modules 222b is equal to the number of the second fusion modules 223b.
[0060] The core feature processing group includes a fourth core feature processing module 221d located before the upsampling module, a fifth core feature processing module 221e located after the first fusion module 223a, a sixth core feature processing module 221f located after the second fusion module 223b, and a seventh core feature module 221g located before the first fusion module 223a.
[0061] Among them, the number of fourth core feature processing modules 221d is equal to the number of upsampling modules 222a, the number of fifth core feature processing modules 221e is equal to the number of first fusion modules 223a, and the number of sixth core feature processing modules 221f is the same as the number of second fusion modules 223b.
[0062] The fourth core feature processing module 221d is used to extract features from the original feature map of the current level (excluding the lowest level) based on channel information mixing operation and spatial information mixing operation to obtain an initial feature enhancement map of the current level. The seventh core feature processing module 221g is used to extract features from the lowest-level original feature map based on channel information mixing operation and spatial information mixing operation to obtain the lowest-level initial feature enhancement map. The upsampling module 222a is used to upsample an initial feature enhancement map of the current level to obtain the first sampled feature map of the current level.
[0063] The first fusion module 223a is used to fuse the first sampled feature map of the current level with the initial feature enhancement map of the next level to obtain the initial feature fusion map of the next level.
[0064] The fifth core feature processing module 221e is used to extract features from the initial feature fusion map of the next level based on channel information mixing operation and spatial information mixing operation, so as to obtain the intermediate feature enhancement map of the next level.
[0065] The downsampling module 222b is used to downsample the intermediate feature enhancement map of the next level to obtain the second sampled feature map of the next level.
[0066] The second fusion module 223b is used to fuse the intermediate feature enhancement map of the previous level with the second sampled feature map of the current level to obtain the intermediate feature fusion map of the current level.
[0067] The sixth core feature processing module 221f is used to extract features from the intermediate feature fusion map of the current level based on channel information mixing operation and spatial information mixing operation to obtain the feature enhancement fusion map of the current level.
[0068] Furthermore, the initial feature enhancement map output by the lowest-level seventh core feature processing module 221e is directly used as the lowest-level second sampled feature map. The lowest-level second fusion module 223b fuses the intermediate feature enhancement map from the previous level with the lowest-level second sampled feature map to obtain the lowest-level intermediate feature fusion map.
[0069] For example, the original feature maps of other levels besides the lowest level (such as C2) in the multi-layer original feature maps (such as C3, C4, and C5) are input into the fourth core feature processing module of the corresponding level, respectively. And the original feature map of the lowest level is input into the seventh core feature processing module to obtain the initial feature map of the lowest level (such as C2').
[0070] The initial feature enhancement maps (such as C3', C4', and C5') output by the fourth core feature processing modules at different levels are input into the upsampling modules at the corresponding levels. The upsampling modules at different levels output the first sampled feature maps (such as C3'+, C4'+, and C5'+) at different levels. Among them, C3'+ has the same resolution as C2, C4'+ has the same resolution as C3, and C5'+ has the same resolution as C4.
[0071] The first sampled feature maps of different levels are input into the first fusion module corresponding to each level. In the first fusion module corresponding to the fifth level, C5'+ and C4' are fused to output the initial feature fusion map P04 of the fourth level. In the first fusion module corresponding to the fourth level, C4'+ and C3' are fused to output the initial feature fusion map P03 of the third level. In the first fusion module corresponding to the third level, C3'+ and C2' are fused to output the initial feature fusion map P02 of the second level.
[0072] The initial feature fusion maps of different levels are input into the fifth core feature processing module corresponding to different levels to obtain intermediate feature enhancement maps of different levels (such as P02', P03' and P04').
[0073] The intermediate feature enhancement maps of different levels are input into the downsampling modules corresponding to different levels to obtain the second sampled feature maps of the corresponding levels (such as P04'-, P03'-, and P02'-). Among them, P04'- has the same resolution as C5', P03'- has the same resolution as P04', and P02'- has the same resolution as P03'.
[0074] Use the initial feature map of the lowest level (such as C2') as the second sampled feature map of the lowest level.
[0075] The second sampled feature maps of different levels are input into the second fusion module of the corresponding level. In the second fusion module corresponding to the fourth level, P04' and C5' are fused to output the intermediate feature fusion map P5 of the fifth level. In the second fusion module corresponding to the third level, P03' and P04' are fused to output the intermediate feature fusion map P4 of the fourth level. In the second fusion module corresponding to the second level, P02' and P03' are fused to output the intermediate feature fusion map P3 of the third level.
[0076] The intermediate feature fusion maps of different levels (such as P3, P4 and P5) are input into the sixth core feature processing module corresponding to different levels to obtain feature enhancement maps of different levels (P3', P4' and P5').
[0077] In some of the above embodiments, the bidirectional sampling fusion path can achieve deep fusion of high-level strong semantic features and low-level strong localization features, which significantly improves the detection accuracy of fuzzy and small targets. In addition, it allows the intermediate level to aggregate macroscopic and microscopic information at the same time, which enhances the model's ability to analyze parasite eggs at different scales (such as single scattered and clustered masses).
[0078] In one embodiment of this application, the first core feature processing module, the second core feature processing module, the third core feature processing module, the fourth core feature processing module, the fifth core feature processing module, the sixth core feature processing module, and the seventh core feature processing module can all adopt the same core feature processing module structure.
[0079] It should be noted that this core feature processing module is an improvement on YOLO11's C3K2, retaining the original residual connections of the C3k2 module to ensure that gradient flow is not affected and to avoid training convergence difficulties.
[0080] Figure 5 This invention provides a schematic diagram of the core feature processing module according to one embodiment of the present application. Figure 5 As shown, the core feature processing module 50 includes a split convolutional layer 51, multiple stacked general inverted bottleneck UIB blocks 52, a directly connected convolutional layer 53, and a fusion convolutional layer 54. The directly connected convolutional layer 53 and the multiple stacked UIB blocks 52 are connected in parallel between the split convolutional layer 51 and the fusion convolutional layer 54.
[0081] The split convolutional layer 51 serves as the input to the core feature processing module, performing initial dimensionality transformation and preliminary feature extraction on the input feature map to obtain the main path feature map and the directly connected path feature map. The main path feature map and the directly connected path feature map are identical.
[0082] The direct-connect convolutional layer 53 is used to adjust the number of channels in the direct-connect feature map so that the number of channels is consistent with the number of channels output by multiple stacked UIB blocks, and to input the adjusted direct-connect feature map into the fusion convolutional layer 54.
[0083] Multiple stacked UIB blocks 53 are used to perform channel information mixing and spatial information mixing operations on the main path feature map, and the main path feature map after the mixing operation is input into the fusion convolutional layer 54.
[0084] The fusion convolutional layer 54 is used to concatenate and fuse the adjusted direct path feature map with the main path feature map after the mixing operation to obtain the enhanced feature map corresponding to the input feature map.
[0085] In one embodiment of this application, the split convolutional layer 51 performs initial dimensionality transformation (i.e., dimensionality increase) and shallow feature extraction on the input feature map, and copies the processed feature map into two identical signals, outputting the main path feature map and the directly connected path feature map, respectively. After splitting, the two paths are processed in parallel, wherein the main path: the main path feature map is input to multiple stacked UIB blocks 52. These UIB blocks sequentially perform deep channel information mixing and spatial information mixing operations on the main path feature map to extract high-dimensional semantic features, and output the processed main path feature map to the fusion convolutional layer 54.
[0086] Direct connection path: The direct connection convolutional layer 53 adjusts the number of channels of the direct connection path feature map (e.g., 1×1 convolution) to make its channel dimension consistent with the channel dimension of the main path feature map after processing by multiple stacked UIB blocks. Then the adjusted direct connection path feature map is input into the fusion convolutional layer 54.
[0087] Finally, the fusion convolutional layer 54 receives feature maps from the two paths, and concatenates and fuses the adjusted direct path feature map with the main path feature map after the mixing operation in the channel dimension to generate an enhanced feature map corresponding to the input feature map.
[0088] In some of the above embodiments, the core feature processing module adopts a dual-path parallel architecture. The main path performs deep spatial information mixing (extracting deep semantic features) through stacked UIB blocks, while the direct connection path retains shallow detailed features (such as the edges and textures of the parasite eggs) through direct connection convolutional layers. Finally, the features are concatenated in a fusion convolutional layer. By fusing the two types of features, the enhanced feature map output by the core feature processing module retains both the fine contour information of the parasite eggs (from the direct connection path) and enhances their semantic features (from the main path), thereby significantly improving the detection rate of tiny parasite eggs and reducing missed detections.
[0089] Furthermore, the dual hybrid mechanism enables the core feature processing module to more flexibly select key features, suppress background noise, and improve the model's generalization ability and robustness under different staining qualities and lighting conditions.
[0090] In one embodiment of this application, each UIB block can be an additional depth convolutional variant structure. The additional depth convolutional variant structure includes a front depthwise separable convolutional layer, a channel expansion layer, an intermediate depthwise separable convolutional layer, an additional depthwise separable convolutional layer, and a channel projection layer connected in sequence.
[0091] A front-end depthwise separable convolutional layer is used to mix spatial information from the input feature map.
[0092] Specifically, the pre-depth separable convolutional layer uses a 3×3 convolutional kernel. While keeping the number of channels constant, each channel of the feature map is convolved independently, which can expand the receptive field of UIB and perform lightweight spatial information interaction in the low-dimensional feature space, thereby providing input with preliminary spatial context information for subsequent feature transformation.
[0093] The channel expansion layer is used to increase the channel dimension of the feature map after spatial information mixing.
[0094] Specifically, this channel expansion layer typically consists of 1x1 pointwise convolutions and non-linear activation units. Its function is to non-linearly expand (upscale) the channel dimension of the feature map. Through this upscaling operation, the feature representation capacity of the model is significantly improved, enabling UIB to learn more complex feature patterns in a higher-dimensional space.
[0095] Intermediate depth separable convolutional layers are used to extract spatial features from the upgraded feature maps in the upgraded high-dimensional channel space.
[0096] Specifically, after the feature map is expanded to a high-dimensional channel space, intermediate depth separable convolutional layers extract deeper spatial features. These intermediate depth separable convolutional layers can leverage the redundancy of high-dimensional features to more effectively capture fine-grained spatial details, edge textures, and local contextual features.
[0097] Additional depth separable convolutional layers are used to perform additional spatial blending operations on the feature maps after spatial feature extraction.
[0098] Specifically, additional depthwise separable convolutional layers are cascaded after intermediate depthwise separable convolutional layers. By adding additional depthwise separable convolutional layers, the topological depth of UIB is increased, thereby enabling the capture of dependencies over longer distances and improving the ability to perceive complex spatial structures.
[0099] The channel projection layer is used to reduce the channel dimension of the feature map after additional spatial blending operations.
[0100] Specifically, the channel projection layer consists of 1x1 linear pointwise convolutions (usually without non-linear activation functions). This layer compresses the high-dimensional feature map back to the target output channel number, thereby significantly reducing the dimensionality of the output feature map and reducing subsequent computational burden and memory usage.
[0101] In some of the above implementation schemes, by employing UIB blocks constructed based on additional depth convolution variants, pointwise convolution is used to achieve channel blending and dimensionality adjustment, and depth convolution is used to achieve spatial blending and expand the receptive field. In this way, by enhancing the model's ability to capture spatial context information, it is possible to more accurately segment and locate individual parasite eggs when they are densely stacked, avoiding misidentification of multiple overlapping eggs as one or confusion with background impurities. Furthermore, the characteristics of depthwise separable convolution are used to significantly reduce floating-point operations and memory access costs, thus meeting the requirements for real-time, high-precision parasite egg detection.
[0102] Furthermore, the UIB block can use neural architecture search to determine whether to enable front-end depthwise separable convolutional layers, intermediate depthwise separable convolutional layers, and additional depthwise separable convolutional layers. In this way, with extremely low computational cost, the UIB can dynamically adjust its emphasis on spatial and channel information at different levels to achieve optimal feature extraction results.
[0103] In practical applications, the core feature processing module built using multiple UIB blocks can reduce model inference latency by 10-20% without sacrificing feature extraction capabilities, and reserve computational redundancy for the accurate calculation of subsequent attention modules and detection heads.
[0104] In one embodiment of this application, the UIB block can also adopt other structures, such as ConvNext block or feedforward network.
[0105] In some embodiments of this application, the parasite egg detection model also includes a mobile multi-query attention module.
[0106] The Mobile Multi-Query Attention (Mobile MQA) module involved in one implementation scheme of this application is a lightweight attention mechanism adapted to mobile hardware. Its core is to reduce memory bandwidth consumption by sharing key-value matrices. The Mobile Multi-Query Attention module can be independently embedded in key positions of multi-scale feature fusion networks or head networks without modifying the model structure.
[0107] In one implementation scheme, Figure 6This invention provides a schematic diagram of the structure of a parasite egg detection model according to another embodiment of the present application, as shown below. Figure 6 As shown, the mobile multi-query attention module 61 can be set in the head network to perform feature weighting on the feature enhancement fusion graph group based on the attention mechanism of multiple query heads sharing the same set of key and value matrices, so as to obtain the feature enhancement fusion graph group after feature enhancement.
[0108] Specifically, the mobile multi-query attention module 61 can be placed before the detection head (such as the classification head and regression head) of the head network. In this way, the mobile multi-query attention module 61 applies attentional weights to the feature enhancement fusion map group of the multi-scale feature fusion network, thereby strengthening the features of the egg region and suppressing background interference such as fecal impurities.
[0109] In one implementation scheme, Figure 7 This invention provides a schematic diagram of the structure of a parasite egg detection model according to another embodiment of the present application, as shown below. Figure 7 As shown, the mobile multi-query attention module 61 is set in the multi-scale feature fusion network. It is used to perform feature weighting on the intermediate-level feature enhancement fusion graph in the feature enhancement fusion graph group based on the attention mechanism of multiple query heads sharing the same set of key and value matrices, and output the feature enhancement fusion graph of the intermediate level and above after feature enhancement.
[0110] Specifically, a mobile multi-query attention module 61 is cascaded after the core feature processing module that outputs the fourth-level feature enhancement fusion map (P4), and a mobile multi-query attention module 61 is cascaded after the core feature processing module that outputs the fifth-level feature enhancement fusion map (P5).
[0111] Thus, by utilizing the mobile multi-query attention module 61, the model's ability to capture long-distance dependencies in feature maps is enhanced while reducing memory bandwidth consumption and computational latency. For complex scenarios involving high-density clustering and mutual occlusion of parasite eggs, the improved multi-scale feature fusion network can accurately focus and extract feature regions of tiny parasite egg targets with sizes ranging from 50-100 μm, effectively suppressing background noise and avoiding feature confusion between overlapping targets, thereby significantly improving the localization accuracy of small-scale targets.
[0112] Comparative experiments based on the COCO val2017 dataset demonstrate that by adding a Mobile MQA module to the multi-scale feature fusion network, the model achieves significant optimizations in inference efficiency and resource consumption while maintaining high accuracy. Specifically: detection accuracy is improved, with the core metric mAP@0.5:0.95 increasing from 43.2 to 43.5 (+0.3 AP), indicating that the improved model performs better in multi-scale object detection accuracy; inference speed is significantly improved, with the inference frame rate increasing from 48 FPS to 61 FPS on the Snapdragon 8 Gen2 mobile platform, a growth rate of 27%, effectively meeting the performance requirements of real-time detection on mobile devices; and the model is significantly lightweight, with the number of parameters reduced by approximately 18%, greatly reducing the computational resource consumption of cloud deployment and the storage and memory usage of mobile devices, improving the feasibility of model deployment in resource-constrained environments.
[0113] Furthermore, by combining a parasite egg detection dataset (such as 8 types of parasite eggs, including long-tailed distribution, small targets, and clustered occlusion scenarios), setting up the Mobile MQA module can improve the recall rate of tail categories by 3%-5% and reduce the false detection rate by 2%-3%, perfectly matching the accuracy and efficiency requirements of home detection.
[0114] In some embodiments of this application, the loss function of the parasite egg detection model includes a weighted cross-entropy loss function and an enhanced repulsion loss function.
[0115] In one embodiment of this application, the weight coefficients in the weighted cross-entropy loss function are determined based on the product of the base weights and the dynamic correction factor, wherein the dynamic correction factor is determined based on the current recall rate of each type of parasite egg.
[0116] Specifically, the weighted cross-entropy loss function L WL It can be expressed as the following formula.
[0117] (1) Among them, y i It is the true class of sample i. To predict the probability of the true class for the model, This represents the final loss weight.
[0118] In one embodiment of this application, the loss weights can be dynamically adjusted based on the class sample size and the model's real-time performance. Specifically, the final loss weights can be expressed as the following formula.
[0119] (2)
[0120] in, The original collection weights, =1 / s i s i Indicates the original sampling frequency. As a dynamic correction factor, This represents the current recall rate, where ε is less than 1 and greater than 0 (e.g., 0.1), used to prevent the weight from dropping to 0.
[0121] In one embodiment of this application, The recall rate can be obtained by smoothing it using an exponential moving average. In this way, the smoothing process can avoid the sharp fluctuations in the recall rate from masking the true trend.
[0122] Current recall rate The calculation formula is as follows.
[0123] (3) Where t represents the round, This represents the smoothing coefficient, which is greater than 0 and less than 1. Let represent the original recall rate of the i-th category sample in round t.
[0124] when When the dynamic correction factor is close to 1 / ε, the final loss weight is maximized. When the dynamic correction factor is ε, the final loss weight is minimized.
[0125] The current recall rate in one implementation scheme of this application refers to the proportion of the number of samples in the current training batch that are correctly identified and classified as type n parasite eggs by the parasite egg detection model in the current training phase, to the actual total number of type n parasite eggs in that batch.
[0126] In one embodiment of this application, the enhanced repulsion loss function is the sum of the attraction loss, the repulsion loss for the ground truth boxes, and the repulsion loss for the predicted boxes, wherein the attraction loss is determined based on a penalty factor, which is determined based on the predicted boxes and the labeled boxes.
[0127] Enhanced repulsion loss function L EL It can be expressed as the following formula.
[0128]
[0129] (4) in, For the loss of attractiveness, L RepGT To exclude the true bounding box loss, L RepBox To exclude predicted bounding boxes from the loss, α and β are loss weights used to balance the auxiliary loss, and a penalty factor. WP and H P W represents the width and height of the prediction box. G and H G Indicates the width and height of the annotation box, and the attractiveness target. That is, for a predicted bounding box P, find the ground truth bounding box with the highest overlap (IoU) among all ground truth bounding boxes g. + This represents the set of all prediction boxes.
[0130] It should be noted that the enhanced repulsion loss function involved in the first embodiment of this application is an improvement on the existing repulsion loss. That is, a penalty factor is added to the attractiveness loss in the existing repulsion loss, so that aspect ratio information needs to be considered when calculating the attractiveness loss, which can effectively solve the problem of inaccurate detection when the target is dense and occluded.
[0131] Furthermore, the larger δ is, the greater the loss of attraction; otherwise, the loss of attraction is smaller. In some embodiments of this application, the training process of the parasite egg detection model adopts a multi-stage training strategy.
[0132] The multi-stage training strategy involved in one embodiment of this application includes an initial training stage, an intermediate training stage, and a later training stage, executed sequentially. In each training stage, an adaptive resampling strategy is used to dynamically adjust the class distribution of the training samples.
[0133] Specifically, in the initial training phase, the sampling weight of head class samples is increased, so that head class samples account for the highest proportion of the training samples in this phase. In this way, the basic feature extraction capability of the model can be quickly built using head samples.
[0134] During the intermediate training phase, the sampling weights of samples from each category are balanced so that the proportion of samples from the head, middle, and tail categories meets a preset balance threshold. In this way, balanced training of all categories is achieved.
[0135] In the later training phase, the sampling weight of tail category samples is increased, ensuring that tail category samples account for the highest proportion of the training samples in this phase. In this way, based on the established basic feature extraction capabilities, the model is fine-tuned using tail category samples.
[0136] In some of the above embodiments, the training process is implemented sequentially through the multi-stage training strategy, which focuses on training head class samples in the initial stage, balanced training of all classes in the middle stage, and fine-tuning of tail class samples in the later stage.
[0137] In an embodiment of the present application, the adaptive resampling strategy can be a sampling strategy for calculating adaptive sampling weights based on class frequencies. The adaptive resampling strategy can specifically include the following steps: obtaining the original sampling probabilities of each class sample in the initial training dataset; generating the sampling weights of each class sample at each stage based on the smoothing factor corresponding to each training stage and the original sampling probabilities; and performing data acquisition on the initial training data based on the sampling weights to obtain training samples that meet the training requirements of each stage.
[0138] The original sampling probability of each class sample involved in an embodiment of the present application can be determined according to the ratio between the number of each class sample and the total samples, and can be expressed as , where represents the number of the i-th class sample, and the total samples , and C represents the total number of sample classes.
[0139] In an embodiment of the present application, the smoothing factor is used to process the sampling weights to make the sampling weights more in line with the training requirements of each stage. The sampling weights can be calculated by the following formula.
[0140] (5) where T is a hyperparameter between 0 and 1, called the smoothing factor.
[0141] When T is 1, standard inverse frequency sampling can be achieved to fully compensate for the imbalance. When T = ⅀, random uniform sampling can be achieved, that is, the sampling probabilities of all class samples are equal. When 0 < T < 1, the intensity of adjustment and rebalancing can be achieved. Specifically, when T approaches 1, the sampling distribution tends to be balanced, giving more attention to the tail samples. When T is closer to 0, the sampling distribution is closer to the original natural distribution, retaining more head class information.
[0142] In an embodiment of the present application, in the initial training stage (such as rounds 1 - 30), T can be ⅀. Thus, the head class samples have the highest proportion in the training samples of this stage, so as to stabilize the model convergence, build the basic feature extraction ability, and solve the problem that there are few tail samples in the initial training stage, and direct balanced sampling is likely to cause model oscillation and non-convergence.
[0143] In the middle training stage (such as rounds 31 - 70), T can be 0.6. Thus, the proportion of the number of samples of the head class, middle class, and tail class meets the preset balance threshold, so as to balance the training weights of the head and tail classes, avoid overfitting of the head, and then solve the problem of insufficient learning of tail class features after the model is basically stable.
[0144] In later training phases (e.g., 71-100 rounds), T can be 1. This ensures that tail category samples have the highest proportion in the training samples of this phase, thereby enhancing the model's ability to identify the features of tail category samples (e.g., tapeworm eggs, whipworm eggs), thus solving the problem of low recall rate for tail categories and the need to specifically improve accuracy.
[0145] It should be noted that this application addresses the problem of training a detection model using the PyTorch framework based on a self-built dataset (clinical fecal samples collected from pet hospitals and annotated by veterinarians). Because there are many detection categories and the training data for each category is unbalanced, with a few categories (tail categories) having very few samples and most categories (head categories) having a large number of samples, the model is biased towards head categories, resulting in low detection accuracy for tail categories. This can be addressed from four dimensions: adaptive resampling strategy, dynamically adjusting the category weight loss function, optimizing the model, and multi-stage training strategy.
[0146] In some embodiments of this application, after detecting multiple detection images using a parasite egg detection model in S102 and generating parasite egg detection information corresponding to the fecal sample of the animal to be detected, the parasite egg detection method further includes: post-processing the parasite egg detection information.
[0147] In one embodiment of this application, post-processing can be a two-stage post-processing mechanism (including error correction and result statistics). In this way, post-processing can ensure the accuracy of counting.
[0148] First, the post-processing steps are as follows: False detection correction is performed on parasite egg detection information. A confidence threshold filtering strategy is used to remove low-quality detection boxes with confidence levels below a preset threshold (e.g., 0.8), effectively filtering background noise and misidentified targets. Simultaneously, to address the issue of multiple adjacent detection boxes for the same egg, a clustering algorithm based on cross-union ratio (CUN) for similar eggs is implemented. By calculating the overlap between detection boxes and applying non-maximum suppression, redundant boxes within overlapping areas are merged, retaining the optimal detection result and preventing the same egg from being counted repeatedly. After false detection correction, the results are statistically analyzed. All detection images are traversed, the number of corrected valid egg detections is summarized, and statistics are performed according to egg type. Finally, a structured detection report containing the quantity, distribution, and confidence level of each type of egg is generated, providing quantitative evidence for parasite diagnosis.
[0149] In some embodiments of this application, the parasite egg detection method further includes: automatically triggering a data backup and retry mechanism when a fault is detected.
[0150] Specifically, when cloud devices encounter sudden failures such as server downtime, network interruption, or analysis process crashes, forcing the interruption of tasks such as video frame splitting, AI detection, and result statistics, a fully automated "fault detection → status marking → data recovery → task resumption" mechanism is activated, triggering data backup and retry mechanisms. Data backup ensures that acquired video data, intermediate processing results (such as split image frames), and phased analysis results are persistently stored. The retry mechanism automatically executes the breakpoint resumption logic based on the task status marked before the failure and the backed-up data. This ensures the robustness and data integrity of image analysis tasks.
[0151] Another embodiment of this application provides a parasite egg detection device that can be configured on a cloud device. Figure 8 This application provides a schematic diagram of the parasite egg detection device according to one embodiment. Figure 8 As shown, the parasite egg detection device 80 includes the following modules.
[0152] The acquisition module 81 is used to acquire multiple detection images collected by the microscope device for the fecal sample of the animal to be tested.
[0153] The detection module 82 is used to detect multiple detection images using a parasite egg detection model and generate parasite egg detection information corresponding to the fecal sample of the animal to be detected. The parasite egg detection information includes the type and quantity of parasite eggs corresponding to each detection image.
[0154] The parasite egg detection model includes a backbone feature extraction network, a multi-scale feature fusion network, and a head network connected in sequence.
[0155] The backbone feature extraction network is used to extract features at different levels for each detected image, thereby obtaining multi-layer original feature maps for each detected image.
[0156] The multi-scale feature fusion network is used for feature extraction based on channel information mixing and spatial information mixing operations. It samples and fuses features from adjacent layers in the multi-layer original feature maps of each detection image to obtain a multi-layer feature enhancement fusion map of each detection image.
[0157] The head network is used to generate parasite egg detection information corresponding to the animal fecal sample to be detected based on the multi-layer feature enhancement fusion map of each detection image.
[0158] It should be understood that the specific features, operations, and details described herein with respect to the methods of this application can also be similarly applied to the apparatus of this application, or vice versa. Furthermore, each step of the methods of this application described above can be performed by a corresponding component or unit of the apparatus of this application.
[0159] It should be understood that the various modules / units of the device of this application can be implemented wholly or partially through software, hardware, firmware, or a combination thereof. Each module / unit can be embedded in the processor of the electronic device in hardware or firmware form or independent of the processor, or it can be stored in the memory of the electronic device in software form for the processor to call to execute the operation of each module / unit. Each module / unit can be implemented as an independent component or module, or two or more modules / units can be implemented as a single component or module.
[0160] The implementation scheme of this application also provides a cloud device. Figure 9 This application shows a schematic diagram of the structure of a cloud device provided in one embodiment, such as... Figure 9 As shown, the cloud device 90 includes a processor 91 and a memory 92 storing computer program instructions. The processor 91 executes the computer program instructions to implement the steps of the parasite egg detection method described above.
[0161] In one embodiment, the cloud device 90 may include a network interface, a communication interface, etc., connected via a system bus. The network interface and communication interface of the cloud device 90 can be used to connect and communicate with external devices via a network.
[0162] This application provides a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the above-described parasite egg detection method.
[0163] The implementation scheme of this application also provides a parasite egg detection system. Figure 10 This application provides a schematic diagram of the architecture of a parasite egg detection system according to one embodiment. Figure 10 As shown, the parasite egg detection system 100 may include the cloud device 90, microscope device 110, and mobile electronic device 120 as described in the above embodiments. The microscope device 110 is equipped with a camera from the mobile electronic device 120 to acquire multiple detection images of the animal feces to be tested.
[0164] In one embodiment of this application, the microscope device includes a stage (with a sample clamp to prevent smear slippage), a focusing knob (manually adjustable with clear scale and minimum adjustment accuracy of 0.01mm), an LED light source, and a camera interface (compatible with mainstream mobile phone cameras with a diameter of 20-30mm, with an anti-slip pad at the interface to ensure stability of the mobile phone during shooting).
[0165] In one embodiment of this application, the mobile electronic device 120 can be a mobile phone.
[0166] Specifically, the camera of the mobile electronic device 120 is aimed at the imaging port of the microscope device, and the field-of-view scanning function of the microscope device is activated (that is, a single inspection can automatically scan more than 100 inspection fields, and the dwell time of each field can be fixed at 2 seconds). At the same time, the camera function of the mobile electronic device is activated, so as to record the complete microscopic imaging video of "more than 100 fields". The frame splitting operation can be performed on the local or cloud device to obtain multiple inspection images.
[0167] With the above system configuration, users can directly capture video of the field of view during the scanning process using their own devices, without the need to purchase additional shooting equipment, making it convenient for users to conduct parasite egg detection at home.
[0168] In some embodiments of this application, the method for adjusting the microscope device includes, when using it for the first time, the user can adjust the focal length using a "standard calibration sheet" (containing simulated insect eggs of known size), and rotate the focusing knob until the simulated insect eggs on the calibration sheet are clearly imaged. Subsequent tests can directly use this focal length parameter (if the sample thickness changes, fine adjustment is sufficient).
[0169] In some embodiments of this application, the mobile electronic device 120 can send the collected video data or multiple detection images to a cloud device.
[0170] In some embodiments of this application, the cloud device 90 can send parasite egg detection information and a post-processed detection report to the mobile electronic device 120 for user viewing.
[0171] In addition, the mobile electronic device 120 stores the test results.
[0172] In one embodiment of this application, the mobile electronic device 120 is equipped with parasite egg detection software. This parasite egg detection software serves as the core for user interaction and data transfer, supporting both Android and iOS systems. Its core functions include three main modules: data upload, result display, and data storage.
[0173] Specifically, the data upload module allows users to directly upload captured "microscope field-of-view scanning videos" to cloud devices. A progress bar can be displayed during the upload process, and it supports resuming interrupted uploads (to avoid data loss due to network interruption).
[0174] Results Display Module: After receiving the test report from the cloud device, it displays key information in a visual format, including but not limited to: Core test results: the type of parasite eggs (such as roundworm eggs, hookworm eggs, tapeworm eggs, etc.) and the quantity (such as "5 roundworm eggs detected / 100 fields of view"); Image auxiliary information: original test field image (i.e., test image), labeled image (the location of suspected parasite eggs is marked with boxes or highlights, and the type is labeled); Health advice: personalized advice is generated based on the test results (such as "a small number of roundworm eggs were detected, it is recommended to consult a veterinarian for deworming medication" and "no parasite eggs were detected, it is recommended to have regular monthly tests").
[0175] Data storage module: Automatically stores all historical detection data, including detection time, detection report, original field of view image and labeled image. It supports users to retrieve historical records by "detection date" and "parasite egg type", which is convenient for long-term tracking of the intestinal health status of the detected animals.
[0176] In addition, the parasite egg detection software interface has three core entry points: "Egg Detection," "History Records," and "Health Knowledge Base." a) "Egg Detection" entry: Clicking this displays a "Shooting Guide" (including illustrated tutorials on device setup and video shooting), with "Select Video" and "Start Upload" buttons below; b) "History Records" entry: Displays all test records in reverse chronological order by "Test Date," with each record showing "Test Time, Egg Type, and Quantity." Clicking this allows you to view the complete report and images; c) "Health Knowledge Base" entry: Provides popular science knowledge about common animal intestinal parasites (such as infection symptoms and prevention methods) to help users understand the test results.
[0177] In one embodiment of this application, the parasite egg detection software and the cloud device use the HTTPS protocol to transmit data, and the video file is uploaded in segments (e.g., each segment is 5MB) to ensure transmission security and efficiency; the report data is in JSON format, which is convenient for software parsing and display.
[0178] In some embodiments of this application, cloud device 90 can send a pre-trained parasite egg detection model to mobile electronic device 120 so that users can perform parasite egg detection using mobile electronic devices.
[0179] In some embodiments of this application, the cloud device 90 may be configured with a cloud AI analysis system, which may include, but is not limited to, the following modules.
[0180] The video quality analysis module's core function is to screen the quality of detection images or video data uploaded from mobile electronic devices to determine whether they meet the detection requirements and avoid invalid analysis.
[0181] The AI detection module's core function is to identify parasite eggs in key frame images (i.e., detection images) of qualified videos, accurately determining the type and quantity of eggs.
[0182] Specifically, the parasite egg detection model in this application's first implementation scheme is based on the YOLO11 framework, with the following improvements: innovative optimizations at the data level, such as using adaptive resampling measurement; optimizations in the loss function, such as dynamically adjusting loss weights and adding an enhanced mutual exclusion loss function for cases of egg aggregation and occlusion; optimization of the model structure, such as the local embedding scheme of the UIB module (focusing on efficiency optimization of the multi-scale feature extraction network) and the independent embedding scheme of the Mobile MQA module (focusing on balancing detection accuracy and speed); and optimization of the training strategy, such as a multi-stage training strategy, which can achieve multiple safeguards. Thus, the model's recognition accuracy is ultimately ensured to be ≥98%.
[0183] The results analysis and processing module's core function is to post-process the results output by the AI detection module, correct false detections, and perform result statistics, thereby eliminating invalid results and ensuring the accuracy of the report.
[0184] In one implementation scheme of this application, if a server failure occurs during the analysis process, the cloud-based AI system automatically triggers a "data backup" and "retry mechanism" to ensure that the user-uploaded videos and analysis results are not lost.
[0185] In some implementation schemes of this application, the cloud device can be deployed with commercial or private servers, adopting a "containerized (Docker) + load balancing" architecture, supporting 1000+ users to upload videos simultaneously, with an analysis response time of ≤5 minutes (single video analysis time).
[0186] Compared with existing technologies for detecting parasite eggs in animal feces, the system provided in this application has the following advantages: 1. High ease of operation: No professional knowledge or equipment is required. Users can complete sample preparation, video shooting and uploading at home. The total testing time (including analysis) is ≤5 minutes, which is far less than the 1-2 days of traditional hospital testing.
[0187] 2. High detection accuracy: Through triple protection of "video quality screening + deep learning AI detection + false detection correction", the detection results are highly accurate, with an accuracy rate of ≥98% for identifying parasite eggs. It can also accurately distinguish the type and quantity of parasite eggs, avoiding misjudgment and omissions caused by traditional manual observation.
[0188] 3. Good data traceability: The software can automatically store all historical test data (reports, raw images, and labeled images), and users can query and compare test results at different times at any time, which is convenient for tracking changes in animal intestinal health.
[0189] 4. Excellent cost and adaptability: The microscope device has a simple structure and low cost, and supports users to take pictures with their own equipment without the need to purchase additional special shooting equipment, thus reducing the user's operating costs.
[0190] 5. High degree of result visualization: The detection results are displayed by combining "raw image + labeled image," allowing users to intuitively see the location and morphology of the eggs, such as... Figure 11 As shown, this enhances the confidence in the test results.
[0191] The technical solution of this application will be further described below with reference to specific embodiments, but the scope of protection of this application is not limited to the following embodiments.
[0192] Sample preparation and device setup: The user collects animal fecal samples and prepares glass slides. After processing the samples, they are placed on the stage of the microscope device, and the focus of the device is adjusted until the field of view is clear.
[0193] Video recording: Point your mobile phone camera at the microscope's imaging port, press the start button to activate the microscope's field-of-view scanning function, and simultaneously start recording video on your mobile phone to fully record the microscopic imaging video of "more than 100 fields of view".
[0194] Video Upload: Open the parasite egg detection software, enter the "Egg Detection" function module, select the video file you have recorded, and click "Upload". The software will automatically transmit the video to the cloud AI analysis system.
[0195] Cloud-based analysis: The cloud-based AI analysis system sequentially initiates "Video Quality Analysis → AI Detection → Result Analysis and Processing". If the video quality is substandard, the app receives a "Reshoot" prompt; if the video quality meets the standards, the system generates a detection report after completing the analysis (including insect egg type, quantity, original image, labeled image, and health recommendations).
[0196] Results feedback and storage: The cloud pushes the test report to the self-developed test APP, and users can view the results by opening the APP; at the same time, the APP automatically stores all data (report, images) of the test, which can be queried later.
[0197] Those skilled in the art will understand that the method steps of this application can be performed by a computer program instructing related hardware, such as a processor. The computer program can be stored in a non-transitory computer-readable storage medium, and its execution causes the steps of this application to be performed. Depending on the context, any reference herein to memory, storage, or other media may include non-volatile or volatile memory. Examples of non-volatile memory include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid-state drive, etc. Examples of volatile memory include random access memory (RAM), external cache memory, etc.
[0198] The technical features described above can be combined arbitrarily. Although not all possible combinations of these technical features are described, any combination of these technical features should be considered to be covered by this specification, provided that such combination does not contain contradictions.
[0199] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A method for detecting parasite eggs, characterized by, include: Acquire multiple images of fecal samples from animals to be tested using a microscope. The parasite egg detection model is used to detect the multiple detection images to generate parasite egg detection information corresponding to the fecal sample of the animal to be detected. The parasite egg detection information includes the type and quantity of parasite eggs corresponding to each detection image. The parasite egg detection model includes: a backbone feature extraction network, a multi-scale feature fusion network, and a head network connected in sequence; The backbone feature extraction network is used to extract features at different levels for each of the detected images to obtain multi-layer original feature maps for each of the detected images; The multi-scale feature fusion network is used for feature extraction based on channel information mixing operation and spatial information mixing operation. It samples and fuses features of adjacent layers in the multi-layer original feature map of each detection image to obtain a multi-layer feature enhancement fusion map of each detection image. The head network is used to generate parasite egg detection information corresponding to the fecal sample of the animal to be detected based on the multi-layer feature enhancement fusion map of each detection image.
2. The method of claim 1, wherein, The multi-scale feature fusion network includes a sampling group, a fusion group, and a core feature processing group. The core feature processing group includes multiple core feature processing modules, the sampling group includes multiple sampling modules, and the fusion group includes multiple fusion modules. The sampling group, the fusion group, and the core feature processing group constitute a unidirectional or bidirectional sampling fusion path.
3. The method of claim 2, wherein, The core feature processing module includes a split convolutional layer, multiple stacked general inverted bottleneck UIB blocks, a direct-connect convolutional layer, and a fusion convolutional layer; wherein, the direct-connect convolutional layer and the multiple stacked UIB blocks are arranged in parallel between the split convolutional layer and the fusion convolutional layer. The split convolutional layer is used to perform initial dimensionality transformation and preliminary feature extraction on the input feature map to obtain the main path feature map and the direct connection path feature map. The direct-connect convolutional layer is used to adjust the number of channels in the direct-connect feature map so that the number of channels is consistent with the number of channels output by multiple stacked UIB blocks, and to input the adjusted direct-connect feature map into the fusion convolutional layer. The multiple stacked UIB blocks are used to perform channel information mixing and spatial information mixing operations on the main path feature map, and input the main path feature map after mixing operations into the fusion convolutional layer. The fusion convolutional layer is used to concatenate and fuse the adjusted direct path feature map with the main path feature map after the mixing operation to obtain a feature enhancement map corresponding to the input feature map.
4. The method according to claim 3, characterized in that, The UIB block is an additional depth convolution variant structure; The additional depth convolutional variant structure includes a front depth separable convolutional layer, a channel expansion layer, an intermediate depth separable convolutional layer, an additional depth separable convolutional layer, and a channel projection layer connected in sequence. The pre-deep separable convolutional layer is used to perform spatial information mixing on the input feature map; The channel extension layer is used to perform channel dimension upscaling on the feature map after spatial information mixing. The intermediate depth separable convolutional layer is used to extract spatial features from the upgraded feature map in the upgraded high-dimensional channel space. The additional depth separable convolutional layer is used to perform additional spatial blending operations on the feature map after spatial feature extraction. The channel projection layer is used to reduce the channel dimension of the feature map after the additional spatial mixing operation.
5. The method according to any one of claims 2 to 4, characterized in that, When the sampling group, the fusion group, and the core feature processing group form a unidirectional sampling fusion path, the number of sampling modules in the sampling group is equal to the number of fusion modules in the fusion group, and is one less than the number of original feature maps, and the number of core feature processing modules in the core feature processing group is one more than twice the number of sampling modules. The core feature processing group includes a first core feature processing module set before the sampling module, which is used to extract features from an original feature map of other levels (excluding the highest or lowest level) of the multi-layer original feature map based on channel information mixing operation and spatial information mixing operation, so as to obtain an initial feature enhancement map of other levels. The fusion module is located after the sampling module and is used to fuse an initial feature enhancement map of another level after sampling with the initial feature enhancement map of the adjacent level to obtain a feature fusion map of the adjacent level. The core feature processing group also includes a second core feature processing module set after the fusion module, which is used to extract features from the feature fusion map of the adjacent layers based on channel information mixing operation and spatial information mixing operation to obtain a feature-enhanced fusion map of the adjacent layers. The core feature processing group also includes a third core feature processing module directly set before the fusion module, which is used to extract features from the lowest or highest level of the original feature map in the multi-layer original feature map based on channel information mixing operation and spatial information mixing operation, so as to obtain the initial feature enhancement map of the lowest or highest level.
6. The method according to any one of claims 2-4, characterized in that, When the sampling group, the fusion group, and the core feature processing group form a bidirectional sampling fusion path, the sampling group includes an equal number of upsampling modules and downsampling modules, and the number of upsampling modules is one less than the number of layers in the multi-layer original feature map; The fusion group includes a first fusion module disposed after the upsampling module and a second fusion module disposed after the downsampling module; The core feature processing group includes a fourth core feature processing module located before the upsampling module, a fifth core feature processing module located after the first fusion module, a sixth core feature processing module located after the second fusion module, and a seventh core feature module located before the downsampling module. The fourth core feature processing module is used to extract features from the original feature map of the current level (excluding the lowest level) based on channel information mixing operation and spatial information mixing operation to obtain an initial feature enhancement map of the current level. The seventh core feature processing module is used to extract features from the lowest-level original feature map based on channel information mixing operation and spatial information mixing operation to obtain the lowest-level initial feature enhancement map. The upsampling module is used to upsample the initial feature enhancement map of the current level to obtain the first sampled feature map of the current level. The first fusion module is used to fuse the first sampled feature map of the current level with the initial feature enhancement map of the next level to obtain the initial feature fusion map of the next level. The fifth core feature processing module is used to extract features from the initial feature fusion map of the next level based on channel information mixing operation and spatial information mixing operation to obtain the intermediate feature enhancement map of the next level. The downsampling module is used to downsample the intermediate feature enhancement map of the next level to obtain the second sampled feature map of the current level. The second fusion module is used to fuse the intermediate feature enhancement map of the previous level with the second sampled feature map of the current level to obtain the intermediate feature fusion map of the current level. The sixth core feature processing module is used to extract features from the intermediate feature fusion map of the current level based on channel information mixing operation and spatial information mixing operation, so as to obtain the feature enhancement fusion map of the current level.
7. The method according to any one of claims 1 to 4, characterized in that, The parasite egg detection model also includes a mobile multi-query attention module; The mobile multi-query attention module is configured in the head network and is used to perform feature weighting on the feature-enhanced fusion graph group based on an attention mechanism where multiple query heads share the same set of key and value matrices, to obtain a feature-enhanced fusion graph group with enhanced features; or... The mobile terminal multi-query attention module is set in the multi-scale feature fusion network. It is used to perform feature weighting on the intermediate and higher-level feature enhancement fusion graphs in the feature enhancement fusion graph group based on the attention mechanism of multiple query heads sharing the same set of key and value matrices, and output the feature enhancement fusion graph of the intermediate level after feature enhancement.
8. The method according to any one of claims 1-4, wherein during the training phase, the loss function of the parasite egg detection model includes a weighted cross-entropy loss function and an enhanced repulsion loss function; The weight coefficients in the weighted cross-entropy loss function are determined by the product of the base weights and the dynamic correction factor, which is determined based on the current recall rate of each type of parasite egg. The enhanced repulsion loss function is the sum of the attraction loss, the repulsion loss for the ground truth boxes, and the repulsion loss for the predicted boxes. The attraction loss is determined based on a penalty factor, which is determined based on the predicted boxes and the labeled boxes.
9. The method of claim 8, wherein, The training process of the parasite egg detection model adopts a multi-stage training strategy, which includes an initial training stage, a middle training stage, and a later training stage executed sequentially. Specifically, an adaptive resampling strategy is used to dynamically adjust the class distribution of training samples at each training stage: In the initial training phase, the sampling weight of head category samples is increased so that the head category samples account for the highest proportion of the training samples in this phase. During the intermediate training phase, the sampling weights of each category of samples are balanced so that the proportion of head, middle and tail categories of samples in the training samples meets the preset balance threshold. In the later training phase, the sampling weight of tail category samples is increased so that tail category samples account for the highest proportion of training samples in this phase.
10. The method of claim 9, wherein, The adaptive resampling strategy includes: Obtain the raw sampling probability of each class sample in the initial training dataset; Based on the smoothing factor corresponding to each training stage and the original sampling probability, the sampling weight of each category sample in each stage is generated. Based on the sampling weights, the initial training data is collected to obtain training samples that meet the training requirements of each stage.
11. A device for detecting parasite eggs, characterized in that include: The acquisition module is used to acquire multiple detection images collected by the microscope device from the fecal sample of the animal to be tested; The detection module is used to detect the multiple detection images using a parasite egg detection model, and generate parasite egg detection information corresponding to the fecal sample of the animal to be detected. The parasite egg detection information includes the type and quantity of parasite eggs corresponding to each detection image. The parasite egg detection model includes: a backbone feature extraction network, a multi-scale feature fusion network, and a head network connected in sequence; The backbone feature extraction network is used to extract features at different levels for each of the detected images to obtain multi-layer original feature maps for each of the detected images; The multi-scale feature fusion network is used for feature extraction based on channel information mixing operation and spatial information mixing operation. It samples and fuses features of adjacent layers in the multi-layer original feature map of each detection image to obtain a multi-layer feature enhancement fusion map of each detection image. The head network is used to generate parasite egg detection information corresponding to the fecal sample of the animal to be detected based on the multi-layer feature enhancement fusion map of each detection image.
12. A cloud device, comprising: The cloud device includes a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the steps of the parasite egg detection method according to any one of claims 1 to 10.
13. A system for detecting parasite eggs, characterized by Includes the cloud device, microscope apparatus, and mobile electronic device as described in claim 12; wherein, The microscope device can be equipped with a camera of the mobile electronic device to acquire multiple detection images of the feces of the animal to be tested.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the parasite egg detection method as described in any one of claims 1 to 10.