Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Referring to fig. 1-7, the invention provides a midge larva recognition system based on deep learning and image recognition, which can realize automatic recognition, classification and statistical analysis of midge larva. The system realizes efficient and accurate detection and identification of the midge larvae through combination of automatic sample processing, image acquisition, image superposition processing, deep learning identification and automatic classification and statistical analysis modules of the species, and provides technical support for biological monitoring and aquatic ecological environment monitoring. The following detailed description of the invention refers to the accompanying drawings:
The image acquisition module is one of the core components of the whole system and is used for acquiring multi-focal plane images of the midge larvae. The module is combined with a high-resolution digital camera through precise optical imaging equipment, so that high-precision imaging of the microstructure of the midge larva is ensured, and high-quality image data is provided for subsequent image processing and deep learning identification.
The optical microscope 10 is a core imaging device in an image acquisition module for high magnification observation of a chironomid larva sample. The optical microscope mainly comprises a transmission light source 11, an objective 12 and an objective table 13, and ensures the visibility and high-precision imaging of a sample. The concrete explanation is as follows:
the transmissive light source 11 is used to provide uniform and stable illumination, ensuring that transmitted light is formed beneath the sample, making each microstructure of the sample clearly visible. The brightness of the transmission light source 11 can be adjusted according to the requirements of different samples, so that the influence of the too strong or the too weak light on the image quality is avoided.
Objective 12 the optical microscope 10 is equipped with an objective 12 of various magnifications, e.g. 10-fold, 40-fold, 100-fold, the user being able to select the appropriate objective magnification depending on the sample size. Objective 12 has high optical transmittance and is capable of magnifying microscopic structures of the midge larvae, such as the chin plate, tail bristles and inner labial bar, ensuring a clear characteristic.
A digital camera 14 is mounted above the microscope's objective lens for capturing an image of the sample imaged by the optical microscope. The camera has high resolution, typically 2000 ten thousand pixels or more, and is capable of recording detailed images of the midge larvae in a high definition manner. The specific functions are as follows:
resolution-high resolution cameras can ensure that each fine feature of the midge larvae is captured, especially under high magnification, ensuring that the images are clear and undistorted.
The camera is provided with an automatic focusing function, so that the focal length can be automatically adjusted when shooting in multiple focal planes, the sample is ensured to be in an optimal imaging state on each focal plane, and blurred images are avoided.
And the camera supports a high frame rate continuous shooting mode, so that continuous image acquisition of different focal planes is completed in a short time, and the working efficiency is improved. More than 5 frames of images are shot per second, so that the integrity of the sample is ensured.
The digital camera 14 is connected with a computer through a high-speed data transmission interface (such as a USB 3.0 or higher standard interface) to transmit the collected image data in real time, so that the high-efficiency processing of the data is ensured. The data transmission speed can reach more than 5Gbps, and the stability of image transmission is ensured.
The computer 20 serves as a core control unit of the image acquisition module and is responsible for managing the entire image acquisition process. The computer is built with special control software which can interact with the digital camera 14 and the optical microscope 10, automatically control various parameters in the image acquisition process, and store and manage the acquired images. The functions of the method include:
And in the automatic control, through presetting acquisition parameters, the computer 20 can automatically control the operations of exposure, focusing, shooting speed and the like of the camera, so that manual intervention is reduced, and the precision and efficiency are improved.
Real-time image display, in which the computer can display the image in real time in the acquisition process, so that an operator can monitor the imaging quality and carry out necessary parameter adjustment.
And (3) storing the images, namely automatically storing the acquired images to local or network storage equipment, and naming file names by time stamps or sample numbers so as to facilitate subsequent retrieval and processing. The system supports multiple image format stores including RAW, JPEG, and TIFF formats.
The multi-focal plane automatic control unit is connected with the computer 20 and the three-axis electric object stage 15 and is responsible for automatically acquiring images under the multi-focal plane. By adjusting the Z axis of the microscope, images of the sample at different focal lengths can be continuously acquired. The multi-focal plane automatic control unit functions as follows:
The Z axis is automatically adjusted, and the unit can accurately adjust the position of the sample on the Z axis, so that the focuses of images collected under different focal lengths are different, and information of different depths of the sample is obtained. The adjustment range can be precisely controlled at the micron level, and each step is moved by 1-2 microns, so that multi-level detail images are ensured to be acquired.
And setting a focal length range, wherein a user can preset the focal length range and the shooting interval through a software interface, and the system automatically adjusts the focal length according to the settings and completes image acquisition. Typically, a depth range of 0 to hundreds of microns may be covered to ensure complete recording of the various layers of information of the sample.
The XYZ three-axis motorized stage 15 is used to fix the sample and make fine adjustments in XYZ directions. In image acquisition, the stage mainly performs the following functions:
X and Y movement the stage can be moved in the horizontal direction (X and Y axes) to ensure that the entire sample area is scanned. For large-size samples, scanning imaging of the full area can be accomplished by multi-field image stitching techniques.
And the Z direction moves, namely, the object stage is matched with the multi-focal-plane automatic control unit, and the height of the sample is accurately adjusted along the Z axis direction, so that the camera can acquire images under different focal planes. The Z-axis adjusting precision reaches the micron level, so that each layer of focal plane can clearly present the structural information of the sample.
The software control interface is used as a user interaction platform of the computer system and is responsible for visual control of the whole image acquisition process. An operator may complete a series of acquisition settings and operations through an interface, including:
and the exposure and focusing settings are that an operator can manually or automatically adjust parameters such as exposure time, focal length, light brightness and the like of the camera to ensure the best quality of image acquisition.
And the acquisition mode selection is that the system supports a plurality of image acquisition modes, including single-view multi-focal-plane acquisition and multi-view scanning acquisition, and a user can select a proper mode according to requirements.
Image previewing and monitoring, namely previewing the acquired image in real time, and timely adjusting acquisition parameters to avoid acquisition errors caused by image blurring or improper exposure.
The whole flow of the image acquisition module is as follows:
1. the operator sets acquisition parameters including focal length range, exposure time and shooting interval through a software control interface.
2. The sample is adjusted to a proper position by an XYZ three-axis electric stage 15, and the optical microscope 10 is matched with the transmission light source 11 to provide stable illumination.
3. The digital camera 14 begins multi-focal plane image acquisition at different focal lengths and the images are transmitted in real time to the computer 20 via the data transmission interface.
4. The computer 20 manages and stores the acquired images, and an operator can monitor the acquisition process in real time through a software interface to ensure the image quality.
The image acquisition module realizes multi-level and high-precision image acquisition of the midge larvae through the organic combination of the precise optical microscope 10, the high-resolution digital camera 14, the three-axis electric object stage 15 and the computer 20. The components are mutually matched, so that complete depth information of the sample is obtained under different focal planes, and high-quality image data is provided for subsequent image processing and identification.
The automated sample processing device 30 is an important component in the system and is responsible for the transport, positioning and fixing of the chironomus larva samples to ensure that the samples are in a stable state during microscopic imaging and can be accurately collected under multiple fields of view and multiple focal planes. Since the body length of each midge larva is usually 1-2 cm, the system can perform certain number control in a single visual field so as to ensure the stable positioning and imaging quality of the sample. Through automatic adjustment and various processing operations to the sample position, errors in manual operation are avoided, and accuracy and efficiency of imaging and identification processes are greatly improved.
The sample loading system is responsible for automatically conveying the chironomus larva samples from the storage container to the imaging area, and ensuring that the number of the samples in the field of view is controlled to be 1 during each imaging, so as to avoid that a plurality of samples interfere with the imaging quality. The specific structure and functions include:
Sample feeding device the chironomus larva sample is transported from the sample bottle to the imaging position by a feeding hose 32. The system has the function of controlling sample flow, can accurately adjust the sample injection speed of a sample, and ensures that only one midge larva individual is contained in each view field. The sample feeding hose 32 is connected to a sample liquid bottle 31 and a peristaltic pump 33, and the sample is transported under controlled liquid flow to an imaging location above the stage.
Peristaltic pump 33 is used to precisely control the flow rate of a liquid sample to avoid too fast a flow of the sample affecting the positioning or imaging of the sample. By adjustable control of peristaltic pump 33, the system is able to adjust the liquid flow rate according to the type and density of the sample, ensuring that the sample is stably and continuously transferred to the imaging area. The peristaltic pump head applies proper compression to the sample introduction hose 32 to push the liquid flow without direct contact with the liquid, thereby avoiding contamination or sample damage. In addition, as the body length of the midge larva is 1-2 cm, the peristaltic pump can control the sample feeding speed of the sample according to preset parameters, so that only 1 complete individual is captured each time within the visual field limit. Peristaltic pumps control sample flow at a low rate through a hose, preventing multiple samples from entering the imaging region.
The sample processing sample holding groove 35 is a key area for flowing and collecting samples on the object stage, and the interior of the groove is connected with the sample feeding hose 34 through the peristaltic pump 33 to inject the chironomus larva sample, so that the imaging and detection of a microscope are facilitated. And injecting a midge larva sample into the groove through a peristaltic pump, and controlling the flow and the number of the samples through software. Specific features of the sample processing well include:
Liquid control after filling the sample processing well with liquid sample by peristaltic pump 33, the system will adjust the liquid flow rate and amount as needed to ensure that the sample remains properly observed in the well. Liquid control has a large impact on the stability of the sample and proper flow rates facilitate proper positioning of the sample within the microscope field of view.
The waste liquid treatment system is used for collecting waste liquid generated in the imaging process, and ensures the cleaning of experimental environment and the safe treatment of samples. The functions of the method include:
The waste liquid guiding device is connected with the discharging hose 36, and the sample waste liquid is led into the waste liquid treatment system. The discharge hose 36 is connected to the sample container 35, and introduces the excess liquid into the waste liquid tank 37, thereby preventing the sample from overflowing or contaminating the stage.
Workflow of automated sample processing device:
1. The sample loading system transfers the chironomus larva sample from the sample storage bottle to the sample processing well 35 by peristaltic pump 33, ensuring that only one individual at a time in the field of view enters the imaging region.
2. The sample is precisely moved in the XYZ direction through the triaxial electric object stage 15, and is automatically adjusted to different fields of view and focal planes, so that the image acquisition of the sample under multiple fields of view and multiple focal planes is completed.
3. And the waste liquid generated in the collection process is discharged through the sample waste liquid treatment system, so that the cleaning of the experimental environment is ensured.
Automated sample processing device 30 achieves a fully automated operation from sample loading to imaging by integrating a sample loading system, peristaltic pump 33, tri-axial motorized stage 15, and waste treatment system. And ensure that only 1 individual is contained in the field of view in each imaging process, avoiding a plurality of samples from interfering with the image quality. The device ensures the stability and accuracy of the sample in the whole imaging process, avoids errors in manual operation, and provides a reliable sample processing basis for high-precision midge larva identification and classification.
In some embodiments, the upper surface structure of the tri-axial motorized stage 15 of the automated sample processing device 30 is optimally designed to accommodate different types of sample processing requirements. To meet the special application of manual operation, especially in the case of needing to perform manual operation on the chironomus larvas, a slide groove 40 for placing slides is added in the system, and a flow design for manually sucking sampling liquid, placing slides and tabletting is provided. The following is a detailed description of this embodiment.
Structural design of slide groove
A slide groove 40 is provided on the upper surface of the three-axis motorized stage 15 for firmly holding a slide desired under a microscope. The slide groove is designed into a groove structure conforming to the size of a standard microscope slide, and has the following functions:
the slide is stably placed, the slide groove 40 can fix the position of the slide, so that slide or shift of the slide in the moving process of the objective table is avoided, and the sample is ensured to be stable in the tabletting and imaging processes.
In some operations, the user can process the sample solution in the sample well 35 by manually sucking it up and dropping it onto the surface of the slide. The operation is suitable for a sample liquid processing scene needing manual control, and comprises the following steps:
1. sample liquid sucking, namely, a user sucks a proper amount of sample liquid from the sample processing sample containing groove 35 through a manual suction pipe. The manual suction tube has reasonable volume design, can absorb a proper amount of liquid at one time, and avoids excessive sample liquid from being injected on a slide.
2. Slide placement a user places a standard sized microscope slide into slide well 40. The slide well 40 has a suitable depth and boundaries to ensure that the slide is firmly placed within the well.
3. And the sample liquid is injected, namely the user uniformly drops the sucked sample liquid on the glass slide, and the sample liquid is uniformly distributed on the surface of the glass slide, so that the fixing of a sample and the subsequent tabletting operation are facilitated.
Manual tabletting process of sample liquid
After the sample liquid is instilled on the glass slide, the system can carry out tabletting treatment on the sample liquid through a tabletting device, so that the chironomus larva sample is uniformly and stably attached to the glass slide. The manual tabletting comprises the following specific processes:
Sample spreading, namely, after the sample drops are dropped into a slide, the chironomus larva sample is distributed on the surface of the slide. The user can more uniformly distribute the sample in the central region of the slide by properly swinging or tilting the slide, thereby facilitating subsequent observation and imaging.
And (3) manual tabletting, namely, carrying out tabletting treatment on the samples by a user through a system or manually adjusting the strength of a tabletting device. The sheeting apparatus applies uniform pressure to cause the chironomus larva sample to adhere evenly to the slide, particularly for micro-structures such as chin plates and tail bristles, and the sheeting operation helps to reveal these critical parts of the sample more clearly.
Recognition process after sample liquid tablet
After manual compression is completed, the system automatically enters an image acquisition and recognition stage. At this point, the sample on the slide has been fixed and leveled, ensuring that high resolution microscopic imaging is enabled and that the microstructure of the sample is identified. The specific identification process is as follows:
Automatic positioning, namely, a slide placed in a slide groove can be adjusted along with the XYZ direction of the three-axis electric object stage 15 to enter the view field of a microscope, and the system ensures that a key area of a sample is positioned at the center of a microscope lens through the accurate movement of the XYZ axis.
Multi-focal plane image acquisition the system performs multi-focal plane image acquisition on the pressed sample by combining the digital camera 14 and the optical microscope 10. By adjusting the Z-axis direction, the system can acquire image information of the sample at different depths, and ensure that all key structures (such as chin plate, tail bristles and the like) of the sample can be imaged clearly in a focal range.
And deep learning identification, namely carrying out feature extraction and automatic classification on the acquired image through an image processing module and a deep learning identification module. The deep learning model can automatically classify the types and subfamilies of the midge larvae according to different microstructures of the samples, and store the results in a database.
Advantages and application scenarios of manual operation
The manual aspiration and compression mode of operation provides flexibility for certain specific experimental requirements. The following are the advantages and applicable scenarios of this embodiment:
The operation is flexible, through manual suction and tabletting, a user can carry out fine control on sample processing, and the method is particularly suitable for processing special or precious samples, and sample damage or error possibly generated in the full-automatic process is avoided.
The manual operation flow is suitable for the scene requiring special treatment of the sample, and if different fixing agents or coloring agents are required to be added into different samples, the manual operation enables the sample treatment to be more flexible.
In the scene of repeatedly treating a sample, adjusting the concentration of the sample liquid or testing different experimental conditions, the manual operation can be matched with an automatic device for use, so that the experimental effect is optimized.
The embodiment provides a flexible manual operation flow for the system, and particularly designs the functions of a slide groove, a manual suction tube and a tabletting operation, so that a user can manually suck sampling liquid, instill a slide and carry out the tabletting operation. The operation mode provides more controllability and flexibility for the sample processing process, and is suitable for experimental scenes needing fine control.
The image overlay processing module 50 is one of the key components of the system and is responsible for fusing and processing data from the multi-focal plane images to generate a high resolution image with a complete depth of focus. Through the processing of the module, the sample images of the midge larvae at different depths can be precisely aligned and overlapped to generate an image of a full focal plane. The quality of the image is greatly improved, and key characteristics of the midge larvae, such as chin plates, inner lip bars, tail bristles and the like, can be ensured, so that the midge larvae can be clearly displayed in a single image.
The multi-focal plane image acquisition unit 51 acquires the images of the midge larvae in different focal planes through the combination of the XYZ three-axis electric stage 15 and the digital camera 14. Each group of image sequences contains information of different depths, and can capture the micro-structures of the midge larvae under different focal lengths.
The digital camera 14 and the microscope work cooperatively, and the system can continuously shoot on different focal planes by adjusting the height of the Z axis. Each image corresponds to the layers of the sample under different depths, the image acquisition process has high frame rate, a large number of image sequences are ensured to be acquired in a short time, and image blurring caused by movement of the sample or liquid interference is avoided.
And (3) data synchronization and caching, namely caching the acquired image into a memory in real time by the system in the acquisition process, and transmitting the acquired image to a processing module through a high-speed data interface. Image data transmission and processing are performed in parallel to ensure the high efficiency and real-time performance of the system.
The multi-scale image decomposition unit 52 is configured to decompose the multi-focal plane image into image layers with different scales by using a laplacian pyramid or gaussian pyramid method. The purpose of this step is to extract different frequency information of the image and provide data support for subsequent image fusion.
Laplacian pyramid decomposition-the unit decomposes each focal plane image into multiple scale levels using the Laplacian pyramid algorithm. Firstly, an image generates a Gaussian pyramid through a Gaussian filter, and then a difference between adjacent scale images is calculated to generate a Laplacian pyramid. The formula is as follows:
Wherein, Representing a laplacian pyramid representation of the ith focal plane image at the ith scale,Is a gaussian pyramid representation of the image.
High frequency and low frequency feature separation-by image decomposition, the low frequency (smooth region) and high frequency (edge and texture detail) information of the image can be effectively separated. The high frequency portion typically represents details and sharp edges in the image, and the low frequency portion represents illumination and a wide range of hue changes. This separation provides a basis for subsequent image fusion so that images of different focal planes can be optimally fused according to the sharpness of a particular region.
The adaptive weighted fusion unit 53 dynamically adjusts the fusion weight of each focal plane image according to the local definition, contrast and motion compensation result of each focal plane image, so as to ensure that the key detail area is optimally displayed in the final full focal plane image.
Local gradient calculation the unit evaluates the sharpness of the image by calculating the local gradient of each focal plane image. The larger the gradient, the more rich the edge and texture information of the image, indicating that the region is more sharp in the focal plane image. The gradient is calculated as follows:
Wherein, Is the gradient value of the ith focal plane image at pixel point x, y.
Local contrast calculation the system evaluates the sharpness of the image by calculating the local contrast of the image in addition to the gradient. The local contrast reflects the brightness difference of the image in a certain area and can reveal whether the image has enough visual information.
Motion compensation-if slight motion (e.g., liquid disturbance) is generated in the sample or environment during multi-focal plane image acquisition, the system corrects for these movements by motion compensation techniques. By an optical flow method or a phase correlation method, the system can estimate the motion vector of the image and compensate, and the formula is as follows:
Where v (x, y) is the motion vector of the sample at time t, I (x, y, t) is the image gray value at time t, and the motion vector is used for correction before image superimposition.
And the self-adaptive weighted fusion unit calculates the weighted value of each focal plane image according to the local gradient, the contrast and the motion compensation result. The specific calculation formula is as follows:
Wherein w i (x, y) is the weight of the ith focal plane image, For the local gradient of the image, C i (x, y) is the local contrast, M i (x, y) is the motion compensated image quality weight, and α and β are adjustment coefficients.
The image fusion unit 54 is responsible for fusing the weighted images of different scales. For each decomposition scale, the system fuses the Laplacian pyramid layers of each focal plane image according to the weighted values to generate a full focal plane image containing multiple layers of information.
And in the multi-scale fusion process, on each scale, calculating a final fusion image according to the weighted value of each focal plane image. The fusion formula is as follows:
Wherein, Is a fused image at the first scale.
And (3) layer-by-layer fusion, namely, the fusion process starts from the lowest scale and gradually expands to high-frequency information, so that the clearest image content is ensured to be reserved on each frequency segment. In the low frequency scale, more is the fusion of illumination and color information, while in the high frequency scale, the system focuses more on detail information such as edges and textures.
The image reconstruction unit 55 is responsible for recombining the fused multi-scale images into a complete full-focus image. Through the operation of the inverse laplacian pyramid, the system can restore the size and resolution of the original image, generating a high-resolution image with complete depth of focus.
And in the image reconstruction process, the fused Laplacian pyramid is subjected to inverse transformation layer by layer, and a final full focal plane image is reconstructed. The reconstruction process is as follows:
Wherein, I fused (x, y) is the final full focal plane image after fusion, and L is the number of decomposed scales.
Feature enhancement the system can also feature enhance key structures (such as chin plate, inner cheilose and tail seta of the midge larva) in the image reconstruction process. By locally reinforcing the high frequency information, the system ensures that these micro structures are clearly shown in the final image.
Preferential fusion of feature regions
The system is particularly optimized for specific structural areas of the midge larvae. For key characteristic areas such as chin plates and tail bristles, the system gives higher weight to the areas in the fusion process, so that the areas are more prominent in the full focal plane image, and the recognition accuracy of a subsequent deep learning model is improved.
Workflow of the image superimposition processing module 50:
1. And acquiring multiple focal plane images by the system through a triaxial electric object stage and a digital camera under different focal lengths to form an image sequence.
2. And (3) multi-scale image decomposition, namely performing multi-scale decomposition on each image to generate a Laplacian pyramid and a Gaussian pyramid, and separating image information with different frequencies.
3. And (3) weighting fusion, namely dynamically adjusting the fusion weight of each focal plane image through the local gradient, the contrast and the motion compensation result, and carrying out multi-scale fusion.
4. And (3) reconstructing the image, namely reconstructing the multi-scale image into a complete full focal plane image through the inverse Laplacian pyramid process, so as to ensure that all key structures are clearly displayed.
The image superposition processing module 50 generates high-quality full-focal-plane images through multi-focal-plane image acquisition, decomposition, weighted fusion and reconstruction, and ensures that structural features of the midge larva sample at different depths can be clearly presented at the same time. The multi-scale fusion and feature region priority processing strategy of the module not only improves the overall quality of the image, but also provides high-quality data input for subsequent deep learning identification, and improves the identification accuracy and efficiency of the system.
The deep learning identification module 60 is an intelligent core of the system and is responsible for automatically identifying and classifying the full-focus image generated by the image superposition processing module. Through the multi-level feature extraction capability of a Convolutional Neural Network (CNN), the module can identify the microstructure of the midge larvae and realize accurate category classification according to the features of the midge larvae. In order to improve the robustness and the accuracy of the system, the deep learning identification module combines a plurality of sub-modules such as data preprocessing, feature extraction, classification prediction, model training, optimization algorithm and the like.
The input preprocessing unit 61 is responsible for data cleaning and preprocessing of the full-focus image output by the image superimposition processing module. In order to meet the input requirements of the deep learning model, the image needs to be subjected to operations such as normalization, enhancement, size adjustment and the like.
And (3) normalizing the image pixel value to the [0,1] interval, thereby being beneficial to accelerating the model training process and improving the convergence of the model.
Image resizing-to accommodate the input layer size of convolutional neural networks, the image needs to be resized, with a common input size of 224 x 224 or 512 x 512. The system uses bilinear interpolation to zoom the image, and ensures that detail information is reserved in the zooming process.
And in the model training stage, the data enhancement technology can generate more diversified samples, and the robustness of the model is enhanced. Common data enhancement operations include:
random rotation-image rotation within the range of [ -15 °, +15° ], preventing the model from excessively relying on a specific directionality.
Random cropping-a portion of the image is cropped randomly to simulate the diversity of the image data.
Random overturn, namely horizontally or vertically overturning the image, and enhancing the generalization capability of the model on samples at different positions.
The convolution feature extraction unit 62 is a core part of the deep learning identification module, and is responsible for extracting a high-level feature representation from an input full-focus image. The unit is based on a Convolutional Neural Network (CNN) architecture, and microstructure features of the midge larvae, such as chin plates, tail setae, inner cheilose and the like, are gradually extracted through a plurality of convolutional layers and pooling layers.
Convolution layer the convolution layer performs a sliding convolution operation on the image through a plurality of convolution kernels (typically 3×3 or 5×5 convolution kernels), extracts local features of the image, and generates a feature map (feature maps). The formula of the convolution operation is as follows:
Wherein I normalized (x, y) is the normalized full focal plane image, w (I, j) is the weight of the convolution kernel, F (x, y) is the convolution result, and b is the bias.
Activation function the convolution results are processed after each convolution layer using a nonlinear activation function (e.g., reLU) to enhance the model's ability to express nonlinear features. The activation formula of the ReLU is:
A(x,y)=max(0,F(x,y))
where a (x, y) is the output after activation.
And the pooling layer is used for performing down-dimension and down-sampling on the activated feature map so as to reduce the calculated amount and enhance the spatial invariance of the features. The usual pooling operation is maximum pooling, and the formula is as follows:
where P is the size of the pooling window, typically 2 x 2.
Stacking of convolutional layers deep convolutional neural networks are typically composed of a stack of multiple convolutional layers and pooled layers, with the network being able to extract more complex, higher-level features as the number of layers increases. For example, shallow convolutions may extract the edge and texture information of the midge larvae, while deep convolutions capture more semantic features such as microscopic shapes of the chin and tail bristles.
The feature classification unit 63 is responsible for further processing the high-level features processed by the convolution feature extraction unit, and outputting the classification result of the midge larvae. The feature classification unit comprises a full connection layer and a Softmax classifier, and comprises the following specific steps:
And the full connection layer is used for flattening the feature map output by the convolution feature extraction unit into a one-dimensional vector and transmitting the one-dimensional vector to the full connection layer (Fully Connected Layer) so as to map the high-dimensional feature into the classification space. The calculation formula of the full connection layer is as follows:
z=W·x+b
wherein W is the weight matrix of the full connection layer, x is the input feature vector, b is the bias, and z is the output feature representation.
The Softmax classifier is used for converting the output of the full-connection layer into probability distribution of various midge larvae, and the formula is as follows:
wherein z j is the score of category j, N is the number of chironomus larva categories, and p (y=j|x) is the probability that the input image belongs to category j.
The training and optimizing unit 64 is used for training and parameter optimization of the model, and updates the weights in the network through a back propagation algorithm, so that the model can learn the characteristics of the midge larvae better. The unit comprises the following key parts:
loss function the loss function of the model adopts cross entropy loss for measuring the difference between the model prediction result and the real label. The definition of cross entropy loss is:
Where y i is the true label of the sample, and p i is the prediction probability of the model output.
And the optimizer is an adaptive learning rate optimization algorithm, wherein in order to accelerate model convergence, the system adopts an Adam optimizer.
Back propagation-in each iteration, the system calculates the gradient by a back propagation algorithm and updates the network weights using an optimizer to reduce the value of the loss function. The back propagation ensures that the network can continuously correct errors, so that the prediction result of the model is more accurate.
The database interface unit 65 is responsible for storing the classification result and related information (such as image number, time stamp, classification confidence, etc.) to the database, so as to facilitate subsequent statistical analysis and data query. The unit has the following functions:
the classification result is stored, namely the result of each classification, including the type, confidence and related metadata (such as detection time and sample position) of the midge larvae are stored in a database.
Query and update the system supports query and update of historical classification results, and users can search classification records of some samples or update wrong classification results according to requirements.
Work flow of the deep learning identification module:
And the input preprocessing, namely normalizing and data enhancing the full focal plane image through an input preprocessing unit 61, and ensuring the image to adapt to the input requirement of the convolutional neural network.
Feature extraction by convolution feature extraction unit 62, the high-level features of the midge larvae are extracted layer by layer using a plurality of convolution layers and pooling layers.
Feature classification, namely mapping the extracted features into a classification space by using a full connection layer and a Softmax classifier in a feature classification unit 63, and outputting the types and the classification confidence of the midge larvae.
Training and optimizing the network by training and optimizing unit 64, updating model weights using back propagation and Adam optimizers, and continuously improving the classification accuracy of the model.
The result is stored, the classified result is stored in the database through the database interface unit 65, so that the subsequent inquiry and statistical analysis are convenient.
The deep learning recognition module can accurately recognize microstructure features of the midge larvae through the organic combination of data preprocessing, convolution feature extraction, classification prediction and optimization training, and realize efficient category classification. The model has strong feature extraction and classification capability, and classification accuracy and robustness are improved by continuously optimizing model weights. The database interface unit ensures the storage and inquiry of the classification result and provides data support for the subsequent statistical analysis.
The automatic classification and statistics module 70 is a core functional module in the whole system, which is responsible for receiving the output of the deep learning identification module and performing the classification and statistical analysis of the midge larvae. The module is combined with the classification result of the deep learning model to automatically classify and count different types of midge larvae, provide real-time type analysis and dynamic change monitoring, and generate a related report. Through the module, a user can comprehensively know the distribution situation and the number change trend of the midge larvae, and data support is provided for water ecological environment monitoring and biodiversity research.
The classification result storage unit 71 is responsible for storing the classification result output by the deep learning identification module in a database, and associating with metadata such as image numbers, time stamps, positions, and the like. The unit ensures the durability and retrievability of the classification results, facilitating subsequent queries and analysis.
And (3) recording classification results, wherein the classification results comprise information such as class labels, confidence levels and the like of the midge larvae, and the classification results of all samples are stored in a database together with metadata such as corresponding image IDs, detection time, sampling positions and the like to generate complete record entries. The entry is stored in a structured manner, so that the system can conveniently and rapidly inquire.
Metadata association-in addition to classification labels, the system automatically associates detected related information, such as image numbers, time stamps, detection places and other metadata, to classification results. These metadata can provide background information for sample collection, particularly in environmental monitoring tasks, which can be analyzed according to different sampling points and times.
And (3) data retrieval and updating, wherein the system supports the user to inquire and update the classification result. If the identification result needs to be manually adjusted or confirmed, the user can edit and update the classification result of the specific sample through the query system, so that the accuracy of the data is ensured.
The confidence level screening unit 72 is configured to screen the classification result according to the confidence level output by the deep learning model, and ensure the reliability of the classification result. For samples with low confidence, the system will mark them as an uncertain classification and allow the user to manually review or further process.
Confidence threshold setting the unit allows the user to set a threshold for classification confidence. The classification result with lower confidence will be labeled "uncertain" and may be processed by further manual review or model optimization. For example, when the confidence level of the classification result is below the set threshold pthresholdpthreshold, the system marks the result as uncertain and the screening process is defined as:
Where y i is a classification label, p i is a classification confidence, and p threshold is a preset confidence threshold.
And a manual review mechanism, wherein for the classification result marked as uncertain, the system provides a manual review function, and a user can review the sample image manually and manually adjust the classification result according to the requirement. This mechanism helps to improve the overall accuracy of the classification result.
The species statistics unit 73 is used for performing statistical analysis on the stored classification result to provide distribution conditions of various midge larvae in the detection sample. The unit can quickly calculate the quantity proportion of different types and generate corresponding statistical charts.
And counting the number of the larvae of the midge of different types according to the classification result, and calculating the number and the proportion of the larvae in the detection sample. The statistical formula is as follows:
Where 1 (y j=yi) is the indicator function, returning 1 when y j=yi, otherwise returning 0, m being the number of samples.
The statistical result shows that the statistical unit can generate various charts including pie charts, bar charts and the like, and the quantity distribution situation of various midge larvae is shown. These charts provide a clear visual data presentation to the user, helping the user to quickly understand the composition of the species in the current sample.
The time sequence analysis unit 74 is used for performing time sequence analysis on the classification result of the midge larvae, and displaying the quantity change trend of various midge larvae in different time periods, and is particularly suitable for long-term monitoring tasks and environmental change analysis.
And (3) processing the time sequence data, namely grouping and counting the number of the midge larvae according to time stamp information in the classification result by the system to generate time sequence data of the midge larvae. The user can set time windows such as day, week, month, etc. so as to flexibly analyze the dynamic changes of the midge larva population in different time periods.
And (3) trend analysis and visualization, wherein the system displays the time sequence analysis results in the form of a line graph and the like to reflect the change trend of the quantity of various midge larvae along with time. The time sequence chart can clearly show the growth, reduction or stability of the population, and helps a user to know the influence of environmental change on the midge larva population.
The report generating unit 75 is responsible for automatically generating detailed report files based on the classification results and the statistical analysis. The report contains the species distribution, time series analysis result and other statistical data of the midge larvae, and supports the report to be exported in various formats, so that the user can conveniently archive or further analyze the report.
Report content the automatically generated report includes the following information:
and summarizing the classification result, namely counting the number and the duty ratio of various midge larvae and providing the type composition of the current sample.
And the time change trend is that the dynamic change of various midge larvae in different time periods is displayed through a time sequence analysis result, and the long-term change trend of population quantity is reflected.
Confidence statistics, namely displaying confidence distribution of various classification results and helping users to know the reliability of the classification results.
Report format export the report generation unit supports export of the report into a variety of formats, which the user may choose to save in PDF, excel or CSV formats. PDF format reports facilitate printing and archiving, while Excel and CSV formats facilitate further data analysis and processing by users.
Workflow of the category automatic classification and statistics module 70:
The classification result of the deep learning identification module 60 is stored in the database through the classification result storage unit 71 and is associated with the related metadata, so that the integrity and traceability of the classification result are ensured.
Confidence screening and processing the system screens the classification results by a confidence screening unit 72, and for classification results with lower confidence, the system marks them as "uncertain classification" and provides manual review functionality.
The system counts the number of various midge larvae through the species counting unit 73 and generates a chart of species distribution, so that the user can visually check the chart conveniently.
Time series analysis by the time series analysis unit 74, the system displays the trend of the quantity of various midge larvae along with time, and helps the user to know the dynamic change of the sample along with time.
Report generation and export the report generation unit 75 automatically generates a complete report file based on the classification results and statistical analysis, supporting multiple format exports.
The automatic classification and statistics module provides powerful automatic analysis capability and user interaction function through automatic storage of classification results, confidence level screening, class statistics and time sequence analysis. The module provides a complete solution for automatic classification and statistical analysis of the midge larva species, and can meet the requirements of multiple application scenes such as environmental monitoring, biodiversity research and the like. Through report generation and a user interface, a user can easily acquire, view and export analysis results, so that related works such as water ecological monitoring are supported.
In general, the invention provides an automatic midge larva recognition system by combining deep learning and image recognition technology, which can realize multi-focal-plane image acquisition, image superposition processing, microstructure feature extraction and automatic classification of species. The system has higher recognition precision and processing efficiency, can effectively reduce manual intervention, improves automatic recognition and classification precision of the midge larvae, and meets the requirements of water ecological environment monitoring and biodiversity research. The system also provides a real-time statistical analysis and report generation function, and provides comprehensive and timely data support for environmental monitoring.
Referring to fig. 8, the invention also provides a method for identifying midge larvae based on deep learning and image identification, which comprises the following steps:
s1, acquiring multi-focal plane images of the midge larvae through an image acquisition module, wherein the image acquisition module comprises a transmission light source, an optical microscope and a high-resolution digital camera, and the digital camera is controlled to automatically acquire image sequences under different focal planes;
s2, performing image superposition processing on the acquired multi-focal-plane image, wherein the image superposition processing comprises the following steps:
Decomposing each focal plane image into a plurality of scale layers through multi-scale Laplacian pyramid decomposition;
Calculating fusion weight according to the local gradient, contrast and motion compensation result of the image, and fusing a plurality of focal plane images to generate a full focal plane image;
S3, inputting the superimposed full-focus image into a deep learning recognition module, wherein the deep learning recognition module extracts the characteristics of the midge larvae based on a convolutional neural network, and the characteristic extraction process comprises convolution, activation and pooling operations;
S4, classifying the extracted features through a full-connection layer of the deep learning identification module and a Softmax classifier, and outputting a type tag of the midge larva and a corresponding classification confidence;
s5, storing the classification result, the image number, the time stamp and the detection position information into a database;
S6, a statistical analysis step, namely carrying out statistical analysis on classification results through a type automatic classification and statistics module, calculating the number of the midge larvae of different types and time sequence changes thereof, generating a type distribution and time trend chart, and automatically generating a report.
The principle of the process flow of the method of the present invention is fully described in the foregoing system embodiment, and is not repeated herein.
Although embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made therein without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.