A fruit cell microscopic image repairing method and system based on topology perception

By employing a topology-aware method for restoring fruit cell microscopic images, which combines edge gradient features and adaptive dilation of the distance transformation field, the problems of topological distortion and texture abnormalities in fruit cell wall reconstruction are solved, achieving efficient restoration of biological morphology and naturalness of visual texture.

CN123071189APending Publication Date: 2026-11-10ZHEJIANG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611089949.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-22
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

Existing technologies for analyzing fruit cell microscopic images suffer from problems such as blurred cell wall structure, topological distortion, texture abnormalities, and poor robustness of deep learning models. In particular, it is difficult to maintain biological topological information and morphological consistency when processing the reconstruction of microscopic fruit cell walls.

Method used

A topology-aware fruit cell microscopic image restoration method is adopted. By extracting edge gradient features and combining them with dense probability maps to generate candidate fracture region masks, adaptive dilation is performed using distance transformation fields. Combined with partial differential equations and high-frequency detail fusion of deep learning, local color statistical matching and brightness adaptive suppression are performed to construct a closed-loop processing architecture.

Benefits of technology

It significantly improved the topological connectivity and morphological consistency of the cell wall, reduced the wall width error, enhanced the physiological realism and visual texture naturalness of the repair results, and improved the generalization ability and robustness of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123071189A_ABST
    Figure CN123071189A_ABST
Patent Text Reader

Abstract

The application discloses a fruit cell microscopic image repairing method and system based on topology perception and relates to the field of image processing. The method comprises the following steps: extracting the edge gradient features of the image to be repaired and inputting the original image into a defect positioning network to output a dense probability map and generate a candidate broken area mask; skeletonizing the candidate mask, determining an adaptive inflation line width based on the sampling value of the distance transformation field, and obtaining a topology thinning repair mask by inflating the skeleton; inputting the original image and the thinning repair mask into a repair network to generate a preliminary repair image; extracting the high-frequency detail component of the image based on the partial differential equation repair, superimposing the high-frequency detail component to the preliminary result, and performing color statistical matching and brightness suppression based on the context pixels outside the defect boundary to obtain a final image. The application overcomes the wall thickness abnormality and topology distortion problems caused by simply relying on the network, and realizes accurate repair in accordance with the biological true thickness and connectivity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of computer vision and biological microscopic image processing technology, and more specifically, to a method and system for restoring fruit cell microscopic images based on topology sensing. Background Technology

[0002] Cells are the basic structural and functional units of plant organisms, and the integrity of cell walls is crucial for fruit cell image analysis and biological research. For succulent fruits, key quality attributes such as firmness, texture, softening, lignification, and chilling injury are all closely related to the structure and integrity of the thin-walled cell walls. The continuity, thickness, and topological characteristics of the cell wall network directly determine the mechanical and physiological properties of fruit tissues during development and storage. Therefore, quantitative characterization of fruit cell wall morphology is of paramount importance in plant physiology, postharvest biology, and fruit quality assessment.

[0003] However, microscopic image analysis of fruit tissues faces significant challenges. Unlike most other plant tissues, fruit parenchyma cells possess large central vacuoles and highly hydrated cytoplasm, making them mechanically extremely fragile during tissue sectioning, staining, and microscopic imaging. Under an optical microscope, fruit cell walls are extremely thin, typically spanning only a few pixels. Image quality is further degraded by uneven staining, defocusing, uneven illumination, and optical scattering. These combined issues result in defects frequently observed in microscopic images, such as localized cell wall ruptures, structural discontinuities, low edge contrast, and topological distortion. Even minute structural defects can significantly bias subsequent morphological analyses, such as cell wall thickness quantification, connectivity assessment, and cell counting.

[0004] To address image defects, existing image restoration algorithms are mainly divided into traditional computational methods and deep learning-based methods. However, when applied to the reconstruction of microscopic fruit cell walls, these methods exhibit poor adaptability and have the following limitations: First, traditional partial differential equation (PDE) restoration methods (such as the Telea and Navier-Stokes methods) and morphological enhancement methods are still widely used in image restoration and defect repair. While these methods perform well in smooth and uniform regions, they often blur delicate biological structures or cause distortions such as excessive thinning or thickening when dealing with narrow cell wall fractures, thus destroying biologically meaningful topological information. The cell walls of mature fruits have extremely low distinguishability against a microscopic background, making it difficult for traditional algorithms to accurately reconstruct fractured cell walls.

[0005] Second, although encoder-decoder networks and diffusion-generative models, represented by U-Net and its variants, have achieved excellent visual performance on natural image inpainting benchmarks, fruit cell wall inpainting differs fundamentally from conventional image inpainting. Qualified reconstruction requires not only high pixel-level fidelity but also the preservation of elongated anisotropic structures, cell wall continuity, and biologically plausible morphology. Existing deep learning inpainting models often overemphasize global pixel similarity (such as PSNR and SSIM) while neglecting topology-aware inpainting performance. While the generated inpainting results may appear visually plausible overall, the texture of the repaired cell walls deviates significantly from the actual morphological features, easily producing abnormal wall thickness, broken topological structures, and unnatural morphologies, failing to meet the requirements of specific biological domains for reconstructing broken cell walls.

[0006] Third, at the model training level, due to the extreme difficulty in obtaining paired data of real intact and damaged microscopic images within the same field of view, existing technologies mostly employ artificial mask destruction to construct training sets. However, in this process, artificially destroyed edges often retain residual anti-aliasing gradients or floating-point operations. Conventional image preprocessing and network training strategies fail to effectively block this information leakage, making it easy for the repair network to cheat by exploiting the residual traces at the bottom layer for feature mapping. This reduces the model's robustness and generalization ability when facing real physical damage in practical applications.

