A method for restoring defocus blur of cylindrical surface microscopic imaging
By acquiring cylindrical surface video and utilizing the U-net structure with Laplacian operator and lightweight dense diffusion model, the defocusing blur problem of online microscopic image monitoring sensors is solved, achieving clear image restoration of cylindrical surface microscopic imaging, which is suitable for full flow monitoring.
Patent Information
- Application Number
- CN202410105395.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-25
- Publication Date
- 2026-11-27
- Estimated Expiration
- 2044-01-25
AI Technical Summary
Existing online microscopic image monitoring sensors have a short focal length, large relative aperture, and small field of view, resulting in a shallow imaging depth of field and easy defocusing and blurring. Traditional methods and deep learning models are unable to effectively recover abrasive grain images.
By acquiring cylindrical surface videos, the Laplacian operator is used to select the clear parts for image stitching, constructing blurred data pairs, and then using the U-net structure of a lightweight dense diffusion model for image restoration. The model is trained to restore the clear image.
It achieves accurate recovery of defocused and blurred images from cylindrical microscopic imaging, improves recovery speed and parameter efficiency, is applicable to full flow monitoring, and solves the problem that traditional methods cannot effectively recover the imaging of circular microscopic imaging sensors.
Smart Images

Figure CN118096537B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of mechanical equipment monitoring and maintenance, and in particular relates to a method for restoring defocus blur in cylindrical microscopic imaging. Background Technology
[0002] Abrasive fragments carried in lubricating oil play a role in monitoring the operating status of mechanical equipment and predicting its service life. Information such as the size, concentration, and color of abrasive fragments is key information for analyzing mechanical equipment, and online microscopic image monitoring sensors are the only method to monitor the color and morphology of abrasive particles.
[0003] Currently, online microscopic image monitoring sensors have short focal lengths, large relative apertures, and small fields of view, resulting in shallow depth of field and sensitivity to defocus, which easily leads to defocus blurring during microscopic imaging. Traditional defocus blurring methods are not ideal for addressing this issue. Similarly, in the field of deep learning, research on defocus blur recovery for abrasive particles is not a priority, resulting in the lack of an ideal model that can effectively recover defocus-blurred abrasive particle images. Summary of the Invention
[0004] To address the defocusing blur caused by microscopic imaging and enable the effective application of circular flow channel microscopic imaging sensors that provide more comprehensive and detailed information on abrasive particles, this invention provides a method for restoring defocusing blur in cylindrical surface microscopic imaging, comprising:
[0005] S1: Acquire video of the cylindrical surface during the rotation of the cylinder around its axis;
[0006] S2: Extract image frames at equal intervals from the video, select the clear parts of the image frames using the Laplacian operator, and stitch the images together to obtain a clear panoramic image of the cylindrical surface;
[0007] S3: Register the image frames in the video with the clear panoramic image of the cylindrical surface using template matching. Extract a clear image of the same size as the image frame from the clear panoramic image. Use the clear image of the same size as the image frame as the label of the image frame to construct a blurred data pair.
[0008] S4: Use fuzzy data to train the cylindrical defocus blur restoration model. Input the image frame to be restored into the trained cylindrical defocus blur restoration model to obtain the restored clear image.
[0009] Preferably, the clear portion of the image frame includes:
[0010] Starting from the center pixel of the image frame, the vertical direction is the size of the image frame, and the horizontal direction is progressively moved 20-30 pixels to the left and right each time. For each selected local image, the Laplacian operator is used to determine whether it is blurred, thereby finding the boundary between the clear and blurred parts and extracting the clear part of the image frame.
[0011] Preferably, extracting the sharp portion of the image frame includes:
[0012] To ensure that the selected local image is completely clear, when the image is moved to a point one step away from the left and right boundaries, the local image is cropped as the clear part of the image frame.
[0013] Preferably, the cylindrical defocus blur restoration model adopts a lightweight dense diffusion model; the lightweight dense diffusion model adopts a U-net structure, which includes: an encoding part, a transition layer, and a decoding part; the encoding part includes: 2 or 3 cascaded encoding layers; the decoding part includes: 2 or 3 cascaded decoding layers; the input of the first encoding layer is the image frame in the blurred data pair, the encoding part, the transition layer, and the decoding part are cascaded in sequence, and the output of the last decoding layer is the restored clear image.
[0014] Preferably, the decoding layer, transition layer, or encoding layer uses N cascaded dense residual blocks; the input of the first dense residual block and the output of the Nth dense residual block are residually connected; the input of each dense residual block and the output of that dense residual block are residually connected.
[0015] Preferably, the dense residual block comprises: M RB modules; the input of the first RB module and the output of the Mth RB module are residually connected; the input of each RB module and the output of that RB module are residually connected; the RB module comprises: V concatenated convolutional blocks; the input of the first convolutional block and the output of the Vth convolutional block are residually connected; the input of each convolutional block and the output of that convolutional block are residually connected; the convolutional block comprises: concatenated activation functions and convolutional layers.
[0016] Preferably, the number of dense residual blocks in the decoding layer and the encoding layer is 2 or 3; the number of dense residual blocks in the transition layer is 2 or 3; the number of RB modules in the dense residual blocks is 2, 3 or 4; and the number of convolutional blocks in the RB modules is 2 or 3.
[0017] Preferably, the activation function is the ReLU function.
[0018] Preferably, training the cylindrical surface defocus blur recovery model includes:
[0019] The video image frames from the blurred data pair are input into the cylindrical defocus blur restoration model for forward propagation. Based on the restoration results of the video image frames by the cylindrical defocus blur restoration model and the true labels of the video image frames, an L1 mean absolute error loss function is constructed. The parameters of the cylindrical defocus blur restoration model are updated using the Adam optimizer algorithm based on the constructed loss function until the loss function converges, thus completing the training of the cylindrical defocus blur restoration model.
[0020] Another aspect of the present invention provides a computer storage medium storing a program, which, when executed by a processor, implements the aforementioned method for restoring defocus blur in cylindrical microscopic imaging.
[0021] The present invention has at least the following beneficial effects
[0022] This invention proposes a method for creating a defocused blur dataset, addressing the shortcomings of existing commercially available abrasive defocused blur datasets. It presents a targeted model for recovering defocused blur on cylindrical surfaces, promoting its application in online microscopic imaging of circular pipe full-flow sensors. This method solves the problem that traditional abrasive image sensors typically use narrow rectangular flow channels with cross-sectional heights ranging from 10μm to 1.5mm, which are incompatible with general circular oil pipes, resulting in high flow resistance and hindering full-flow monitoring. This provides a suitable alternative for further industrial applications. This method can accurately recover defocused blurry cylindrical images caused by microscopic depth-of-field issues, resolving the defocused blur problem in cylindrical imaging by circular microscopic imaging sensors.
[0023] Compared with traditional defocus blur recovery methods and other deep learning models, this invention can perform directional defocus blur recovery of cylindrical images with significantly reduced parameters and weights, and a significant improvement in recovery speed, enabling clear recovery of blurred cylindrical images. Attached Figure Description
[0024] Figure 1 This is a schematic diagram of the method flow of the present invention;
[0025] Figure 2 This is a schematic diagram of the network structure of the lightweight dense diffusion model of the present invention;
[0026] Figure 3 This is a schematic diagram of the specific structure of the lightweight dense diffusion model of the present invention;
[0027] Figure 4 The image frame of this invention;
[0028] Figure 5 This is a clear image obtained by the present invention through image frames and panoramic images;
[0029] Figure 6This is a test image frame for the present invention;
[0030] Figure 7 To restore the image of the model of the present invention. Detailed Implementation
[0031] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0032] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.
[0033] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.
[0034] Please see Figure 1 This invention provides a method for restoring defocus blur in cylindrical microscopic imaging, comprising:
[0035] S1: Acquire video of the cylindrical surface during the rotation of the cylinder around its axis;
[0036] In this embodiment, during the rotation of the cylinder around its axis, a fixed CMOS sensor captures real-time video of the cylindrical surface. In this embodiment, the circular oil passage can be considered a cylinder. By analyzing the video of the oil passage, the operating status of the equipment can be accurately determined, facilitating timely maintenance. Please refer to [link to relevant documentation]. Figure 4 , Figure 4This is a frame of an image from a video captured in an embodiment of the present invention. Figure 4 As can be seen, the pixels in the middle area of this image frame are relatively clear, while those near the left and right sides are blurry. This is due to defocus blur caused by the microscopic depth of field problem. Therefore, this invention uses automatic annotation algorithms S2-S3 to construct blurry data pairs. Please refer to [link to relevant documentation]. Figure 5 , Figure 5 The clear panoramic image of the present invention is produced by extracting image frames at equal intervals from a video, selecting the clear parts of the image frames using the Laplacian operator, and stitching the images together to obtain a clear panoramic image of the cylindrical surface.
[0037] S2: Extract image frames at equal intervals from the video, select the clear parts of the image frames using the Laplacian operator, and stitch the images together to obtain a clear panoramic image of the cylindrical surface;
[0038] S3: Register the image frames in the video with the clear panoramic image of the cylindrical surface using template matching. Extract a clear image of the same size as the image frame from the clear panoramic image. Use the clear image of the same size as the image frame as the label of the image frame to construct a blurred data pair.
[0039] S4: Use fuzzy data to train the cylindrical defocus blur restoration model. Input the image frame to be restored into the trained cylindrical defocus blur restoration model to obtain the restored clear image.
[0040] Preferably, the clear portion of the image frame includes:
[0041] Starting from the center pixel of the image frame, the vertical direction is the size of the image frame, and the horizontal direction is progressively moved 20-30 pixels to the left and right each time. For each selected local image, the Laplacian operator is used to determine whether it is blurred, thereby finding the boundary between the clear and blurred parts and extracting the clear part of the image frame.
[0042] Preferably, extracting the sharp portion of the image frame includes:
[0043] To ensure that the selected local image is completely clear, when the image is moved to a point one step away from the left and right boundaries, the local image is cropped as the clear part of the image frame.
[0044] Please see Figure 2 and Figure 3Preferably, the cylindrical defocus blur restoration model adopts a lightweight dense diffusion model; the lightweight dense diffusion model adopts a U-net structure, which includes: an encoding part, a transition layer, and a decoding part; the encoding part includes: 2 or 3 cascaded encoding layers; the decoding part includes: 2 or 3 cascaded decoding layers; the input of the first encoding layer is the image frame in the blurred data pair, the encoding part, the transition layer, and the decoding part are cascaded in sequence, and the output of the last decoding layer is the restored clear image.
[0045] Preferably, the decoding layer, transition layer, or encoding layer uses N cascaded dense residual blocks; the input of the first dense residual block and the output of the Nth dense residual block are residually connected; the input of each dense residual block and the output of that dense residual block are residually connected.
[0046] Preferably, the dense residual block comprises: M RB modules; the input of the first RB module and the output of the Mth RB module are residually connected; the input of each RB module and the output of that RB module are residually connected; the RB module comprises: V concatenated convolutional blocks; the input of the first convolutional block and the output of the Vth convolutional block are residually connected; the input of each convolutional block and the output of that convolutional block are residually connected; the convolutional block comprises: concatenated activation functions and convolutional layers.
[0047] Preferably, the number of dense residual blocks in the decoding layer and the encoding layer is 2 or 3; the number of dense residual blocks in the transition layer is 2 or 3; the number of RB modules in the dense residual blocks is 2, 3 or 4; and the number of convolutional blocks in the RB modules is 2 or 3.
[0048] Preferably, the activation function is the ReLU function.
[0049] Preferably, training the cylindrical surface defocus blur recovery model includes:
[0050] The video image frames from the blurred data pair are input into the cylindrical defocus blur restoration model for forward propagation. Based on the restoration results of the video image frames by the cylindrical defocus blur restoration model and the true labels of the video image frames, an L1 mean absolute error loss function is constructed. The parameters of the cylindrical defocus blur restoration model are updated using the Adam optimizer algorithm based on the constructed loss function until the loss function converges, thus completing the training of the cylindrical defocus blur restoration model.
[0051] Please see Figure 6 , Figure 6In real-time image frames acquired during actual operation, significant blurring is clearly visible on both the left and right sides of the image, which hinders analysis of the device's operational status. Therefore, this video frame image is input into a trained cylindrical defocus blur recovery model to obtain a restored, clear image, such as... Figure 7 As shown, this invention can accurately recover the out-of-focus blurred cylindrical image caused by the microscopic depth of field problem, thus solving the problem of out-of-focus blurring in cylindrical imaging of circular microscopic imaging sensors.
[0052] Another aspect of the present invention provides a computer storage medium storing a program, which, when executed by a processor, implements the aforementioned method for restoring defocus blur in cylindrical microscopic imaging.
[0053] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.
[0054] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
[0055] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.
Claims
1. A method for restoring defocus blur in cylindrical microscopic imaging, characterized in that, include: S1: Acquire video of the cylindrical surface during the rotation of the cylinder around its axis; S2: Extract image frames at equal intervals from the video, select the clear parts of the image frames using the Laplacian operator, and stitch the images together to obtain a clear panoramic image of the cylindrical surface; S3: Register the image frames in the video with the clear panoramic image of the cylindrical surface using template matching. Extract a clear image of the same size as the image frame from the clear panoramic image. Use the clear image of the same size as the image frame as the label of the image frame to construct a blurred data pair. S4: Use fuzzy data to train the cylindrical surface defocused blur recovery model, input the image frame to be recovered into the trained cylindrical surface defocused blur recovery model, and obtain the recovered clear image; The clear portion of the image frame includes: Starting from the center pixel of the image frame, the vertical direction is the size of the image frame, and the horizontal direction is progressively moved 20-30 pixels to the left and right each time. For each selected local image, the Laplacian operator is used to determine whether it is blurred, so as to find the boundary between the clear part and the blurred part and extract the clear part in the image frame. The extraction of the sharp portion from the image frame includes: To ensure that the selected local image is completely clear, when the image is moved to a point one step away from the left and right boundaries, the local image is cropped as the clear part of the image frame. The cylindrical defocus blur restoration model employs a lightweight dense diffusion model. This model uses a U-net structure, comprising an encoding part, a transition layer, and a decoding part. The encoding part includes two or three cascaded encoding layers. The decoding part includes two or three cascaded decoding layers. The input to the first encoding layer is an image frame from a blurred data pair. The encoding part, transition layer, and decoding part are sequentially cascaded, and the output of the last decoding layer is the restored sharp image. The decoding layer, transition layer, or encoding layer uses N cascaded dense residual blocks; the input of the first dense residual block and the output of the Nth dense residual block are residually concatenated; the input of each dense residual block and the output of that dense residual block are residually concatenated. The dense residual block comprises: M RB modules; the input of the first RB module and the output of the Mth RB module are residually concatenated; the input of each RB module and the output of that RB module are residually concatenated; the RB module comprises: V concatenated convolutional blocks; the input of the first convolutional block and the output of the Vth convolutional block are residually concatenated; the input of each convolutional block and the output of that convolutional block are residually concatenated; the convolutional block comprises: concatenated activation functions and convolutional layers.
2. The method for restoring defocus blur in cylindrical surface microscopic imaging according to claim 1, characterized in that, The number of dense residual blocks in the decoding layer and the encoding layer is 2 or 3; the number of dense residual blocks in the transition layer is 2 or 3; the number of RB modules in the dense residual blocks is 2, 3 or 4; the number of convolutional blocks in the RB modules is 2 or 3.
3. The method for restoring defocus blur in cylindrical surface microscopic imaging according to claim 2, characterized in that, The activation function is the ReLU function.
4. The method for restoring defocus blur in cylindrical surface microscopic imaging according to claim 1, characterized in that, The training of the cylindrical surface defocus blur recovery model includes: The video image frames from the blurred data pair are input into the cylindrical defocus blur restoration model for forward propagation. Based on the restoration results of the video image frames by the cylindrical defocus blur restoration model and the true labels of the video image frames, an L1 mean absolute error loss function is constructed. The parameters of the cylindrical defocus blur restoration model are updated using the Adam optimizer algorithm based on the constructed loss function until the loss function converges, thus completing the training of the cylindrical defocus blur restoration model.
5. A computer storage medium storing a program, characterized in that, When the program is executed by the processor, it implements the method for restoring defocus blur in cylindrical microscopic imaging as described in any one of claims 1-4.
