Detection model training method, detection method and detection model training device
By extracting and segmenting regions of interest from training ray images, performing grayscale mapping, and constructing multi-channel image groups to train the detection model, the problems of poor detection performance and high resource consumption in existing detection schemes are solved, achieving efficient detection results and low resource consumption.
Patent Information
- Application Number
- CN202511060214.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-30
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2045-07-30
AI Technical Summary
Existing automated detection solutions based on detection models have poor detection performance, high resource consumption, and low training efficiency, which limits their rapid deployment and efficient operation in practical applications.
The region of interest is extracted from the training ray image and divided into several sub-region blocks. The minimum and maximum target gray values of each sub-region block are determined. Gray-scale mapping is performed according to the window width and window level. Multi-channel image groups are constructed for model training, avoiding the use of image enhancement techniques and increasing the number of training iterations.
The detection model's detection and recognition capabilities were improved, resulting in more accurate detection results. At the same time, resource consumption and training time were reduced, thus improving the model's detection efficiency.
Smart Images

Figure CN120913006A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of automatic detection, in particular to a detection model training method, a detection method and a detection model training device. BACKGROUND
[0002] In recent years, with the rapid development of machine learning and deep learning technology, automatic detection schemes based on detection models gradually replace manual detection methods. Automatic detection schemes based on detection models can be applied to many scenarios, such as X-ray workpiece defect detection scenarios, X-ray lesion detection scenarios, etc.
[0003] The automatic detection scheme based on the detection model is to obtain a training X-ray image from a constructed training X-ray image set (the training X-ray image set includes a plurality of training X-ray images with annotations, such as a plurality of training X-ray images with workpiece defect information annotated in the X-ray workpiece defect detection scenario), input the training X-ray image into the detection model for training, and after the training is completed, obtain a target X-ray image and directly input the target X-ray image into the trained detection model for detection.
[0004] Although the above-mentioned automatic detection scheme based on the detection model improves the detection efficiency compared with the manual detection method, the detection effect is not good. SUMMARY
[0005] Therefore, the present application provides a detection model training method, a detection method and related devices to solve the problem of poor detection effect of the existing detection scheme, and the technical solutions are as follows:
[0006] The first aspect of the present application provides a detection model training method, comprising:
[0007] obtaining a training X-ray image from a training X-ray image set;
[0008] extracting a region of interest from the training X-ray image, and dividing the region of interest into a plurality of sub-region blocks to obtain a to-be-processed image set including the plurality of sub-region blocks, each sub-region block in the to-be-processed image set being a to-be-processed image;
[0009] determining the minimum target gray value and the maximum target gray value of each image in the to-be-processed image set, and determining the window width and window level corresponding to each image in the to-be-processed image set according to the minimum target gray value and the maximum target gray value of each image in the to-be-processed image set;
[0010] For each image in the to-be-processed image set, according to the window width and window level corresponding to the image, the pixel gray value of the image is mapped using a preset gray mapping rule to obtain a gray mapped image corresponding to the image;
[0011] The gray-scale mapped image corresponding to each image in the training radiograph and the image set to be processed is constructed into a multi-channel image group;
[0012] The detection model is trained using the multi-channel image group.
[0013] In a possible implementation, the image set to be processed further includes the training radiograph;
[0014] The gray-scale mapped image corresponding to each image in the training radiograph and the image set to be processed is constructed into a multi-channel image group, including:
[0015] The gray-scale mapped image corresponding to each image in the training radiograph and the image set to be processed is constructed into a multi-channel image group, including:
[0016] In a possible implementation, the determination of the minimum target gray-scale value and the maximum target gray-scale value of each image in the image set to be processed includes:
[0017] For each image in the image set to be processed:
[0018] The image is scaled by a preset scaling multiple to obtain a thumbnail of the image;
[0019] The gray-scale histogram of the thumbnail of the image is calculated to obtain the gray-scale histogram corresponding to the image;
[0020] The minimum target gray-scale value and the maximum target gray-scale value of the image are determined according to a preset gray-scale range ratio and the gray-scale histogram corresponding to the image, wherein the gray-scale range ratio is the ratio of the reserved gray-scale range to the entire gray-scale range.
[0021] In a possible implementation, the training radiograph is an N-bit gray-scale radiograph, the gray-scale range of the N-bit gray-scale radiograph is [0, M], and M is 2 N -1;
[0022] The pixel gray-scale value of the image is mapped using a preset gray-scale mapping rule to obtain the gray-scale mapped image corresponding to the image according to the window width and the window level corresponding to the image, including:
[0023] The pixel gray-scale value of the image is mapped using a preset gray-scale mapping rule to obtain the gray-scale mapped image corresponding to the image according to the window width and the window level corresponding to the image, including:
[0024] According to the gray mapping table corresponding to the image, the pixel gray value of the image is mapped to obtain the gray mapping image corresponding to the image.
[0025] In a possible implementation, the method further includes:
[0026] The image is tiled into a one-dimensional array, and each element in the one-dimensional array is a gray value of a pixel in the image.
[0027] For each gray value in the one-dimensional array, the corresponding mapped gray value of the gray value is obtained by querying the gray mapping table corresponding to the image, and the corresponding mapped gray value of the gray value is used to replace the gray value in the one-dimensional array.
[0028] According to the one-dimensional array after the gray value replacement, the gray mapping image corresponding to the image is generated.
[0029] In a possible implementation, the training ray image is an N-bit gray ray image, the gray range of the N-bit gray ray image is [0, M], and M is 2 N -1; the method further includes:
[0030] An initial gray mapping table corresponding to the image is constructed, the initial gray mapping table includes each gray value in the range of [0, M], and the corresponding mapped gray value of each gray value in the range of [0, M] is empty.
[0031] For each pixel in the image, it is queried whether the corresponding mapped gray value of the gray value of the pixel exists in the gray mapping table corresponding to the image.
[0032] If not, the corresponding mapped gray value of the gray value of the pixel is directly mapped according to the window width and the window level corresponding to the image by using the preset gray mapping rule, and the corresponding mapped gray value of the gray value of the pixel is stored in the gray mapping table corresponding to the image; if yes, the corresponding mapped gray value of the gray value of the pixel is directly obtained from the gray mapping table corresponding to the image.
[0033] According to the corresponding mapped gray value of the gray value of each pixel in the image, the gray mapping image corresponding to the image is generated.
[0034] In a possible implementation, the mapping of the pixel gray value of the image according to the preset gray mapping rule according to the window width and the window level corresponding to the image to obtain the gray mapping image corresponding to the image comprises the following steps.
[0035] For each pixel in the image, the gray value of the pixel is mapped according to the preset gray mapping rule according to the window width and the window level corresponding to the image to obtain the mapped gray value corresponding to the gray value of the pixel.
[0036] According to the mapped gray value corresponding to the gray value of each pixel in the image, a gray mapping image corresponding to the image is generated.
[0037] In a possible implementation, the set of images to be processed further comprises the training ray image; and the training ray image and the gray mapping image corresponding to each image in the set of images to be processed are constructed into a multi-channel image group, which comprises the following steps.
[0038] For each sub-region block, an image with the same size as the training ray image is constructed by filling pixels with a set gray value around the gray mapping image corresponding to the sub-region block to obtain a gray mapping extended image corresponding to the sub-region block, and the position of the gray mapping image corresponding to the sub-region block in the gray mapping extended image corresponding to the sub-region block is the same as the position of the sub-region block in the training ray image.
[0039] The training ray image, the gray mapping image corresponding to the training ray image, and the gray mapping extended image corresponding to each of the sub-region blocks are combined into a multi-channel image group.
[0040] The second aspect of the application provides a detection method, which comprises the following steps.
[0041] A target ray image is obtained.
[0042] A detection model trained in advance is used to detect the target ray image, wherein the detection model is trained by using any one of the detection model training methods.
[0043] The third aspect of the application provides a detection model training device, which comprises a training ray image acquisition module, an area of interest extraction and division module, a gray threshold determination module, a window width and window level determination module, an image gray mapping module, a multi-channel image group construction module, and a model training module.
[0044] The training ray image acquisition module is configured to acquire a training ray image from a set of training ray images.
[0045] The region-of-interest extraction and division module is configured to extract a region-of-interest from the training radiograph and divide the region-of-interest into a plurality of sub-region blocks to obtain a set of to-be-processed images including the plurality of sub-region blocks, each of the sub-region blocks in the set of to-be-processed images being a to-be-processed image;
[0046] The gray scale threshold determination module is configured to determine a minimum target gray scale value and a maximum target gray scale value for each image in the set of to-be-processed images;
[0047] The window width and window level determination module is configured to determine a window width and a window level corresponding to each image in the set of to-be-processed images according to the minimum target gray scale value and the maximum target gray scale value of the image;
[0048] The image gray scale mapping module is configured to, for each image in the set of to-be-processed images, map pixel gray scale values of the image according to the window width and the window level corresponding to the image by using a preset gray scale mapping rule to obtain a gray scale mapped image corresponding to the image;
[0049] The multi-channel image group construction module is configured to construct the training radiograph and the gray scale mapped images corresponding to the images in the set of to-be-processed images into a multi-channel image group;
[0050] The model training module is configured to train a detection model by using the multi-channel image group.
[0051] By means of the technical solutions described above, the detection model training method provided by the present application, after obtaining a training radiograph, does not directly train a detection model by using the training radiograph, but extracts a region-of-interest from the training radiograph, divides the region-of-interest into a plurality of sub-region blocks, determines a minimum target gray scale value and a maximum target gray scale value for each sub-region block, and then determines a window width and a window level corresponding to each sub-region block according to the minimum target gray scale value and the maximum target gray scale value of the sub-region block. Then, according to the window width and the window level corresponding to each sub-region block, the pixel gray scale values of each sub-region block are mapped by using a preset gray scale mapping rule. Through the mapping processing, the details of the region-of-interest can be highlighted, and the readability of the region-of-interest can be improved. After obtaining the gray scale mapped images corresponding to the sub-region blocks respectively, the training radiograph and the gray scale mapped images corresponding to the sub-region blocks respectively are constructed into a multi-channel image group, and a detection model is trained by using the multi-channel image group. Compared with directly training a detection model by using a training radiograph, training a detection model by using a multi-channel image group enables the model to capture more details in the image, thereby effectively improving the detection and recognition capability of the detection model. That is, a detection model with better detection effect can be trained by using the detection model training method provided by the present application, and then, by using the detection model to detect a target radiograph, a more accurate detection result can be obtained. Attached Figure Description
[0052] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0053] Figure 1 A schematic flowchart illustrating the detection model training method provided in this application embodiment;
[0054] Figure 2 This is a schematic diagram illustrating the extraction and division of the region of interest from the training ray image.
[0055] Figure 3 A schematic diagram for obtaining a multi-channel image group;
[0056] Figure 4 The training loss curve is obtained by directly using the original training ray images to train the detection model;
[0057] Figure 5 The training loss curve for training a detection model using the detection model training method provided in the embodiments of this application;
[0058] Figure 6 This diagram illustrates a performance comparison between the detection model trained directly using the original training ray images and the detection model trained using the training method provided in this application.
[0059] Figure 7 This is a schematic diagram of the structure of a detection model training device provided in an embodiment of this application. Detailed Implementation
[0060] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0061] The embodiments of this application will now be described with reference to the accompanying drawings. Those skilled in the art will recognize that, with technological advancements and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are equally applicable to similar technical problems.
[0062] The terms "first", "second", and the like in the description and claims of the application and the above drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a particular order or sequence. It should be understood that the terms used in this way can be interchanged, as appropriate, and are merely a way of distinguishing between objects of the same attribute in the description of the embodiments of the application. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, so that a process, method, system, product or apparatus including a series of units does not have to be limited to those units, but can include other units not clearly listed or inherent to the process, method, product or apparatus.
[0063] In view of the poor detection effect of the existing detection scheme, the current solution strategy is to optimize the model performance by increasing the amount of training data and increasing the number of model training. Specifically, after the training ray image set is constructed, the training ray image in the training ray image set is enhanced by using image enhancement technology (such as random offset, rotation, flip, etc.) to expand the training ray image set, that is, the training ray image in the training ray image set is enhanced by using image enhancement technology, and the enhanced ray image is added to the training ray image set as a new training ray image, which can increase the number and diversity of training ray images. In addition, the number of iterations of model training is increased, so that the model can better fit the data, thereby improving the generalization ability and detection accuracy of the model.
[0064] The above solution strategy can improve the detection effect of the detection model, but still has some problems, such as high resource consumption and low training efficiency. Although the image enhancement technology can generate new training ray images, it also significantly increases the training time of the model. The generation of new training ray images not only puts higher requirements on storage and computing resources, but also as the number of model iterations increases, the training time will be correspondingly extended, resulting in longer resource occupation time before the resources can be released. This contradiction between high resource consumption and low training efficiency limits the rapid deployment and efficient operation of the detection model in practical applications.
[0065] In view of the problems existing in the above strategy, the present application provides a detection model training method, which will be introduced in the following embodiments.
[0066] Please refer to Figure 1 , which shows a flowchart of the detection model training method provided by the embodiments of the present application, which can include:
[0067] Step S101: obtaining a training ray image from a training ray image set.
[0068] The training radiographic image set includes a plurality of labeled training radiographic images.
[0069] The detection model training method provided by the embodiment can be applied to many scenes, such as a radiographic workpiece defect detection scene, a radiographic lesion detection scene, and the like.
[0070] For example, the application scene is the radiographic workpiece defect detection scene, and the training radiographic image set includes a plurality of training radiographic images labeled with workpiece defect information (such as defect position, defect category, and the like).
[0071] Step S102: Extracting a region of interest from the training radiographic image, and dividing the region of interest into a plurality of sub-region blocks to obtain a to-be-processed image set including the plurality of sub-region blocks.
[0072] Each sub-region block in the to-be-processed image set is a to-be-processed image.
[0073] In a possible implementation, the position of the region of interest can be pre-set, and the region of interest can be extracted from the training radiographic image based on the position of the region of interest. In order to be able to process different parts in the region of interest in detail, the embodiment further divides the region of interest into a plurality of sub-region blocks after extracting the region of interest.
[0074] In a possible implementation, the number of blocks can be pre-set, and then the region of interest is divided according to the pre-set number of blocks. In the process of dividing the region of interest, an average division method can be used, of course, the embodiment is not limited thereto, for example, the region of interest can also be divided by using a non-average division method.
[0075] For example, the training radiographic image is a 1024*1024 pixel sixteen-bit gray radiographic image, and the position of the region of interest is (256, 256, 768, 768), wherein (256, 256) is the upper left corner coordinate, and (768, 768) is the lower right corner coordinate, as shown in FIG. 1. Figure 2 Based on the position (256, 256, 768, 768) of the region of interest, a 512*512 pixel region of interest is extracted from the training radiographic image. After the 512*512 pixel region of interest is extracted, the 512*512 pixel region of interest is evenly divided into four regions to obtain four 256*256 pixel sub-region blocks.
[0076] In a possible implementation, the plurality of sub-region blocks obtained by dividing the region of interest can be combined to form a to-be-processed image set for subsequent processing.
[0077] In some application scenarios, such as the radiographic workpiece defect detection scenario, defects can not only appear in the region of interest of the radiographic image, but also appear outside the region of interest. Therefore, in order to obtain more accurate and comprehensive detection results, in another possible implementation, the sub-regional blocks obtained by dividing the region of interest and the training radiographic images can be combined to form a set of images to be processed for subsequent processing, that is, in addition to processing the sub-regional blocks, the training radiographic images are also processed.
[0078] Step S103: Determine the minimum target gray value and the maximum target gray value of each image in the set of images to be processed, and determine the window width and window level corresponding to each image in the set of images to be processed according to the minimum target gray value and the maximum target gray value of each image in the set of images to be processed.
[0079] In this embodiment, the window technology is used to process each image in the set of images to be processed, so as to highlight the details in the image, improve the readability of the image, and further improve the training effect of the detection model.
[0080] Specifically, the minimum target gray value and the maximum target gray value of each image in the set of images to be processed are first determined, that is, the target gray value range of each image in the set of images to be processed is determined, and then the window width and window level corresponding to each image in the set of images to be processed are determined according to the minimum target gray value and the maximum target gray value of each image in the set of images to be processed. Next, step S104 is executed.
[0081] In this embodiment, different window widths and window levels can be determined for different images in the set of images to be processed, such as different window widths and window levels for each sub-regional block. Based on different window widths and window levels, different parts of the region of interest can be processed in detail.
[0082] Step S104: For each image in the set of images to be processed, the pixel gray value of the image is mapped using a preset gray mapping rule according to the window width and window level corresponding to the image, to obtain a gray mapped image corresponding to the image.
[0083] The set of images to be processed includes a plurality of sub-regional blocks obtained by dividing the region of interest. For each sub-regional block, the pixel gray value of the sub-regional block is mapped using a preset gray mapping rule according to the window width and window level corresponding to the sub-regional block, to obtain a gray mapped image corresponding to the sub-regional block. By mapping the pixel gray value of each sub-regional block, the details of the region of interest can be highlighted.
[0084] If the training radiograph is included in the image set to be processed, the pixel gray value of the training radiograph is mapped according to the window width and window level corresponding to the training radiograph, and a gray mapping rule is used to obtain the gray mapping image corresponding to the training radiograph. Compared with the training radiograph, the details (such as edge details) of the gray mapping image corresponding to the training radiograph are more prominent.
[0085] Step S105: The gray mapping images corresponding to the training radiograph and each image in the image set to be processed are constructed into a multi-channel image group.
[0086] For example, the region of interest of the training radiograph is divided into four regions on average to obtain four sub-regional blocks, as shown in Figure 3 The pixel gray value of the training radiograph is mapped to obtain the gray mapping image corresponding to the training radiograph. The pixel gray value of the four sub-regional blocks is mapped respectively to obtain the gray mapping image corresponding to the four sub-regional blocks. The training radiograph, the gray mapping image corresponding to the training radiograph, and the gray mapping image corresponding to the four sub-regional blocks are constructed into a 6-channel image group.
[0087] Step S106: The detection model is trained using the multi-channel image group.
[0088] Specifically, the multi-channel image group is input into the detection model, the detection model extracts features from the input multi-channel image group, and gives a detection result (such as a workpiece defect detection result) according to the extracted features. According to the detection result (such as the workpiece defect detection result) and the information labeled by the training radiograph (such as the labeled workpiece defect information), the model prediction loss is determined, and the parameters of the detection model are updated according to the model prediction loss.
[0089] The detection model is iteratively trained multiple times according to the above process until the training end condition (such as model convergence, reaching a predetermined number of training iterations, etc.) is met.
[0090] The detection model training method provided in the embodiments of the present application does not directly train the detection model by using the training radiograph in the training radiograph set, but extracts the region of interest from the training radiograph. In order to be able to process different parts in the region of interest in detail, the region of interest is divided into a plurality of sub-region blocks, and the minimum target gray value and the maximum target gray value of each sub-region block are determined. Then, according to the minimum target gray value and the maximum target gray value of each sub-region block, the window width and the window level corresponding to each sub-region block are determined. Then, according to the window width and the window level corresponding to each sub-region block, the pixel gray value of each sub-region block is mapped by using the preset gray mapping rule. Through the mapping processing, the details of the region of interest can be highlighted, and the readability of the region of interest can be improved. In order to improve the model training effect, the pixel gray value of the training radiograph can also be mapped in the same way. After obtaining the gray mapping after image corresponding to each sub-region block and the gray mapping after image corresponding to the training radiograph, the training radiograph, the gray mapping after image corresponding to the training radiograph, and the gray mapping after image corresponding to each sub-region block are constructed into a multi-channel image group. The detection model is trained by using the multi-channel image group. Compared with directly training the detection model by using the training radiograph, training the detection model by using the multi-channel image group enables the model to more comprehensively capture the detailed information in the image, thereby effectively improving the detection and recognition capability of the detection model. That is, the detection model with good detection effect can be trained by using the detection model training method provided in the embodiments of the present application. In addition, the detection model training method provided in the embodiments of the present application does not need to use image enhancement technology to expand the training radiograph set, nor does it need to increase the number of model training times, and a detection model with good detection effect can be obtained.
[0091] In another embodiment of the present application, the specific implementation process of "step S103: determining the minimum target gray value and the maximum target gray value of each image in the set of images to be processed, and determining the window width and the window level corresponding to each image in the set of images to be processed according to the minimum target gray value and the maximum target gray value of each image in the set of images to be processed" in the above embodiment is introduced.
[0092] First, the specific implementation process of determining the minimum target gray value and the maximum target gray value of each image in the set of images to be processed is introduced.
[0093] The process of determining the minimum target gray value and the maximum target gray value of each image in the set of images to be processed can include:
[0094] Step a1: for each image in the set of images to be processed, scaling the image by a preset scaling multiple to obtain a thumbnail of the image.
[0095] Since the size of the training radiograph and the sub-region block is different, different scaling multiples can be used for scaling.
[0096] Step a2: Calculate a gray scale histogram of the thumbnail image to obtain a gray scale histogram corresponding to the thumbnail image.
[0097] It should be noted that the embodiment can also not scale the image, but directly calculate a gray scale histogram of the image to obtain a gray scale histogram corresponding to the image.
[0098] Step a3: Determine a minimum target gray scale value and a maximum target gray scale value of the image according to a preset gray scale range proportion and the gray scale histogram corresponding to the image.
[0099] The gray scale range proportion is a proportion of a reserved gray scale range to an entire gray scale range, such as 0.995.
[0100] Specifically, a cumulative probability distribution is calculated according to the gray scale histogram corresponding to the image, and the minimum target gray scale value and the maximum target gray scale value of the image are determined according to the preset gray scale range proportion and the cumulative probability distribution.
[0101] Suppose the training ray image is an N-bit gray scale ray image, then the gray scale range of the N-bit gray scale ray image is [0, M], and M is 2 N -1, and correspondingly, for each image in the set of images to be processed, the gray scale range of the gray scale histogram corresponding to the image is [0, M].
[0102] For each image in the set of images to be processed, the process of calculating a cumulative probability distribution according to the gray scale histogram corresponding to the image includes: calculating cumulative sums corresponding to respective gray scale values in the range [0, M] according to the gray scale histogram of the image (a cumulative sum corresponding to a gray scale value is a cumulative pixel number from 0 to the gray scale value), normalizing the cumulative sums corresponding to the respective gray scale values in the range [0, M] based on the size of the image to obtain cumulative probabilities corresponding to the respective gray scale values in the range [0, M], and composing the cumulative probability distribution from the cumulative probabilities corresponding to the respective gray scale values in the range [0, M].
[0103] If the preset gray scale range proportion is denoted as fraction, the minimum target gray scale value is denoted as threshold_low, and the maximum target gray scale value is denoted as threshold_high, then:
[0104] threshold_low=np.searchsorted(P,1-fraction) (1);
[0105] threshold_high=np.searchsorted(P, fraction)-1 (2).
[0106] wherein P represents the cumulative probability distribution, np.searchsorted(P, 1-fraction) represents the gray value at which the cumulative probability first exceeds 1-fraction, and np.searchsorted(P, fraction)-1 represents the gray value at which the cumulative probability first exceeds fraction.
[0107] The minimum target gray value and the maximum target gray value of each image in the set of images to be processed can be obtained through the above process.
[0108] After obtaining the minimum target gray value and the maximum target gray value of each image in the set of images to be processed, the window width and the window level corresponding to each image in the set of images to be processed are further determined according to the minimum target gray value and the maximum target gray value of each image in the set of images to be processed.
[0109] Specifically, for each image in the set of images to be processed, the window width and the window level corresponding to the image can be determined according to the minimum target gray value and the maximum target gray value of the image according to the following formula:
[0110] ww = threshold_high - threshold_low + 1 (3) ;
[0111] wl = (threshold_high + threshold_low) / 2 (4).
[0112] wherein threshold_high is the maximum target gray value of the image, threshold_low is the minimum target gray value of the image, ww is the window width corresponding to the image, and wl is the window level corresponding to the image.
[0113] In another embodiment of the present application, the specific implementation process of "step S104: for each image in the set of images to be processed, according to the window width and the window level corresponding to the image, the pixel gray value of the image is mapped using a preset gray mapping rule to obtain the gray mapping image corresponding to the image" in the above embodiment is introduced.
[0114] There are many implementation methods for step S104, and the following three implementation methods are provided in the present embodiment.
[0115] The first implementation method is as follows.
[0116] Step b1: for each image in the set of images to be processed, according to the window width and the window level corresponding to the image, each gray value in the range of [0, M] is mapped using a preset gray mapping rule to obtain a gray mapping table corresponding to the image.
[0117] The training radiographic image is an N-bit gray radiographic image, the gray scale range of the N-bit gray radiographic image is [0, M], and M is 2 N -1. For example, the training radiographic image is a 16-bit radiographic gray image, and the gray scale range of the 16-bit radiographic gray image is [0, 65535].
[0118] The gray scale mapping table includes each gray scale value in the range [0, M] and the corresponding mapped gray scale value in the range [0, M]. In a possible implementation, the mapping table can be an array with a length of M+1, the index of the array is 0-M, the index of the array represents the original gray scale value, and the value of the array is the mapped gray scale value corresponding to the original gray scale value.
[0119] The gray scale mapping rule is as follows:
[0120] (5).
[0121] For any gray scale value x in the range [0, M], if the gray scale value x is less than , the gray scale value is mapped to 0, if the gray scale value x is greater than , the gray scale value is mapped to M, if the gray scale value x is greater than or equal to and less than or equal to , the gray scale value is mapped to
[0122] Step b2, mapping the pixel gray scale value of the image according to the gray scale mapping table corresponding to the image to obtain the gray scale mapped image corresponding to the image.
[0123] In a possible implementation, the image can be tiled into a one-dimensional array, each element in the one-dimensional array is the gray scale value of a pixel in the image, for each gray scale value in the one-dimensional array, the corresponding mapped gray scale value of the gray scale value is obtained by querying the gray scale mapping table corresponding to the image, the corresponding mapped gray scale value of the gray scale value is used to replace the gray scale value in the one-dimensional array, and the gray scale mapped image corresponding to the image is generated according to the one-dimensional array after the gray scale value is replaced.
[0124] The second implementation:
[0125] Step c1, for each image in the set of images to be processed, constructing the initial gray scale mapping table corresponding to the image.
[0126] The initial gray scale mapping table includes each gray scale value in the range [0, M], and the corresponding mapped gray scale value in the range [0, M] is empty. In a possible implementation, the mapping table can be an array with a length of M+1, the index of the array is 0-M, and the value of the initial array is empty.
[0127] Step c2, for each pixel in the image, querying whether the image corresponding gray scale mapping table exists the mapping gray scale value corresponding to the gray scale value of the pixel.
[0128] Step c3-a, if the image corresponding gray scale mapping table does not exist the mapping gray scale value corresponding to the gray scale value of the pixel, according to the window width and window level corresponding to the image, using the preset gray scale mapping rule, mapping the gray scale value of the pixel to obtain the mapping gray scale value corresponding to the gray scale value of the pixel, and storing the mapping gray scale value corresponding to the gray scale value of the pixel in the image corresponding gray scale mapping table.
[0129] If the image corresponding gray scale mapping table does not exist the gray scale value of the pixel, according to the window width and window level corresponding to the image, directly using the gray scale mapping rule (such as the gray scale mapping rule of formula (5) above) to map the gray scale value of the pixel, after obtaining the mapping gray scale value corresponding to the gray scale value of the pixel, storing the mapping gray scale value corresponding to the gray scale value of the pixel in the gray scale mapping table, so that when the same gray scale value needs to be mapped, the mapping gray scale value is directly obtained from the gray scale mapping table without the need to map based on the gray scale mapping rule.
[0130] Step c3-b, if the image corresponding gray scale mapping table exists the mapping gray scale value corresponding to the gray scale value of the pixel, directly obtaining the mapping gray scale value corresponding to the gray scale value of the pixel from the image corresponding gray scale mapping table.
[0131] In the case that the image corresponding gray scale mapping table exists the mapping gray scale value corresponding to the gray scale value of the pixel, the mapping gray scale value corresponding to the gray scale value of the pixel can be directly obtained from the gray scale mapping table without the need to map based on the gray scale mapping rule.
[0132] Step c4, generating the image corresponding gray scale mapping image according to the mapping gray scale value corresponding to the gray scale value of each pixel in the image.
[0133] After obtaining the mapping gray scale value corresponding to the gray scale value of each pixel in the image, the radiograph image can be reshaped according to the mapping gray scale value corresponding to the gray scale value of each pixel in the image, so as to obtain the image corresponding gray scale mapping image.
[0134] In a possible implementation, the image can be tiled into a one-dimensional array, each element in the one-dimensional array is the gray scale value of a pixel in the image, for each gray scale value in the one-dimensional array, after obtaining the mapping gray scale value corresponding to the gray scale value based on the gray scale mapping rule or the image corresponding gray scale mapping table, replacing the gray scale value in the one-dimensional array with the mapping gray scale value corresponding to the gray scale value, and generating the image corresponding gray scale mapping image according to the one-dimensional array after the gray scale value replacement.
[0135] The third implementation manner:
[0136] Step d1, for each image in the set of images to be processed, according to the window width and window level corresponding to the image, directly using the preset gray mapping rule, the gray value of each pixel of the image is mapped to obtain the mapped gray value corresponding to the gray value of each pixel of the image.
[0137] For each pixel of the image, according to the window width and window level corresponding to the image, using the preset gray mapping rule (such as the gray mapping rule of formula (5) above), the gray value of the pixel is mapped to obtain the mapped gray value corresponding to the gray value of the pixel.
[0138] Compared with the above two implementation manners, the embodiment directly uses the preset gray mapping rule to map the gray value of each pixel of the image, without constructing the gray mapping table.
[0139] Step d2, generating the gray mapping image corresponding to the image according to the mapped gray value corresponding to the gray value of each pixel in the image.
[0140] In a possible implementation manner, the image can be tiled into a one-dimensional array, each element in the one-dimensional array is the gray value of a pixel in the image, for each gray value in the one-dimensional array, after obtaining the mapped gray value corresponding to the gray value based on the gray mapping rule, the mapped gray value corresponding to the gray value is used to replace the gray value in the one-dimensional array, and the gray mapping image corresponding to the image is generated according to the one-dimensional array after the gray value replacement.
[0141] In another embodiment of the present application, the specific implementation process of "step S105: constructing the gray mapping image corresponding to each image in the set of images to be processed and the training radiograph into a multi-channel image group" in the above embodiment is introduced.
[0142] In the case that the set of images to be processed includes the training radiograph and a plurality of sub-region blocks, the process of constructing the gray mapping image corresponding to each image in the set of images to be processed and the training radiograph into a multi-channel image group can include:
[0143] Step e1, for each sub-region block, by filling the pixels with a set gray value around the gray mapping image corresponding to the sub-region block, an image with the same size as the training radiograph is constructed, and a gray mapping extended image corresponding to the sub-region block is obtained.
[0144] In a possible implementation manner, an image with the same size as the training radiograph can be constructed by filling the pixels with a gray value of 0 around the gray mapping image corresponding to the sub-region block.
[0145] The position of the gray-scale mapped image corresponding to the sub-region block in the gray-scale mapped extended image corresponding to the sub-region block is the same as the position of the sub-region block in the training radiograph image.
[0146] Step e2, combining the training radiograph image, the gray-scale mapped image corresponding to the training radiograph image, and the gray-scale mapped extended images corresponding to the sub-region blocks into a multi-channel image group.
[0147] The training radiograph image, the gray-scale mapped image corresponding to the training radiograph image, and the gray-scale mapped extended images corresponding to the sub-region blocks can be spliced to obtain a multi-channel image group. The multi-channel image group can be represented as:
[0148] Result_images=[original_image, processed_image, processed_block1,…,processed_blockm] (6).
[0149] Wherein, original_image represents the training radiograph image, processed_image represents the mapped image corresponding to the training radiograph image, there are m sub-region blocks, processed_block1 represents the gray-scale mapped extended image corresponding to the first sub-region block, processed_blockm represents the gray-scale mapped extended image corresponding to the mth sub-region block, and Result_images is the multi-channel image group.
[0150] It should be noted that if the training radiograph image is not included in the set of images to be processed, the training radiograph image and the gray-scale mapped extended images corresponding to the sub-region blocks are combined into a multi-channel image group, i.e.:
[0151] Result_images=[original_image,processed_block1,…,processed_blockm](7).
[0152] After obtaining the multi-channel image group, the multi-channel image group can be input into the detection model for training. During the training process, AutoML (Auto Model Optimization) is used to automatically adjust the hyperparameters of the model and perform multiple tests to obtain more feedback. By continuously trying different combinations of hyperparameters, the model has more opportunities to converge in the optimal direction, and ultimately achieves higher accuracy and better generalization.
[0153] It should be noted that, since the multi-channel image group is input into the detection model for training, the structure of the detection model needs to be adapted to the input. In one possible implementation, a detection model that is adapted to the input can be constructed. In another possible implementation, the structure of the detection model that takes the training radiograph as input can be adjusted, for example, the network width can be increased (width expansion), and the number of channels can be increased in each branch or each convolution layer, so as to adapt to the input, so that the model can capture more feature patterns and better identify and segment small and complex objects.
[0154] In the model training based on a batch of 3000x2500 pixel sixteen-bit gray radiographs, when the multi-channel image group obtained by processing the original training radiograph is used to train the detection model, the average loss value obtained by the training iteration number of about 200 times is 0.07, as shown in FIG. 6. When the original training radiograph is directly used to train the detection model, more than 500 times are needed to reach the same fitting trend, which shows that the resource occupation time of the detection model training method provided in the present application is greatly reduced, as shown in FIG. 7. Figure 4 Figure 5
[0155] Taking the radiographic workpiece defect detection scenario as an example, the detection model trained by the detection model training method provided in the present application has good improvement in the discovery of small defects (i.e. the model's missed detection rate), as shown in FIG. 8. The intersection over union between the defect area predicted by the model and the real defect area is improved from about 40% to 75%, which shows that the prediction accuracy is greatly improved. For the same batch of radiographs and labeled data, the precision and recall are effectively improved, which also shows that the generalization of the model is improved. Figure 6
[0156] Based on the detection model training method provided in the above embodiments, the embodiments of the present application further provide a detection method, which can include:
[0157] Step f1: obtaining a target radiograph.
[0158] The target radiograph is a radiograph to be detected, such as a radiographic workpiece defect detection scenario.
[0159] Step f2: detecting the target radiograph based on the pre-trained detection model.
[0160] The detection model is trained by the detection model training method provided in the above embodiments.
[0161] Since the detection model in the embodiment of the application is trained by using the detection model training method provided in the above embodiment, the detection model has strong detection and recognition capability, and thus, the detection model can be used to detect the target radiograph, and a more accurate detection result can be obtained.
[0162] The embodiment of the application further provides a device for executing the detection model training method provided in the above embodiment. Please refer to Figure 7 , Figure 7 A structural schematic diagram of a detection model training device provided in the embodiment of the application is shown in FIG. 7. The detection model training device can include a training radiograph acquisition module 701, an interested region extraction and division module 702, a gray scale threshold value determination module 703, a window width and window level determination module 704, an image gray scale mapping module 705, a multi-channel image group construction module 706, and a model training module 707.
[0163] The training radiograph acquisition module 701 is configured to acquire training radiographs from a training radiograph set.
[0164] The interested region extraction and division module 702 is configured to extract an interested region from the training radiograph, and divide the interested region into a plurality of sub-region blocks to obtain a to-be-processed image set including the plurality of sub-region blocks, each sub-region block in the to-be-processed image set being a to-be-processed image.
[0165] The gray scale threshold value determination module 703 is configured to determine a minimum target gray scale value and a maximum target gray scale value of each image in the to-be-processed image set.
[0166] The window width and window level determination module 704 is configured to determine a window width and a window level corresponding to each image in the to-be-processed image set according to the minimum target gray scale value and the maximum target gray scale value of the image.
[0167] The image gray scale mapping module 705 is configured to, for each image in the to-be-processed image set, map pixel gray scale values of the image by using a preset gray scale mapping rule according to the window width and the window level corresponding to the image, to obtain a gray scale mapped image corresponding to the image.
[0168] The multi-channel image group construction module 706 is configured to construct the gray scale mapped images corresponding to the training radiograph and each image in the to-be-processed image set into a multi-channel image group.
[0169] The model training module 707 is configured to train a detection model by using the multi-channel image group.
[0170] In a possible implementation, the to-be-processed image set further includes the training radiograph.
[0171] The multi-channel image group construction module 706 is specifically configured to:
[0172] The multi-channel image group is constructed by the training radiograph, the gray-mapped image corresponding to the training radiograph, and the gray-mapped images corresponding to the sub-regional blocks.
[0173] In a possible implementation, the gray threshold determination module 703 is specifically configured to:
[0174] For each image in the image set to be processed:
[0175] scaling the image by a preset scaling multiple to obtain a thumbnail of the image;
[0176] calculating a gray histogram of the thumbnail of the image to obtain a gray histogram corresponding to the image;
[0177] determining a minimum target gray value and a maximum target gray value of the image according to a preset gray range ratio and the gray histogram corresponding to the image, wherein the gray range ratio is a ratio of a reserved gray range to an entire gray range.
[0178] The training radiograph is an N-bit gray radiograph, and a gray range of the N-bit gray radiograph is [0, M], where M is 2 N -1.
[0179] In a possible implementation, the image gray mapping module 705 is specifically configured to:
[0180] mapping each gray value in the range [0, M] according to the window width and the window level corresponding to the image by using a preset gray mapping rule to obtain a gray mapping table corresponding to the image, the gray mapping table including the gray values in the range [0, M] and the mapped gray values corresponding to the gray values in the range [0, M], respectively;
[0181] mapping the pixel gray values of the image according to the gray mapping table corresponding to the image to obtain the gray-mapped image corresponding to the image.
[0182] In a possible implementation, the image gray mapping module 705 is specifically configured to:
[0183] flattening the image into a one-dimensional array, each element in the one-dimensional array being a gray value of a pixel in the image;
[0184] for each gray value in the one-dimensional array, obtaining a mapped gray value corresponding to the gray value by querying a gray mapping table corresponding to the image, and replacing the gray value in the one-dimensional array with the mapped gray value corresponding to the gray value;
[0185] generating a gray-mapped image corresponding to the image according to the one-dimensional array after the gray value replacement.
[0186] In a possible implementation, when the image gray mapping module 705 is used to, for each image in the set of images to be processed, map pixel gray values of the image according to a window width and a window level corresponding to the image by using a preset gray mapping rule, to obtain a gray-mapped image corresponding to the image, the image gray mapping module 705 is specifically configured to:
[0187] construct an initial gray mapping table corresponding to the image, the initial gray mapping table including each gray value in a range of [0, M], and each gray value in the range of [0, M] corresponding to a mapped gray value being empty;
[0188] for each pixel in the image, query whether a mapped gray value corresponding to a gray value of the pixel exists in the gray mapping table corresponding to the image;
[0189] if not, directly map the gray value of the pixel according to the window width and the window level corresponding to the image by using the preset gray mapping rule, to obtain the mapped gray value corresponding to the gray value of the pixel, and store the mapped gray value corresponding to the gray value of the pixel in the gray mapping table corresponding to the image; or if yes, directly obtain the mapped gray value corresponding to the gray value of the pixel from the gray mapping table corresponding to the image;
[0190] generate the gray-mapped image corresponding to the image according to the mapped gray values corresponding to the gray values of the pixels in the image.
[0191] In a possible implementation, when the image gray mapping module 705 is used to, for each image in the set of images to be processed, map pixel gray values of the image according to a window width and a window level corresponding to the image by using a preset gray mapping rule, to obtain a gray-mapped image corresponding to the image, the image gray mapping module 705 is specifically configured to:
[0192] for each pixel in the image, map a gray value of the pixel according to the window width and the window level corresponding to the image by using the preset gray mapping rule, to obtain a mapped gray value corresponding to the gray value of the pixel;
[0193] According to the mapping gray values corresponding to the gray values of the pixels in the image, a gray mapping image corresponding to the image is generated.
[0194] In a possible implementation, the set of images to be processed further includes a training ray image. When the training ray image and the gray mapping images corresponding to the images in the set of images to be processed are constructed into the multi-channel image group, the multi-channel image group construction module 706 is specifically configured to:
[0195] For each sub-region block, an image with the same size as the training ray image is constructed by filling pixels with a set gray value around the gray mapping image corresponding to the sub-region block, to obtain a gray mapping extended image corresponding to the sub-region block, and the position of the gray mapping image corresponding to the sub-region block in the gray mapping extended image corresponding to the sub-region block is the same as the position of the sub-region block in the training ray image.
[0196] The training ray image, the gray mapping image corresponding to the training ray image, and the gray mapping extended images corresponding to the sub-region blocks are combined into the multi-channel image group.
[0197] The detection model training device provided in the embodiments of the present application is used to train the detection model, so that the model can more comprehensively capture the detailed information in the image, thereby effectively improving the detection and recognition capability of the detection model, that is, the detection model with better detection effect can be trained by using the detection model training device provided in the embodiments of the present application.
[0198] The embodiments of the present application further provide an electronic device, which can include at least one processor and a memory connected with the processor.
[0199] The processor can be a central processing unit CPU, or an application specific integrated circuit ASIC, or one or more integrated circuits configured to implement the embodiments of the present application, etc.; the memory can include a high-speed RAM memory, and can also include a non-volatile memory, etc., such as at least one disk memory.
[0200] The memory is configured to store a computer program, and the processor is configured to execute the computer program, so that the electronic device can implement the steps of the detection model training method and / or the detection method provided in the above embodiments.
[0201] The embodiments of the present application further provide a computer storage medium, which carries one or more computer programs, and when the one or more computer programs are executed by an electronic device, the electronic device can implement the steps of the detection model training method and / or the detection method provided in the above embodiments.
[0202] The embodiment of the present application further provides a computer program product comprising computer readable instructions which, when run on an electronic device, cause the electronic device to implement the steps of the detection model training method and / or the detection method provided by the above-described embodiment.
[0203] In addition, it should be noted that the above-described apparatus embodiments are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment. In addition, the connection relationship between the modules in the apparatus embodiments provided by the present application indicates that there is a communication connection between them, which can be implemented as one or more communication buses or signal lines.
[0204] Through the above description of the embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software and the necessary general hardware, and of course, it can also be implemented by special hardware including special integrated circuits, special CPUs, special memories, special components, etc. Generally, functions completed by computer programs can be easily implemented by corresponding hardware, and the specific hardware structure for implementing the same function can also be various, such as analog circuits, digital circuits or special circuits, etc. However, for the present application, software program implementation is a better embodiment. Based on this understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a readable storage medium, such as a computer's floppy disk, U disk, mobile hard disk, ROM, RAM, magnetic disk or optical disk, etc., including a plurality of instructions to make a computer device (which can be a personal computer, a training device, or a network device, etc.) execute the methods described in various embodiments of the present application.
[0205] In the above embodiments, all or part can be realized by software, hardware, firmware or any combination thereof. When realized by software, it can be realized in the form of a computer program product in whole or in part.
[0206] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions can be transmitted from one website, computer, training device or data center to another website, computer, training device or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be stored by the computer or a data storage device such as a training device, a data center, etc. integrated with one or more available media sets. The available media can be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a solid state disk (SSD)), etc.
Claims
1. A detection model training method, characterized in that, The method comprises the following steps: obtaining a training radiograph from a training radiograph set; extracting a region of interest from the training radiograph and dividing the region of interest into a plurality of sub-regional blocks to obtain a to-be-processed image set comprising the plurality of sub-regional blocks, each sub-regional block in the to-be-processed image set being a to-be-processed image; determining a minimum target gray value and a maximum target gray value of each image in the to-be-processed image set, and determining a window width and a window level corresponding to each image in the to-be-processed image set according to the minimum target gray value and the maximum target gray value of each image in the to-be-processed image set; for each image in the to-be-processed image set, mapping pixel gray values of the image according to the window width and the window level corresponding to the image by using a preset gray mapping rule to obtain a gray-mapped image corresponding to the image; constructing a multi-channel image group from the training radiograph and the gray-mapped images corresponding to the images in the to-be-processed image set respectively; training a detection model by using the multi-channel image group.
2. The detection model training method of claim 1, wherein, The to-be-processed image set further comprises the training radiograph; the step of constructing a multi-channel image group from the training radiograph and the gray-mapped images corresponding to the images in the to-be-processed image set respectively comprises: constructing a multi-channel image group from the training radiograph, the gray-mapped image corresponding to the training radiograph, and the gray-mapped images corresponding to the plurality of sub-regional blocks respectively.
3. The detection model training method of claim 1, wherein, The step of determining a minimum target gray value and a maximum target gray value of each image in the to-be-processed image set comprises: for each image in the to-be-processed image set: scaling the image by a preset scaling factor to obtain a thumbnail of the image; calculating a gray histogram of the thumbnail of the image to obtain a gray histogram corresponding to the image; determining a minimum target gray value and a maximum target gray value of the image according to a preset gray range ratio and the gray histogram corresponding to the image, wherein the gray range ratio is a ratio of a reserved gray range to an entire gray range.
4. The detection model training method of claim 1, wherein, The training radiograph is an N-bit gray radiograph, the gray scale range of the N-bit gray radiograph is [0, M], M is 2 N -1; The step of mapping pixel gray values of the image according to the window width and the window level corresponding to the image by using a preset gray mapping rule to obtain a gray-mapped image corresponding to the image comprises: mapping each gray value in the range of [0, M] according to the window width and the window level corresponding to the image by using a preset gray mapping rule to obtain a gray mapping table corresponding to the image, the gray mapping table comprising each gray value in the range of [0, M] and the mapped gray value corresponding to each gray value in the range of [0, M] respectively; mapping pixel gray values of the image according to the gray mapping table corresponding to the image to obtain a gray-mapped image corresponding to the image.
5. The detection model training method of claim 4, wherein, The step of mapping pixel gray values of the image according to the gray mapping table corresponding to the image to obtain a gray-mapped image corresponding to the image comprises: tiling the image into a one-dimensional array, each element in the one-dimensional array being a gray value of a pixel in the image; For each gray value in the one-dimensional array, the mapped gray value corresponding to the gray value is obtained by querying the gray-scale mapping table corresponding to the image, and the mapped gray value corresponding to the gray value is used to replace the gray value in the one-dimensional array. Generate the corresponding grayscale mapped image based on the one-dimensional array after grayscale value replacement.
6. The detection model training method of claim 1, wherein, The training radiograph is an N-bit gray radiograph, the gray scale range of the N-bit gray radiograph is [0, M], M is 2 N -1; The step of mapping the pixel grayscale values of the image according to the window width and window level corresponding to the image, using a preset grayscale mapping rule, to obtain the corresponding grayscale mapped image, includes: Construct an initial grayscale mapping table corresponding to the image. The initial grayscale mapping table includes grayscale values in the range [0, M]. The mapped grayscale values corresponding to each grayscale value in the range [0, M] are empty. For each pixel in the image, query the grayscale mapping table corresponding to the image to see if there is a mapped grayscale value corresponding to the grayscale value of that pixel; If not, then based on the window width and window level corresponding to the image, the gray value of the pixel is mapped using a preset gray-scale mapping rule to obtain the mapped gray value corresponding to the gray value of the pixel, and the mapped gray value corresponding to the gray value of the pixel is stored in the gray-scale mapping table corresponding to the image; if yes, then the mapped gray value corresponding to the gray value of the pixel is directly obtained from the gray-scale mapping table corresponding to the image. Based on the mapped gray values of each pixel in the image, generate the corresponding gray-mapped image.
7. The detection model training method of claim 1, wherein, The step of mapping the pixel grayscale values of the image according to the window width and window level corresponding to the image, using a preset grayscale mapping rule, to obtain the corresponding grayscale mapped image, includes: For each pixel in the image, based on the window width and window level corresponding to the image, the gray value of the pixel is mapped using a preset gray-scale mapping rule to obtain the mapped gray value corresponding to the gray value of the pixel. Based on the mapped gray values of each pixel in the image, generate the corresponding gray-mapped image. 8.The method of Claim 1, wherein The set of images to be processed also includes the training ray images; The step of constructing a multi-channel image group from the training ray image and the grayscale mapped images corresponding to each image in the image set to be processed includes: For each sub-region block, by filling the area around the grayscale mapped image corresponding to the sub-region block with pixels of a set grayscale value, an image of the same size as the training ray image is constructed, resulting in the grayscale mapped extended image corresponding to the sub-region block. The position of the grayscale mapped image corresponding to the sub-region block in the grayscale mapped extended image corresponding to the sub-region block is the same as the position of the sub-region block in the training ray image. The training ray image, the grayscale mapped image corresponding to the training ray image, and the grayscale mapped extended images corresponding to the several sub-region blocks are combined into a multi-channel image group.
9. A method of detection, characterized in that include: Acquire target ray image; The target ray image is detected using a pre-trained detection model, wherein the detection model is trained using the detection model training method described in any one of claims 1 to 8. 10.A detection model training apparatus, comprising: include: The training radiograph image acquisition module, the region of interest extraction and division module, the gray scale threshold determination module, the window width and window level determination module, the image gray scale mapping module, the multi-channel image group construction module, and the model training module; The training radiograph image acquisition module is configured to acquire training radiograph images from a training radiograph image set; The region of interest extraction and division module is configured to extract a region of interest from the training radiograph image and divide the region of interest into a plurality of sub-region blocks to obtain a to-be-processed image set including the plurality of sub-region blocks, each sub-region block in the to-be-processed image set being a to-be-processed image; The gray scale threshold determination module is configured to determine a minimum target gray scale value and a maximum target gray scale value for each image in the to-be-processed image set; The window width and window level determination module is configured to determine a window width and a window level corresponding to each image in the to-be-processed image set according to the minimum target gray scale value and the maximum target gray scale value of the image; The image gray scale mapping module is configured to, for each image in the to-be-processed image set, map pixel gray scale values of the image according to the window width and the window level corresponding to the image by using a preset gray scale mapping rule to obtain a gray scale mapped image corresponding to the image; The multi-channel image group construction module is configured to construct the training radiograph image and the gray scale mapped images corresponding to the images in the to-be-processed image set into a multi-channel image group; The model training module is configured to train a detection model by using the multi-channel image group.
Citation Information
Patent Citations
Target detection model training method and device and communication equipment
CN113034449A
Generative adversarial network training method and device, computer equipment and storage medium
CN115860067A
Model training method, image segmentation method, terminal device and computer medium
CN115908437A
Image enhancement method and device, equipment and storage medium
CN119941599A
Systems and methods for plaque identification, plaque composition analysis, and plaque stability detection
US20230115927A1