[0007] In summary, there is an urgent need in this field for a topology-aware computing framework specifically designed for fruit cell wall repair. This framework should be able to restore biologically realistic cell wall images while maintaining thin-wall continuity, topology preservation, and morphological consistency. Summary of the Invention

[0008] To address the numerous shortcomings of existing technologies, this invention aims to provide a method and system for restoring fruit cell microscopic images based on topology awareness. It addresses the technical problems of traditional image restoration algorithms, which easily lead to blurred fine wall structures and abnormal wall thickness when processing fruit cell microscopic images, as well as the lack of physiological realism in restoration results due to existing deep learning models neglecting biological topological morphology and excessively pursuing global pixel similarity. Furthermore, this invention also aims to overcome the problem of low-level information leakage caused by artificial mask disruption during existing network training, thereby providing a complete computational framework capable of restoring biologically realistic cell wall images while maintaining thin-wall continuity, topological preservation, and morphological consistency.

[0009] The present invention addresses the aforementioned technical problems primarily through the following technical solution: a method for restoring fruit cell microscopic images based on topology sensing, comprising the following steps: S1: Obtain microscopic images of the fruit cells to be repaired; S2: Extract the edge gradient features of the fruit cell microscopic image, combine them with the original image and input them into a pre-trained defect localization network, output a dense probability map, and generate a candidate fracture region mask based on the dense probability map; S3: The candidate fracture region mask is skeletonized to obtain the mask skeleton. The distance transformation field of the cell wall region is calculated. The adaptive expansion linewidth is determined based on the sampling value of the distance transformation field at the position of the mask skeleton. The mask skeleton is expanded with the adaptive expansion linewidth to obtain the topology refinement and repair mask. S4: Input the fruit cell microscopic image and the topology refinement and repair mask into the pre-trained repair network to generate a preliminary repair image; S5: Extract the high-frequency detail components obtained from the fruit cell microscopic image based on the partial differential equation repair algorithm, superimpose them onto the corresponding area of ​​the preliminary repaired image according to a preset weight, and perform local color statistical matching and brightness adaptive suppression based on the context pixels outside the defect boundary to obtain the final repaired microscopic image.

[0010] This solution provides a closed-loop processing architecture that integrates topology awareness and morphology fusion. At the input stage, since fruit cells (especially large vacuolar structures) often exhibit extremely low-contrast edges under a microscope, this solution forcibly introduces edge gradient features and RGB channel concatenation, effectively improving the network's sensitivity to weak boundaries. In the masking stage, this solution overcomes the limitations of directly using the network's output probability map by innovatively introducing an adaptive dilation mechanism based on distance transform field (DT). This mechanism dynamically constrains the boundary repair based on the physical pixel span, perfectly solving the problem that simple deep learning repair can easily lead to over-expansion or thinning of thin-walled structures. In the post-processing stage, this solution does not rely solely on the network output but instead weights and fuses the high-frequency structural details of traditional partial differential equations (PDEs) with low-frequency predictions from deep learning, and performs local brightness adaptive adjustment in a specific color space. This synergistic combination of traditional CV operators and deep learning feature extraction ensures that the repaired cell walls are not only topologically connected but also maintain a high degree of physiological consistency with the surrounding real tissue in terms of color and texture.

[0011] Preferably, step S2, which involves generating a candidate fracture region mask based on the dense probability map, includes the following specific steps: S21: Obtain the dense probability map output by the defect localization network; S22: The dense probability map is binarized using an adaptive effective threshold, which is determined by a combination of the basic confidence threshold, the adaptive threshold, and the minimum threshold. S23: Perform morphological opening and closing operations on the binarized result, and then remove connected components with areas lower than a preset area threshold to obtain the candidate fracture region mask.

