A deep learning-based MRI foreign object identification method and system
Patent Information
- Application Number
- CN202611001137.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-07
- Publication Date
- 2026-10-09
- Estimated Expiration
- 2046-07-07
AI Technical Summary
[0003]目前,MRI检查室的异物检测主要依赖金属探测器、人工问询及目视检查,存在以下技术问题:1)检测手段单一:金属探测器不能区分铁磁性与非铁磁性金属(如铝、铜),常因手机、皮带扣等非铁磁性物品引发误报,导致检查流程中断;2)无非金属异物检测能力:MRI检查前患者应尽量去除所有随身物品,但现有系统无法检测非金属异物(如塑料水瓶、背包等),存在安全盲区;3)小目标识别差:首饰、耳钉等微小物体(<32×32像素)是常见安全隐患,但现有检测方法对此类目标的识别准确率显著下降;4)极端形态物体易漏检:传统单尺度检测对极端长宽比物体(如拐杖、雨伞等细长物体)容易漏检;5)无物品级识别能力,只能判断是否存在金属,不能识别是什么物品
本发明提出一种基于深度学习的MRI环境异物识别方法及系统。首先,本发明可实现112类物品的精准识别:引入YOLO-World开放词汇检测架构,依托CLIP(ContrastiveLanguage-Image Pre-training,对比语言-图像预训练模型)实现零样本泛化识别;内置112类细粒度提示词(覆盖头部饰品至大型医疗设备),通过112类细粒度检测→20类MRI安全映射的两级语义架构,将视觉特征直接关联至临床安全标签;无需针对新型随身物品或医疗器械重新采集数据与训练模型,仅需更新文本提示即可无缝扩展;解决传统探测器只报不认的技术瓶颈,实现从物理信号探测到语义级物品识别的跨越,模型扩展周期从月级训练缩短至小时级配置;其次,本发明提出多尺度分区全覆盖检测策略:采用全图检测与分块检测的多尺度检测策略,显著增强了浅层边缘梯度与深层语义特征激活,其中密度自适应动态分块检测策略将目标检测流程中第一阶段的部分产出反向反馈至检测策略自身,即粗检测结果不仅用于最终判定,还用于动态规划后续精检测的空间搜索方案,使得系统具备根据实际场景自适应调度计算资源的能力,在目标稀疏的场景中自动减少分块数以节省推理耗时,在目标密集的场景中自动增加分块数并触发子分割以提升局部检测精度;实时视频流可采用首帧全扫描+后续帧单图推理的自适应调度,在保障≥15fps监控帧率的同时,实现对任意尺寸、长宽比及空间分布物体的无死角捕获,极端形态物体漏检率降低至<1%;再次,本发明构建注意力聚焦-语义吸收-动态阈值三层防御矩阵:将112类目标拆分为3组(每组约40类)逐组推理,CLIP对比学习中的单类注意力权重理论提升约3倍;注入9个背景类(person/牛仔裤/裤袋等)作为语义负样本池,在归一化指数函数层竞争分散衣物纹理与家具反光的匹配概率,从源头抑制伪阳性;基于超过5000张临床真实场景回测数据,为手提包、智能手机、外科镊子等15类高频误检目标标定独立置信度门槛,在后处理阶段执行硬性过滤;该机制在保持真检率>96%的前提下,将临床环境误报率降低至<2次/小时,确保系统在真实高压医疗场景中的长期稳定运行与医护人员信任度。
Smart Images

