Medical infrared image small target detection method and computer equipment
By performing image block division, random masking, encoding processing and self-supervised learning on medical infrared images, and using sliding windows with hierarchical self-attention mechanism and Yolov5 model, the problems of noise information and small target recognition in medical infrared images are solved, achieving high-accuracy detection effect.
Patent Information
- Application Number
- CN202411661099.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-20
- Publication Date
- 2025-04-25
AI Technical Summary
There are a large number of noise information and small target lesions in medical infrared images, resulting in poor detection results. It is difficult for the existing technology to effectively filter noise information and accurately identify small targets.
The sliding window with a hierarchical self-attention mechanism is given attention weight by performing image block division, random masking, automatic encoder encoding processing, self-supervised learning, and a sliding window with a hierarchical self-attention mechanism, and the Yolov5 model is used for regression and classification to achieve accurate identification of small goals.
It effectively filters the noise information in infrared images, improves the accuracy of identification of small target lesions, and significantly improves the accuracy of medical infrared image detection.
Smart Images

Figure CN119887615A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of medical infrared image target detection, and in particular to a medical infrared image small target detection method and computer equipment. Background Art
[0002] The task of object detection in medical infrared images is a challenging classification and regression task, which has important applications in computer-aided detection and diagnosis. However, in existing methods, researchers have not considered the serious noise interference of medical infrared images and the small size of the objects to be detected, resulting in poor detection results for medical infrared image object detection.
[0003] With the continuous development of deep learning technology, target detection technology in the image field has been widely used in many practical medical diagnosis applications, such as the detection of exudates in the retinas of diabetic patients, early tumor detection, and vascular plaque segmentation. Although some existing methods can achieve good performance in general medical image target detection applications, they are not applicable to target detection in medical infrared images. Because medical infrared image detection is mainly used for early screening of diseases, the potential lesions or temperature abnormalities are usually concentrated in a very small area, and the volume of the target to be detected is relatively small, which belongs to a small target. At the same time, the boundaries of the parts or potential lesion areas in medical infrared images are relatively fuzzy, and there is a lot of noise information interference.
[0004] Therefore, since the targets to be detected in medical infrared images are all small targets, how to make the machine filter out most of the noise information and accurately identify the smaller lesion parts in the image remains an important challenge in the field of medical infrared image target detection. Summary of the invention
[0005] Based on this, it is necessary to provide a medical infrared image small target detection method and computer equipment that can improve the accuracy of medical infrared image detection by effectively filtering out noise information in medical infrared images and accurately identifying smaller lesion parts in medical infrared images.
[0006] A method for detecting small targets in medical infrared images, comprising the steps of:
[0007] Performing an image block division operation on the medical infrared image to obtain a plurality of regular image blocks;
[0008] Randomly masking multiple image blocks to obtain masked image blocks and unmasked image blocks;
[0009] Using an automatic encoder to encode the unmasked image block to obtain an encoded image block;
[0010] Inputting the entire medical infrared image set sequence consisting of the encoded image blocks and the masked image blocks into a decoder for self-supervised learning to obtain a reconstructed image feature vector;
[0011] Using a sliding window with a hierarchical self-attention mechanism to assign attention weights to the image feature vector to obtain a feature vector with attention weights;
[0012] The Yolov5 model is used to regress and classify the feature vector with attention weights to obtain a set sequence of bounding box coordinate values of the disease location and the maximum probability disease category of the object to be detected.
[0013] A computer device includes a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned method for detecting small targets in medical infrared images when executing the computer program.
[0014] The above-mentioned small target detection method and computer device for medical infrared images divide the medical infrared image into image blocks, and randomly mask the multiple image blocks obtained by the division, and encode the unmasked image blocks, and then perform self-supervised learning on the masked image blocks and the encoded image blocks to reconstruct the missing pixels and obtain the reconstructed image feature vector, so as to filter out the noise information in the image and obtain a better infrared image representation; learn the importance difference between the image feature vectors through a sliding window with a hierarchical self-attention mechanism, so as to give a higher weight to the small target to be detected; and then use the Yolov5 model to predict the set sequence of the location of the bounding box and the category of the target to be detected, so as to obtain the set sequence of the bounding box coordinate values of the accurate disease location and the maximum probability disease category of the object to be detected. Therefore, the above-mentioned small target detection method for medical infrared images effectively filters the noise information in the infrared image, and effectively identifies the small target (smaller lesion part) in the image, which greatly improves the accuracy of medical infrared image detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 The figure is a flow chart of a method for detecting small targets in medical infrared images in a preferred embodiment of the present invention.
[0016] Figure 2 for Figure 1 The flowchart of step S30 in the method for detecting small targets in medical infrared images is shown;
[0017] Figure 3 for Figure 1 The flowchart of step S40 in the method for detecting small targets in medical infrared images is shown;
[0018] Figure 4 for Figure 1 The flowchart of step S60 in the method for detecting small targets in medical infrared images is shown;
[0019] Figure 5 1 is a diagram of the internal structure of a computer device in one embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Preferred embodiments of the present invention are provided in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present invention more thorough and comprehensive.
[0021] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.
[0022] When describing positional relationships, unless otherwise specified, when an element is referred to as being "on" another element, it can be directly on the other element or there can be an intermediate element. It is also understood that when an element is referred to as being "between" two elements, it can be the only one between the two elements, or there can be one or more intermediate elements.
[0023] In the case of using “including”, “having”, and “comprising” described herein, another component may be added unless a clear limiting term such as “only”, “consisting of”, etc. is used. Unless mentioned otherwise, a term in the singular form may include a plural form and should not be understood as being one in number.
[0024] The present invention provides a method and computer device for detecting small targets in medical infrared images. Image mask reconstruction is performed based on the data of the medical infrared images to filter out noise information in the medical infrared images, and small targets (smaller lesion parts) in the images are identified through a sliding window with a hierarchical self-attention mechanism, which can effectively improve the accuracy of medical infrared image detection.
[0025] The medical infrared image small target detection method provided in this application can be applied to Figure 1 In the application environment shown, the application environment may include a medical infrared imaging device and a computer device, and the medical infrared imaging device communicates with the computer device through a network to achieve data transmission and instruction interaction.
[0026] In some embodiments, the medical infrared imaging device may be a non-invasive biomedical imaging device for disease diagnosis or research purposes, such as a medical infrared thermal imager, a portable near-infrared medical infrared imaging device. Among them, the medical infrared thermal imager includes a unit optical scanning type, an electrically cooled thermal imager, and an uncooled focal plane array type, and the portable near-infrared medical infrared imaging device includes a portable near-infrared brain imaging system, etc. It should be understood that the infrared thermal imager provided above is for illustrative purposes only and is not intended to limit the scope of the present application.
[0027] As an example, a medical infrared imaging device may specifically include a frame, a detector, and a detection area. The frame may be used to support the detector, and the detection area may be used to place an object to be detected for infrared imaging. The detector may be used to detect infrared radiation of the object to be detected.
[0028] Optionally, the medical infrared imaging device may further include a display screen, which may be used to observe the medical infrared imaging device and / or data information of the object to be detected detected by the medical infrared imaging device. For example, medical staff may observe the blood supply status of the limb blood vessels of the object to be detected, the local blood circulation status, and monitor the location of acute and chronic inflammation, etc. through the display screen.
[0029] In some embodiments, the medical infrared imaging device can also send the acquired infrared image data to a computer device via a network for further analysis, processing and display.
[0030] Optionally, the above application environment may also include a storage device ( Figure 1 The storage device may store data, instructions and / or any other information. For example, the storage device may store original infrared image data of the object to be detected acquired by the medical infrared imaging device, or / and infrared images of the object to be detected processed by the computer device.
[0031] As an example, the storage device may include one or more of a mass storage device, a removable storage device, a volatile read memory, a read-only memory, etc. In addition, the storage device may also include a data storage device of a cloud computing platform (such as a public cloud, a private cloud, etc.).
[0032] It should be noted that the above description is provided for illustrative purposes only and is not intended to limit the scope of the present application. For those of ordinary skill in the art, various changes and modifications may be made under the guidance of the content of the present application. The features, structures, methods and other features of the exemplary embodiments described in the present application may be combined in various ways to obtain additional and / or alternative exemplary embodiments, and these changes and modifications will not deviate from the scope of the present application.
[0033] After introducing the application environment of the present application, the technical solution of the embodiment of the present application and how the technical solution of the embodiment of the present application solves the above-mentioned technical problems will be further described in detail through embodiments and in combination with the accompanying drawings. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. It should be noted that a method for detecting small targets in medical infrared images provided in the embodiment of the present application can be executed by Figure 1 The medical infrared imaging device including the processor can also be Figure 1 The computer device in the medical infrared image small target detection device can also be a medical infrared image small target detection device, which can be implemented as part or all of a processor (which can be specifically a processor in a medical infrared imaging device / computer device) through software, hardware, or a combination of software and hardware. Obviously, the described embodiments are part of the embodiments of the present application, not all of them.
[0034] The following method embodiments are described by taking a computer device as an example. The computer device may be at least one device other than a medical infrared imaging device. For example, a personal computer, a laptop, a smart phone, a tablet computer, a portable wearable device, or any combination thereof; another example, a single server or a server group, which may be centralized or distributed; or may be integrated on a medical infrared imaging device.
[0035] The computer device may be a terminal or a server, may be a separate computing device, or may be integrated into a medical infrared imaging device. As long as it can complete small target detection in medical infrared images, this embodiment does not limit this.
[0036] See also Figure 1 The medical infrared image small target detection method in a preferred embodiment of the present invention includes steps S10 to S60.
[0037] Step S10, performing an image block division operation on the medical infrared image to obtain a plurality of regular image blocks.
[0038] Step S20, randomly masking multiple image blocks to obtain masked image blocks and unmasked image blocks. That is, randomly masking multiple regular image blocks obtained in step S10, at this time, some image blocks will be masked and some image blocks will not be masked.
[0039] Step S30, using an automatic encoder to encode the unmasked image block to obtain an encoded image block. By executing step S30, the unmasked image block is mapped into a high-dimensional vector to obtain an encoded image block.
[0040] Step S40, inputting the entire set sequence of medical infrared images consisting of the encoded image blocks and the masked image blocks into a decoder for self-supervised learning to obtain a reconstructed image feature vector.
[0041] Step S50, using a sliding window with a hierarchical self-attention mechanism to assign attention weights to the image feature vector to obtain a feature vector with attention weights.
[0042] Specifically, step S50 includes the following steps:
[0043] The feature map x of the image feature vector is linearly mapped using the following formula to obtain the linearly changed feature vectors f(x), g(x), and h(x):
[0044] f(x)=W f *x
[0045] g(x)=W g *x
[0046] h(x)=W h *x
[0047] Among them, W f , W g , W h are all learnable linear mapping coefficients, (x) is the query feature vector, g(x) is the key feature vector, and h(x) is the value feature vector;
[0048] Calculate e using the following formula t,i :
[0049]
[0050] Where, t = 1, 2, ..., i = 1, 2, ..., j = 1, 2, ..., d x is the dimension of the feature graph x, T is the transpose of the matrix, e t,i is the similarity score between the t-th position and the corresponding i-th region.
[0051] The similarity score a between the t-th position and the corresponding i-th region is calculated using the following formula: t,i :
[0052]
[0053] Wherein, K is the length of the sequence, k=1, 2, ...K;
[0054] The attention weight Z of the i-th region of the feature map x at the t-th position is calculated using the following formula: i :
[0055]
[0056] Among them, W v is a learnable parameter with the same shape as the feature map x;
[0057] In this way, the attention weight of each region in the image feature vector is calculated through the above three steps, thereby effectively distinguishing the importance of different feature vectors in the medical infrared image.
[0058] Step S60, using the Yolov5 model to perform regression and classification operations on the feature vector with attention weights to obtain a set sequence of bounding box coordinate values of the disease location and the maximum probability disease category of the object to be detected.
[0059] By executing steps S10 to S40, the medical infrared image is divided into image blocks, and the multiple image blocks obtained by the division are randomly masked, and then the unmasked image blocks are encoded. Thereafter, self-supervised learning is performed on the masked image blocks and the encoded image blocks to reconstruct the missing pixels and obtain the reconstructed image feature vector, thereby filtering out the noise information in the image and obtaining a better infrared image representation.
[0060] In order to reflect the differences in feature vectors of different regions in the image and enhance the attention score of the target to be detected in the image, in step S50, a sliding window with a hierarchical self-attention mechanism is used to capture the most useful semantic information in the image feature vector and assign them a higher attention weight, that is, a higher attention weight is assigned to the small target to be detected.
[0061] By executing step S60, the Yolov5 model is used to predict the set sequence of the bounding box location and the category of the target to be detected, so as to obtain the accurate set sequence of bounding box coordinate values of the disease location and the maximum probability disease category of the object to be detected.
[0062] Therefore, the above-mentioned small target detection method for medical infrared images can effectively filter out noise information in infrared images and effectively identify small targets (smaller lesion parts) in infrared images, greatly improving the accuracy of medical infrared image detection.
[0063] Please also read Figure 2 In some embodiments, the autoencoder includes a position encoding block and a plurality of first Transformer blocks. Step S30 includes steps S31 to S32.
[0064] Step S31, using the position encoding block to embed the position vector into the unmasked image block to obtain the image block with the position vector.
[0065] Step S32: Use a plurality of first Transformer blocks to perform linear mapping and image feature extraction on the image block with the position vector to obtain an encoded image block.
[0066] In order to reflect the position difference between different image feature vectors, in step S31, the position vector corresponding to the image feature vector is embedded into the image block matching the image feature vector to obtain an image block with a position vector; and then step S32 is executed to linearly map and extract image features of the image block with the position vector through a series of first Transformer blocks to obtain an encoded image block.
[0067] Please also read Figure 3 In some embodiments, the decoder module includes a text embedding layer, a position encoding layer, and a plurality of second Transformer blocks. Step S40 includes step S41 and step S43.
[0068] Step S41, inputting the encoded image block and the masked image block into the text embedding layer to output a high-dimensional vector.
[0069] Step S42: input the high-dimensional vector into the position encoding layer for position vector embedding to obtain a high-dimensional vector with a position vector.
[0070] Step S43: Use multiple second Transformer blocks to process the high-dimensional vector with the position vector to obtain a reconstructed image feature vector.
[0071] By executing step S41, the encoded image blocks and the masked image blocks are converted into vector representations to obtain high-dimensional vectors. By executing step S42, position information is added to each high-dimensional vector to reflect the specific position information of each image block in the infrared image. By executing step S43, the high-bit vector with the position vector is reconstructed to reconstruct the missing pixels and obtain the reconstructed image feature vector, thereby removing excessive useless information.
[0072] In some embodiments, before step S50, the method further includes the steps of: designing a sliding window in a manner of evenly dividing the image; introducing a self-attention mechanism into non-overlapping sliding windows to obtain a sliding window with a hierarchical self-attention mechanism.
[0073] Thus, in order to focus attention on the small target to be detected, the above two steps are used to give the small target to be detected a higher attention score.
[0074] In some embodiments, each sliding window includes M×M image blocks, a computational complexity of a global MSA, and a computational complexity of an MSA related to the window size.
[0075] The computational complexity Ω(MSA) of the global MSA is calculated using the following formula:
[0076] Ω(MSA)=4hwC 2 +2(hw) 2 C.
[0077] The computational complexity of MSA related to the window size Ω(W-MSA) is calculated using the following formula:
[0078] Ω(W-MSA)=4hwC 2 +2M 2 hwC.
[0079] Among them, h and w are the length and width of the medical infrared image, respectively, and C is the number of channels.
[0080] In this way, for a medical infrared image of size h×w, the computational complexity of the global MSA (i.e., the global sliding window) and the computational complexity of the M-MSA (i.e., the sliding window with a hierarchical self-attention mechanism) are calculated by the above two formulas to obtain the sliding window.
[0081] Further, in some embodiments, the attention module of the sliding window with the hierarchical self-attention mechanism includes a first module and a second module. The first module and the second module are used alternately in the sliding window with the hierarchical self-attention mechanism. The sliding window with the hierarchical self-attention mechanism adopts a shift partitioning strategy in which the first module and the second module are used alternately.
[0082] The window division strategy of the first module is to divide the 2M×2M feature map into two M×M windows. The window division strategy of the second module is to divide the feature map into window.
[0083] By dividing the attention module of the sliding window with a hierarchical self-attention mechanism into a first module and a second module, and using them alternately in the sliding window with a hierarchical self-attention mechanism, the sliding window with a hierarchical self-attention mechanism can maintain the computing power of the sliding window with a hierarchical self-attention mechanism while also having the ability to connect other modules across windows.
[0084] Furthermore, in some embodiments, the lth feature vector of the lth feature map after being processed by the W-MSA module is calculated using the following formula:
[0085]
[0086] The lth eigenvector of the lth feature map after being processed by the MLP module is calculated using the following formula:
[0087]
[0088] The following formula is used to calculate the l+1th eigenvector of the l+1th feature map after it is processed by the SW-MSA module:
[0089]
[0090] The l+1th feature vector of the l+1th feature map after being processed by the MLP module is calculated using the following formula:
[0091]
[0092] Among them, W-MSA means that the sliding window with hierarchical self-attention mechanism adopts the conventional partitioning strategy, SW-MSA means that the sliding window with hierarchical self-attention mechanism adopts the shift partitioning strategy, MLP means multi-layer perception, l = 2, 3,...
[0093] In this way, a continuous feature vector with attention weights in the medical infrared image is calculated by the above calculation formula.
[0094] It should be noted that when l-1=1, Z l-1 is the feature vector obtained after executing step S40.
[0095] In some embodiments, the Yolov5 model includes a backbone network, a neck network, an FPN+PAN structure, and a prediction network. The backbone network includes a Focus structure, a CBL module, an SSP module, and a BottleneckCSP module. The neck network includes a connection operation, an upsampling operation, a CBL module, and a BottleneckCSP module.
[0096] Specifically, the CBL module includes convolutional layers, BatchNorm and LeakyRELU. The convolutional layer consists of 32 convolution kernels, a filter of size 3×3, and a convolutional neural network with stride 2. The BottleneckCSP module is a Network composed of Cross StagePartial blocks.
[0097] Please also read Figure 4 , step S60, includes steps S61 to S64.
[0098] Step S61: In the backbone network, the feature vector with attention weight is input into the Focus structure, and is processed by the CBL module, the SSP module and the BottleneckCSP module to obtain the feature vector processed by the backbone network.
[0099] Among them, the BottleneckCSP module is mainly used to extract rich semantic information in the feature vector and reduce the gradient information reread during model training; the SSP module consists of spatial pyramid pooling operations and is used to extract multi-scale features.
[0100] Step S62: In the neck network, the feature vector processed by the backbone network is subjected to connection operation, upsampling operation, CBL module, and BottleneckCSP module processing to obtain an integrated feature vector.
[0101] Step S63: input the integrated feature vector into the FPN+PAN structure to obtain multi-scale semantic information and positioning information.
[0102] Among them, the FPN layer in the FPN+PAN structure transmits multi-scale speech information from top to bottom, and the PAN layer in the FPN+PAN structure uploads semantic bottom-up positioning information.
[0103] Step S64, input the multi-scale semantic information and positioning information into the prediction network to output a set sequence of bounding box coordinate values of the disease location and the maximum probability disease category of the object to be detected.
[0104] In this way, by executing steps S61 to S64, the maximum probability disease category in the medical infrared image and the set sequence of bounding box coordinate values of the disease location are accurately predicted based on the feature vector with attention weight.
[0105] Based on the same inventive concept, the embodiment of the present application further provides a computer device, which may be a terminal, and its internal structure diagram may be as shown in FIG. Figure 5As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computing program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with the external middle section in a wired or wireless manner, and the wireless manner can be achieved through WI FI, an operator network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a method for detecting small targets in medical infrared images is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch screen covered on the display screen, or a key, track or touch pad set on the computer device shell, or an external keyboard, touch pad or mouse, etc.
[0106] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer equipment on the machine to which the solution of the present application is applied. The specific computer equipment may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0107] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0108] Performing an image block division operation on the medical infrared image to obtain a plurality of regular image blocks;
[0109] Randomly masking multiple image blocks to obtain masked image blocks and unmasked image blocks;
[0110] Using an automatic encoder to encode the unmasked image block to obtain an encoded image block;
[0111] The entire medical infrared image set sequence consisting of the encoded image blocks and the masked image blocks is input into the decoder for self-supervised learning to obtain a reconstructed image feature vector;
[0112] Use a sliding window with a hierarchical self-attention mechanism to assign attention weights to the image feature vector to obtain a feature vector with attention weights;
[0113] The Yolov5 model is used to regress and classify the feature vector with attention weights to obtain a set sequence of bounding box coordinate values of the disease location and the maximum probability disease category of the object to be detected.
[0114] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0115] The above-mentioned embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. A method for detecting small targets in medical infrared images, characterized in that: Includes steps: Performing an image block division operation on the medical infrared image to obtain a plurality of regular image blocks; Randomly masking multiple image blocks to obtain masked image blocks and unmasked image blocks; Using an automatic encoder to encode the unmasked image block to obtain an encoded image block; Inputting the entire medical infrared image set sequence consisting of the encoded image blocks and the masked image blocks into a decoder for self-supervised learning to obtain a reconstructed image feature vector; Using a sliding window with a hierarchical self-attention mechanism to assign attention weights to the image feature vector to obtain a feature vector with attention weights; The Yolov5 model is used to regress and classify the feature vector with attention weights to obtain a set sequence of bounding box coordinate values of the disease location and the maximum probability disease category of the object to be detected.
2. The method for detecting small targets in medical infrared images according to claim 1, characterized in that: The autoencoder includes a position encoding block and a plurality of first Transformer blocks; The step of encoding the unmasked image block by using an automatic encoder to obtain an encoded image block comprises: Using the position encoding block to embed the position vector of the unmasked image block to obtain an image block with a position vector; A plurality of the first Transformer blocks are used to perform linear mapping and image feature extraction on the image block with the position vector to obtain an encoded image block.
3. The method for detecting small targets in medical infrared images according to claim 1, characterized in that: The decoder module includes a text embedding layer, a position encoding layer and a plurality of second Transformer blocks; The step of inputting the entire medical infrared image set sequence consisting of the encoded image blocks and the masked image blocks into a decoder to obtain a reconstructed image feature vector comprises: Inputting the encoded image block and the masked image block into a text embedding layer to output a high-dimensional vector; Inputting the high-dimensional vector into the position encoding layer for position vector embedding to obtain a high-dimensional vector with a position vector; The high-dimensional vector with the position vector is processed by using a plurality of the second Transformer blocks to obtain a reconstructed image feature vector.
4. The method for detecting small targets in medical infrared images according to claim 1, characterized in that: The step of assigning attention weights to the image feature vector using a sliding window with a hierarchical self-attention mechanism comprises: The feature map x of the image feature vector is linearly mapped using the following formula to obtain the linearly changed feature vectors f(x), g(x), h(x): f(x)=W f *x g(x)=W g *x h(x)=W h *x Among them, W f , W g , W h are all learnable linear mapping coefficients, f(x) is the query feature vector, g(x) is the key feature vector, and h(x) is the value feature vector; Use the following formula to calculate e t,i : Where, t = 1, 2, ..., i = 1, 2, ..., j = 1, 2, ..., d x is the dimension of the feature graph x, T is the transpose of the matrix, e t,i is the similarity score between the t-th position and the corresponding i-th region; The normalized similarity score a between the t-th position and the corresponding i-th region is calculated using the following formula: t,i : Where K is the length of the sequence, k = 1, 2, ... K; The attention weight Z of the i-th region of the feature map x at the t-th position is calculated using the following formula: i : Among them, W v is a learnable parameter with the same shape as the feature map x.
5. The method for detecting small targets in medical infrared images according to claim 1, characterized in that: Before the step of assigning attention weights to the image feature vector using a sliding window with a hierarchical self-attention mechanism, the step further includes: Design the sliding window in a way that evenly divides the image; The self-attention mechanism is introduced into non-overlapping sliding windows to obtain sliding windows with hierarchical self-attention mechanism.
6. The method for detecting small targets in medical infrared images according to claim 1, characterized in that: Each of the sliding windows includes M×M image blocks, a computational complexity of a global MSA, and a computational complexity of an MSA related to the window size; The computational complexity Ω(MSA) of the global MSA is calculated using the following formula: Ω(MSA)=4hwC 2 +2(hw) 2 C; The computational complexity of MSA related to the window size Ω(W-MSA) is calculated using the following formula: Ω(W-MSA)=4hwC 2 +2M 2 hwC; Among them, h and w are the length and width of the medical infrared image, respectively, and C is the number of channels.
7. The method for detecting small targets in medical infrared images according to claim 6, characterized in that: The attention module of the sliding window with a hierarchical self-attention mechanism includes a first module and a second module; the first module and the second module are used alternately in the sliding window with a hierarchical self-attention mechanism; the sliding window with a hierarchical self-attention mechanism adopts a shift partitioning strategy in which the first module and the second module are used alternately; The window division strategy of the first module is to divide the 2M×2M feature map into two M×M windows. The window division strategy of the second module is to divide the feature map into two M×M windows based on the first module. window.
8. The method for detecting small targets in medical infrared images according to claim 7, characterized in that: The following formula is used to calculate the lth eigenvector of the lth feature map after being processed by the W-MSA module: The lth eigenvector of the lth feature map after being processed by the MLP module is calculated using the following formula: The following formula is used to calculate the l+1th eigenvector of the l+1th feature map after it is processed by the SW-MSA module: The l+1th feature vector of the l+1th feature map after being processed by the MLP module is calculated using the following formula: Among them, W-MSA means that the sliding window with hierarchical self-attention mechanism adopts the conventional partitioning strategy, SW-MSA means that the sliding window with hierarchical self-attention mechanism adopts the shift partitioning strategy, and MLP means multi-layer perception.
9. The method for detecting small targets in medical infrared images according to claim 1, characterized in that: The Yolov5 model includes a backbone network, a neck network, an FPN+PAN structure and a prediction network; the backbone network includes a Focus structure, a CBL module, an SSP module, and a BottleneckCSP module; the neck network includes a connection operation, an upsampling operation, a CBL module, and a BottleneckCSP module; The step of using the Yolov5 model to regress and classify the feature vector with attention weights includes: In the backbone network, the feature vector with attention weight is input into the Focus structure, and processed by the CBL module, the SSP module and the BottleneckCSP module to obtain the feature vector processed by the backbone network; In the neck network, the feature vector processed by the backbone network is subjected to connection operation, upsampling operation, CBL module, and BottleneckCSP module processing to obtain an integrated feature vector; The integrated feature vector is input into the FPN+PAN structure to obtain multi-scale semantic information and positioning information; The multi-scale semantic information and positioning information are input into the prediction network to output a set sequence of bounding box coordinate values of the disease location and a maximum probability disease category of the object to be detected.
10. A computer device comprising a memory and a processor, wherein a computer program is stored in the memory, wherein: When the processor executes the computer program, the steps of the method for detecting small targets in medical infrared images as described in any one of claims 1 to 8 are implemented.