WO2023184913A1 - 模型训练方法、超分辨率重建方法、装置、设备及介质 - Google Patents
模型训练方法、超分辨率重建方法、装置、设备及介质 Download PDFInfo
- Publication number
- WO2023184913A1 WO2023184913A1 PCT/CN2022/122864 CN2022122864W WO2023184913A1 WO 2023184913 A1 WO2023184913 A1 WO 2023184913A1 CN 2022122864 W CN2022122864 W CN 2022122864W WO 2023184913 A1 WO2023184913 A1 WO 2023184913A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- super
- feature map
- loss function
- resolution
- image
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 121
- 238000012549 training Methods 0.000 title claims abstract description 75
- 238000005070 sampling Methods 0.000 claims abstract description 26
- 238000000605 extraction Methods 0.000 claims abstract description 17
- 230000006870 function Effects 0.000 claims description 138
- 238000004364 calculation method Methods 0.000 claims description 7
- 238000013527 convolutional neural network Methods 0.000 claims description 6
- ORILYTVJVMAKLC-UHFFFAOYSA-N Adamantane Natural products C1C(C2)CC3CC1CC2C3 ORILYTVJVMAKLC-UHFFFAOYSA-N 0.000 claims description 2
- 238000010276 construction Methods 0.000 claims 1
- 238000013473 artificial intelligence Methods 0.000 abstract description 4
- 238000012545 processing Methods 0.000 description 11
- 238000004891 communication Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000000052 comparative effect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000002059 diagnostic imaging Methods 0.000 description 1
- 238000003384 imaging method Methods 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000010606 normalization Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformations in the plane of the image
- G06T3/40—Scaling of whole images or parts thereof, e.g. expanding or contracting
- G06T3/4053—Scaling of whole images or parts thereof, e.g. expanding or contracting based on super-resolution, i.e. the output image resolution being higher than the sensor resolution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
Definitions
- This application relates to artificial intelligence technology, and in particular to a model training method, super-resolution reconstruction method, device, equipment and medium.
- Super Resolution is the process of recovering a high-resolution (HR) image from a given low-resolution (LR) image. It is a classic application of computer vision. Through software or hardware methods, the corresponding high-resolution images are reconstructed from the observed low-resolution images, which can be used in the fields of monitoring equipment, satellite image remote sensing, digital high-definition, microscopic imaging, video coding communications, video restoration, and medical imaging. All have important application value. The inventor realized that when currently using a super-resolution model to reconstruct an image to obtain a corresponding super-resolution image, there is still a problem of low image quality and unclear image quality.
- a model training method a super-resolution reconstruction method, a device, a device, and a medium are provided.
- a super-resolution model training method including: obtaining a down-sampled image obtained by down-sampling the original resolution image, performing feature extraction on the down-sampled image to obtain an initial feature map; and extracting the initial feature map according to a preset sampling ratio. Carry out two random samplings to obtain the first feature map and the second feature map respectively. Construct a contrast loss function based on the first feature map and the second feature map; use the preset upsampling method to process the initial feature map to obtain a super-resolution image.
- An image super-resolution reconstruction method including: acquiring a low-resolution image to be reconstructed; and processing the low-resolution image to be reconstructed using a super-resolution model trained by the super-resolution model training method disclosed in any embodiment of the present application. , to obtain the corresponding super-resolution image.
- a super-resolution model training device including: a feature extraction module, used to obtain a down-sampled image obtained by down-sampling the original resolution image, and perform feature extraction on the down-sampled image to obtain an initial feature map; a comparison loss function Building module, used to randomly sample the initial feature map twice according to the preset sampling ratio, obtain the first feature map and the second feature map respectively, and construct a contrast loss function based on the first feature map and the second feature map; L1 loss function A building module for processing the initial feature map using a preset upsampling method to obtain a super-resolution image, and constructing an L1 loss function based on the original resolution image and the super-resolution image; and a model training module for using the contrast loss function and The L1 loss function constructs a total loss function, and uses the total loss function to train the original super-resolution model to obtain the trained super-resolution model.
- An electronic device including: a memory for storing computer readable instructions; and one or more processors for executing computer readable instructions to implement the super-resolution model training method disclosed in any embodiment of the present application. or steps to implement the image super-resolution reconstruction method disclosed in any embodiment of this application.
- a non-volatile computer-readable storage medium for storing computer-readable instructions; wherein, when executed by a processor, the computer-readable instructions implement the steps of implementing any of the super-resolution model training methods implemented in the present application or implement the present application. Apply the steps of the image super-resolution reconstruction method disclosed in any embodiment.
- Figure 1 is a flow chart of a super-resolution model training method according to one or more embodiments
- Figure 2 is a flow chart of a specific super-resolution model training method according to one or more embodiments
- Figure 3 is a flow chart of a super-resolution model training method according to one or more embodiments
- Figure 4 is a flow chart of an image super-resolution reconstruction method according to one or more embodiments
- Figure 5 is a schematic structural diagram of a super-resolution model training device according to one or more embodiments
- Figure 6 is a structural diagram of an electronic device according to one or more embodiments.
- Super-resolution is the process of recovering a high-resolution image from a given low-resolution image and is a classic application of computer vision.
- embodiments of the present application disclose a super-resolution model training method and an image super-resolution reconstruction method, which can improve the performance of the super-resolution model, so that when using the super-resolution model to process images, better results can be obtained. High-quality super-resolution images.
- a super-resolution model training method which method can be applied to electronic devices.
- the method includes:
- Step S11 Obtain the down-sampled image obtained by down-sampling the original resolution image, and perform feature extraction on the down-sampled image to obtain an initial feature map.
- the original resolution image is first down-sampled.
- the resize function in MATLAB can be used to down-sample the original resolution image to obtain the corresponding down-sampled image. Then perform feature extraction on the downsampled image to obtain the initial feature map. It should be noted that after feature extraction on the downsampled image, the image size of the initial feature map obtained is consistent with the downsampled image, but the number of channels will increase. Note for C.
- Step S12 Randomly sample the initial feature map twice according to the preset sampling ratio to obtain the first feature map and the second feature map respectively, and construct a contrast loss function based on the first feature map and the second feature map.
- the initial feature map is randomly sampled twice according to the preset sampling ratio to obtain the first feature map and the second feature map respectively; where, the preset sampling ratio is recorded as ⁇ , and the image size of the initial feature map is assumed to be is H*W, then the image size of the first feature map and the second feature map is H*W* ⁇ .
- the value of ⁇ is taken as 0.5, then the obtained first feature map and the second feature map are the initial feature maps. half of the image size, and then construct a contrast loss function based on the first feature map and the second feature map.
- the second feature map can be used as a positive sample of the first feature map, and the image obtained by randomly sampling other different initial feature maps can be used as a negative sample, that is, it will be compared with the target image. The more similar images are used as positive samples, and the irrelevant images are used as negative samples.
- Step S13 Use the preset upsampling method to process the initial feature map to obtain a super-resolution image, and construct an L1 loss function based on the original resolution image and the super-resolution image.
- the above-mentioned processing of the initial feature map using a preset upsampling method to obtain a super-resolution image includes: using an interpolation method to expand the pixels of the initial feature map to obtain an expanded feature map;
- the feature map is input to a convolutional neural network with a filter number of three in the last convolutional layer, so that the expanded feature map can be processed through the convolutional neural network to reduce the number of channels of the expanded feature map, and the number of channels is three. super-resolution images. It can be understood that this embodiment needs to map the obtained initial feature map of the C channel back to an RGB three-channel image.
- the H*W*C feature map is first expanded into the sH*sW*C feature map using the interpolation method, and then the feature map that is enlarged by a multiple of s 2 is mapped into an RGB image, thus achieving s 2 Multiple super-resolution.
- the number of channels of the above initial feature map is 512 and the image size is 48 ⁇ 48
- the expansion factor is 4
- the image size is 96 ⁇ 96 and the channels are
- the expanded feature map is still 512, and then the expanded feature map is input to a convolutional neural network with a filter number of three in the last convolutional layer, and the expanded feature map is processed through the convolutional neural network.
- the channel number of the expanded feature map is reduced to obtain a super-resolution image with three channels, that is, a mapped RGB three-channel image is obtained.
- the number of filters determines the number of channels of the output image, that is, the number of filters is the number of channels of the output feature map.
- the L1 loss is calculated for the super-resolution image and the original resolution image to construct the L1 loss function.
- the L1 loss function can also be called the minimum absolute value deviation or absolute value loss function, which is used to minimize the absolute difference between the target value and the estimated value; in this embodiment, it is used to compare the original resolution The gap between the image and the super-resolution image is minimized.
- Step S14 Construct a total loss function based on the contrast loss function and the L1 loss function, and use the total loss function to train the original super-resolution model to obtain the trained super-resolution model.
- a total loss function of the model is constructed based on the contrast loss function and the L1 loss function, and then the total loss function is used to train the original super-resolution model to obtain a trained super-resolution model.
- this application first obtains the down-sampled image obtained by down-sampling the original resolution image, and performs feature extraction on the down-sampled image to obtain the initial feature map; then the initial feature map is randomly sampled twice according to the preset sampling ratio.
- this application first performs feature extraction on the downsampled image to obtain the initial feature map, and then randomly samples the initial feature map twice to obtain The first feature map and the second feature map corresponding to the initial feature map; then construct a contrast loss function based on the first feature map and the second feature map, and combine it with the L1 loss function to construct a total loss function to train the original super-resolution model to Obtain a super-resolution model with better performance, so that when the super-resolution model is subsequently used to process images, a higher-quality super-resolution image can be obtained.
- Step S21 Obtain the down-sampled image obtained by down-sampling the original resolution image, and perform feature extraction on the down-sampled image to obtain an initial feature map.
- Step S22 Randomly sample the initial feature map twice according to the preset sampling ratio to obtain the first feature map and the second feature map respectively, and construct a contrast loss function based on the first feature map and the second feature map.
- Step S23 Use the preset upsampling method to process the initial feature map to obtain a super-resolution image, and construct an L1 loss function based on the original resolution image and the super-resolution image.
- Step S24 Construct a total loss function based on the contrast loss function and the L1 loss function, and determine the preset number of iterations and the hyperparameter information of the preset optimizer; where the hyperparameter information includes the learning rate and batch size.
- the hyperparameter information may include but is not limited to the learning rate and batch size (ie, batch size).
- the default optimizer can be specifically the Adam optimizer, the learning rate can be set to 0.0001, and the batch size can be 16.
- Step S25 Train the original super-resolution model based on the preset number of iterations and the preset optimizer and using the training set and the total loss function to obtain a trained super-resolution model.
- this embodiment before training the original super-resolution model to obtain the trained super-resolution model, it also includes: downsampling a number of original resolution images according to a preset downsampling multiple to obtain the corresponding downsampled images; a training set for training the original super-resolution model is constructed based on the original resolution image and the downsampled image, where the training samples in the training set include the original resolution image and the corresponding downsampled image. That is, this embodiment first collects a number of original resolution images, and then downsamples these original resolution images according to a preset downsampling multiple to obtain downsampled images at different multiples.
- the original super-resolution model is trained based on the preset optimizer and using the training set and the total loss function.
- the training is stopped to obtain the trained super-resolution model.
- the embodiment of the present application constructs a training set for training the original super-resolution model based on the original resolution image and the corresponding down-sampled image, and then determines the preset iteration number and the hyperparameter information of the preset optimizer, and then based on the preset Set the number of iterations and the preset optimizer and use the training set and the total loss function to train the original super-resolution model to obtain a super-resolution model with better performance.
- the embodiment of the present application discloses a specific super-resolution model training method. Compared with the previous embodiment, this embodiment further explains and optimizes the technical solution. Specifically include:
- Step S31 Obtain the down-sampled image obtained by down-sampling the original resolution image, and perform feature extraction on the down-sampled image to obtain an initial feature map.
- Step S32 Randomly sample the initial feature map twice according to the preset sampling ratio to obtain the first feature map and the second feature map respectively.
- the first feature map and the second feature map are respectively input into the multi-layer perceptron network to obtain a first output value corresponding to the first feature map and a second output value corresponding to the second feature map.
- the multilayer perceptron network in this embodiment, may specifically have a 5-layer structure.
- the first feature map and the second feature map can also be input into a convolution kernel with a size of 1 ⁇ 1, and we get a first output value corresponding to the first feature map and a second output value corresponding to the second feature map.
- the above-mentioned multi-layer perceptron network and 1 ⁇ 1 convolution kernel can achieve dimensionality reduction of the image only on the channel without changing the width and height of the feature map. In this way, the amount of parameters can be reduced and the contrast loss function can be reduced. reduce computational complexity and improve computational efficiency.
- Step S33 Construct a contrast loss function based on the first feature map and the second feature map and the first output value and the second output value.
- a comparison loss function is constructed based on the first feature map and the second feature map as well as the first output value and the second output value. It can be understood that assuming that N is the data sample captured in one training, then After N initial feature maps are randomly sampled twice, 2N sampled feature maps will be obtained. The first feature map is marked as yi , the second feature map is marked as y′ i , the first output value is marked as z i , and the second output value is marked as z′ i , then for the first feature map and the second feature map
- the formula for calculating comparative loss is as follows:
- contr represents contrast
- L contr represents contrast loss function
- sim is used to find cosine similarity, that is, the dot product after normalization
- t is the hyperparameter temperature, the default value is 0.5
- N is the batch size, that is, one training The number of captured data samples
- yi is the first feature map
- y′ i is the second feature map
- z i is the first output value
- z′ i is the second output value.
- contr represents the contrast
- N is the batch size
- y i is the first feature map
- y′ i is the second feature map.
- Step S34 Use the preset upsampling method to process the initial feature map to obtain a super-resolution image, and construct an L1 loss function based on the original resolution image and the super-resolution image.
- L img represents the L1 loss function
- IHR represents the original resolution image
- ISR represents the super-resolution image
- represents the norm.
- Step S35 Assign corresponding weight coefficients to the contrast loss function and L1 loss function; use the weight coefficients to weight the contrast loss function and L1 loss function accordingly to construct a total loss function, and use the total loss function to perform the original super-resolution
- the model is trained to obtain the trained super-resolution model.
- loss represents the total loss function
- ⁇ represents the weight coefficient
- ⁇ is set to 0.5
- L img represents the L1 loss function
- L contr represents the contrast loss function
- an L2 weight attenuation in order to prevent the super-resolution model from over-fitting and improve the stability of the super-resolution model reconstruction, an L2 weight attenuation can be added to the above total loss function to form a new total loss function, and use the above new total loss function to train the original super-resolution model.
- the specific expression of the above-mentioned L2 weight attenuation in this embodiment can be:
- w i is the parameter value of the model when calculating the i-th sample
- N is the batch size
- ⁇ is the weight value.
- ⁇ is taken as 0.1; then in this case, a new total loss function is finally obtained:
- the first feature map and the second feature map are respectively input into the multi-layer perceptron network to obtain the first output value corresponding to the first feature map. and a second output value corresponding to the second feature map, and then construct a contrastive loss function based on the first feature map and the second feature map and the first output value and the second output value.
- a contrastive loss function based on the first feature map and the second feature map and the first output value and the second output value.
- This application introduces a contrast loss function to supervise the model at the feature layer, making the images generated by the model clearer and sharper at the edges, allowing the super-resolution model to achieve better super-resolution effects.
- an image super-resolution reconstruction method which method includes:
- Step S41 Obtain the low-resolution image to be reconstructed.
- Step S42 The super-resolution model trained using the super-resolution model training method disclosed in any of the aforementioned embodiments is processed on the low-resolution image to be reconstructed to obtain the corresponding super-resolution image.
- the low-resolution image to be reconstructed is first obtained, and then the super-resolution model trained by the aforementioned disclosed super-resolution model training method is used to process the low-resolution image to be reconstructed to obtain the corresponding super-resolution rate image. It can be seen that this application can obtain any low-resolution image to be reconstructed and process it using the super-resolution model in this application to achieve super-resolution of the image and restore the image quality.
- a super-resolution model training device which device includes a feature extraction module 11, a contrast loss function building module 12, an L1 loss function building module 13 and Model training module 14, including:
- the feature extraction module 11 is used to obtain a down-sampled image obtained by down-sampling the original resolution image, and perform feature extraction on the down-sampled image to obtain an initial feature map;
- the contrast loss function building module 12 is used to randomly sample the initial feature map twice according to the preset sampling ratio, obtain the first feature map and the second feature map respectively, and construct a contrast loss function based on the first feature map and the second feature map. ;
- the L1 loss function building module 13 is used to process the initial feature map using a preset upsampling method to obtain a super-resolution image, and build an L1 loss function based on the original resolution image and the super-resolution image;
- the model training module 14 is used to construct a total loss function based on the contrast loss function and the L1 loss function, and use the total loss function to train the original super-resolution model to obtain a trained super-resolution model.
- Each module in the above-mentioned super-resolution model training device can be implemented in whole or in part by software, hardware, and combinations thereof.
- Each of the above modules can be embedded in or independent of the processor in the electronic device in the form of hardware, or can be stored in the memory of the electronic device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
- FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Specifically, it may include: at least one processor 21, at least one memory 22, power supply 23, communication interface 24, input and output interface 25 and communication bus 26.
- the memory 22 is used to store computer readable instructions, which are loaded and executed by the processor 21 to implement the relevant steps in the super-resolution model training method executed by the computer device disclosed in any of the foregoing embodiments, or To implement the image super-resolution reconstruction method executed by the computer device disclosed in any of the foregoing embodiments.
- the power supply 23 is used to provide operating voltage for each hardware device on the computer device 20;
- the communication interface 24 can create a data transmission channel between the computer device 20 and external devices, and the communication protocol it follows can be applicable Any communication protocol of the technical solution of this application is not specifically limited here;
- the input and output interface 25 is used to obtain external input data or output data to the external world, and its specific interface type can be selected according to specific application needs. Here Not specifically limited.
- the processor 21 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc.
- the processor 21 can adopt at least one hardware form among DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), and PLA (Programmable Logic Array, programmable logic array).
- the processor 21 may also include a main processor and a co-processor.
- the main processor is a processor used to process data in the wake-up state, also called CPU (Central Processing Unit, central processing unit); the co-processor is A low-power processor used to process data in standby mode.
- the processor 21 may be integrated with a GPU (Graphics Processing Unit, image processor), and the GPU is responsible for rendering and drawing the content that needs to be displayed on the display screen.
- the processor 21 may also include an AI (Artificial Intelligence, artificial intelligence) processor, which is used to process computing operations related to machine learning.
- AI Artificial Intelligence, artificial intelligence
- the memory 22, as a carrier for resource storage can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc.
- the resources stored thereon include the operating system 221, computer readable instructions 222 and data 223, etc., and the storage method can be short-term. Storage or permanent storage.
- the operating system 221 is used to manage and control each hardware device and computer readable instructions 222 on the computer device 20 to realize the operation and processing of the massive data 223 in the memory 22 by the processor 21. It can be Windows, Unix, Linux wait.
- the computer-readable instructions 222 may further include computer-readable instructions that can be used to complete other specific tasks. Computer readable instructions.
- the data 223 may also include data collected by its own input and output interface 25, etc.
- embodiments of the present application also disclose a non-volatile computer-readable storage medium, in which computer-readable instructions are stored.
- computer-readable instructions When the computer-readable instructions are loaded and executed by the processor, any of the foregoing embodiments can be implemented.
- the disclosed method steps are performed during the super-resolution model training process, or implement the image super-resolution reconstruction method performed by the computer device disclosed in any of the foregoing embodiments.
- RAM random access memory
- ROM read-only memory
- electrically programmable ROM electrically erasable programmable ROM
- registers hard disks, removable disks, CD-ROMs, or anywhere in the field of technology. any other known form of storage media.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Artificial Intelligence (AREA)
- Life Sciences & Earth Sciences (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Evolutionary Biology (AREA)
- Evolutionary Computation (AREA)
- General Engineering & Computer Science (AREA)
- Image Analysis (AREA)
- Image Processing (AREA)
Abstract
本申请公开了一种模型训练方法、超分辨率重建方法、装置、设备及介质,涉及人工智能领域,包括:获取对原始分辨率图像进行下采样得到的下采样图像,并对下采样图像进行特征提取以得到初始特征图;按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于第一特征图和第二特征图构建对比损失函数;利用预设上采样方法对初始特征图进行处理得到超分辨率图像,基于原始分辨率图像和超分辨率图像构建L1损失函数;基于对比损失函数和L1损失函数构建总损失函数,并利用总损失函数对原始超分辨率模型进行训练。本申请通过构建对比损失函数并结合L1损失函数对原始超分辨率模型进行训练,以提高模型的性能。
Description
相关申请的交叉引用
本申请要求于2022年03月31日提交中国专利局,申请号为202210332655.3,申请名称为“模型训练方法、超分辨率重建方法、装置、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
本申请涉及人工智能技术,特别涉及一种模型训练方法、超分辨率重建方法、装置、设备及介质。
超分辨率(Super Resolution,即SR)是从给定的低分辨率(Low Resolution,即LR)图像中恢复高分辨率(High Resolution,即HR)图像的过程,是计算机视觉的一个经典应用。通过软件或硬件的方法,从观测到的低分辨率图像重建出相应的高分辨率图像,在监控设备、卫星图像遥感、数字高清、显微成像、视频编码通信、视频复原和医学影像等领域都有重要的应用价值。发明人意识到,当前在使用超分辨率模型对图像进行重建,以得到相应的超分辨率图像时,仍存在图像质量较低、不清晰的问题。
综上,如何提高超分辨率模型的性能,以便利用该超分辨率模型对图像进行处理时,能得到更高质量的超分辨率图像是目前有待解决的问题。
发明内容
根据本申请公开的各种实施例,提供一种模型训练方法、超分辨率重建方法、装置、设备及介质。
一种超分辨率模型训练方法,包括:获取对原始分辨率图像进行下采样后得到的下采样图像,并对下采样图像进行特征提取以得到初始特征图;按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于第一特征图和第二特征图构建对比损失函数;利用预设上采样方法对初始特征图进行处理得到超分辨率图像,基于原始分辨率图像和超分辨率图像构建L1损失函数;及基于对比损失函数和L1 损失函数构建总损失函数,并利用总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
一种图像超分辨率重建方法,包括:获取待重建低分辨率图像;及利用本申请任一实施例公开的超分辨率模型训练方法训练得到的超分辨率模型对待重建低分辨率图像进行处理,以得到相应的超分辨率图像。
一种超分辨率模型训练装置,包括:特征提取模块,用于获取对原始分辨率图像进行下采样后得到的下采样图像,并对下采样图像进行特征提取以得到初始特征图;对比损失函数构建模块,用于按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于第一特征图和第二特征图构建对比损失函数;L1损失函数构建模块,用于利用预设上采样方法对初始特征图进行处理得到超分辨率图像,基于原始分辨率图像和超分辨率图像构建L1损失函数;及模型训练模块,用于基于对比损失函数和L1损失函数构建总损失函数,并利用总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
一种电子设备,包括:存储器,用于保存计算机可读指令;及一个或多个处理器,用于执行计算机可读指令,以实现本申请任一实施例公开的超分辨率模型训练方法的步骤或者以实现本申请任一实施例公开的图像超分辨率重建方法的步骤。
一种非易失性计算机可读存储介质,用于存储计算机可读指令;其中,计算机可读指令被处理器执行时实现实现本申请任一实施的超分辨率模型训练方法的步骤或者实现本申请任一实施例公开的图像超分辨率重建方法的步骤。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显。
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。
图1为根据一个或多个实施例中超分辨率模型训练方法流程图;
图2为根据一个或多个实施例中具体的超分辨率模型训练方法流程图;
图3为根据一个或多个实施例中超分辨率模型训练方法流程图;
图4为根据一个或多个实施例中图像超分辨率重建方法流程图;
图5为根据一个或多个实施例中超分辨率模型训练装置结构示意图;
图6为根据一个或多个实施例中电子设备结构图。
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
超分辨率是从给定的低分辨率图像中恢复高分辨率图像的过程,是计算机视觉的一个经典应用。当前在使用超分辨率模型对图像进行重建,以得到相应的超分辨率图像时,仍存在图像质量较低、不清晰的问题。为此,本申请实施例公开了一种超分辨率模型训练方法和图像超分辨率重建方法,能够提高超分辨率模型的性能,以便利用该超分辨率模型对图像进行处理时,能得到更高质量的超分辨率图像。
参见图1所示,在本申请的某些实施例中,提供一种超分辨率模型训练方法,该方法可以应用于电子设备,该方法包括:
步骤S11:获取对原始分辨率图像进行下采样后得到的下采样图像,并对下采样图像进行特征提取以得到初始特征图。
本实施例中,首先对原始分辨率图像进行下采样,具体可以为利用MATLAB中的resize函数对原始分辨率图像下采样,以获得相应的下采样图像。然后对该下采样图像进行特征提取以得到初始特征图,需要注意的是,对下采样图像进行特征提取后,得到的初始特征图的图像大小与下采样图像一致,但通道数会增加,记为C。
步骤S12:按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于第一特征图和第二特征图构建对比损失函数。
本实施例中,按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图;其中,将预设采样比率记为β、假设初始特征图的图像大小为H*W,那么第一特征图和第二特征图的图像大小为H*W*β,一般将β的值取为0.5,那么得到的第一特征图和第二特征图为初始特征图的图像大小的一半,再基于第一特征图和第二特征图构建对比损失函数。通过这种采样方式的对比学习,可以使得学习的特征图具有更加紧密的关联,在对图像进行大倍率超分辨率的时候,效果更加清晰。
需要指出的是,本实施例中,可以将第二特征图作为第一特征图的正样本,而对其他不同初始特征图进行随机采样得到的图像则作为负样本,也即,将与目标图像更相近 的图像作为正样本,不相关的图像作为负样本。
步骤S13:利用预设上采样方法对初始特征图进行处理得到超分辨率图像,基于原始分辨率图像和超分辨率图像构建L1损失函数。
本实施例中,上述利用预设上采样方法对初始特征图进行处理,以得到超分辨率图像,包括:利用插值方法对初始特征图的像素点进行扩充,得到扩充后特征图;将扩充后特征图输入至最后一层卷积层的滤波器数量为三的卷积神经网络,以便通过卷积神经网络对扩充后特征图进行处理以降低扩充后特征图的通道数,得到通道数为三的超分辨率图像。可以理解的是,本实施例需要将获得的C通道的初始特征图,映射回RGB三通道图像。在这个过程中,先将H*W*C特征图利用插值方法扩充成sH*sW*C的特征图,再将这个放大了s
2倍数的特征图映射成RGB图像,这样就实现了s
2倍数的超分辨率。例如,假设上述初始特征图的通道数为512,图像大小为48×48,首先利用插值方法对初始特征图的像素点进行扩充,当扩充倍数为4时,得到图像大小为96×96,通道数仍为512的扩充后特征图,再将扩充后特征图输入至最后一层卷积层的滤波器数量为三的卷积神经网络,并通过卷积神经网络对扩充后特征图进行处理以降低扩充后特征图的通道数,得到通道数为三的超分辨率图像,也即得到了映射后的RGB三通道图像。可以理解的是,滤波器的数量决定了输出图像的通道数,也即滤波器的数量为多少,那么输出的特征图的通道数就是多少。得到超分辨率图像后,再对超分辨率图像和原始分辨率图像计算L1损失,以构建L1损失函数。需要指出的是,L1损失函数也可以称为最小绝对值偏差或绝对值损失函数,它用于最小化目标值与估计值的绝对差值;本实施例中,其是用于对原始分辨率图像和超分辨率图像之间的差距进行最小化。
步骤S14:基于对比损失函数和L1损失函数构建总损失函数,并利用总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
本实施例中,基于对比损失函数和L1损失函数构建模型的总损失函数,然后利用该总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
可见,本申请首先获取对原始分辨率图像进行下采样后得到的下采样图像,并对下采样图像进行特征提取以得到初始特征图;然后按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于第一特征图和第二特征图构建对比损失函数;接着利用预设上采样方法对初始特征图进行处理得到超分辨率图像,基于原始分辨率图像和超分辨率图像构建L1损失函数;最后基于对比损失函数和L1损失函数构建总损失函数,并利用总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。由此可见,本申请在获得对原始分辨率图像进行下采样得到的下采样图 后,先对下采样图进行特征提取以得到初始特征图,再对初始特征图进行两次随机采样,以得到初始特征图对应的第一特征图和第二特征图;然后基于第一特征图和第二特征图构建对比损失函数,并结合L1损失函数构建总损失函数对原始超分辨率模型进行训练,以得到性能更好的超分辨率模型,以便后续利用该超分辨率模型对图像进行处理时,能得到更高质量的超分辨率图像。
参见图2所示,在本申请的某些实施例中,公开了一种具体的超分辨率模型训练方法,相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。具体包括:
步骤S21:获取对原始分辨率图像进行下采样后得到的下采样图像,并对下采样图像进行特征提取以得到初始特征图。
步骤S22:按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于第一特征图和第二特征图构建对比损失函数。
步骤S23:利用预设上采样方法对初始特征图进行处理得到超分辨率图像,基于原始分辨率图像和超分辨率图像构建L1损失函数。
步骤S24:基于对比损失函数和L1损失函数构建总损失函数,并确定预设迭代次数和预设优化器的超参数信息;其中,超参数信息包括学习率和批量大小。
本实施例中,需要确定预设迭代次数和选取的预设优化器的超参数信息,超参数信息可以包括但不限于学习率和批量大小(即batchsize)。预设优化器具体可以为Adam优化器,学习率可以设为0.0001,批量大小可以为16。
步骤S25:基于预设迭代次数和预设优化器并利用训练集和总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
本实施例中,在对原始超分辨率模型进行训练,以得到训练后的超分辨率模型之前,还包括:按照预设下采样倍数对若干数量张原始分辨率图像进行下采样,以得到相应的下采样图像;基于原始分辨率图像和下采样图像构造用于训练原始超分辨率模型的训练集,其中,训练集中的训练样本包含原始分辨率图像以及对应的下采样图像。也即,本实施例首先采集若干数量张原始分辨率图像,然后按照预设下采样倍数对这些原始分辨率图像进行下采样,以得到不同倍数下的下采样图像,上述预设下采样倍数可以为2倍、3倍或4倍,并且,还需要指出的是,上述原始分辨率图像一般选取分辨率大于2000的图像。然后将这些成对的原始分辨率图像和对应的下采样图像作为训练集。同样以验证集:训练集=2:8的比例,在不同的原始分辨率图像上按照上述方式制作验证集。
本实施例中,基于预设优化器并利用训练集和总损失函数对原始超分辨率模型进行训练,当训练次数到达预设迭代次数后则停止训练,以得到训练后的超分辨率模型。
其中,关于上述步骤S21、S22和S23更加具体的处理过程可以参考前述实施例中公开的相应内容,在此不再进行赘述。
可见,本申请实施例通过基于原始分辨率图像和对应的下采样图像构造用于训练原始超分辨率模型的训练集,然后确定预设迭代次数和预设优化器的超参数信息,然后基于预设迭代次数和预设优化器并利用训练集和总损失函数对原始超分辨率模型进行训练,以得到性能更好的超分辨率模型。
参见图3所示,本申请实施例公开了一种具体的超分辨率模型训练方法,相对于上一实施例,本实施例对技术方案作了进一步的说明和优化。具体包括:
步骤S31:获取对原始分辨率图像进行下采样后得到的下采样图像,并对下采样图像进行特征提取以得到初始特征图。
步骤S32:按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,将第一特征图和第二特征图分别输入多层感知机网络,得到与第一特征图对应的第一输出值和与第二特征图对应的第二输出值。
本实施例中,在得到第一特征图和第二特征图后,还需要将第一特征图和第二特征图输入至多层感知机网络(multilayer perceptron,即MLP)中,得到与第一特征图对应的第一输出值和与第二特征图对应的第二输出值。其中,本实施例中的多层感知机网络具体可以为5层结构。
当然,本实施例除了可以将第一特征图和第二特征图输入至多层感知机网络,还可以将第一特征图和第二特征图输入一个尺寸为1×1的卷积核中,得到与第一特征图对应的第一输出值和与第二特征图对应的第二输出值。上述多层感知机网络和1×1的卷积核都能实现不改变特征图的宽和高,只在通道上对图像进行降维处理,如此一来,能够减少参数量,降低对比损失函数计算的复杂度,并提升计算效率。
步骤S33:基于第一特征图和第二特征图以及第一输出值和第二输出值构建对比损失函数。
本实施例中,基于第一特征图和第二特征图以及第一输出值和第二输出值构建对比损失函数,可以理解的是,假设以N为一次训练所抓取的数据样本,则对N张初始特征图进行两次随机采样后,会得到2N张采样后的特征图。将第一特征图记为y
i、第二特征图记为y′
i,第一输出值记为z
i,第二输出值记为z′
i,那么对第一特征图和第二特征图进行对比损失计算的公式如下:
其中,contr表示对比度,L
contr表示对比损失函数;sim用于求余弦相似度,即归一化后的点积;t是超参数温度,默认取值为0.5;N为批量大小,即一次训练抓取的数据样本数量;y
i为第一特征图、y′
i为第二特征图,z
i为第一输出值,z′
i为第二输出值。
整个数据样本的对比损失函数的计算公式为:
其中,contr表示对比度;N为批量大小;y
i为第一特征图、y′
i为第二特征图。
步骤S34:利用预设上采样方法对初始特征图进行处理得到超分辨率图像,基于原始分辨率图像和超分辨率图像构建L1损失函数。
本实施中,L1损失函数的计算公式为:
L
img=||IHR-ISR||;
其中,L
img表示L1损失函数;IHR表示原始分辨率图像;ISR表示超分辨率图像;||*||表示范数。
步骤S35:为对比损失函数和L1损失函数分配相应的权重系数;利用权重系数分别对对比损失函数和L1损失函数进行相应的加权,以构建总损失函数,并利用总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
本实施例中,在利用对比损失函数和L1损失函数构建总损失函数时,需要为对比损失函数和L1损失函数分配相应的权重系数,并进行相应的加权计算以构建总损失函数。总损失函数的计算公式为:
loss=αL
img+(1-α)L
contr;
其中,loss表示总损失函数,α表示权重系数,本实施例中将α设为0.5;L
img表示L1损失函数;L
contr表示对比损失函数。
在另一种具体实施方式中,为了防止超分辨率模型过拟合,并提高超分辨率模型重建的稳定性,还可以在上述总损失函数的基础上,再增加一个L2权重衰减以形成新的总损失函数,并利用上述新的总损失函数对原始超分辨率模型进行训练。其中,本实施例 中的上述L2权重衰减的具体表达式可以是:
其中,w
i为第i个样本计算时模型的参数值,N为批量大小,λ为权重值,一般将λ取为0.1;那么在这种情况下,最后得到一个新的总损失函数为:
可见,本申请实施例在得到第一特征图和第二特征图后,再将第一特征图和第二特征图分别输入多层感知机网络,得到与第一特征图对应的第一输出值和与第二特征图对应的第二输出值,然后基于第一特征图和第二特征图以及第一输出值和第二输出值构建对比损失函数。并且,在构建总损失函数时,还需为对比损失函数和L1损失函数分配相应的权重系数,以得到加权计算后的总损失函数,以便利用该总损失函数对原始超分辨率模型进行训练,以得到性能更好的超分辨率模型。本申请通过引入对比损失函数,对模型在特征层进行监督,使得模型生成的图像在边缘处更加清晰锐化,能够让超分辨率模型达到更优的超分辨率效果。
参见图4所示,在本申请的某些实施例中,公开了一种图像超分辨率重建方法,该方法包括:
步骤S41:获取待重建低分辨率图像。
步骤S42:利用前述任一实施例公开的超分辨率模型训练方法训练得到的超分辨率模型对待重建低分辨率图像进行处理,以得到相应的超分辨率图像。
可见,本申请实施例中,首先获取待重建低分辨率图像,然后利用前述公开的超分辨率模型训练方法训练得到的超分辨率模型对待重建低分辨率图像进行处理,以得到相应的超分辨率图像。由此可见,本申请可以获取任意一张待重建的低分辨率图像,并利用本申请中的超分辨率模型进行处理,以实现图像的超分辨率,达到恢复图像质量的目的。
需要指出的是,本申请公开的这种基于对比学习构建对比损失函数的方法可以应用于任意的超分辨率模型中,以实现对超分辨率算法进行有效的提升,并提升图像恢复的质量。
应该理解的是,虽然图1-4的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图1-4中的至少 一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。
参见图5所示,在本申请的某些实施例中,还公开了一种超分辨率模型训练装置,该装置包括特征提取模块11、对比损失函数构建模块12、L1损失函数构建模块13及模型训练模块14,其中:
特征提取模块11,用于获取对原始分辨率图像进行下采样后得到的下采样图像,并对下采样图像进行特征提取以得到初始特征图;
对比损失函数构建模块12,用于按照预设采样比率对初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于第一特征图和第二特征图构建对比损失函数;
L1损失函数构建模块13,用于利用预设上采样方法对初始特征图进行处理得到超分辨率图像,基于原始分辨率图像和超分辨率图像构建L1损失函数;
模型训练模块14,用于基于对比损失函数和L1损失函数构建总损失函数,并利用总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
关于超分辨率模型训练装置的具体限定可以参见上文中对于分辨率模型训练方法的限定,在此不再赘述。上述超分辨率模型训练装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于电子设备中的处理器中,也可以以软件形式存储于电子设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
图6为本申请实施例提供的一种电子设备的结构示意图。具体可以包括:至少一个处理器21、至少一个存储器22、电源23、通信接口24、输入输出接口25和通信总线26。其中,存储器22用于存储计算机可读指令,计算机可读指令由处理器21加载并执行,以实现前述任一实施例公开的由计算机设备执行的超分辨率模型训练方法中的相关步骤,或者以实现前述任一实施例公开的由计算机设备执行的图像超分辨率重建方法。
本实施例中,电源23用于为计算机设备20上的各硬件设备提供工作电压;通信接口24能够为计算机设备20创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本申请技术方案的任意通信协议,在此不对其进行具体限定;输入输出接口25,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。
其中,处理器21可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器21可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器21也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central Processing Unit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器21可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器21还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。
另外,存储器22作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,其上所存储的资源包括操作系统221、计算机可读指令222及数据223等,存储方式可以是短暂存储或者永久存储。
其中,操作系统221用于管理与控制计算机设备20上的各硬件设备以及计算机可读指令222,以实现处理器21对存储器22中海量数据223的运算与处理,其可以是Windows、Unix、Linux等。计算机可读指令222除了包括能够用于完成前述任一实施例公开的由计算机设备20执行的超分辨率模型训练方法的计算机可读指令之外,还可以进一步包括能够用于完成其他特定工作的计算机可读指令。数据223除了可以包括计算机设备接收到的由外部设备传输进来的数据,也可以包括由自身输入输出接口25采集到的数据等。
进一步的,本申请实施例还公开了一种非易失性计算机可读存储介质,存储介质中存储有计算机可读指令,计算机可读指令被处理器加载并执行时,实现前述任一实施例公开的由超分辨率模型训练过程中执行的方法步骤,或者实现前述任一实施例公开的由计算机设备执行的图像超分辨率重建方法。
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条 件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上对本申请所提供的一种模型训练方法、超分辨率重建方法、装置、设备及介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。
Claims (20)
- 一种超分辨率模型训练方法,其特征在于,包括:获取对原始分辨率图像进行下采样后得到的下采样图像,并对所述下采样图像进行特征提取以得到初始特征图;按照预设采样比率对所述初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于所述第一特征图和所述第二特征图构建对比损失函数;利用预设上采样方法对所述初始特征图进行处理得到超分辨率图像,基于所述原始分辨率图像和所述超分辨率图像构建L1损失函数;及基于所述对比损失函数和所述L1损失函数构建总损失函数,并利用所述总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
- 根据权利要求1所述的超分辨率模型训练方法,其特征在于,所述利用所述总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型之前,还包括:按照预设下采样倍数对若干数量张原始分辨率图像进行下采样,以得到相应的下采样图像;及基于所述原始分辨率图像和所述下采样图像构造用于训练所述原始超分辨率模型的训练集,其中,所述训练集中的训练样本包含所述原始分辨率图像以及对应的所述下采样图像。
- 根据权利要求1或者2所述的超分辨率模型训练方法,其特征在于,所述利用所述总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型,包括:确定预设迭代次数和预设优化器的超参数信息;及基于所述预设迭代次数和所述预设优化器并利用所述训练集和所述总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
- 根据权利要求3所述的超分辨率模型训练方法,其特征在于,所述超参数信息包括学习率和批量大小。
- 根据权利要求4所述的超分辨率模型训练方法,其特征在于,所述预设优化器为Adam优化器、学习率为0.000和/或批量大小为16。
- 根据权利要求1至5任一项所述的超分辨率模型训练方法,其特征在于,所述基于所述第一特征图和所述第二特征图构建对比损失函数,包括:将所述第一特征图和所述第二特征图分别输入多层感知机网络,得到与所述第一特征图对应的第一输出值和与所述第二特征图对应的第二输出值;及基于所述第一特征图和所述第二特征图以及所述第一输出值和所述第二输出值构建对比损失函数。
- 根据权利要求1至5任一项所述的超分辨率模型训练方法,其特征在于,所述基于所述第一特征图和所述第二特征图构建对比损失函数,包括:将所述第一特征图和所述第二特征图分别输入1×1的卷积核,得到与所述第一特征图对应的第一输出值和与所述第二特征图对应的第二输出值;及基于所述第一特征图和所述第二特征图以及所述第一输出值和所述第二输出值构建对比损失函数。
- 根据权利要求8所述的超分辨率模型训练方法,其特征在于,所述L1损失函数的计算公式为:L img=||IHR-ISR||;其中,L img表示L1损失函数;IHR表示原始分辨率图像;ISR表示超分辨率图像;||*||表示范数。
- 根据权利要求1至9任一项所述的超分辨率模型训练方法,其特征在于,所述利用预设上采样方法对所述初始特征图进行处理得到超分辨率图像,包括:利用插值方法对所述初始特征图的像素点进行扩充,得到扩充后特征图;及将所述扩充后特征图输入至最后一层卷积层的滤波器数量为三的卷积神经网络,以便通过所述卷积神经网络对所述扩充后特征图进行处理以降低所述扩充后特征图的通道 数,得到通道数为三的超分辨率图像。
- 根据权利要求1至10任一项所述的超分辨率模型训练方法,其特征在于,所述基于所述对比损失函数和所述L1损失函数构建总损失函数,包括:为所述对比损失函数和所述L1损失函数分配相应的权重系数;及利用所述权重系数分别对所述对比损失函数和所述L1损失函数进行相应的加权,以构建总损失函数。
- 根据权利要求11所述的超分辨率模型训练方法,其特征在于,所述基于所述对比损失函数和所述L1损失函数构建总损失函数,还包括:在所述总损失函数上增加一个L2权重衰减,得到新的总损失函数,所述新的总损失函数用于对原始超分辨率模型进行训练。
- 根据权利要求1至13任一项所述的超分辨率模型训练方法,其特征在于,所述获取对原始分辨率图像进行下采样后得到的下采样图像,包括:利用MATLAB中的resize函数对原始分辨率图像下采样,获得所述原始分辨率图像对应的下采样图像。
- 根据权利要求1至14任一项所述的超分辨率模型训练方法,其特征在于,所述初始特征图与所述下采样图像的图像大小一致。
- 根据权利要求1至15任一项所述的超分辨率模型训练方法,其特征在于,在进行超分辨率模型训练时,将所述第二特征图作为所述第一特征图的正样本,并将其他不同初始特征图进行随机采样得到的图像则作为所述第一特征图的负样本。
- 一种图像超分辨率重建方法,其特征在于,包括:获取待重建低分辨率图像;利用如权利要求1至16任一项所述的超分辨率模型训练方法训练得到的超分辨率模型对所述待重建低分辨率图像进行处理,以得到相应的超分辨率图像。
- 一种超分辨率模型训练装置,其特征在于,包括:特征提取模块,用于获取对原始分辨率图像进行下采样后得到的下采样图像,并对 所述下采样图像进行特征提取以得到初始特征图;对比损失函数构建模块,用于按照预设采样比率对所述初始特征图进行两次随机采样,分别得到第一特征图和第二特征图,基于所述第一特征图和所述第二特征图构建对比损失函数;L1损失函数构建模块,用于利用预设上采样方法对所述初始特征图进行处理得到超分辨率图像,基于所述原始分辨率图像和所述超分辨率图像构建L1损失函数;及模型训练模块,用于基于所述对比损失函数和所述L1损失函数构建总损失函数,并利用所述总损失函数对原始超分辨率模型进行训练,以得到训练后的超分辨率模型。
- 一种电子设备,其特征在于,包括:存储器,用于保存计算机可读指令;及至少一个处理器,用于执行所述计算机可读指令,以实现如权利要求1至16任一项所述的超分辨率模型训练方法的步骤,或者以实现如权利要求17所述的图像超分辨率重建方法的步骤。
- 一种非易失性计算机可读存储介质,其特征在于,用于存储计算机可读指令;其中,所述计算机可读指令被处理器执行时实现如权利要求1至16任一项所述的超分辨率模型训练方法的步骤,或者实现如权利要求17所述的图像超分辨率重建方法的步骤。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210332655.3A CN114494022B (zh) | 2022-03-31 | 2022-03-31 | 模型训练方法、超分辨率重建方法、装置、设备及介质 |
CN202210332655.3 | 2022-03-31 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023184913A1 true WO2023184913A1 (zh) | 2023-10-05 |
Family
ID=81487716
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/122864 WO2023184913A1 (zh) | 2022-03-31 | 2022-09-29 | 模型训练方法、超分辨率重建方法、装置、设备及介质 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN114494022B (zh) |
WO (1) | WO2023184913A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118552410A (zh) * | 2024-07-29 | 2024-08-27 | 中国人民解放军国防科技大学 | 一种海面高度的超分辨率重构方法、装置、设备及介质 |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114494022B (zh) * | 2022-03-31 | 2022-07-29 | 苏州浪潮智能科技有限公司 | 模型训练方法、超分辨率重建方法、装置、设备及介质 |
US20240046527A1 (en) * | 2022-08-02 | 2024-02-08 | Alibaba Singapore Holding Private Limited | End-to-end optimization of adaptive spatial resampling towards machine vision |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111062872A (zh) * | 2019-12-17 | 2020-04-24 | 暨南大学 | 一种基于边缘检测的图像超分辨率重建方法及系统 |
CN111626932A (zh) * | 2020-05-07 | 2020-09-04 | Tcl华星光电技术有限公司 | 图像的超分辨率重建方法及装置 |
CN112734643A (zh) * | 2021-01-15 | 2021-04-30 | 重庆邮电大学 | 一种基于级联网络的轻量图像超分辨率重建方法 |
CN113129231A (zh) * | 2021-04-07 | 2021-07-16 | 中国科学院计算技术研究所 | 一种基于对抗生成网络生成高清图像的方法及系统 |
US20210407042A1 (en) * | 2018-11-16 | 2021-12-30 | Google Llc | Generating super-resolution images using neural networks |
CN114494022A (zh) * | 2022-03-31 | 2022-05-13 | 苏州浪潮智能科技有限公司 | 模型训练方法、超分辨率重建方法、装置、设备及介质 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110717851B (zh) * | 2019-10-18 | 2023-10-27 | 京东方科技集团股份有限公司 | 图像处理方法及装置、神经网络的训练方法、存储介质 |
CN110992270A (zh) * | 2019-12-19 | 2020-04-10 | 西南石油大学 | 基于注意力的多尺度残差注意网络图像超分辨率重建方法 |
CN112529150B (zh) * | 2020-12-01 | 2024-06-14 | 华为技术有限公司 | 一种模型结构、模型训练方法、图像增强方法及设备 |
-
2022
- 2022-03-31 CN CN202210332655.3A patent/CN114494022B/zh active Active
- 2022-09-29 WO PCT/CN2022/122864 patent/WO2023184913A1/zh unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20210407042A1 (en) * | 2018-11-16 | 2021-12-30 | Google Llc | Generating super-resolution images using neural networks |
CN111062872A (zh) * | 2019-12-17 | 2020-04-24 | 暨南大学 | 一种基于边缘检测的图像超分辨率重建方法及系统 |
CN111626932A (zh) * | 2020-05-07 | 2020-09-04 | Tcl华星光电技术有限公司 | 图像的超分辨率重建方法及装置 |
CN112734643A (zh) * | 2021-01-15 | 2021-04-30 | 重庆邮电大学 | 一种基于级联网络的轻量图像超分辨率重建方法 |
CN113129231A (zh) * | 2021-04-07 | 2021-07-16 | 中国科学院计算技术研究所 | 一种基于对抗生成网络生成高清图像的方法及系统 |
CN114494022A (zh) * | 2022-03-31 | 2022-05-13 | 苏州浪潮智能科技有限公司 | 模型训练方法、超分辨率重建方法、装置、设备及介质 |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118552410A (zh) * | 2024-07-29 | 2024-08-27 | 中国人民解放军国防科技大学 | 一种海面高度的超分辨率重构方法、装置、设备及介质 |
Also Published As
Publication number | Publication date |
---|---|
CN114494022A (zh) | 2022-05-13 |
CN114494022B (zh) | 2022-07-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2023184913A1 (zh) | 模型训练方法、超分辨率重建方法、装置、设备及介质 | |
CN111369440B (zh) | 模型训练、图像超分辨处理方法、装置、终端及存储介质 | |
CN110570356B (zh) | 图像处理方法和装置、电子设备及存储介质 | |
CN111105352A (zh) | 超分辨率图像重构方法、系统、计算机设备及存储介质 | |
CN104899835B (zh) | 基于盲模糊估计与锚定空间映射的图像超分辨处理方法 | |
EP4172927A1 (en) | Image super-resolution reconstructing | |
US20220286696A1 (en) | Image compression method and apparatus | |
WO2022042124A1 (zh) | 超分辨率图像重建方法、装置、计算机设备和存储介质 | |
CN112132959A (zh) | 数字岩心图像处理方法、装置、计算机设备及存储介质 | |
KR20210045828A (ko) | 영상 처리 장치 및 방법 | |
US12118692B2 (en) | Image super-resolution | |
Wei et al. | Improving resolution of medical images with deep dense convolutional neural network | |
US11871145B2 (en) | Optimization of adaptive convolutions for video frame interpolation | |
CN117651965A (zh) | 使用神经网络的高清图像操作方法和系统 | |
CN112907448A (zh) | 一种任意比率图像超分辨率方法、系统、设备及存储介质 | |
CN114862679A (zh) | 基于残差生成对抗网络的单图超分辨率重建方法 | |
US20240155071A1 (en) | Text to video generation | |
WO2023179385A1 (zh) | 一种视频超分方法、装置、设备及存储介质 | |
CN116664409B (zh) | 图像超分辨率重建方法、装置、计算机设备及存储介质 | |
WO2020187042A1 (zh) | 图像处理方法、装置、设备以及计算机可读介质 | |
WO2024032331A9 (zh) | 图像处理方法及装置、电子设备、存储介质 | |
WO2019090876A1 (zh) | 一种基于直线扩展收缩模式的图像缩放方法 | |
CN114008661A (zh) | 图像处理方法、装置及其计算机程序产品 | |
WO2021218414A1 (zh) | 视频增强方法及装置、电子设备、存储介质 | |
WO2022155990A1 (zh) | 一种基于自监督学习的视频盲超分辨率重建方法及系统 |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22934731 Country of ref document: EP Kind code of ref document: A1 |