Figure CN122574832B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of medical safety monitoring technology, specifically to a method and system for foreign object identification in MRI environments based on deep learning. Background Technology
[0002] The magnetic resonance imaging (MRI) examination room contains a strong magnetic field environment. If ferromagnetic metal objects are drawn into the magnet, it can cause serious safety accidents such as equipment damage and personal injury. Foreign object detection in the MRI examination room is a crucial step in ensuring the safety of MRI imaging.
[0003] Currently, foreign body detection in MRI examination rooms mainly relies on metal detectors, manual questioning, and visual inspection, which presents the following technical problems: 1) Limited detection methods: Metal detectors cannot distinguish between ferromagnetic and non-ferromagnetic metals (such as aluminum and copper), and often cause false alarms due to non-ferromagnetic items such as mobile phones and belt buckles, leading to interruptions in the examination process; 2) Lack of non-metallic foreign body detection capability: Patients should remove all personal belongings before MRI examination, but existing systems cannot detect non-metallic foreign bodies (such as plastic water bottles, backpacks, etc.), creating a safety blind spot; 3) Poor recognition of small targets: Small objects such as jewelry and earrings (<32×32 pixels) are common safety hazards, but the accuracy of existing detection methods for recognizing such targets is significantly reduced; 4) Extremely shaped objects are easily missed: Traditional single-scale detection is prone to missing objects with extreme aspect ratios (such as canes, umbrellas, and other slender objects); 5) Lack of item-level recognition capability: It can only determine whether metal is present, but cannot identify what kind of object it is.
[0004] Therefore, there is an urgent need for an MRI-based method for identifying foreign objects in the environment that has object-level recognition capabilities and a good detection rate for small targets and objects with extreme shapes. Summary of the Invention
[0005] To address or alleviate one or more of the aforementioned problems, this invention proposes a method and system for foreign object identification in MRI environments based on deep learning.
[0006] According to one aspect of the present invention, a method for foreign object identification in MRI environment based on deep learning is proposed, the method comprising the following steps: Real-time acquisition of high-definition video streams and preprocessing of video images; A deep learning-based target detection model is used to perform a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on the constructed target text prompt set, so as to obtain preliminary detection results. Determine the triggering conditions based on the preliminary test results; Enhanced detection is performed on the preliminary detection results that meet the triggering conditions, including: expanding and enlarging the detection box in the preliminary detection result outward from the center, inputting the enlarged detection box into the target detection model for re-inference, and obtaining the secondary detection result; The secondary detection results are mapped and deduplicated to obtain the final detection result; The detection results include: target category, detection box, and confidence level.
[0007] Furthermore, the preprocessing includes: contrast enhancement, noise removal, color space conversion, and image size adaptation.
[0008] Furthermore, the method employs a deep learning-based target detection model, and performs a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on the constructed target text prompt set, to obtain preliminary detection results, including: Based on the principles of semantic similarity, detection area grouping by body part, false detection isolation, and inter-group balance, the target text prompts are pre-divided into three groups of prompt words. The preprocessed image is input into a deep learning-based object detection model, and full-image detection is performed based on three different sets of prompt words. The three sets of detection results are then merged into a full-image detection result. The preprocessed image is divided into n×n overlapping blocks, and each block is input into a deep learning-based object detection model to perform block detection based on the constructed target text prompt set. The coordinates of each detection box in each block detection result are mapped back to the image coordinate system of the original image based on the coordinate offset to obtain the detection result of each block. The full-image detection results are combined with the detection results of each block to obtain preliminary detection results.
[0009] Further, the block detection involves: performing density-adaptive dynamic block division on the preprocessed image, and performing block detection on the block-divided image based on the constructed target text prompt set; including: The center points of the detection boxes in the full-image detection results are grouped based on the spatial clustering algorithm; Merge the coordinates of all detection boxes corresponding to each group to obtain the smallest bounding rectangle containing all detection boxes of that group; The density value for each group is calculated as follows: the number of detection boxes within the group divided by the ratio of the area of the smallest bounding rectangle of that group to the total area of the image. Based on the minimum bounding rectangle of each group, the context filling region is expanded outward to form the image block corresponding to that group; wherein, the size of the filling region is determined based on the density value. For a group that simultaneously meets the following three conditions, the corresponding image block is further divided into multiple smaller overlapping sub-blocks: the density value reaches a preset threshold; the size of the current image block meets the minimum size requirement; and the total number of blocks in the current image block is less than the preset upper limit of the number of blocks.
[0010] Furthermore, the trigger condition judgment for the preliminary detection result includes: the maximum side length of the detection box in the preliminary detection result is less than a preset scale threshold, and the confidence level is between the first confidence threshold and the second confidence threshold; wherein, the second confidence threshold is greater than the first confidence threshold.
[0011] Furthermore, for each high-false-detection target, a separate confidence threshold is set instead of the first confidence threshold common to other targets. This separate confidence threshold is higher than the first confidence threshold and lower than the second confidence threshold.
[0012] Furthermore, the mapping and deduplication of the secondary detection results to obtain the final detection result includes: Based on the detection location and functional attributes of the items, multiple fine-grained item categories in the target text prompt set are pre-merged into corresponding coarse categories through a many-to-one mapping table to obtain the MRI safety coarse category set; after obtaining the secondary detection results, the coarse category corresponding to the secondary detection results is determined according to the many-to-one mapping relationship; non-maximum suppression is performed on each coarse category to retain the non-overlapping detection boxes with the highest confidence built into each category to obtain the final detection result.
[0013] Furthermore, the deep learning-based object detection model is the YOLO-World open vocabulary detection model.
[0014] According to another aspect of the present invention, a deep learning-based MRI environment foreign object identification system is proposed, the system being used to implement the aforementioned deep learning-based MRI environment foreign object identification method; the system includes: The image acquisition module is configured to acquire high-definition video streams in real time and preprocess the video images; The deep learning detection module is configured to use a deep learning-based target detection model to perform a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on the constructed target text prompt set, and obtain preliminary detection results. The enhanced detection module is configured to determine the trigger conditions for the preliminary detection results; and to perform enhanced detection on the preliminary detection results that meet the trigger conditions, including: expanding and enlarging the detection box in the preliminary detection results outward from the center, inputting the enlarged detection box into the target detection model for re-inference, and obtaining the secondary detection results; The final detection module is configured to map and deduplicate the secondary detection results to obtain the final detection result; The detection results include: target category, detection box, and confidence level.
[0015] The present invention has the following technical effects: This invention proposes a method and system for foreign object recognition in MRI environments based on deep learning. Firstly, this invention can accurately identify 112 categories of objects: it introduces the YOLO-World open vocabulary detection architecture and relies on CLIP (Contrastive Language-Image Pre-training) to achieve zero-shot generalization recognition; it incorporates 112 fine-grained cue words (covering everything from headwear to large medical devices), and through a two-level semantic architecture of 112 fine-grained detection → 20 MRI safety mappings, it directly associates visual features with clinical safety labels; it eliminates the need to re-collect data and retrain the model for new personal items or medical devices, seamlessly expanding only by updating the text cue; it overcomes the technical bottleneck of traditional detectors that only report but do not recognize, achieving a leap from physical signal detection to semantic-level object recognition, and reducing the model expansion cycle from monthly. Training time is reduced to hours; secondly, this invention proposes a multi-scale partitioned full-coverage detection strategy: employing a multi-scale detection strategy combining full-image detection and block detection, significantly enhancing shallow edge gradients and deep semantic feature activation. The density-adaptive dynamic block detection strategy feeds back some of the output from the first stage of the target detection process to the detection strategy itself. That is, the coarse detection result is not only used for the final judgment but also for dynamically planning the spatial search scheme for subsequent fine detection. This enables the system to adaptively schedule computing resources according to the actual scene, automatically reducing the number of blocks in sparse target scenes to save inference time. In scenes with dense targets, the number of blocks is automatically increased and sub-segmentation is triggered to improve local detection accuracy; the real-time video stream can adopt adaptive scheduling of full scanning of the first frame + single-image inference of subsequent frames, while ensuring a monitoring frame rate of ≥15fps, achieving blind-spot-free capture of objects of any size, aspect ratio and spatial distribution, and reducing the false detection rate of extreme-shaped objects to <1%; furthermore, this invention constructs a three-layer defense matrix of attention focusing - semantic absorption - dynamic threshold: the 112 target categories are divided into 3 groups (approximately 40 categories in each group) for group-by-group inference, improving the single-class attention weight theory in CLIP contrastive learning by approximately 3 times; Nine background classes (person / jeans / pockets, etc.) are used as a semantic negative sample pool. The matching probability of clothing texture and furniture reflection is competitively dispersed in the normalized exponential function layer to suppress false positives from the source. Based on more than 5,000 backtesting data from real clinical scenarios, independent confidence thresholds are set for 15 high-frequency false positive targets such as handbags, smartphones, and surgical forceps, and hard filtering is performed in the post-processing stage. This mechanism reduces the false positive rate in the clinical environment to less than 2 times / hour while maintaining a true detection rate of >96%, ensuring the long-term stable operation of the system in real high-pressure medical scenarios and the trust of medical staff. Attached Figure Description
[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 This is a flowchart of a foreign object identification method for MRI environment based on deep learning, as described in an embodiment of the present invention. Figure 2 This is a schematic diagram of the structure of a foreign object identification system for MRI environment based on deep learning, as described in an embodiment of the present invention. Detailed Implementation
[0018] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are part of this invention.
[0019] This invention proposes a deep learning-based method for foreign object identification in MRI environments, such as... Figure 1 As shown, the method includes the following steps: S1. Real-time acquisition of high-definition video streams and preprocessing of video images; S2. A deep learning-based target detection model is used to perform a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on the constructed target text prompt set to obtain preliminary detection results. S3. Determine the triggering conditions based on the preliminary test results; S4. Perform enhanced detection on the preliminary detection results that meet the triggering conditions, including: expanding and enlarging the detection box in the preliminary detection results outward from the center, inputting the enlarged detection box into the target detection model for re-inference, and obtaining the secondary detection results; S5. Map and deduplicate the secondary detection results to obtain the final detection results; wherein, the detection results include: target category, detection box, and confidence level.
[0020] The method begins with S1. First, in S1, a high-definition video stream is acquired in real time, and the video images are preprocessed.
[0021] According to an embodiment of the present invention, an image acquisition device (camera array) installed at the entrance and key locations inside the MRI examination room is used to acquire high-definition video streams in real time. The image acquisition device supports high-definition (≥1080P), low-light, and wide-angle video stream acquisition.
[0022] The video images are preprocessed, including contrast enhancement, noise removal, color space conversion, and image size adaptation. Specifically, a contrast-limited adaptive histogram equalization (CLAHE) algorithm is used to enhance local contrast, where the contrast limit parameter is 4.0 and the block grid size is 8×8 pixels. Gaussian filtering (3×3 kernel size, standard deviation 1.0) and median filtering (3×3 kernel size) are cascaded to remove noise. The blue-green-red color space (BGR) is converted to red-green-blue color space (RGB) to adapt to the inference engine of the deep learning model (YOLO-World open vocabulary detection model). The input size is adaptively adjusted according to the detection mode (e.g., adjusted to 1280×1280 pixels in YOLO-World open vocabulary detection mode).
[0023] Then, in S2, a deep learning-based object detection model is used to perform a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on the constructed target text prompt set, to obtain preliminary detection results. This includes: pre-dividing the prompt words in the target text prompt set into three groups based on semantic similarity principles, detection region grouping by body part principles, false detection isolation principles, and inter-group balance principles; inputting the preprocessed image into the deep learning-based object detection model, performing full-image detection based on the three different groups of prompt words, and merging the three groups of detection results as the full-image detection result; dividing the preprocessed image into n×n overlapping block images, and inputting each block image into the deep learning-based object detection model, performing block detection based on the constructed target text prompt set; mapping the coordinates of each detection box in each block detection result back to the image coordinate system of the original image based on coordinate offsets to obtain each block detection result; merging the full-image detection result with each block detection result to obtain the preliminary detection result.
[0024] According to an embodiment of the present invention, a target text prompt set is pre-constructed as shown in Table 1, which includes 112 types of detection targets and 9 types of empty detection categories; wherein, the 112 types of detection targets can be divided according to the detection area, and the empty detection categories are used to absorb false detections of clothing and background.
[0025] Table 1 A deep learning-based object detection model is adopted. In this embodiment, the YOLO-World open vocabulary detection model is used. Based on the constructed target text prompt set, a multi-scale detection strategy of full-image detection and block detection is performed on the preprocessed image.
[0026] Specifically, because the CLIP attention to each category is diluted when using the YOLO-World open vocabulary detection model based on CLIP visual-language alignment for zero-shot detection with a large number of categories, the 112 target categories and 9 empty detection categories were divided into three groups of approximately 40 categories each before detection, based on the following principles: 1) Semantic similarity principle: Items with similar visual features and semantic meanings are grouped together to avoid mutual interference between CLIP comparison language-image pre-trained model attention between categories within the same group; 2) Detection region principle grouped by body part: Group A covers personal accessories worn from head to feet, Group B covers electronic devices, tools, containers and bags, and Group C covers necklaces / pendants, medical devices and large items; 3) False detection isolation principle: Categories with similar visual features but different semantics (such as earrings and necklaces) are assigned to different groups to prevent CLIP from mismatching across categories; 4) Inter-group balance principle: The number of categories in each group is controlled between 35 and 48 to ensure that the CLIP attention concentration in each group is similar and to avoid dilution of attention due to too many categories in a single group. For example, necklaces / pendants / chokers were moved from group A to group C to prevent dangling earrings from being mismatched as necklaces by the CLIP contrastive language-image pre-trained model; group B includes trouser pockets and jeans to absorb cases where pocket / jeans areas are misdetected as handbags / smartphones. Specific groupings are shown in Table 2.
[0027] Table 2 First, in step S21, after performing three parallel full-image detections based on the grouped prompts shown in Table 2, the three detection results are merged into a single full-image detection result. Specifically, the YOLO-World category setting interface (i.e., the dynamic text category switching function provided by the YOLO-World model, used to inject the target category text list of the current detection group into the CLIP text encoder before inference) can be called group by group to switch text prompts and then detect them separately. Finally, all detection results are merged. After using the above grouped detection, CLIP's attention concentration on each class is improved by about 3 times, significantly improving the detection rate.
[0028] Subsequently, in S22, after the grouped full-image detection is completed, multi-scale block detection is performed on the preprocessed image using the constructed target text cue set; the block detection strategy includes a fixed block detection strategy and a density-adaptive dynamic block detection strategy.
[0029] The fixed-block detection strategy is as follows: the preprocessed image is divided into n×n overlapping blocks, and each block is input into the YOLO-World open vocabulary detection model. Block detection is then performed based on the constructed target text cue set. As an example, the image is divided into a 2×2 grid, with each block covering the original... Figure 2 / 3 width and height, with adjacent blocks overlapping by 1 / 3; or, divide the image into a 3×3 grid, with each block covering the original. Figure 1 / 2 width and height, with 1 / 6 overlap between adjacent blocks.
[0030] The drawback of fixed-block segmentation is that if there are too few blocks, when targets are concentrated in a local area of the image, the target density in a single block is too high, making it difficult to effectively distinguish adjacent small objects; if there are too many blocks, when targets are sparsely distributed across the entire image, many blocks contain no effective content, resulting in a waste of inference computing power. Therefore, a density-adaptive dynamic block detection strategy is proposed, specifically: the center points of detection boxes in the full-image detection results are grouped based on a spatial clustering algorithm; the coordinates of all detection boxes corresponding to each group are merged to obtain the minimum bounding rectangle containing all detection boxes in that group; the density value of each group is calculated as follows: the number of detection boxes in the group divided by the ratio of the area of the minimum bounding rectangle of that group to the area of the entire image; based on the minimum bounding rectangle of each group, the context filling area is expanded outward to form the image block corresponding to that group; the size of the filling area is determined based on the density value; for groups that simultaneously meet the following three conditions, the image block corresponding to that group is further divided into multiple smaller overlapping sub-blocks: the density value reaches a preset threshold; the size of the current image block meets the minimum size requirement; the total number of blocks in the current image block is less than the preset upper limit of the number of blocks. Specifically, the process involves the following steps: 1) Target center point clustering: Extract the geometric center point coordinates of all detection boxes in the full-image detection results. Use a density-based spatial clustering algorithm (such as the DBSCAN algorithm) to group these center points. The clustering radius is a fixed proportion of the image diagonal length to maintain consistency in the clustering scale across images of different resolutions. A pixel-level lower limit is set to prevent the clustering radius from being too small and failing in low-resolution scenes. After clustering, each detection box is assigned to its corresponding target group according to its cluster label. 2) Target group bounding box calculation: For each target group, take the union of the coordinates of all its member detection boxes and calculate the bounding rectangle of the group, i.e., the minimum bounding rectangle of all detection boxes. 3) Group density evaluation: For each target group, calculate its density value as follows: the number of detection boxes in the group divided by the proportion of the area of the bounding box (minimum bounding rectangle) of the group to the area of the entire image. Groups with a large number of detection boxes and small bounding box areas are high-density groups, indicating that the targets in the area are closely clustered. Groups with a small number of targets or large bounding box areas are low-density groups. 4) Adaptive expansion of the outer padding area: Based on the bounding box of each group, the context padding area is expanded outward to form the image block corresponding to that group; the padding ratio is determined according to the density value, with groups with high density values using a larger padding ratio and groups with low density values using a smaller padding ratio; the blocks of high-density groups expand outward more, naturally producing a larger overlap area between adjacent blocks, which provides a higher sampling density and more cross-block coverage opportunities for the areas where the target is closely arranged.
[0031] Further high-density group sub-segmentation is performed: For target groups that meet the following three conditions, their corresponding image blocks are further divided into multiple smaller sub-blocks: 1) The density value within the group reaches a preset threshold; 2) The current block size meets the minimum size requirement; 3) The total number of blocks in the current image is less than a preset upper limit, for example, 8 blocks. Sub-blocks adopt the block segmentation principle in the fixed-block detection strategy; sub-blocks are not constrained by the minimum size requirement because they will be uniformly scaled to the model input size during subsequent inference stages, and small sub-blocks will not cause pixel waste. This step enables the system to deploy detection resolution several times higher than normal in highly dense local areas of the target.
[0032] Furthermore, the minimum size constraint is set for the blocks after adaptive padding expansion as follows: when the side length of any block image is less than the preset lower limit, it is uniformly expanded to the minimum size on both sides with the center of the block image as the anchor point. If the expansion touches the image boundary, it is padded to the other side to ensure that the block always falls completely within the image range.
[0033] Furthermore, all target groups are sorted in descending order of density value, with high-density groups given priority in block allocation; when the quota is exhausted, low-density groups no longer generate blocks.
[0034] It should be noted that if the library upon which the spatial clustering algorithm depends is unavailable, adaptive block partitioning will be skipped directly; if an exception occurs during clustering execution, an empty result will be returned, triggering degradation; if the number of blocks generated by adaptive partitioning does not meet the minimum requirement (e.g., less than a 2×2 grid), degradation will also be triggered. In any degradation scenario, the system will seamlessly switch to the preset fixed block partitioning strategy to ensure that the detection coverage is not affected.
[0035] The density-adaptive dynamic block-segmentation detection strategy feeds back the full-image detection output from the target detection process to the detection strategy itself. This means the coarse detection results are not only used for the final judgment but also for dynamically planning the spatial search scheme for subsequent fine-grained detection. This enables the system to adaptively allocate computing resources based on the actual scene. In sparse target scenes, it automatically reduces the number of blocks to save inference time, while in dense target scenes, it automatically increases the number of blocks and triggers sub-segmentation to improve local detection accuracy. The number, location, and overlap ratio of blocks are all driven in real-time by the target distribution data from the full-image detection, requiring no manual pre-setting or scene calibration. This allows the same system to maintain high detection performance in different scenarios such as open halls, crowded entrances, and areas with stacked clutter.
[0036] Subsequently, in step S23, the coordinates of each detection box in each block detection result are mapped back to the image coordinate system of the original image based on coordinate offsets to obtain the detection results for each block. Specifically, the coordinates of each vertex of the original image frame are equal to the corresponding coordinates of the detection box within the block plus the offset of the upper left corner of the block relative to the original image. That is, the horizontal coordinate of the upper left corner of the original image frame is equal to the horizontal coordinate of the upper left corner of the block frame plus the horizontal offset; the vertical coordinate of the upper left corner of the original image frame is equal to the vertical coordinate of the upper left corner of the block frame plus the vertical offset; the horizontal coordinate of the lower right corner of the original image frame is equal to the horizontal coordinate of the lower right corner of the block frame plus the horizontal offset; and the vertical coordinate of the lower right corner of the original image frame is equal to the vertical coordinate of the lower right corner of the block frame plus the vertical offset. The offset is determined according to the block segmentation strategy: for a fixed block detection strategy, the offset of each block is a pre-calculated fixed value; for a density-adaptive dynamic block segmentation strategy, the number, position, and size of the blocks are dynamically generated based on the clustering results, and the offset of each block needs to be calculated separately according to its actual cropping position, but the basic formula for coordinate mapping is the same.
[0037] Subsequently, in step S24, the full-image detection results are merged with the detection results of each block to obtain preliminary detection results. These preliminary results include the detection bounding boxes, the target category or label in the target text prompt set, and the confidence level.
[0038] Step S2 employs a multi-scale detection strategy combining full-image detection and block detection, achieving the following technical effects: 1) Improved detection rate for slender objects: For objects with extreme aspect ratios, such as canes and umbrellas, full-image detection results in weak feature activation and frequent missed detections; block detection significantly increases the pixel proportion of such objects in local regions, enhancing features and significantly improving the detection rate; 2) Complete coverage of cross-regional objects: For objects spanning multiple block boundaries, full-image detection may lead to partial truncation; block detection ensures that at least one block completely contains the object, achieving complete coverage; 3) Enhanced capture of small targets: For small targets, full-image detection has insufficient resolution; block detection magnifies local regions, increasing resolution by approximately 1.5 times and enhancing the ability to capture small targets.
[0039] Then, in S3, the trigger conditions are determined based on the preliminary detection results.
[0040] According to an embodiment of the present invention, the following enhanced detection trigger conditions are determined for the detection box in the preliminary detection result: the maximum side length of the detection box is less than a preset scale threshold (the preset scale threshold is, for example, 48 pixels); and the confidence level is in the range of [0.15, 0.65], where 0.15 is the first confidence threshold and 0.65 is the second confidence threshold.
[0041] Furthermore, for each high-false-detection target, a separate confidence threshold is set instead of the first confidence threshold (0.15) common to other targets. This separate confidence threshold is higher than the first confidence threshold but lower than the second confidence threshold. As an example, each high-false-detection target and its corresponding confidence threshold are shown in Table 3.
[0042] Table 3 Then, in S4, enhanced detection is performed on the preliminary detection results that meet the triggering conditions, including: expanding and enlarging the detection box in the preliminary detection results outward from the center, inputting the enlarged detection box into the target detection model for re-inference, and obtaining the secondary detection results.
[0043] According to an embodiment of the present invention, the enhanced detection process includes: expanding the context region outward by 0.5 times the side length centered on the detection box; enlarging the ROI (Region of Interest) by 4 times using bicubic interpolation; feeding the enlarged image into the YOLO-World model for re-inference; mapping the detection box coordinates back to the original image coordinate system at a 1 / 4 ratio; and obtaining the secondary detection result. Specifically, after re-inferring the detection box from the enlarged ROI, a third confidence threshold (e.g., 0.35) can be used to filter the detection boxes, eliminating those with a confidence level lower than this threshold. This allows for the suppression of low-confidence false detections caused by interpolation and context expansion within the enlarged image domain using a relatively higher confidence threshold.
[0044] Then, in S5, the secondary detection results are mapped and deduplicated to obtain the final detection results. This includes: based on the detection location and functional attributes of the items, multiple fine-grained item categories in the target text prompt set are pre-merged into the corresponding coarse classification categories through a many-to-one mapping table to obtain the MRI safety coarse classification set; after obtaining the secondary detection results, the coarse classification category corresponding to the secondary detection results is determined according to the many-to-one mapping relationship; non-maximum suppression is performed on each coarse classification category to retain the non-overlapping detection boxes with the highest built-in confidence in each category to obtain the final detection results.
[0045] According to embodiments of the present invention, the principles for establishing the MRI safety coarse classification set are as follows: 1) Merging items with the same function: Multiple items with the same function are mapped to the same safety category (e.g., multiple key-type items are mapped to keys / keychains); 2) Merging items with the same location: Accessories worn on the same body part are mapped to the same safety category (e.g., earrings, ear studs, and ear clips are mapped to earrings); 3) Merging items with different functions but similar visual features or semantics: Items with different functions but similar visual features or semantics are merged into the same safety category (e.g., scissors, wrenches, paperclips, etc. are classified into the tools category). The specific MRI safety coarse classification set is shown in Table 4. Each detection target in the target text prompt set has one and only one coarse classification category, and there is no one-to-many ambiguity; the 9 empty detection categories in the target text prompt set are not mapped, and empty values are automatically discarded during querying.
[0046] Table 4 After obtaining the secondary detection results, based on the many-to-one mapping relationship, the coarse classification category in the MRI safety coarse classification set corresponding to the secondary detection results is determined. Non-maximum suppression (IoU threshold of 0.45) is performed on each coarse classification category, and the non-overlapping bounding boxes with the highest built-in confidence for each category are retained to obtain the final detection result. The final detection result includes the coordinates of the non-overlapping bounding boxes, the target category, or the name or number of the coarse classification category in the MRI safety coarse classification set, and the confidence level.
[0047] It should be noted that, in addition to the YOLO-World open vocabulary detection model, other deep learning models can also be used, such as Transformer neural networks or others.
[0048] In its implementation, the system adopts an event-driven pipeline architecture, with modules decoupled through a unified data structure. Data transmission between modules uses a unified message data structure. YOLO-World is used as the basic detector, and the CLIP model is used to construct an alignment space between visual features and text semantics. 121 text prompts (112 target detection words + 9 empty detection words) are injected through the YOLO-World category setting interface, and the CLIP text encoder generates corresponding fixed-dimensional semantic embedding vectors. The prompt word engineering principles are: use concise noun phrases of 1-3 words; use modifiers to disambiguate ambiguous categories; merge synonymous class names; add qualifiers to common nouns; and set empty detection classes to absorb false detections through CLIP attention competition.
[0049] Upon system startup, the system automatically identifies the computing backend (CUDA / MPS / CPU) and adaptively configures the batch size, input resolution, and computational precision based on the video memory / memory capacity (e.g., ≥8GB enables FP16+batch=4, low-configuration downgrades to INT8 / single-thread). All inference and feature extraction are completed on local edge nodes, with video streams remaining within the hospital premises, achieving agile deployment with low latency, high privacy, and zero dependencies. Single-frame inference latency is stable at 180~350ms.
[0050] Furthermore, during the model initialization phase (on the CPU), CLIP text embedding vectors for multiple detection groups are pre-computed and cached on the inference device. At runtime, zero-overhead switching between detection groups is achieved through tensor reference swapping, avoiding the placeholder storage compatibility crash issue triggered by repeated calls to the neural network word embedding layer on the MPS device. Specifically, addressing the CPU-GPU data transfer bottleneck in the neural network word embedding layer of Apple's MPS architecture, an innovative scheme of pre-compiling text embeddings on the CPU and zero-overhead tensor swapping at runtime is adopted, completely eliminating the risk of graph compilation crashes when dynamically switching categories.
[0051] This invention also proposes a deep learning-based MRI environmental foreign object identification system, which is used to implement the deep learning-based MRI environmental foreign object identification method described in the above embodiments; as follows: Figure 2 As shown, the system includes: The image acquisition module 210 is configured to acquire high-definition video streams in real time and preprocess the video images; The deep learning detection module 220 is configured to use a deep learning-based target detection model to perform a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on the constructed target text prompt set, and obtain preliminary detection results. The enhanced detection module 230 is configured to determine the trigger conditions for the preliminary detection results; and to perform enhanced detection on the preliminary detection results that meet the trigger conditions, including: expanding and enlarging the detection box in the preliminary detection results outward from the center, inputting the enlarged detection box into the target detection model for re-inference, and obtaining the secondary detection results; The final detection module 240 is configured to map and deduplicate the secondary detection results to obtain the final detection results; wherein, the detection results include: target category, detection box coordinates and confidence level.
[0052] The function of the deep learning-based MRI environment foreign object identification system described in this embodiment can be explained by the aforementioned deep learning-based MRI environment foreign object identification method. Therefore, for the parts not described in detail in the system embodiment, please refer to the above method embodiment, and they will not be repeated here.
[0053] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the technical solutions of the embodiments of the present invention.
Claims
1. A method for foreign object identification in MRI environment based on deep learning, characterized in that, Includes the following steps: Real-time acquisition of high-definition video streams and preprocessing of video images; A deep learning-based target detection model is used to perform a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on the constructed target text prompt set, so as to obtain preliminary detection results. Determine the triggering conditions based on the preliminary test results; Enhanced detection is performed on the preliminary detection results that meet the triggering conditions, including: expanding and enlarging the detection box in the preliminary detection result outward from the center, inputting the enlarged detection box into the target detection model for re-inference, and obtaining the secondary detection result; The secondary detection results are mapped and deduplicated to obtain the final detection result; The detection results include: target category, detection box, and confidence level; The method employs a deep learning-based object detection model, and performs a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on a constructed target text prompt set, obtaining preliminary detection results including: Based on the principles of semantic similarity, detection area grouping by body part, false detection isolation, and inter-group balance, the target text prompts are pre-divided into three groups of prompt words. The preprocessed image is input into a deep learning-based object detection model, and full-image detection is performed based on three different sets of prompt words. The three sets of detection results are then merged into a full-image detection result. The preprocessed image is divided into n×n overlapping blocks, and each block is input into a deep learning-based object detection model to perform block detection based on the constructed target text prompt set. The coordinates of each detection box in each block detection result are mapped back to the image coordinate system of the original image based on the coordinate offset to obtain the detection result of each block. The full-image detection results are combined with the detection results of each block to obtain preliminary detection results; The block detection involves: dynamically dividing the preprocessed image into density-adaptive blocks, and performing block detection on the block-divided image based on a constructed target text cue set; including: The center points of the detection boxes in the full-image detection results are grouped based on the spatial clustering algorithm; Merge the coordinates of all detection boxes corresponding to each group to obtain the smallest bounding rectangle containing all detection boxes of that group; The density value for each group is calculated as follows: the number of detection boxes within the group divided by the ratio of the area of the smallest bounding rectangle of that group to the total area of the image. Based on the minimum bounding rectangle of each group, the context filling region is expanded outward to form the image block corresponding to that group; wherein, the size of the filling region is determined based on the density value. For a group that simultaneously meets the following three conditions, the corresponding image block is further divided into multiple smaller overlapping sub-blocks: the density value reaches a preset threshold; the size of the current image block meets the minimum size requirement; and the total number of blocks in the current image block is less than the preset upper limit of the number of blocks. The trigger condition judgment for the preliminary detection result includes: the maximum side length of the detection box in the preliminary detection result is less than a preset scale threshold, and the confidence level is between the first confidence threshold and the second confidence threshold; wherein, the second confidence threshold is greater than the first confidence threshold; The deep learning-based object detection model is the YOLO-World open vocabulary detection model.
2. The method for foreign object identification in MRI environment based on deep learning according to claim 1, characterized in that, The preprocessing includes: contrast enhancement, noise removal, color space conversion, and image size adaptation.
3. The method for foreign object identification in MRI environment based on deep learning according to claim 1, characterized in that, For each high false positive target, a separate confidence threshold is set instead of the first confidence threshold common to other targets. This separate confidence threshold is higher than the first confidence threshold and lower than the second confidence threshold.
4. The method for foreign object identification in MRI environment based on deep learning according to claim 3, characterized in that, The process of mapping and deduplicating the secondary detection results to obtain the final detection result includes: Based on the detection location and functional attributes of the items, multiple fine-grained item categories in the target text prompt set are pre-merged into the corresponding coarse classification categories through a many-to-one mapping table to obtain the MRI safety coarse classification set; After obtaining the secondary detection results, the coarse classification category corresponding to the secondary detection results is determined based on the many-to-one mapping relationship; Non-maximum suppression is performed on each coarse classification category, and the non-overlapping detection boxes with the highest confidence built into each category are retained to obtain the final detection results.
5. A foreign object recognition system for MRI environments based on deep learning, characterized in that, The system is used to implement the deep learning-based foreign object identification method for MRI environments according to any one of claims 1-4; the system includes: The image acquisition module is configured to acquire high-definition video streams in real time and preprocess the video images; The deep learning detection module is configured to use a deep learning-based target detection model to perform a multi-scale detection strategy of full-image detection and block detection on the preprocessed image based on the constructed target text prompt set, and obtain preliminary detection results. The enhanced detection module is configured to determine the trigger conditions for the preliminary detection results; and to perform enhanced detection on the preliminary detection results that meet the trigger conditions, including: expanding and enlarging the detection box in the preliminary detection results outward from the center, inputting the enlarged detection box into the target detection model for re-inference, and obtaining the secondary detection results; The final detection module is configured to map and deduplicate the secondary detection results to obtain the final detection result; The detection results include: target category, detection box, and confidence level.
Citation Information
Patent Citations
Visual detection method and system for quality of aerospace parachute based on deep learning
CN119991680A
Target detection method and system based on coarse screening and fine detection
CN121527404A