[0012] For the dense probability map output by the defect localization network, this scheme designs rigorous post-processing logic. The optimal calculation logic for the adaptive effective threshold is τ. eff =max(min(τ,τ k ),τ min Among them, a minimum threshold τ is introduced. min The direct purpose of (e.g., preferably 0.02) is to prevent the probabilistic response of the thin-walled, weak structure of plants from being overly suppressed when processing microscopic images, thereby preserving potential broken connection clues to the greatest extent. Morphological operations and area filtering further eliminate isolated background noise.

[0013] Preferably, step S3 specifically includes: S31: Perform skeletalization processing on the candidate fracture region mask; S32: Binarize the cell wall region of the cell micrograph, calculate the Euclidean distance from the background pixel to the nearest binary pixel in the wall region, and obtain the distance transformation field; S33: Obtain the median of the distance transformation corresponding to the effective pixels on the skeleton of the candidate fracture region mask, and determine the global wall width scalar based on the median; S34: At the endpoints of the predicted connecting skeleton, calculate the median of the distance transformation of the nearest wall in the local neighborhood to determine the local wall width; S35: The global wall width scalar and the local wall width are weighted and averaged, and the average is truncated and restricted within a preset physical span range to obtain an adaptive expansion line width. The skeleton is then expanded using the adaptive expansion line width.

[0014] Step S3 is the core of this invention for controlling cell wall width. A distance transformation field for the entire image is constructed by calculating the Euclidean distance from background pixels to the nearest binary pixel in the cell wall region. Instead of using a fixed dilation kernel, this scheme extracts the median of the distance transformation corresponding to effective pixels on the skeleton (median filtering effectively removes local abnormal noise) as a global wall width scalar, and weights it in conjunction with the local wall width at the endpoints. This is further truncated within a preset physical span range (e.g., [3, 15] pixels, which closely matches the actual physical span of fruit cell walls under an optical microscope), ensuring that the mask boundary, serving as a repair guide, strictly conforms to the actual biological thickness, avoiding misjudging the blurred boundaries of adjacent vacuoles as cell walls. This fundamentally avoids the design flaw in conventional schemes where uncontrolled cell wall thickening occurs due to reliance solely on the topological loss function constraints within the network, demonstrating the irreplaceable nature of this hybrid architecture.

[0015] Preferably, in step S5, the extraction and superposition of high-frequency detail components are performed as follows: S501: The topology thinning and restoration mask region is restored based on the Telea algorithm and the Navier-Stokes algorithm respectively, and the restoration results of the two are fused with equal weight to obtain the classic restored image; S502: Subtract the Gaussian blurred image from the classic restored image to obtain the high-frequency detail component; S503: Multiply the high-frequency detail components by a fixed constant in the range of 0.55 to 0.70, then superimpose them onto the preliminary repaired image and truncate them to the effective pixel value range.

[0016] Pure deep learning models are prone to causing edge blurring when restoring delicate anisotropic structures. This approach leverages the characteristics of the Telea and Navier-Stokes algorithms, which excel at handling high-frequency details but cannot recover macroscopic topology. The high-frequency components are extracted and multiplied by a specific range (preferably 0.62) of weights before being superimposed onto the deep learning output. This numerical range is an empirical constant determined through extensive validation set experiments to achieve the optimal trade-off between Local Structural Similarity Indices (LPIPS) and wall width error, significantly improving the visual texture realism of the restored band.

[0017] Preferably, in step S5, local color statistical matching is performed based on the context pixels outside the defect boundary, specifically including the following steps: S511: Perform morphological dilation on the topology refinement and repair mask to obtain an annular region that closely adheres to the defect boundary; S512: Combining the gradient magnitude of the image, select pixels with gradients greater than a preset percentile from the annular region as real wall reference contexts. S513: Calculate the mean and standard deviation of each color channel in the real wall reference context, and the mean and standard deviation of the preliminary repaired image within the topology refinement repair mask area; S514: By subtracting the mean value within the mask from the pixel values ​​of the initially repaired image, multiplying it by the standard deviation ratio, and then superimposing the context mean, the pixel values ​​within the repair mask are aligned to obtain an image after color statistical matching.

[0018] To eliminate local brightness breaks caused by uneven illumination or defocusing in the microscope, this scheme employs a high-precision Z-score color matching algorithm. Its core innovation lies in not blindly selecting the global background, but rather using morphological dilation to extract a ring-shaped region closely adhering to the defect boundary. High-gradient pixels representing the true cell wall line are then rigorously selected using gradient magnitudes (e.g., greater than the 45th percentile) as statistical reference targets. By matching the mean and standard deviation of the repaired area with this true cell wall line, the color distribution at the repaired fracture site transitions smoothly with the intact cell walls at both ends, avoiding the phenomenon of mistakenly filling the cell wall with the background vacuolar color.

[0019] Preferably, in step S5, the brightness adaptive suppression specifically includes: S521: Convert the image after color statistical matching to the CIELAB color space; S522: Multiply the values ​​of its luminance channels by a luminance scaling factor in the range of 0.88 to 0.94; S523: Convert back to RGB color space and replace the pixels in the original mask area.

[0020] This step falls under the photometric constraint in morphological consistency fusion. Converting the image to CIELAB space to separate brightness and chromaticity allows for adjustments to brightness and darkness without compromising the physiological authenticity of the cell wall repair boundary colors. By uniformly multiplying the L channel by a suppression factor of 0.88 to 0.94 (preferably 0.91), the repaired cell wall lines are intentionally made slightly darker than the original network output, thus maintaining a high degree of consistency between its macroscopic grayscale and the surrounding natural cell wall lines, further enhancing visual coherence.

[0021] Preferably, the repair network is trained using a dataset that includes the following mechanisms: A paired mask is generated based on undamaged, intact cell microscopic images and corresponding artificially damaged images. The artificially damaged image is hard masked, and the pixel values ​​in the corresponding paired mask area are forcibly assigned to specific values ​​to prevent the leakage of underlying information; When applying random cropping image enhancement, a defect protection mechanism is introduced: if the number of effective pixels in the cropped mask is lower than a preset lower limit, line segment defects with a line width of 3 to 8 pixels are randomly generated on the image and the binarized defect mask tensor is updated simultaneously.

[0022] To address the challenge of accurately identifying defects in microscopic images, this solution employs a dedicated training set construction rule. Specifically, it introduces a defect protection mechanism: during random cropping, if a nearly defect-free flat area is encountered, a biomimetic crack with a width of 3 to 8 pixels (perfectly matching the physical width of a fruit's thin wall) is forcibly generated randomly. This not only prevents network collapse due to a lack of effective supervision signals in the training batches but also significantly enhances the model's generalization ability to various random local fracture patterns.

[0023] Preferably, the hard masking of artificially damaged images specifically includes the following steps: The pixel values ​​of each channel of the defective image to be input are normalized to obtain the normalized defective image tensor. Based on the Hadamard product formula T masked =T norm⊙(1-M) performs a hard masking operation on the normalized defective image tensor, where T norm Let T represent the normalized defective image tensor, M represent the binarized paired mask tensor with a value of 1 for the defective region, and T represent the image tensor. masked This represents the image tensor after hard masking. The hard masking operation forces the pixel values ​​in the artificially damaged area to be cleared to zero.

[0024] This is a defense mechanism to prevent deep learning models from taking shortcuts. When manually using image editing software to destroy complete images to construct a training set, it is very easy to leave invisible anti-aliasing gradients or interpolation remnants at the broken edges. If this hard masking operation is not performed, the CNN will keenly capture and use these low-level residual traces for feature mapping during training, causing it to completely fail when faced with real physical slice breaks. By using the Hadamard product formula, the pixels within the mask are forcibly cleared to zero in the feature normalization domain, completely blocking the information leakage path and ensuring that the model learns true contextual topological inference capabilities, rather than simple residual noise recognition.

[0025] Preferably, the repair network is updated by backpropagation based on a composite loss function, which includes at least local reconstruction loss and mask focus perception similarity loss. The local reconstruction loss is calculated by taking the L1 distance of the generated image within the mask area and normalizing it according to the number of mask pixels. The method for calculating the mask focusing perception similarity loss is as follows: the part of the generated image within the mask area is stitched and fused with the part of the complete cell micrograph outside the mask area to form a stitched focused image. Then, the distance between the stitched focused image and the complete cell micrograph in the feature space of the pre-trained visual network is calculated. The defect localization network is trained based on the sum of a weighted binary cross-entropy loss and a Dice loss. The dynamic positive sample weights in the weighted binary cross-entropy loss are determined by the ratio of the total number of background negative sample pixels to the total number of thin-walled positive sample pixels, and the ratio is truncated within a preset range.

[0026] The loss function of this invention is deeply customized for the characteristics of microscopic images. Conventional perceptual losses (such as LPIPS) are usually calculated across the entire image. However, since the background of large vacuoles occupies a large area in cell microscopic images, the perceptual differences in subtle repair areas are severely diluted. The stitching and focusing image strategy adopted in this scheme (pred_focus=pred⊙M+gt⊙(1−M)) forces the perceptual network to focus only on the texture differences within the repair mask, which greatly improves the consistency of local perception. At the same time, in the loss function of the localization network, in response to the well-known problem of very few linear foregrounds and extremely large backgrounds in cell images, the dynamic positive sample weights are hard-truncated (preferably truncated in the range of [1.0, 50.0]), which effectively stabilizes the gradient descent process of sparse and slender wall structures.

[0027] A topology-aware fruit cell microscopic image restoration system, comprising: The image acquisition module is used to acquire microscopic images of the fruit cells to be repaired; The defect localization and prediction module is used to extract the edge gradient features of the fruit cell microscopic image, combine them with the original image and input them into a pre-trained defect localization network, output a dense probability map, and generate a candidate fracture region mask based on the dense probability map. An adaptive topology refinement module is used to perform skeletonization processing on the candidate fracture region mask to obtain a mask skeleton, calculate the distance transformation field of the cell wall region, determine the adaptive expansion linewidth based on the sampled value of the distance transformation field at the mask skeleton position, and expand the mask skeleton with the adaptive expansion linewidth to obtain a topology refinement repair mask. The network repair module is used to input the fruit cell microscopic image and the topology refinement repair mask into a pre-trained repair network to generate a preliminary repair image; The morphology and color fusion module is used to extract the high-frequency detail components obtained by the partial differential equation repair algorithm from the microscopic image of the fruit cells, superimpose them onto the corresponding area of ​​the preliminary repaired image according to a preset weight, and perform local color statistical matching and brightness adaptive suppression based on the context pixels outside the defect boundary to obtain the final repaired microscopic image.

[0028] This system is the virtual device entity corresponding to each of the above methods and steps. The modules work together to provide a complete end-to-end processing architecture from automatic defect identification to topology refinement and realistic texture fusion. It can be directly integrated into industrial-grade microscopic image analysis software to facilitate subsequent quantitative analysis of plant physiology.

[0029] The substantial effects of this invention are: (1) Significantly reducing wall width error and maintaining physiological authenticity: By introducing an explicit mask adaptive thinning mechanism based on distance transformation, the uncontrolled proliferation and thickening phenomenon of traditional deep learning models when repairing slender anisotropic structures is effectively overcome. (2) Greatly improving structural topological continuity: By combining localization network and composite topological loss, this scheme significantly reduces the number of skeleton breakpoints, ensuring that the repaired cell wall forms a closed-loop connected network, thus removing structural obstacles for subsequent botanical quantitative indicators such as cell counting and area calculation. (3) Eliminating the bias of solely relying on indicators and achieving highly natural texture: Abandoning the traditional concept of simply pursuing global PSNR and SSIM, by using local statistical matching and PDE high-frequency detail fusion, the perceptual consistency and color transition smoothness of the local repair area are prioritized, making the computer-generated repair marks difficult to be detected by the naked eye and analysis algorithms. (4) Strong generalization ability and robustness: After rigorous dataset leakage prevention construction and cross-domain evaluation test, the present invention has shown extremely stable repair performance when facing different imaging parameters, staining schemes and cell morphologies, and has extremely high applicability to complex and ever-changing real optical microscopy imaging scenarios. Attached Figure Description

[0030] Figure 1 This is a flowchart of a fruit cell microscopic image restoration method based on topology sensing according to the present invention; Figure 2 This is a framework diagram of a fruit cell microscopic image restoration system and method based on topology sensing according to the present invention; Figure 3 This is a visual comparison of the repair results of this invention with those of existing classic repair algorithms in terms of cell wall topological connectivity; Figure 4 These are visual comparison images of different repair algorithms for repairing microscopic cell wall damage. Detailed Implementation

[0031] The technical solution of the present invention will be further described in detail below through embodiments and in conjunction with the accompanying drawings.

[0032] Example: Figure 2 This embodiment illustrates a topology-aware fruit cell microscopic image restoration system and method. Its complete data flow and module architecture clearly demonstrate a closed-loop processing procedure coupling explicit mask computation and implicit network prediction. The original RGB image at the system input is stitched together with the extracted single-channel edge gradient features. Subsequently, it passes through a defect localization network and a distance-transform-based topology thinning logic. Finally, in the post-processing stage, statistical matching of high-frequency textures and colors is completed, thereby generating the final restored image.

[0033] like Figure 1As shown, the specific process of the fruit cell microscopic image restoration method based on topology sensing is as follows: S1: Obtain microscopic images of the fruit cells to be repaired.

[0034] In this embodiment, in order to train and apply this method, image data containing the microscopic features of fruit cells is first constructed and acquired.

[0035] Training data acquisition and pairing: A self-built fruit cell wall microscopic image pairing dataset was used. Each image pair contains an undamaged complete reference image and a corresponding artificially damaged image.

[0036] Geometric Enhancement and Leakage Prevention: During the training phase, geometric enhancement operations (including reflection filling to 256×256 pixels, random cropping, horizontal / vertical flipping, random 90-degree rotation, and elastic deformation) are performed simultaneously on the complete image, the defective image, and the corresponding defect mask. To prevent the defective mask from being empty, which would result in a lack of supervision signal for batch training, a defect protection mechanism is introduced: if the number of effective pixels in the cropped mask is less than 10, 1 to 3 black line segments with a line width of 3 to 8 pixels are randomly drawn on the defective image, and the defect mask is updated simultaneously.

[0037] Hard occlusion: Normalize the pixel values ​​of each channel of the defective image to be input to [-1,1] to obtain the normalized defective image tensor T. norm Based on the Hadamard product formula T masked =T norm ⊙(1-M) performs a hard masking operation, where M is a binary paired mask tensor with a defect region value of 1. This step forcibly clears the pixel values ​​in the artificially damaged area to zero, completely blocking the possibility of the repair network cheating by using underlying floating-point remnants or anti-aliasing traces for feature mapping.

[0038] S2: Extract the edge gradient features of the fruit cell microscopic image, combine them with the original image and input them into a pre-trained defect localization network, output a dense probability map, and generate a candidate fracture region mask based on the dense probability map.

[0039] Edge feature fusion: The RGB image with hard occlusion is converted to grayscale, and the horizontal gradient S is calculated using a 3×3 Sobel operator. x and vertical gradient S y Calculate the gradient magnitude E = sqrt(S x 2 +S y 2 Divide the value by the maximum value to normalize it to the [0,1] interval. Then, concatenate the single-channel edge feature map with the 3-channel RGB image along the channel dimension to form a 4-channel tensor, which is then input into the defect localization network.

[0040] Network Prediction and Post-processing: The localization network adopts a U-Net architecture, outputting a single-channel dense probability map of the predicted fracture region. An adaptive effective threshold τ is used. eff =max(min(τ,τ k ),τ min The probability graph is binarized, where τ is the base confidence threshold (e.g., 0.5 or a preset empirical constant). k The optional top-k adaptive threshold, τ, is dynamically calculated based on the pixel response distribution in the dense probability map output by the model. min The optimal value is 0.02 to prevent excessive suppression of the response of the microscopic thin-walled weak structure. After binarization, isolated noise is suppressed and narrow gaps are reconnected through morphological opening and closing operations. Then, small connected components with areas below the preset threshold are removed to obtain the final candidate fracture region mask.

[0041] S3: The candidate fracture region mask is skeletonized to obtain a mask skeleton. The distance transformation field of the cell wall region is calculated. The adaptive expansion linewidth is determined based on the sampling value of the distance transformation field at the position of the mask skeleton. The mask skeleton is expanded with the adaptive expansion linewidth to obtain a topology refinement and repair mask.

[0042] This step aims to control the physical thickness of the repair boundary to prevent over-repair.

[0043] Distance transform field calculation: Threshold segmentation is performed on the cell wall regions of the cell micrograph (e.g., using Gaussian blur combined with Otsu's method for binarization) to extract the foreground wall regions. The L2 Euclidean distance from the background pixel to the nearest binary pixel of the wall region is calculated using a 5×5 mask to obtain the distance transform field (DT).

[0044] Adaptive linewidth calculation: Extract the median of the distance transformation from the real wall skeleton of the entire image and multiply it by 2 to obtain the global wall width scalar. At the endpoint of the predicted mask skeleton (i.e., the break point), take the median of the distance transformation of the nearest wall in the local neighborhood (e.g., 10 pixels) to determine the local wall width. Take a weighted average of the global wall width and the local wall width, each with a weight of 50%, and truncate it within the physical span interval of [3, 15] pixels, forcing it to be an odd number, to obtain the adaptive expansion linewidth.

[0045] Mask refinement: Morphological dilation of the single-pixel-wide mask skeleton is performed using the dynamically calculated adaptive linewidth to generate a topological refinement and repair mask that closely matches the thickness of real biological materials.

[0046] S4: Input the microscopic image of the fruit cells and the topology refinement and repair mask into the pre-trained repair network to generate a preliminary repair image.

[0047] Repair network structure: The repair network also adopts the U-Net architecture, with 5 input channels (RGB three channels + single-channel thinning mask + single-channel edge map). The encoder uses a MaxPool structure that does not require independent downsampling convolution, and the decoder uses bilinear upsampling combined with skip connections, without additional Sigmoid / Tanh, and the output is directly truncated to the [-1,1] interval.

[0048] Composite Loss Function Constraint: The training of this repair network is based on the composite loss function L. total =λ1L L1 +λ2L grad +λ3L LPIPS Backpropagation is performed to update the loss function. The preferred weight parameters for each loss term are λ1=1.0, λ2=0.2, and λ3=1.0. The specific definitions and algorithm sources for each parameter in the composite loss function are as follows: (1) L L1 (Local Reconstruction Loss): This item only calculates the L1 distance between the generated RGB image and the real complete reference image within the topology refinement and repair mask area, and normalizes it according to the total number of pixels in the mask to ensure the basic pixel-level color and brightness consistency of the broken area.

[0049] (2) L grad (Gradient Consistency Loss): This term is specifically used to maintain the orientation of the cell wall and the continuity of the edge structure. Algorithmically, it uses the finite difference approximation to calculate the Sobel gradient magnitudes of the predicted image and the real image within the repaired mask, and then calculates the L1 distance between them in the gradient domain.

[0050] (3) L LPIPS (Mask-Focused Perceptual Similarity Loss): To address the issue that conventional global perception loss is easily diluted by large-area bubbly backgrounds, this embodiment modifies the traditional LPIPS algorithm using "mask focusing." Specifically, the portion of the network-generated image within the mask region is hard-stitched with the portion of the real complete image outside the mask region, forming a stitched focused image (i.e., pred_focus = pred⊙M + gt⊙(1-M), where pred is the preliminary repaired image, M is the defect mask, and gt is the complete reference image). This stitched focused image and the original complete reference image are then input into a pre-trained visual network (such as AlexNet or VGG) containing frozen weights to extract deep features, and their distance in the feature space is calculated. This design forces the loss gradient to focus on and penalize microscopic textures and high-frequency semantic differences at the repaired fracture point.

[0051] S5: Extract the high-frequency detail components obtained from the fruit cell microscopic image based on the partial differential equation repair algorithm, superimpose them onto the corresponding area of ​​the preliminary repaired image according to a preset weight, and perform local color statistical matching and brightness adaptive suppression based on the context pixels outside the defect boundary to obtain the final repaired microscopic image.

[0052] This step plays a crucial role in ensuring the morphological consistency of the repair results.

[0053] PDE High-Frequency Detail Fusion: Within the masked area, the classic Telea and Navier-Stokes algorithms are used for restoration and equal-weighted fusion. The result of the classic restoration is subtracted from the result after 9×9 Gaussian blurring to extract the high-frequency detail components. The high-frequency details are multiplied by a fixed constant (preferably 0.62, within the optimal trade-off range of 0.55 to 0.70) and superimposed on the initial restored image of U-Net, significantly enhancing the microscopic texture of the cell walls.

[0054] Z-score color statistical matching: After dilating the mask 3×3 and subtracting the original mask, a ring-shaped region only 1 pixel wide is obtained, closely adhering to the defect boundary. The gradient magnitude of this region is calculated, and high-gradient pixels with a gradient greater than the 45th percentile are selected as the real wall reference context. The mean (μ) of the restored image within the mask and the mean (μ) of the restorative image in each RGB channel are calculated separately. r ,μ m ) and standard deviation (σ) r ,σ m ), through formula V new =(V old -μ m )·(σ r / σ m )+μ r The distribution is aligned to ensure that the color of the repaired fracture surface blends perfectly with the actual wall line.

[0055] Brightness-adaptive suppression: The color-aligned image is converted into the CIELAB color space, the brightness channel L is extracted, and the entire channel is multiplied by a brightness scaling factor (preferably 0.91, within the range of 0.88 to 0.94) to prevent the generated wall lines from being too bright. Finally, it is converted back to the RGB space, and the result is seamlessly embedded into the original image mask area.

[0056] This embodiment also provides a topology-aware fruit cell microscopic image restoration system, which includes virtual functional modules for performing the various steps of the above-described method. Specifically, it includes: Image acquisition module: used to acquire microscopic images of fruit cells to be repaired and perform preprocessing operations such as image normalization and hard masking.

[0057] Defect localization and prediction module: used to extract the edge gradient features of the fruit cell microscopic image, combine them with the original image and input them into a pre-trained defect localization network, output a dense probability map, and generate a candidate fracture region mask based on the dense probability map.

[0058] Adaptive topology refinement module: used to perform skeletonization processing on the candidate fracture region mask to obtain the mask skeleton, calculate the distance transformation field of the cell wall region, determine the adaptive expansion linewidth based on the sampling value of the distance transformation field at the position of the mask skeleton, and expand the mask skeleton with the adaptive expansion linewidth to obtain the topology refinement repair mask.

[0059] Network repair module: used to input the fruit cell microscopic image and the topology refinement repair mask into a pre-trained repair network to generate a preliminary repair image.

[0060] The morphology and color fusion module is used to extract the high-frequency detail components obtained from the fruit cell microscopic image based on the partial differential equation repair algorithm, superimpose them onto the corresponding area of ​​the preliminary repaired image according to a preset weight, and perform local color statistical matching and brightness adaptive suppression based on the context pixels outside the defect boundary to obtain the final repaired microscopic image.

[0061] Figure 3 The image shows a visual comparison between the restoration results of this invention and existing classic restoration algorithms in terms of cell wall topological connectivity. In the figure, skeletal topology extraction was performed on each restoration result. The cyan line segments visually map the extracted cell wall skeleton, while the red markers represent the topological connection nodes (branch intersections) in the cell wall network. The comparison clearly shows that traditional image restoration models, lacking perception of biological tissue morphology, result in excessively blurred or broken cell structures in the restoration area, leading to skeleton extraction failure. The images show only a very small number of cyan line segments and isolated red nodes, indicating severe loss of the cell wall network. In contrast, the restoration results of this invention show dense and continuous cyan skeleton line segments and abundant and reasonable distribution of red intersection nodes, successfully reconstructing a complete closed-loop continuous network and perfectly maintaining the biological network topology characteristics of the succulent fruit tissue.

[0062] Figure 4 This paper demonstrates the intermediate output results of the present invention under different data modes and a visual comparison of the repair of microscopic cell wall damage by different repair algorithms. Figure 4 (a) and Figure 4 (b) Shows the paired triplet input and paired mask when a complete reference graph is available during the training phase; Figure 4 (c) shows the triple input when there is no reference image during the actual reasoning phase; Figure 4(d) shows the no-reference dense probability map output by the defect localization prediction module, verifying the accuracy of the present invention in locating micro-defects in practical applications.

[0063] also, Figure 4 (e) A comparison of the repair effects of multiple methods is shown. From the magnified details of the defect in the image, it is clear that traditional methods either result in excessive blurring of fine cellular structures or generate repair marks with abnormal width and abrupt color at the break. This invention, by introducing targeted morphological fusion constraints and local color matching technology, achieves a perfect smooth transition between the generated cell wall region and the surrounding natural background pixels in terms of physical thickness, texture detail, and photometric grayscale. The repair marks are almost visually imperceptible, achieving optimal morphological consistency.

[0064] To further verify the superior performance of the proposed method in actual microscopic tissue repair and the non-obviousness of each module, the inventors conducted detailed quantitative comparative tests and ablation experiments based on a rigorous paired dataset. The specific verification data are as follows: 1. Comparison of quantitative indicators As shown in Table 1, the present invention has been comprehensively quantitatively evaluated against existing mainstream repair algorithms (including traditional methods such as Telea and deep learning models).

[0065] Table 1. Quantitative performance comparison of different repair algorithms method Peak signal-to-noise ratio Structural similarity Perceived image patch similarity Continuity Wall width error This invention 27.79 0.855 0.141 0.416 0.799 Deep learning 32.17 0.891 0.117 0.294 1.253 Telea tradition 32.99 0.907 0.153 0.340 6.244 Ns traditional 33.21 0.908 0.153 0.395 5.422 SD Deep Learning 26.28 0.812 0.132 0.627 1.096 According to the data in Table 1, although some deep learning models that simply pursue global pixel distribution optimization achieve high scores in global peak signal-to-noise ratio (PSNR) and structural similarity (SSIM), they do so at the cost of sacrificing local structural realism. This invention achieves superior performance compared to all baselines in the core metrics characterizing cell wall reconstruction accuracy—width error (WIR) and structural continuity (CONTINUITY). This demonstrates that in the field of biological microscopic imaging, the strategy of this invention successfully overcomes the technical bias of solely focusing on pixel-level metrics.

[0066] 2. Color Statistics and Detail Blending and Dissolving Experiment As shown in Tables 2 and 3, targeted ablation tests were conducted to verify the technical effect of the "shape and color fusion" module in step S5.

[0067] Table 2 Ablation Experiment of Morphology and Color Fusion Module method Peak signal-to-noise ratio Structural similarity Supervising the U-Net baseline 32.17 0.891 High-frequency detail fusion variant 28.31 0.855 Brightness Coordination Variation 29.82 0.878 This method 27.79 0.855 Table 3 Mask Area Indicators method Peak signal-to-noise ratio Structural similarity Perceived image patch similarity Telea tradition 32.17 0.891 0.155 NS tradition 28.31 0.855 0.155 Supervising the U-Net baseline 29.82 0.878 0.119 This invention 27.79 0.855 0.116 The data in Tables 2 and 3 clearly demonstrate that after superimposing high-frequency detail components based on partial differential equations (PDEs) and performing Z-score color matching and brightness suppression (multiplication factor control) based on real wall lines, the model achieves a remarkably significant improvement in Local Perceptual Image Patch Similarity (LPIPS). This comparative data strongly supports the core role of the post-processing fusion step in this invention in eliminating artificial repair traces and restoring the natural properties of microscopic textures.

[0068] 3. Verification of Topological Masking Mechanism As shown in Table 4, the irreplaceable role of the explicit topological adaptive expansion mechanism in controlling cell wall thickening in this invention is revealed.

[0069] Table 4 Ablation Experiments of Topology Adaptive Mask Refinement Mechanism method Structural continuity Wall width error Supervising the U-Net baseline 0.294±0.306 1.253±1.734 Topology loss augmented supervised repair network 0.597±0.254 2.184±2.137 This invention 0.416±0.229 0.799±1.150 Some existing technologies attempt to improve connectivity by simply introducing topological feature constraints into the network. As shown in Table 3, the test data for the topology loss-enhanced supervised repair network indicates that this purely implicit constraint easily leads to uncontrolled alternation of thickening and thinning in the repair structure, with the median wall width error significantly increasing to approximately 2.184 pixels. In contrast, after fully incorporating the "distance-transform-based mask adaptive dilatation and thinning" mechanism of this invention, the wall width error of the repair region is significantly reduced and extremely stable at approximately 0.799 pixels. This dramatic data comparison not only verifies the extreme precision of this scheme in maintaining biologically realistic thickness but also demonstrates the non-obviousness of the design strategy of integrating explicit geometric constraints into the deep network framework.

[0070] The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to substitute them, without departing from the spirit of the invention or exceeding the scope defined by the appended claims.

[0071] Although this paper frequently uses terms such as candidate fracture region mask, topology refinement and repair mask, and high-frequency detail component, the possibility of using other terms is not excluded. These terms are used merely for the convenience of describing and explaining the essence of this invention; interpreting them as any additional limitation would contradict the spirit of this invention.

Claims

1. A method for restoring fruit cell microscopic images based on topology sensing, characterized in that, Includes the following steps: S1: Obtain microscopic images of the fruit cells to be repaired; S2: Extract the edge gradient features of the fruit cell microscopic image, combine them with the original image and input them into a pre-trained defect localization network, output a dense probability map, and generate a candidate fracture region mask based on the dense probability map; S3: The candidate fracture region mask is skeletonized to obtain the mask skeleton. The distance transformation field of the cell wall region is calculated. The adaptive expansion linewidth is determined based on the sampling value of the distance transformation field at the position of the mask skeleton. The mask skeleton is expanded with the adaptive expansion linewidth to obtain the topology refinement and repair mask. S4: Input the fruit cell microscopic image and the topology refinement and repair mask into the pre-trained repair network to generate a preliminary repair image; S5: Extract the high-frequency detail components obtained from the fruit cell microscopic image based on the partial differential equation repair algorithm, superimpose them onto the corresponding area of ​​the preliminary repaired image according to a preset weight, and perform local color statistical matching and brightness adaptive suppression based on the context pixels outside the defect boundary to obtain the final repaired microscopic image.

2. The method according to claim 1, characterized in that, In step S2, the specific steps for generating the candidate fracture region mask based on the dense probability map include: S21: Obtain the dense probability map output by the defect localization network; S22: The dense probability map is binarized using an adaptive effective threshold, which is determined by a combination of the base confidence threshold, the adaptive threshold, and the minimum threshold. S23: Perform morphological opening and closing operations on the binarized result, and then remove connected components with areas lower than a preset area threshold to obtain the candidate fracture region mask.

3. The method according to claim 1, characterized in that, Step S3 specifically includes: S31: Perform skeletalization processing on the candidate fracture region mask; S32: Binarize the cell wall region of the cell micrograph, calculate the Euclidean distance from the background pixel to the nearest binary pixel in the wall region, and obtain the distance transformation field; S33: Obtain the median distance transformation of the effective pixels on the skeleton of the candidate fracture region mask, and determine the global wall width scalar based on the median. S34: At the endpoints of the predicted connecting skeleton, calculate the median of the distance transformation of the nearest wall in the local neighborhood to determine the local wall width; S35: The global wall width scalar and the local wall width are weighted and averaged, and the average is truncated and restricted within a preset physical span range to obtain an adaptive expansion line width. The skeleton is then expanded using the adaptive expansion line width.

4. The method according to claim 1, characterized in that, In step S5, the extraction and superposition of high-frequency detail components are specifically performed as follows: S501: The topology thinning and restoration mask region is restored based on the Telea algorithm and the Navier-Stokes algorithm respectively, and the restoration results of the two are fused with equal weight to obtain the classic restored image; S502: Subtract the Gaussian blurred image from the classic restored image to obtain the high-frequency detail component; S503: Multiply the high-frequency detail components by a fixed constant in the range of 0.55 to 0.70, then superimpose them onto the preliminary repaired image and truncate them to the effective pixel value range.

5. The method according to claim 1, characterized in that, In step S5, local color statistical matching is performed based on the context pixels outside the defect boundary, specifically including the following steps: S511: Perform morphological dilation on the topology refinement and repair mask to obtain an annular region that closely adheres to the defect boundary; S512: Combining the gradient magnitude of the image, select pixels with gradients greater than a preset percentile from the annular region as real wall reference contexts. S513: Calculate the mean and standard deviation of each color channel in the real wall reference context, and the mean and standard deviation of the preliminary repaired image within the topology refinement repair mask area; S514: By subtracting the mean value within the mask from the pixel values ​​of the initially repaired image, multiplying it by the standard deviation ratio, and then superimposing the context mean, the pixel values ​​within the repair mask are aligned to obtain an image after color statistical matching.

6. The method according to claim 1 or 5, characterized in that, In step S5, the brightness adaptive suppression specifically includes: S521: Convert the image after color statistical matching to the CIELAB color space; S522: Multiply the values ​​of its luminance channels by a luminance scaling factor in the range of 0.88 to 0.94; S523: Convert back to RGB color space and replace the pixels in the original mask area.

7. The method according to claim 1, characterized in that, The repair network is trained on a dataset that includes the following mechanisms: A paired mask is generated based on undamaged, intact cell microscopic images and corresponding artificially damaged images. The artificially damaged image is hard masked, and the pixel values ​​in the corresponding paired mask area are forcibly assigned to specific values ​​to prevent the leakage of underlying information; When applying random cropping image enhancement, a defect protection mechanism is introduced: if the number of effective pixels in the cropped mask is lower than a preset lower limit, line segment defects with a line width of 3 to 8 pixels are randomly generated on the image and the binarized defect mask tensor is updated simultaneously.

8. The method according to claim 7, characterized in that, The hard masking of artificially damaged images specifically includes the following steps: The pixel values ​​of each channel of the defective image to be input are normalized to obtain the normalized defective image tensor. Based on the Hadamard product formula T masked =T norm ⊙(1-M) performs a hard masking operation on the normalized defective image tensor, where T norm Let T represent the normalized defective image tensor, M represent the binarized paired mask tensor with a value of 1 for the defective region, and T represent the image tensor. masked This represents the image tensor after hard masking. The hard masking operation forces the pixel values ​​in the artificially damaged area to be cleared to zero.

9. The method according to claim 1, characterized in that, The repair network is updated by backpropagation based on a composite loss function, which includes at least local reconstruction loss and mask focus perception similarity loss. The local reconstruction loss is calculated by taking the L1 distance of the generated image within the mask area and normalizing it according to the number of mask pixels. The method for calculating the mask focusing perception similarity loss is as follows: the part of the generated image within the mask area is stitched and fused with the part of the complete cell micrograph outside the mask area to form a stitched focused image. Then, the distance between the stitched focused image and the complete cell micrograph in the feature space of the pre-trained visual network is calculated. The defect localization network is trained based on the sum of a weighted binary cross-entropy loss and a Dice loss. The dynamic positive sample weights in the weighted binary cross-entropy loss are determined by the ratio of the total number of background negative sample pixels to the total number of thin-walled positive sample pixels, and the ratio is truncated within a preset range.

10. A fruit cell microscopic image restoration system based on topology sensing, characterized in that, include: The image acquisition module is used to acquire microscopic images of the fruit cells to be repaired; The defect localization and prediction module is used to extract the edge gradient features of the fruit cell microscopic image, combine them with the original image and input them into a pre-trained defect localization network, output a dense probability map, and generate a candidate fracture region mask based on the dense probability map. An adaptive topology refinement module is used to perform skeletonization processing on the candidate fracture region mask to obtain a mask skeleton, calculate the distance transformation field of the cell wall region, determine the adaptive expansion linewidth based on the sampled value of the distance transformation field at the mask skeleton position, and expand the mask skeleton with the adaptive expansion linewidth to obtain a topology refinement repair mask. The network repair module is used to input the fruit cell microscopic image and the topology refinement repair mask into a pre-trained repair network to generate a preliminary repair image; The morphology and color fusion module is used to extract the high-frequency detail components obtained by the partial differential equation repair algorithm from the microscopic image of the fruit cells, superimpose them onto the corresponding area of ​​the preliminary repaired image according to a preset weight, and perform local color statistical matching and brightness adaptive suppression based on the context pixels outside the defect boundary to obtain the final repaired microscopic image.