Foreign object detection method, apparatus, electronic device, and computer program product
By performing noise addition and inverse denoising reconstruction on images in ore processing scenarios, anomaly heatmaps are generated, solving the reliability problem of foreign object detection in ore processing scenarios, achieving effective detection in the absence of anomaly sample annotations, and improving the stability and accuracy of detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN STREAMING VIDEO TECH
- Filing Date
- 2026-03-02
- Publication Date
- 2026-06-16
AI Technical Summary
In ore processing scenarios, existing foreign object detection methods rely on supervised learning, which makes it difficult to obtain a sufficient number of abnormal samples. This leads to the detection methods being prone to missed detections or false detections when the type of foreign object changes or the operating conditions fluctuate.
The acquired images to be tested are subjected to noise reduction to an intermediate noise level, and an inverse denoising and reconstruction is performed using a trained reconstruction model to generate an anomaly heatmap. The presence of foreign objects is then determined by combining the area conditions of the anomaly candidate regions.
In the absence of abnormal sample annotations, it improves the reliability and stability of foreign object detection, and significantly enhances the accuracy and anti-interference ability of detection.
Smart Images

Figure CN122223641A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of mining technology, and in particular relates to a foreign object detection method, a foreign object detection device, an electronic device, and a computer program product. Background Technology
[0002] Machine vision is typically used on ore processing production lines to detect ore on conveyor belts online, preventing foreign objects (including non-ore objects and large pieces of ore) from entering the crushing equipment and causing damage. Current common detection methods rely on image-based target recognition or anomaly detection models to analyze the conveyor belt footage. However, in real-world ore processing scenarios, foreign object types are diverse and their occurrence frequency is low, making it difficult to obtain a sufficient number of anomaly samples for model training. This leads to supervised learning-based detection methods being prone to missed or false detections when the type of foreign object changes or operating conditions fluctuate. Therefore, achieving reliable detection of foreign objects in ore processing scenarios has become a pressing technical problem that needs to be solved. Summary of the Invention
[0003] This application provides a foreign object detection method, a foreign object detection device, an electronic device, and a computer program product, which can reliably detect foreign objects in ore processing scenarios.
[0004] Firstly, this application provides a foreign object detection method, including:
[0005] The acquired image to be tested is subjected to noise addition processing to increase the noise level to an intermediate level, resulting in a noisy image. The image to be tested is acquired from the ore processing scene. The trained reconstruction model is used to perform inverse denoising and reconstruction on the noisy image to obtain the reconstructed image. An anomaly heatmap is generated based on the differences between the image to be tested and the reconstructed image; Anomaly candidate regions were identified in the anomaly heatmap; If the anomaly candidate region meets the preset anomaly conditions, the presence of a foreign object is determined.
[0006] Secondly, this application provides a foreign object detection device, comprising: The noise-adding module is used to perform noise-adding processing on the acquired image to be tested, adding noise to the image to the intermediate noise level to obtain a noisy image. The image to be tested is acquired from the ore processing scene. The reconstruction module is used to perform inverse denoising and reconstruction on the noisy image using a trained reconstruction model to obtain the reconstructed image. The generation module is used to generate anomaly heatmaps based on the differences between the image to be tested and the reconstructed image; The first determining module is used to identify candidate regions of anomalies in the anomaly heatmap. The second determination module is used to determine the presence of a foreign object when the abnormal candidate region meets the preset abnormal conditions.
[0007] Thirdly, this application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method described in the first aspect.
[0008] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described in the first aspect above.
[0009] Fifthly, this application provides a computer program product comprising a computer program that, when executed by one or more processors, implements the steps of the method described in the first aspect.
[0010] The advantages of this application compared to existing technologies are as follows: This application adds noise to the acquired image to be tested, raising the noise level to an intermediate level. Then, a trained reconstruction model performs inverse denoising and reconstruction on the noisy image to obtain a reconstructed image. Since the reconstruction model mainly learns the image features of normal ore scenes, when foreign objects are present in the image to be tested, the foreign object region is difficult to accurately reconstruct during the reconstruction process, resulting in a significant difference between the image to be tested and the reconstructed image in that region. The anomaly heatmap generated based on this difference can highlight anomaly candidate regions, and the presence of foreign objects can be determined by the area conditions of the anomaly candidate regions. This enables effective detection of foreign objects in ore processing scenarios in the absence of anomaly sample annotations, improving the reliability and stability of detection.
[0011] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 This is a schematic diagram illustrating the implementation process of the foreign object detection method provided in the embodiments of this application; Figure 2 This is a structural block diagram of the foreign object detection device provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0014] The embodiments of the technical solution of this application will now be described in detail with reference to the accompanying drawings. These embodiments are only used to more clearly illustrate the technical solution of this application and are therefore merely examples, and should not be used to limit the scope of protection of this application.
[0015] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application; the terms “comprising” and “having”, and any variations thereof, in the specification, claims, and foregoing description of the drawings are intended to cover non-exclusive inclusion.
[0016] In the description of the embodiments of this application, technical terms such as "first" and "second" are used only to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly indicating the number, specific order, or primary and secondary relationship of the indicated technical features.
[0017] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0018] In the description of the embodiments in this application, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects have an "or" relationship.
[0019] In the description of the embodiments of this application, the term "multiple" refers to two or more (including two), unless otherwise expressly and specifically defined.
[0020] This application proposes a foreign object detection method applied to ore processing scenarios such as conveyor belts in mining areas. The aim is to detect foreign objects on the conveyor belt in an unsupervised manner, including large pieces of ore or other types of objects. It is understood that the execution entity of this foreign object detection method is an electronic device with image processing capabilities; this application does not limit the type of such electronic device. Please refer to [link to relevant documentation]. Figure 1 , Figure 1The implementation process of this foreign object detection method is presented, and detailed below: Step 101: Perform noise addition processing on the acquired image to be tested, adding noise to the image to the intermediate noise level to obtain a noisy image.
[0021] Electronic devices can acquire the image under test in real time using industrial cameras deployed next to the conveyor belt; alternatively, electronic devices can also acquire the image under test in real time from existing monitoring systems deployed in the mining area. This application does not limit the specific method of acquiring the image under test. Generally, the acquired image under test is a color image or grayscale image containing ore flow.
[0022] After acquiring the image to be tested, the electronic device can perform noise addition processing on the image. Noise addition refers to a forward noise addition operation within the diffusion model framework, which can be performed by a conditional diffusion reconstruction model. Unlike existing technologies, in this embodiment, the electronic device does not completely add noise to the image to near-pure noise; instead, it adds noise to an intermediate noise level.
[0023] The intermediate noise level can be defined by the target noise-adding time step, which can be denoted as . t opt In a preset noise-adding schedule with a total time step of T, the electronic device can select a suitable time step from a preset candidate time step interval. t opt That's understandable. The selection needs to balance two factors: if If the noise level is too low, the injected noise will not be sufficient to disrupt the texture features of the anomalous target, and the subsequent reconstruction model may directly reconstruct the anomalous target, leading to missed detection; conversely, if the noise level is too high, the injected noise will be insufficient to destroy the texture features of the anomalous target. If the noise level is too high, excessive loss of image structural information may occur during the noise addition process, leading to structural shifts during reconstruction and false alarms. Therefore, The total time step should be selected. The middle region, denoted as the intermediate step candidate interval, allows the noisy image to retain structural information while destroying texture details. In some examples, this intermediate step candidate interval can be [0.3T, 0.7T], where [0.3T, 0.7T] is the selected target noisy time step. t opt It can be 0.5T; no specific limit is specified here.
[0024] An electronic device can inject Gaussian noise into the image under test based on a selected target noise-adding time step, thereby obtaining a noisy image. This noise-adding process can be represented by the following formula:
[0025] in, Represents the image to be tested; Indicates the time step for adding noise to the target; This is the cumulative retention factor, typically a value between 0 and 1; Standard Gaussian noise; This represents a noisy image. It's understandable that when... When an appropriate value is selected, part of the amplitude of the original signal is preserved. The low-frequency information of the image under test (including but not limited to the outline of the ore pile and the shape of the object) is preserved in the noisy image, while the high-frequency information of the image under test (including but not limited to the surface texture and material details) is destroyed by noise.
[0026] In some embodiments, after acquiring the image to be tested, the electronic device may preprocess the image before performing noise addition processing. This preprocessing may include, but is not limited to, image distortion correction, conveyor belt region cropping, size adjustment and numerical normalization (e.g., mapping to the [-1,1] interval), and extraction of corresponding operating condition information, etc., which are not limited here. It should be noted that the extraction of operating condition information should be performed based on the original image to be tested before numerical normalization (or before any other preprocessing steps) to preserve the true environmental characteristics.
[0027] This step allows the electronic device to control the noise level to an intermediate level, preserving the overall spatial structure of the image while destroying local texture details. This lays the foundation for subsequent reconstruction steps, ensuring that when the reconstruction model attempts to restore anomalous areas, it will incorrectly patch them as common normal fragmented mineral textures due to the lack of corresponding texture memory, thus producing significant reconstruction differences in anomalous areas; at the same time, it can also avoid deformation of normal areas due to complete destruction of the structure.
[0028] Step 102: Using the trained reconstruction model, perform inverse denoising reconstruction on the noisy image to obtain the reconstructed image.
[0029] The electronic device can then process the acquired noisy image using a pre-trained reconstruction model. Specifically, the reconstruction model is a deep neural network that learns and models the visual distribution patterns of a normal ore flow.
[0030] During the training phase of the reconstruction model, the model only uses a large number of images of broken ore flow under normal operating conditions for learning, and has never encountered samples of foreign objects (including large pieces of ore or other types of objects that are not ore).
[0031] In the application phase of the reconstruction model, electronic devices can add noise to images. and its corresponding noise time step The input is fed into the reconstruction model, causing it to perform an inverse denoising and reconstruction process; that is, simulating the inverse process of the diffusion model, from the noisy image... It begins by progressively predicting and removing noise, ultimately outputting a clear reconstructed image. Since the reconstruction model only learned how to recover the image information of normal broken ore from noise during training, it can reconstruct the original texture well for areas containing normal broken ore in the test image. However, for areas containing foreign objects in the test image, the reconstruction model will attempt to reconstruct the foreign object area as a broken ore texture due to the bias of its training memory.
[0032] Through this step, the electronic device utilizes the reconstruction model's unidirectional learning ability to visualize the distribution patterns of normal ore fragments, forcing the model to incorrectly reconstruct areas that may contain foreign objects. This process ensures that the reconstructed image is highly similar to the original image in areas containing normal ore fragments, while exhibiting a significant visual difference in areas containing foreign objects, thus creating conditions for subsequent difference detection.
[0033] Step 103: Generate an anomaly heatmap based on the differences between the image to be tested and the reconstructed image.
[0034] Electronic devices can compare the image under test with the reconstructed image, calculate the differences between them, and generate an anomaly heatmap. This heatmap, the image under test, and the reconstructed image have the same resolution, and the value of each pixel in the heatmap represents the probability of an anomaly at that location. Generally, the higher the value, the greater the probability of an anomaly at that location; conversely, the lower the value, the less likely an anomaly is at that location.
[0035] In some examples, the electronic device may directly calculate the difference in pixel values between the image under test and the reconstructed image to generate an anomaly heatmap. Alternatively, to more robustly capture semantic-level differences, the electronic device may further extract multi-layer features obtained from the image under test and the reconstructed image through a pre-trained deep network, calculate multi-scale differences in the feature space, and generate an anomaly heatmap by fusing pixel-level differences and feature-level multi-scale differences.
[0036] This step allows the electronic device to convert the qualitative differences expressed in the reconstructed image into an anomaly heatmap that can express quantitative differences. This anomaly heatmap can visually highlight areas that deviate from normal fragmented ore, i.e., areas suspected of containing large pieces of ore or other types of objects, thus providing a data foundation for subsequent accurate foreign object detection and localization.
[0037] Step 104: Identify candidate regions for anomalies in the anomaly heatmap.
[0038] Since directly observing the continuous values of a heatmap makes decision-making difficult, electronic devices can use image segmentation techniques to identify candidate regions for anomalies within the heatmap. Specifically, the electronic device can set a threshold and then perform a binarization segmentation operation on the heatmap. Based on the segmentation results, candidate regions for anomalies can be identified from the heatmap.
[0039] Through this step, the electronic device can transform the anomaly heatmap into discrete and specific anomaly candidate regions, which provides the electronic device with the possible location and range of anomalies.
[0040] Step 105: If the abnormal candidate area meets the preset abnormal conditions, it is determined that there is a foreign object.
[0041] After obtaining candidate anomaly regions, the electronic device can verify them to eliminate false alarms caused by possible transient interference (such as light flickering, splashing water droplets, or dust). For this purpose, preset anomaly conditions are introduced as verification rules. For example, the electronic device can set an area threshold; only when the area of a candidate anomaly region exceeds this threshold is the candidate region considered to represent a sufficiently large anomalous target (such as a large piece of ore), thus concluding the presence of a foreign object. Furthermore, the setting of these anomaly conditions is not limited to the area dimension; it can also include the average intensity of the anomaly heatmap within the candidate anomaly region and / or the shape complexity of the candidate anomaly region, etc., which are not limited here.
[0042] In some embodiments, to further improve reliability, the abnormal condition may also include the number of abnormal frames, thereby introducing a temporal consistency verification mechanism, which can provide a more stable foreign object detection result based on the number of abnormal frames. Specifically, for each abnormal candidate region, the electronic device can detect whether the abnormal candidate region has been stably detected in several consecutive abnormal frames of the test image; if so, it is considered that the abnormal candidate region satisfies spatiotemporal continuity, and its possibility of false detection is small. At this time, the abnormal candidate region will be finally confirmed as expressing a valid foreign object, that is, a foreign object is currently present; otherwise, if not, it is considered that the abnormal candidate region does not satisfy spatiotemporal continuity, and it may be a false detection caused by external conditions. At this time, the abnormal candidate region fails to express a valid foreign object, that is, no foreign object is currently present.
[0043] In some embodiments, when a foreign object is detected, the electronic device may output an alarm message, which may be used to trigger corresponding follow-up processing, including but not limited to shutdown inspection and / or sorting of foreign objects, etc., which are not limited here.
[0044] This step allows the electronic device to accurately detect the presence of foreign objects, significantly improving the stability and anti-interference capability of the detection, thereby ensuring the reliability of the final foreign object detection result and enabling subsequent linkage control.
[0045] In some embodiments, under actual ore processing scenarios, factors such as light intensity, dust concentration, conveyor belt speed, and ore quantity significantly affect image distribution. This can lead to blurred or unstable reconstruction results when directly training an unconditional diffusion reconstruction model under changing conditions, resulting in widespread false alarms. Therefore, in this embodiment, the reconstruction model used by the electronic device can specifically be a conditional diffusion reconstruction model. The training process for this conditional diffusion reconstruction model is detailed below: A1, obtain sample images and corresponding operating condition information.
[0046] Electronic equipment can acquire sample images from historical monitoring videos of the ore processing scene or specially acquired image sequences. It is important to note that all acquired sample images are images of normal crushed ore flow; that is, the sample images should only contain images of crushed ore within a normal size range flowing on the conveyor belt and should not contain image information of foreign objects.
[0047] Based on this, it is also necessary to collect or calculate the corresponding operating condition information for each sample image. The operating condition information refers to the status parameters of the on-site environment and / or equipment operation at the time the image was acquired; these status parameters significantly affect the specific appearance of the image.
[0048] In some examples, this operating condition information may include, but is not limited to, light intensity, dust concentration, belt speed, and ore quantity level, and can be expressed in the following form: .in, The intensity of light can be estimated from the average gray value of the sample image or the brightness of a specific area. Dust concentration can be estimated by the contrast attenuation of the sample image or the degree of energy attenuation of high-frequency components; The belt speed can be directly read from the control system, or it can be indirectly estimated through optical flow analysis of consecutive frame sample images. The ore quantity grade can be obtained by classifying the area ratio or texture complexity of the ore-covered region in the sample image.
[0049] It is understandable that the above operating condition information constitutes the conditional label describing the image generation environment. In fact, during the application of the conditional diffusion reconstruction model, electronic devices can also obtain the operating condition information corresponding to the image under test in the same way, which will not be elaborated here.
[0050] This step allows the electronic equipment to provide a high-quality data foundation for subsequent model training. Since only normal sample images are used, it ensures that the target distribution learned by the reconstructed model is a purely normal pattern; furthermore, the operational information provides the necessary input conditions for the reconstructed model to adapt to changing field environments.
[0051] A2 encodes the operating condition information into a condition vector and injects it into the condition diffusion reconstruction model.
[0052] The raw operating condition information obtained in step A1 is typically represented as a scalar or low-dimensional vector. Electronic devices can fuse and upscale this information, transforming it into an information-rich condition vector. This process is usually implemented using a multilayer perceptron (MLP). This MLP can process the obtained public information... As input, after nonlinear transformation, the output is a vector c of fixed dimension (e.g., 128-dimensional or 256-dimensional). This process is the encoding of operating condition information, which can be expressed by the following formula:
[0053] in, For the conditional vector dimension, This is the conditional vector obtained after mapping. The other parameters have been explained in the previous text and will not be repeated here.
[0054] Obtain the condition vector Subsequently, the electronic device can inject it into the conditional diffusion reconstruction model. The denoising network of this model employs a U-Net encoder-decoder structure. The encoder includes multiple downsampling stages and adds a self-attention layer at lower resolutions to enhance global dependency modeling capabilities. The decoder is symmetrically configured with the encoder and fuses with encoded features at corresponding scales through skip connections to preserve fine-grained spatial details. Each residual block simultaneously receives modulation from both conditional encoding and time-step encoding, enabling the network to stably reconstruct normal fragmented ore textures under different noise levels and combinations of conditions.
[0055] In some examples, the injection mechanism used by electronic devices can be Adaptive Layer Normalization (AdaLN), which works as follows: In each residual block of the U-Net structure, after performing layer normalization (LayerNorm) on the intermediate feature h, fixed scaling and offset parameters are no longer used. Instead, affine transformation is performed using scaling parameter γ(c) and offset parameter β(c) dynamically generated by a small network (usually a lightweight MLP) from the conditional vector c. This process can be expressed as the following formula:
[0056] in, As an intermediate feature, The scaling parameters are generated from the condition vector. The offset parameter is generated from the condition vector. This indicates element-wise multiplication. This means that the condition vector c (including working condition information such as illumination and dust information) directly modulates the distribution of features in each layer of the network, enabling the network to adaptively adjust its behavior during the denoising process according to the working conditions, generating crushed ore images that conform to the characteristics of the current environment.
[0057] Through this step, the electronic device encodes and deeply integrates physically perceptible operating condition information into the model architecture, making the reconstructed model no longer environment-independent but environment-aware. This ensures that the reconstructed model can understand the reasons for the current image quality degradation when facing different operating conditions, and generate normal fragmented ore images that conform to the visual characteristics of the current environment during reconstruction, thereby greatly reducing systematic false alarms caused by changes in the overall environment.
[0058] A3 uses a preset noise prediction loss function to train the conditional diffusion reconstruction model.
[0059] When training a conditional diffusion reconstruction model, the electronic device performs the following operations for each normal sample image x0 and its corresponding conditional vector c: First, it randomly samples a time step t, where t∈{1,2,...,T}, and T is the total number of diffusion steps; then, according to the forward formula of the diffusion process, it adds noise to the sample image x0 to obtain the noisy image x at time t. t Next, the noisy image x t The embedding representation of time step t and the conditional vector c are input together into the noise prediction network ε. θ In the U-Net (i.e., the conditional diffusion reconstruction model), the goal of this noise prediction network is to predict the noise ε added to x0; finally, the noise ε predicted by the network is calculated using a pre-defined noise prediction loss function. θ (x t The difference between (t,c) and the actual added noise ε, the noise prediction loss function is as follows:
[0060] The training objective is to minimize the obtained loss, that is, to achieve convergence of the obtained loss. Therefore, after training the conditional diffusion reconstruction model with a large amount of sample data and the obtained loss, the conditional diffusion reconstruction model can learn the following ability: given an image with arbitrary noise level t and current working condition c, accurately predict the noise; that is, the conditional diffusion reconstruction model has mastered how to start from the noise level and, under the guidance of the conditional vector c, reversely denoise and recover the normal crushed ore image x0 that conforms to the current working condition.
[0061] Through this step, combined with a preset noise prediction loss function, the electronic device can effectively train the conditional diffusion reconstruction model, enabling it to learn the conditional data distribution of a normal ore flow image under various noise interferences and operating conditions. It can be understood that the obtained conditional diffusion reconstruction model, when applied to step 102 mentioned above, can... The denoising process begins, resulting in a reconstructed image, which can be expressed as follows:
[0062] in, This is a conditional vector obtained based on the working condition information of the image under test. This describes the denoising process for the conditional diffusion reconstruction model.
[0063] In some embodiments, in order for the anomaly heatmap to accurately reflect the difference between the image under test and the reconstructed image, and to achieve precise anomaly localization, the electronic device can generate the anomaly heatmap in the following manner: B1 calculates the pixel differences between the image to be tested and the reconstructed image in pixel space.
[0064] Record the image to be tested (or the preprocessed image to be tested) as Reconstruct the image as Due to the image to be tested With reconstructed image Since the two images are the same size, electronic devices can directly calculate the pixel difference at corresponding pixel positions in the two images, which can be expressed by the following formula:
[0065] in, Here are the pixel coordinates. The pixel difference calculated using the above formula can be used to measure local grayscale differences. After calculation, a pixel difference map with the same resolution as the input image is obtained, where each pixel value reflects the direct numerical deviation between the original brightness / color of that point and the reconstructed result.
[0066] It should be noted that if the image is a multi-channel image (such as an RGB color image), the electronic device can first calculate the differences between each channel and then calculate the average or take the maximum value.
[0067] This step allows the electronic device to obtain the pixel differences between the image under test and the reconstructed image. Since pixel differences are extremely sensitive to even the smallest changes in grayscale or color within an image, it can quickly locate areas where pixel values have changed significantly, laying the foundation for subsequent anomaly detection.
[0068] B2 extracts multi-layer features from the image to be tested and the reconstructed image, and calculates the feature differences between the image to be tested and the reconstructed image under each layer of features.
[0069] To obtain deeper semantically informative difference metrics and compensate for the susceptibility of simple pixel differences to illumination and noise interference, electronic devices can also extract multi-scale feature differences. For this purpose, electronic devices can be equipped with pre-trained deep feature extraction networks. This deep feature extraction network extracts features from the test image and the reconstructed image, and calculates the differences in the feature spaces of each layer. This deep feature extraction network is typically pre-trained on a large image dataset (such as ImageNet), and its different depths of network layers can extract feature representations of the input image at different levels. Specifically, the calculation process of multi-scale feature differences may include: First, multi-scale features are extracted from the image to be tested and the reconstructed image. That is, the image to be tested... I org and reconstructed image I rec Input into the deep feature extraction network respectively The system extracts features (specifically feature maps) from each layer to capture differences at different levels, such as texture, edge, structure, and semantics. Generally, shallow features have a small receptive field and are sensitive to local textures, while deep features have a large receptive field and are sensitive to overall structure and semantics.
[0070] Next, for each layer of extracted features, the feature differences between the test image and the reconstructed image are calculated. Specifically, for the 1st layer... The number of channels in the feature map output by each feature layer is: The feature error of this layer can be calculated using the following formula:
[0071] in, For channel indexing.
[0072] This step allows the electronic device to obtain multi-scale feature differences between the image under test and the reconstructed image. Since these feature differences are more sensitive to changes in the semantic content, structural relationships, and material properties of the image, they can further help distinguish between normal fragmented ore and foreign matter in the image.
[0073] B3, which combines pixel differences and feature differences to generate an anomaly heatmap.
[0074] Since pixel differences and feature differences between layers may have different numerical magnitudes and resolutions, directly adding them together for fusion may lead to unreasonable fusion results. Therefore, electronic devices can use a weighted fusion method to fuse the two, thereby generating an anomaly heatmap. This anomaly heatmap has the same resolution as the original image under test, and the pixel value of each pixel comprehensively reflects the confidence level that the pixel location belongs to an anomaly region.
[0075] Through this step, the electronic device can fuse multi-source information to construct a robust and highly discriminative anomaly heatmap. Since pixel differences provide subtle clues to local changes, and multi-layered feature differences provide global consistency constraints from detail to semantics, their fusion helps the electronic device capture local abruptness and overall inconsistency of anomalies. This effectively suppresses isolated high responses caused by the complex texture of the ore flow itself or transient noise, allowing true anomalous regions to stand out in a high-contrast and spatially coherent manner on the anomaly heatmap. This, in turn, helps in the subsequent accurate localization of anomaly candidate regions.
[0076] In some embodiments, the process of fusing pixel differences and feature differences to generate an anomaly heatmap may include: C1 upsamples the feature differences under each layer to the same resolution as the image under test.
[0077] The feature differences between layers extracted by pre-trained deep feature extraction networks often have different resolutions, and these resolutions are usually lower than the resolution of the image under test. Therefore, in order to perform pixel-by-pixel fusion with pixel differences (with the same resolution as the image under test), electronic devices can first upsample all feature differences to the same scale. In some examples, this upsampling operation can be implemented through bilinear interpolation, which will not be elaborated here.
[0078] This step allows the electronic device to align all the difference maps to be fused (including feature differences and pixel differences) in the spatial dimension, laying the foundation for subsequent pixel-by-pixel positional information integration.
[0079] C2 performs normalization processing on pixel differences and feature differences after upsampling of features at each layer.
[0080] Due to pixel differences, Norm, feature difference The norms of the two are of different magnitudes, so numerical alignment of each error difference is required before fusion. In the embodiments of this application, the electronic device can adopt a global normalization method based on validation set statistics, using the extreme values or variance parameters obtained from statistics on normal samples to map each error to a uniform order of magnitude range, rather than performing independent minimum-maximum normalization for a single image, thereby preserving the absolute difference in abnormal intensity.
[0081] C3 weights and fuses the normalized pixel differences and the normalized feature differences under each layer according to preset weights to obtain an anomaly heatmap.
[0082] After resolution alignment and numerical magnitude normalization are completed, the electronic device can linearly weight and combine all processed errors to generate the final anomaly heatmap. The preset weights used in this process reflect the importance of different error information in the final anomaly determination.
[0083] In some examples, the weights of pixel errors can be denoted as... w 0, the weights of the feature errors of each layer are respectively denoted as w 1, w 2,..., w l (Assuming there are a total of) l (Layer features). These weights can be fixed values set empirically, or they can be fine-tuned based on performance on a validation set. For example, electronic devices can be assigned weights that vary more significantly to mid-layer features because they balance detailed texture and semantic structural information.
[0084] For ease of understanding, the above weighted fusion process can be represented by the following formula:
[0085] in, For normalized pixel error, For normalized feature error, The weights for pixel errors, For the first Weights of layer feature errors E total This is the generated heatmap of anomalies.
[0086] It is understandable that normal regions have small normalization errors at all scales, resulting in lower values; while foreign object regions usually generate large normalization errors at multiple scales simultaneously. These errors, after being weighted and accumulated, form significant high-value response regions, which are clearly displayed on the heatmap.
[0087] Through this step, the electronic device can fuse multi-scale and multi-level errors based on controllable weight configuration to obtain an anomaly heatmap. This anomaly heatmap can intuitively indicate the probability that each pixel location in the image belongs to an anomaly, providing accurate and robust input for subsequent threshold-based binarization segmentation and anomaly candidate region identification.
[0088] In some embodiments, the electronic device can determine abnormal candidate regions in the following manner: D1, based on adaptive thresholding, performs thresholding segmentation on the abnormal heatmap to obtain a binary mask image.
[0089] Electronic devices can directly use a fixed threshold to perform threshold segmentation on anomaly heatmaps to obtain binary mask images. However, fixed thresholds are ineffective in complex and variable working conditions in mining areas (such as gradual changes in illumination and / or fluctuations in dust concentration), easily leading to false alarms or missed alarms. Therefore, in this embodiment, the electronic device can replace the fixed threshold with an adaptive threshold. This adaptive threshold refers to a threshold that is not fixed but dynamically calculated based on the statistical characteristics of recent image sequences, and can be adjusted to fluctuate according to the overall anomaly response level of the scene.
[0090] Specifically, the electronic device can maintain a sliding window containing anomaly heatmaps corresponding to the most recent N frames of historical images to be tested, where N is a positive integer, such as 50 or other suitable values. Based on the anomaly heatmap data within this sliding window, the electronic device can calculate the average error of each historical image to be tested. Taking any historical image to be tested as an example, its average error refers to the mean of the error values expressed by all pixels in the anomaly heatmap of that historical image; thus, N average errors can be obtained, forming an average error sequence.
[0091] Of course, this sliding window can be further optimized to include anomaly heatmaps corresponding to the most recent N frames of historical test images with high confidence. The confidence level can be inferred from the reconstruction errors of the historical test images: a low reconstruction error indicates that most areas of the frame can be reconstructed normally, resulting in high confidence (classified as a normal frame); a high reconstruction error indicates that the frame may contain abnormal areas, resulting in low confidence (potentially an abnormal frame). The purpose of this optimization is to ensure that the sliding window only includes error statistics from test images with high confidence, avoiding the high error values of abnormal frames from contaminating the statistical results of the normal error distribution, thereby guaranteeing the stability and accuracy of the subsequently obtained adaptive threshold.
[0092] Based on this average error sequence, the electronic device can further calculate the mean and standard deviation of the average error within the sliding window using statistical methods, and then calculate the adaptive threshold using the following formula:
[0093] in, This represents the mean; represents the standard deviation; k represents the empirical coefficient, which can be adjusted, for example, it can be 3, corresponding to the 3-sigma principle in statistics; This is the calculated adaptive threshold.
[0094] Obtain the adaptive threshold Then, the electronic device can detect the abnormal heatmap E of the current frame. total Perform threshold segmentation. That is, for abnormal heatmaps E... total For each pixel position (i,j) in the dataset, assign the value E corresponding to that pixel. total(i,j) and Comparison: If E total(i,j) > If the value is not specified, the pixel is considered a potential outlier and is marked as foreground (e.g., assigned a value of 1).
[0095] Conversely, if E total(i,j) ≤ If the value is not specified, the pixel is considered to belong to the normal background and is marked as background (for example, assigned a value of 0). This yields the binary mask image.
[0096] This step utilizes a dynamically changing adaptive threshold to detect preliminary anomalies. This adaptive threshold can adapt to the overall response drift caused by long-term environmental changes, effectively distinguishing truly significant abnormal high-response regions from high values of random noise caused by slight fluctuations in operating conditions, thus obtaining a relatively clean binary preliminary result.
[0097] D2 performs connected component analysis on the binary mask image to obtain anomaly candidate regions.
[0098] In a binary mask image, foreground pixels (points with a value of 1) may be scattered across different locations in the image. Based on this, electronic devices can perform connected component analysis on the binary mask image to identify and label these spatially connected sets of foreground pixels, thereby obtaining anomaly candidate regions.
[0099] Specifically, before connected component analysis, the electronic device can first perform basic morphological operations on the binary mask image, such as morphological opening (erosion followed by dilation). Through morphological opening, the electronic device can effectively remove small isolated noise points (such as misclassified points of a few pixels) in the binary mask image and smooth the boundaries of larger regions, thus making the binary mask image cleaner and more coherent. Then, the electronic device can scan the morphologically processed binary mask image and use specific connectivity rules (such as 4-connectivity or 8-connectivity) to determine the adjacency relationships between pixels. This process can group all interconnected foreground pixels into the same set and assign a unique label to each such independent set. It can be understood that an independent set can be identified as an anomalous candidate region, representing a spatially continuous and sizable suspected anomalous object, such as a large ore, a stick, or a clump of foreign objects.
[0100] As can be seen from the above, this embodiment of the application performs noise addition processing on the acquired image to be tested, increasing the noise level to an intermediate level. Then, a trained reconstruction model is used to perform inverse denoising and reconstruction on the noisy image to obtain a reconstructed image. Since the reconstruction model mainly learns the image features of normal ore scenes, when there are foreign objects in the image to be tested, the foreign object area is difficult to accurately restore during the reconstruction process, resulting in a significant difference between the image to be tested and the reconstructed image in that area. The anomaly heatmap generated based on this difference can highlight the anomaly candidate area, and the presence of foreign objects can be determined by the area condition of the anomaly candidate area. Thus, effective detection of foreign objects in ore processing scenarios can be achieved in the absence of anomaly sample annotations, improving the reliability and stability of detection.
[0101] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0102] Corresponding to the foreign object detection method provided above, this application also provides a foreign object detection device. Please refer to... Figure 2 The foreign object detection device 2 in this embodiment includes: The noise-adding module 201 is used to perform noise-adding processing on the acquired image to be tested, adding noise to the image to be tested to an intermediate noise level to obtain a noisy image, wherein the image to be tested is acquired from the ore processing scene; The reconstruction module 202 is used to perform inverse denoising reconstruction on the noisy image using a trained reconstruction model to obtain a reconstructed image; Generation module 203 is used to generate an anomaly heatmap based on the differences between the image to be tested and the reconstructed image; The first determining module 204 is used to determine the candidate regions of anomalies in the anomaly heatmap. The second determining module 205 is used to determine the presence of a foreign object when the abnormal candidate region meets the preset abnormal conditions.
[0103] In some embodiments, the reconstruction model is a conditional diffusion reconstruction model; the foreign object detection device 2 further includes: a training module for training the conditional diffusion reconstruction model; the training module includes: The first acquisition unit is used to acquire sample images and corresponding working condition information; The injection unit is used to encode the operating condition information into a condition vector and inject it into the condition diffusion reconstruction model; The training unit is used to train the conditional diffusion reconstruction model using a preset noise prediction loss function.
[0104] In some embodiments, the noise-adding module 201 includes: The second acquisition unit is used to acquire the image to be tested; The determination unit is used to determine the target noise addition time step according to the preset noise scheduling function; The noise-adding unit is used to inject Gaussian noise into the image under test based on the target noise-adding time step to obtain a noisy image.
[0105] In some embodiments, the generation module 203 includes: The first computing unit is used to calculate the pixel differences between the image under test and the reconstructed image in the pixel space; The extraction unit is used to extract multi-layer features of the image to be tested and the reconstructed image, and to calculate the feature differences between the image to be tested and the reconstructed image under each layer of features. The fusion unit is used to fuse pixel differences and feature differences to generate anomaly heatmaps.
[0106] In some embodiments, the fusion unit includes: The upsampling subunit is used to upsample the feature differences under each layer to the same resolution as the image under test; The normalization subunit is used to perform normalization processing on pixel differences and feature differences after upsampling of features from each layer; The weighted fusion subunit is used to weight and fuse the normalized pixel differences and the normalized feature differences under each layer according to preset weights to obtain an anomaly heatmap.
[0107] In some embodiments, the first determining module 204 includes: The segmentation unit is used to perform threshold segmentation on the abnormal heatmap based on an adaptive threshold to obtain a binary mask image; The analysis unit is used to perform connected component analysis on the binary mask image to obtain anomaly candidate regions.
[0108] In some embodiments, the first determining module 204 further includes: The second calculation unit is used to calculate the average error of each historical image to be tested based on the abnormal heat map of each historical image to be tested. The third calculation unit is used to calculate the mean and standard deviation based on the average error of each historical image to be tested; The fourth calculation unit is used to calculate the adaptive threshold based on the mean and standard deviation.
[0109] As can be seen from the above, this embodiment of the application performs noise addition processing on the acquired image to be tested, increasing the noise level to an intermediate level. Then, a trained reconstruction model is used to perform inverse denoising and reconstruction on the noisy image to obtain a reconstructed image. Since the reconstruction model mainly learns the image features of normal ore scenes, when there are foreign objects in the image to be tested, the foreign object area is difficult to accurately restore during the reconstruction process, resulting in a significant difference between the image to be tested and the reconstructed image in that area. The anomaly heatmap generated based on this difference can highlight the anomaly candidate area, and the presence of foreign objects can be determined by the area condition of the anomaly candidate area. Thus, effective detection of foreign objects in ore processing scenarios can be achieved in the absence of anomaly sample annotations, improving the reliability and stability of detection.
[0110] Corresponding to the foreign object detection method provided above, this application also provides an electronic device. Please refer to... Figure 3 The electronic device 3 in this application embodiment includes: a memory 301, and one or more processors 302. Figure 3 (Only one is shown in the image) and a computer program stored in memory 301 and executable on the processor. Specifically, the processor 302 performs the following steps by running the aforementioned computer program stored in memory 301: The acquired image to be tested is subjected to noise addition processing to increase the noise level to an intermediate level, resulting in a noisy image. The image to be tested is acquired from the ore processing scene. The trained reconstruction model is used to perform inverse denoising and reconstruction on the noisy image to obtain the reconstructed image. An anomaly heatmap is generated based on the differences between the image to be tested and the reconstructed image; Anomaly candidate regions were identified in the anomaly heatmap; If the anomaly candidate region meets the preset anomaly conditions, the presence of a foreign object is determined.
[0111] Assuming the above is the first possible implementation, then in the second possible implementation based on the first possible implementation, the reconstruction model is a conditional diffusion reconstruction model; the training process of the conditional diffusion reconstruction model includes: Acquire sample images and corresponding operating condition information; The operating condition information is encoded into a condition vector and injected into the conditional diffusion reconstruction model; The conditional diffusion reconstruction model is trained using a pre-defined noise prediction loss function.
[0112] In a third possible implementation based on the first possible implementation described above, or based on the second possible implementation described above, noise addition processing is performed on the acquired image to be tested to add noise to the image to be tested to an intermediate noise level, resulting in a noisy image, including: Acquire the image to be tested; The target noise addition time step is determined according to the preset noise scheduling function; Based on the target noise addition time step, Gaussian noise is injected into the image to be tested to obtain a noisy image.
[0113] In a fourth possible implementation based on the first possible implementation described above, or based on the second possible implementation described above, generating an anomaly heatmap based on the difference between the image to be tested and the reconstructed image includes: Calculate the pixel differences between the image to be tested and the reconstructed image in pixel space; Extract multi-layer features from the image to be tested and the reconstructed image, and calculate the feature differences between the image to be tested and the reconstructed image under each layer of features; By fusing pixel differences and feature differences, an anomaly heatmap is generated.
[0114] In a fifth possible implementation provided based on the fourth possible implementation described above, pixel differences and feature differences are fused to generate an anomaly heatmap, including: Upsample the feature differences under each layer to the same resolution as the image under test; Normalization is performed on pixel differences and feature differences after upsampling of features at each layer. The normalized pixel differences and the normalized feature differences under each layer are weighted and fused according to preset weights to obtain an anomaly heatmap.
[0115] In a sixth possible implementation based on the first possible implementation described above, or based on the second possible implementation described above, identifying anomaly candidate regions in the anomaly heatmap includes: Based on adaptive thresholding, threshold segmentation is performed on abnormal heatmaps to obtain binary mask images; Connectivity analysis is performed on the binary mask image to obtain anomaly candidate regions.
[0116] In the seventh possible implementation provided based on the sixth possible implementation described above, the adaptive threshold is calculated as follows: Based on the anomaly heatmaps of each historical image to be tested, the average error of each historical image to be tested is calculated. Calculate the mean and standard deviation based on the average error of each historical image to be tested; An adaptive threshold is calculated based on the mean and standard deviation.
[0117] It should be understood that, in the embodiments of this application, the processor 302 may be a central processing unit (CPU), but it may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0118] Memory 301 may include read-only memory and random access memory, and provides instructions and data to processor 302. Some or all of memory 301 may also include non-volatile random access memory. For example, memory 301 may also store device type information.
[0119] As can be seen from the above, this embodiment of the application performs noise addition processing on the acquired image to be tested, increasing the noise level to an intermediate level. Then, a trained reconstruction model is used to perform inverse denoising and reconstruction on the noisy image to obtain a reconstructed image. Since the reconstruction model mainly learns the image features of normal ore scenes, when there are foreign objects in the image to be tested, the foreign object area is difficult to accurately restore during the reconstruction process, resulting in a significant difference between the image to be tested and the reconstructed image in that area. The anomaly heatmap generated based on this difference can highlight the anomaly candidate area, and the presence of foreign objects can be determined by the area condition of the anomaly candidate area. Thus, effective detection of foreign objects in ore processing scenarios can be achieved in the absence of anomaly sample annotations, improving the reliability and stability of detection.
[0120] This application also provides a computer program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.
[0121] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the above device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0122] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0123] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of external device software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0124] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules or units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.
[0125] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0126] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing associated hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer-readable storage device, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the contents of the aforementioned computer-readable storage media may be appropriately added to or subtracted from the contents according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media may not include electrical carrier signals and telecommunication signals.
[0127] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for detecting foreign objects, characterized in that, include: The acquired image to be tested is subjected to noise addition processing to increase the noise level of the image to be tested to an intermediate noise level, thereby obtaining a noisy image. The image to be tested is acquired from an ore processing scenario. The noisy image is reversed and reconstructed using the trained reconstruction model to obtain the reconstructed image. An anomaly heatmap is generated based on the differences between the image to be tested and the reconstructed image; Anomaly candidate regions are identified in the anomaly heatmap; If the candidate region of anomalies meets the preset anomaly conditions, it is determined that a foreign object exists.
2. The foreign object detection method as described in claim 1, characterized in that, The reconstruction model is a conditional diffusion reconstruction model; the training process of the conditional diffusion reconstruction model includes: Acquire sample images and corresponding operating condition information; The operating condition information is encoded into a condition vector and injected into the conditional diffusion reconstruction model; The conditional diffusion reconstruction model is trained using a preset noise prediction loss function.
3. The foreign object detection method as described in claim 1 or 2, characterized in that, The step of performing noise addition processing on the acquired image to be tested, adding noise to the image to an intermediate noise level to obtain a noisy image, includes: Acquire the image to be tested; Determine the target noise-adding time step within the preset time step candidate interval; Based on the target noise-adding time step, Gaussian noise is injected into the image to be tested to obtain the noisy image.
4. The foreign object detection method as described in claim 1 or 2, characterized in that, The step of generating an anomaly heatmap based on the difference between the image to be tested and the reconstructed image includes: Calculate the pixel differences between the image to be tested and the reconstructed image in the pixel space; Extract multi-layer features from the image to be tested and the reconstructed image, and calculate the feature differences between the image to be tested and the reconstructed image under each layer of features; By fusing the pixel differences and the feature differences, an anomaly heatmap is generated.
5. The foreign object detection method as described in claim 4, characterized in that, The process of fusing the pixel differences and the feature differences to generate an anomaly heatmap includes: The feature differences under each layer are upsampled to the same resolution as the image to be tested; Normalization processing is performed on the pixel differences and the feature differences after downsampling of each layer's features; The normalized pixel differences and the normalized feature differences under each layer are weighted and fused according to preset weights to obtain the abnormal heatmap.
6. The foreign object detection method as described in claim 1 or 2, characterized in that, The process of identifying candidate regions for anomalies in the abnormal heatmap includes: Based on an adaptive threshold, the abnormal heatmap is segmented to obtain a binary mask image; Connectivity analysis is performed on the binary mask image to obtain the anomaly candidate region.
7. The foreign object detection method as described in claim 6, characterized in that, The adaptive threshold is calculated as follows: Based on the abnormal heatmaps of each historical image to be tested, the average error of each historical image to be tested is calculated. Calculate the mean and standard deviation based on the average error of each of the historical images to be tested. The adaptive threshold is calculated based on the mean and the standard deviation.
8. A foreign object detection device, characterized in that, include: The noise-adding module is used to perform noise-adding processing on the acquired image to be tested, adding noise to the image to be tested to an intermediate noise level to obtain a noisy image, wherein the image to be tested is acquired from an ore processing scenario; The reconstruction module is used to perform inverse denoising reconstruction on the noisy image using a trained reconstruction model to obtain a reconstructed image; The generation module is used to generate an anomaly heatmap based on the differences between the image to be tested and the reconstructed image; The first determining module is used to determine the abnormal candidate region in the abnormal heat map; The second determining module is used to determine the presence of a foreign object when the abnormal candidate region meets the preset abnormal conditions.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 7.
10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by one or more processors, implements the method as described in any one of claims 1 to 7.