CN114627035A - Multi-focus image fusion method, system, device and storage medium - Google Patents

Multi-focus image fusion method, system, device and storage medium Download PDF

Info

Publication number
CN114627035A
CN114627035A CN202210116063.8A CN202210116063A CN114627035A CN 114627035 A CN114627035 A CN 114627035A CN 202210116063 A CN202210116063 A CN 202210116063A CN 114627035 A CN114627035 A CN 114627035A
Authority
CN
China
Prior art keywords
fusion
image
network model
focus image
focus
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210116063.8A
Other languages
Chinese (zh)
Other versions
CN114627035B (en
Inventor
尹海涛
周伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nanjing University of Posts and Telecommunications
Original Assignee
Nanjing University of Posts and Telecommunications
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nanjing University of Posts and Telecommunications filed Critical Nanjing University of Posts and Telecommunications
Priority to CN202210116063.8A priority Critical patent/CN114627035B/en
Publication of CN114627035A publication Critical patent/CN114627035A/en
Application granted granted Critical
Publication of CN114627035B publication Critical patent/CN114627035B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Evolutionary Computation (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Computational Linguistics (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

本发明公开了一种多聚焦图像融合方法、系统、装置及存储介质,属于多聚焦图像融合技术领域,所述方法包括:获取待融合的多聚焦图像;将多聚焦图像输入预训练好的融合网络模型中进行融合,得到融合图像;所述融合网络模型通过以下方法构建:利用空洞卷积网络和基于注意力机制的密集卷积神经网络构建融合网络模型;解决现有技术中对源图像特征提取单一且不能有效突出显著特征的重要性的缺陷,实现在多聚焦图像融合时保留丰富的细节信息,融合得到的融合图像视觉质量较优。

Figure 202210116063

The invention discloses a multi-focus image fusion method, system, device and storage medium, belonging to the technical field of multi-focus image fusion. The method includes: acquiring a multi-focus image to be fused; inputting the multi-focus image into a pre-trained fusion Fusion is performed in the network model to obtain a fusion image; the fusion network model is constructed by the following methods: constructing a fusion network model by using an atrous convolutional network and a dense convolutional neural network based on an attention mechanism; Extracting a single defect that cannot effectively highlight the importance of salient features, realizes the preservation of rich detail information during multi-focus image fusion, and the fusion image obtained by fusion has better visual quality.

Figure 202210116063

Description

一种多聚焦图像融合方法、系统、装置及存储介质A multi-focus image fusion method, system, device and storage medium

技术领域technical field

本发明涉及一种多聚焦图像融合方法、系统、装置及存储介质,属于多聚焦图像融合技术领域。The invention relates to a multi-focus image fusion method, system, device and storage medium, and belongs to the technical field of multi-focus image fusion.

背景技术Background technique

在数字图像采集过程中,由于光学传感器镜头景深的限制,相机系统成像时对于全景深图像获取难度较大,经常出现景深范围内景物清晰,景深范围外景物模糊的问题;然而,部分不清晰的区域不利于后续的图像理解与应用,同时还可能造成一定的误差。多聚焦图像融合技术能有效地解决这一问题,将具有不同聚焦区域的同目标场景图像互补结合,有效解决全场景清晰成像问题,使其在同一张图像上包含更丰富的信息,达到实际使用的要求;目前,多聚焦图像融合技术已经在机器视觉、遥感监测和军事医学等领域发挥着至关重要的作用。In the process of digital image acquisition, due to the limitation of the depth of field of the optical sensor lens, it is difficult for the camera system to obtain panoramic depth images during imaging, and the problem that the scene within the depth of field is clear and the scene outside the depth of field is blurred often occurs. The region is not conducive to subsequent image understanding and application, and may also cause certain errors. The multi-focus image fusion technology can effectively solve this problem. It combines complementary images of the same target scene with different focus areas to effectively solve the problem of clear imaging of the whole scene, so that it contains more information on the same image and achieves practical use. At present, multi-focus image fusion technology has played a vital role in the fields of machine vision, remote sensing monitoring and military medicine.

现有多聚焦图像融合技术主要可分为变换域方法、空间域方法和深度学习方法。变换域方法通常先将原始图像分解成不同的变换系数,然后通过相应的融合规则将这些变换系数作融合,最终将融合好的系数做逆变换获得融合图像;空间域方法则直接对源图像的像素或区域进行融合操作,提取聚焦区域中的清晰像素;但是变换域方法和空间域方法都需要人工设计显著信息的活跃水平度量以及融合规则,一定程度上限制了融合算法的普适性;近年来,由于深度学习强大的特征提取与数据表征能力,基于深度学习的多聚焦图像融合技术也随之流行起来;目前大多数基于深度学习的多聚焦图像融合技术关键在于利用卷积神经网络从多聚焦源图像中系统准确地检测出聚焦区域,然后融合来自不同源图像的聚焦区域生成全场景清晰图像;与传统多聚焦图像融合技术相比,基于深度学习的多聚焦图像融合技术在一定程度上提高了融合质量,但仍存在一些局限性,主要体现在:1.对源图像的特征提取尺度单一;2.不能有效地突出显著特征的重要性。Existing multi-focus image fusion techniques can be mainly divided into transform domain methods, spatial domain methods and deep learning methods. The transform domain method usually decomposes the original image into different transform coefficients, and then fuses these transform coefficients through the corresponding fusion rules, and finally inversely transforms the fused coefficients to obtain a fused image; the spatial domain method directly converts the source image. Pixels or regions are fused to extract clear pixels in the focal region; however, both the transform domain method and the spatial domain method need to manually design the activity level measurement of significant information and the fusion rules, which limits the universality of the fusion algorithm to a certain extent; Due to the powerful feature extraction and data representation capabilities of deep learning, multi-focus image fusion technology based on deep learning has also become popular; most of the current deep learning-based multi-focus image fusion technology The key is to use convolutional neural networks to The system accurately detects the focus area in the focus source image, and then fuses the focus areas from different source images to generate a clear image of the whole scene; compared with the traditional multi-focus image fusion technology, the multi-focus image fusion technology based on deep learning can achieve a certain The fusion quality is improved, but there are still some limitations, which are mainly reflected in: 1. The feature extraction scale of the source image is single; 2. The importance of salient features cannot be effectively highlighted.

发明内容SUMMARY OF THE INVENTION

本发明的目的在于提供一种多聚焦图像融合方法、系统、装置及存储介质,解决现有技术中对源图像特征提取单一且不能有效突出显著特征的重要性的缺陷,实现在多聚焦图像融合时保留丰富的细节信息,融合得到的融合图像视觉质量较优。The purpose of the present invention is to provide a multi-focus image fusion method, system, device and storage medium, which solves the defect in the prior art that the source image feature extraction is single and cannot effectively highlight the importance of salient features, and realizes multi-focus image fusion. While retaining rich detail information, the visual quality of the fusion image obtained by fusion is better.

为实现以上目的,本发明是采用下述技术方案实现的:To achieve the above object, the present invention adopts the following technical solutions to realize:

第一方面,本发明提供了一种多聚焦图像融合方法,包括:In a first aspect, the present invention provides a multi-focus image fusion method, including:

获取待融合的多聚焦图像;Obtain the multi-focus image to be fused;

将多聚焦图像输入预训练好的融合网络模型中进行融合,得到融合图像;Input the multi-focus image into the pre-trained fusion network model for fusion to obtain the fusion image;

所述融合网络模型通过以下方法构建:利用空洞卷积网络和基于注意力机制的密集卷积神经网络构建融合网络模型。The fusion network model is constructed by the following method: constructing a fusion network model by using an atrous convolutional network and a dense convolutional neural network based on an attention mechanism.

结合第一方面,进一步的,还包括建立训练数据集的步骤,包括:In combination with the first aspect, further, it also includes the steps of establishing a training data set, including:

从公共数据集MS-COCO中提取图像,将其尺寸剪裁成统一尺寸,得到标签图像,由标签图像组成训练数据集。Images are extracted from the public dataset MS-COCO, and their size is cropped to a uniform size to obtain labeled images, which form a training dataset.

结合第一方面,进一步的,还包括对所述训练数据集进行预处理的步骤,包括:In combination with the first aspect, further, it also includes the step of preprocessing the training data set, including:

对训练数据集中的标签图像做不同区域的高斯模糊处理。Gaussian blurring different regions of the label images in the training dataset.

结合第一方面,进一步的,还包括设置所述融合网络模型的损失函数的步骤,包括:In combination with the first aspect, it further includes the step of setting the loss function of the fusion network model, including:

设置如下的损失函数:Set the following loss function:

L=Lmse+αLssim+βLper L=L mse + αL ssim + βL per

Lssim=1-SSIM(O,T)L ssim =1-SSIM(O,T)

Figure BDA0003494906340000031
Figure BDA0003494906340000031

其中,L是损失函数,Lmse是均方损失函数,Lssim是结构相似度损失函数,Lper是感知损失函数,α和β是平衡参数,O是融合图像,T是标签图像,SSIM(O,T)表示O和T之间的结构相似性,

Figure BDA0003494906340000032
表示融合图像通过VGG16提取的特征图第i通道中坐标为(x,y)的像素值,
Figure BDA0003494906340000033
表示标签图像通过VGG16提取的特征图第i通道中坐标为(x,y)的像素值,Cf、Hf和Wf分别表示任意特征图的通道数、高度和宽度。where L is the loss function, L mse is the mean square loss function, L ssim is the structural similarity loss function, L per is the perceptual loss function, α and β are the balance parameters, O is the fusion image, T is the label image, SSIM ( O,T) represents the structural similarity between O and T,
Figure BDA0003494906340000032
Indicates the pixel value with coordinates (x, y) in the i-th channel of the feature map extracted by VGG16 of the fusion image,
Figure BDA0003494906340000033
Represents the pixel value with coordinates (x, y) in the i-th channel of the feature map extracted by VGG16 from the label image, and C f , H f and W f represent the channel number, height and width of any feature map, respectively.

结合第一方面,进一步的,所述融合网络模型通过以下方法进行训练:In combination with the first aspect, further, the fusion network model is trained by the following methods:

在Pytorch中利用构造好的训练数据集对融合网络模型进行训练,训练过程中批的大小设为8。The fusion network model is trained using the constructed training data set in Pytorch, and the batch size is set to 8 during the training process.

结合第一方面,进一步的,还包括优化融合网络模型的参数的步骤,包括:In combination with the first aspect, further, it also includes the steps of optimizing the parameters of the fusion network model, including:

采用Adam优化器对融合网络模型的参数进行优化,其中Adam优化器的初始学习率设为0.001。The parameters of the fusion network model are optimized by the Adam optimizer, where the initial learning rate of the Adam optimizer is set to 0.001.

第二方面,本发明还提供了一种多聚焦图像融合系统,包括:In a second aspect, the present invention also provides a multi-focus image fusion system, including:

获取模块:用于获取待融合的多聚焦图像;Acquisition module: used to acquire the multi-focus image to be fused;

融合模块:用于将多聚焦图像输入预训练好的融合网络模型中进行融合,得到融合图像。Fusion module: It is used to input the multi-focus image into the pre-trained fusion network model for fusion to obtain a fusion image.

第三方面,本发明还提供了一种多聚焦图像融合装置,包括处理器及存储介质;In a third aspect, the present invention also provides a multi-focus image fusion device, including a processor and a storage medium;

所述存储介质用于存储指令;the storage medium is used for storing instructions;

所述处理器用于根据所述指令进行操作以执行根据第一方面任一项所述方法的步骤。The processor is adapted to operate in accordance with the instructions to perform the steps of the method according to any one of the first aspects.

第四方面,本发明还提供了计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现第一方面任一项所述方法的步骤。In a fourth aspect, the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the steps of any one of the methods in the first aspect.

与现有技术相比,本发明所达到的有益效果是:Compared with the prior art, the beneficial effects achieved by the present invention are:

本发明提供的一种多聚焦图像融合方法、系统、装置及存储介质,将多聚焦图像输入预训练好的融合网络模型中进行融合,得到融合图像,实现多聚焦图像的融合;其中空洞卷积网络通过增大扩张率来扩大感受野,进而更加全面地提取源图像(待融合的多聚焦图像)中的多尺度特征;密集卷积神经网络能够有效解决深层网络的梯度消失问题,同时为了进一步突出显著特征的重要性,在密集卷积神经网络中引入了注意力机制,自适应地选择显著性特征,从而提高融合性能;综上所述,本发明方案在融合多聚焦图像时能够保留丰富的细节信息,融合得到的融合图像视觉质量较优。The invention provides a multi-focus image fusion method, system, device and storage medium. The multi-focus image is input into a pre-trained fusion network model for fusion to obtain a fusion image, and the fusion of the multi-focus image is realized; wherein the hole convolution The network expands the receptive field by increasing the expansion rate, and then extracts the multi-scale features in the source image (the multi-focus image to be fused) more comprehensively; the dense convolutional neural network can effectively solve the gradient disappearance problem of the deep network, and in order to further Highlighting the importance of salient features, an attention mechanism is introduced into the dense convolutional neural network to adaptively select salient features, thereby improving the fusion performance; in summary, the solution of the present invention can retain richness when fusing multi-focus images The visual quality of the fusion image obtained by fusion is better.

附图说明Description of drawings

图1是本发明实施例提供的一种多聚焦图像融合方法的流程图之一;1 is one of the flowcharts of a multi-focus image fusion method provided by an embodiment of the present invention;

图2是本发明实施例提供的融合网络模型的结构示意图;2 is a schematic structural diagram of a fusion network model provided by an embodiment of the present invention;

图3是本发明实施例提供的一种多聚焦图像融合方法的流程图之二。FIG. 3 is the second flowchart of a multi-focus image fusion method provided by an embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图对本发明作进一步描述,以下实施例仅用于更加清楚地说明本发明的技术方案,而不能以此来限制本发明的保护范围。The present invention will be further described below with reference to the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention, and cannot be used to limit the protection scope of the present invention.

实施例1Example 1

如图1所示,本发明实施例提供的一种多聚焦图像融合方法,包括:As shown in FIG. 1, a multi-focus image fusion method provided by an embodiment of the present invention includes:

S1、获取待融合的多聚焦图像。S1. Acquire a multi-focus image to be fused.

获取有部分不清晰的多聚焦图像,用于后续的融合。Acquire a partially blurred multi-focus image for subsequent fusion.

S2、将多聚焦图像输入预训练好的融合网络模型中进行融合,得到融合图像。S2. Input the multi-focus image into the pre-trained fusion network model for fusion to obtain a fusion image.

构造训练数据集:基于公共数据集MS-COCO构造带有标签的训练数据集(多聚焦图像数据集)。Construct training dataset: Construct a labeled training dataset (multi-focus image dataset) based on the public dataset MS-COCO.

在实际应用中,很难获得多聚焦图像及其配对的全景深图像,为此本发明构建了一组模拟的多聚焦图像数据集(即训练数据集)。In practical applications, it is difficult to obtain multi-focus images and their paired panoramic deep images, for which the present invention constructs a set of simulated multi-focus image datasets (ie, training datasets).

选取公共数据集MS-COCO中8000张高清自然图像,将其尺寸统一剪裁为128×128然后作为标签图像。Select 8000 high-definition natural images in the public dataset MS-COCO, uniformly crop them to 128×128 and use them as label images.

对训练数据集进行预处理:对标签图像做不同区域的高斯模糊处理,具体的可以是对标签图像做互补区域的高斯模糊处理。Preprocess the training data set: perform Gaussian blurring on the label image in different regions, specifically, do Gaussian blurring on the complementary region of the label image.

为了模拟不同景深产生的不同程度模糊,本发明将选取的8000张标签图像平均分成4组,分别采用高斯模糊半径为2、4、6和8的高斯模糊进行模糊处理。In order to simulate different degrees of blur caused by different depths of field, the present invention divides the selected 8000 label images into 4 groups on average, and uses Gaussian blur with Gaussian blur radius of 2, 4, 6 and 8 for blurring processing.

利用空洞卷积网络、卷积层和基于注意力机制的密集卷积神经网络构建融合网络模型。Construct a fusion network model using atrous convolutional networks, convolutional layers, and attention-based dense convolutional neural networks.

如图2所示,该融合网络模型包括三个部分,分别是特征提取(Featureextraction)、特征融合(Feature fusion)和图像重建(Image reconstruction)。As shown in Figure 2, the fusion network model includes three parts, namely feature extraction, feature fusion and image reconstruction.

特征提取部分包括两个网络分支,两个网络分支共享权重,每条网络分支由1个多分支并行的空洞卷积网络、1个1×1卷积层和1个含注意力机制的密集卷积神经网络构成。The feature extraction part includes two network branches, the two network branches share weights, each network branch consists of a multi-branch parallel atrous convolutional network, a 1×1 convolutional layer and a dense volume with an attention mechanism Constructed neural network.

多分支并行的空洞卷积网络的特征通道设为192,且该网络由3个卷积核大小为3×3、扩张率分别为1、2和3的空洞卷积构成。The feature channel of the multi-branch parallel atrous convolutional network is set to 192, and the network consists of three atrous convolutions with kernel size of 3×3 and dilation rate of 1, 2 and 3, respectively.

含注意力机制的密集卷积神经网络的输入通道和输出通道分别为64和256,由1个密集块和3个Squeeze-Excitation-Block组成,其中密集块包含3个3×3卷积层,每层的输出级联为下一层的输入。The input channels and output channels of the dense convolutional neural network with attention mechanism are 64 and 256, respectively, and consist of 1 dense block and 3 Squeeze-Excitation-Block, where the dense block contains 3 3×3 convolutional layers, The output of each layer is cascaded as the input to the next layer.

1×1卷积层用于调整特征通道的维度。A 1×1 convolutional layer is used to adjust the dimension of feature channels.

特征融合部分由“拼接”操作和1个1×1卷积层组成,主要实现特征的融合。The feature fusion part consists of a "splicing" operation and a 1×1 convolutional layer, which mainly realizes feature fusion.

特征融合部分将特征提取部分得到的多聚焦图像的特征进行“拼接”和1×1卷积操作,实现特征融合得到融合特征,其中,1×1卷积层的输入通道和输出通道分别为512和64。The feature fusion part performs "splicing" and 1 × 1 convolution operations on the features of the multi-focus image obtained by the feature extraction part to achieve feature fusion to obtain fusion features, where the input channel and output channel of the 1 × 1 convolution layer are 512 and 64.

图像重建部分主要将融合特征生成融合图像,该部分由4个3×3卷积层组成,特征通道数分别为64、64、64和3;除最后一层外的每个卷积层都采用ReLU作为激活函数。The image reconstruction part mainly generates the fusion image from the fusion features. This part consists of 4 3×3 convolutional layers, and the number of feature channels is 64, 64, 64 and 3 respectively; each convolutional layer except the last layer adopts ReLU as activation function.

为使重建的图像更加准确,设置上述融合网络模型的损失函数,设置如下的损失函数:In order to make the reconstructed image more accurate, set the loss function of the above fusion network model, and set the following loss function:

L=Lmse+αLssim+βLper L=L mse + αL ssim + βL per

Lssim=1-SSIM(O,T)L ssim =1-SSIM(O,T)

Figure BDA0003494906340000061
Figure BDA0003494906340000061

其中,L是损失函数,Lmse是均方损失函数,Lssim是结构相似度损失函数,Lper是感知损失函数,α和β是平衡参数,O是融合图像,T是标签图像,SSIM(O,T)表示O和T之间的结构相似性,

Figure BDA0003494906340000071
表示融合图像通过VGG16提取的特征图第i通道中坐标为(x,y)的像素值,
Figure BDA0003494906340000072
表示标签图像通过VGG16提取的特征图第i通道中坐标为(x,y)的像素值,Cf、Hf和Wf分别表示任意特征图的通道数、高度和宽度。where L is the loss function, L mse is the mean square loss function, L ssim is the structural similarity loss function, L per is the perceptual loss function, α and β are the balance parameters, O is the fusion image, T is the label image, SSIM ( O,T) represents the structural similarity between O and T,
Figure BDA0003494906340000071
Indicates the pixel value with coordinates (x, y) in the i-th channel of the feature map extracted by VGG16 of the fusion image,
Figure BDA0003494906340000072
Represents the pixel value with coordinates (x, y) in the i-th channel of the feature map extracted by VGG16 from the label image, and C f , H f and W f represent the channel number, height and width of any feature map, respectively.

在本实施例中,α和β均为0.5。In this embodiment, both α and β are 0.5.

利用构造好的训练数据集对融合网络模型进行训练,在训练过程中,融合网络模型的超参数包括批大小(Batch size)、初始学习率(Learning rate)、迭代次数(epoch)、学习率衰减策略。The fusion network model is trained using the constructed training data set. During the training process, the hyperparameters of the fusion network model include batch size, initial learning rate, number of iterations (epoch), and learning rate decay. Strategy.

在本实施例中,采用Pytorch(一个基于python的科学计算库)来实现融合网络模型的训练,程序运行环境为RTX 3080/10GB RAM,Intel Core i7-10700K@3.80GHz。In this embodiment, Pytorch (a scientific computing library based on python) is used to implement the training of the fusion network model, and the program running environment is RTX 3080/10GB RAM, Intel Core i7-10700K@3.80GHz.

训练过程中的批的大小设为8,采用Adam优化器对参数进行优化,优化器的初始学习率设为0.001,并采用余弦退火衰减方式调整学习率,网络共计训练500epoch。The batch size in the training process is set to 8, the parameters are optimized by the Adam optimizer, the initial learning rate of the optimizer is set to 0.001, and the cosine annealing decay method is used to adjust the learning rate, and the network is trained for a total of 500 epochs.

将多聚焦图像输入预训练好的融合网络模型中进行融合,即可得到融合图像。The fusion image can be obtained by inputting the multi-focus image into the pre-trained fusion network model for fusion.

为证明本发明所提融合技术的有效性,选取了8种主流的多聚焦图像融合方法在Lytro多聚焦彩色图像数据集和本发明进行比较,分别为NSCT方法、SR方法、IMF方法、MWGF方法、CNN方法、DeepFuse方法、DenseFuse方法(包括DenseFuse-ADD方法和DenseFuse-L1方法)和IFCNN-MAX方法。所有对比方法均使用文献中提供的默认参数进行测试。In order to prove the effectiveness of the fusion technology proposed in the present invention, 8 mainstream multi-focus image fusion methods were selected to compare the Lytro multi-focus color image data set with the present invention, namely the NSCT method, the SR method, the IMF method, and the MWGF method. , CNN method, DeepFuse method, DenseFuse method (including DenseFuse-ADD method and DenseFuse-L1 method) and IFCNN-MAX method. All comparative methods were tested using default parameters provided in the literature.

本实施例中采用了四种客观指标作为量化指标,分别为平均梯度(AG)、空间频率(SF)、视觉信息保真度(VIF)和边缘保持度(QAB/F),表1为Lytro数据集上的平均指标值;从表1中可以看出,本发明在在AG、SF和VIF这三项指标上获得最优结果,对于QAB/F指标,也获得了仅次于CNN方法的次优结果;从结果来看,本发明是一种可行且高效的多聚焦图像融合方法。In this embodiment, four objective indicators are used as quantitative indicators, namely, average gradient (AG), spatial frequency (SF), visual information fidelity (VIF) and edge retention (Q AB/F ). Table 1 shows The average index value on the Lytro data set; as can be seen from Table 1, the present invention obtains the best results on the three indexes of AG, SF and VIF, and also obtains the second best result after the CNN for the Q AB/F index Suboptimal results of the method; from the results, the present invention is a feasible and efficient multi-focus image fusion method.

表1 Lytro数据集上的平均指标值Table 1 Average metric values on the Lytro dataset

Figure BDA0003494906340000081
Figure BDA0003494906340000081

实施例2Example 2

本发明实施例提供的一种多聚焦图像融合系统,包括:A multi-focus image fusion system provided by an embodiment of the present invention includes:

获取模块:用于获取待融合的多聚焦图像;Acquisition module: used to acquire the multi-focus image to be fused;

融合模块:用于将多聚焦图像输入预训练好的融合网络模型中进行融合,得到融合图像。Fusion module: It is used to input the multi-focus image into the pre-trained fusion network model for fusion to obtain a fusion image.

所述融合网络模型通过以下方法构建:利用空洞卷积网络和基于注意力机制的密集卷积神经网络构建融合网络模型。The fusion network model is constructed by the following method: constructing a fusion network model by using an atrous convolutional network and a dense convolutional neural network based on an attention mechanism.

实施例3Example 3

本发明实施例提供的一种多聚焦图像融合装置,包括处理器及存储介质;A multi-focus image fusion device provided by an embodiment of the present invention includes a processor and a storage medium;

所述存储介质用于存储指令;the storage medium is used for storing instructions;

所述处理器用于根据所述指令进行操作以执行下述方法的步骤:The processor is configured to operate in accordance with the instructions to perform the steps of the following methods:

获取待融合的多聚焦图像;Obtain the multi-focus image to be fused;

将多聚焦图像输入预训练好的融合网络模型中进行融合,得到融合图像。The multi-focus image is input into the pre-trained fusion network model for fusion, and the fusion image is obtained.

所述融合网络模型通过以下方法构建:利用空洞卷积网络和基于注意力机制的密集卷积神经网络构建融合网络模型。The fusion network model is constructed by the following method: constructing a fusion network model by using an atrous convolutional network and a dense convolutional neural network based on an attention mechanism.

实施例4Example 4

本发明实施例提供的计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现下述方法的步骤:The computer-readable storage medium provided by the embodiment of the present invention stores a computer program on it, and when the program is executed by a processor, implements the steps of the following method:

获取待融合的多聚焦图像;Obtain the multi-focus image to be fused;

将多聚焦图像输入预训练好的融合网络模型中进行融合,得到融合图像。The multi-focus image is input into the pre-trained fusion network model for fusion, and the fusion image is obtained.

所述融合网络模型通过以下方法构建:利用空洞卷积网络和基于注意力机制的密集卷积神经网络构建融合网络模型。The fusion network model is constructed by the following method: constructing a fusion network model by using an atrous convolutional network and a dense convolutional neural network based on an attention mechanism.

实施例5Example 5

如图3所示,本发明实施例提供的一种多聚焦图像融合方法,包括:As shown in FIG. 3 , a multi-focus image fusion method provided by an embodiment of the present invention includes:

S1、构造训练数据集,并对所述训练数据集进行预处理。S1. Construct a training data set, and preprocess the training data set.

S2、利用注意力机制和密集卷积神经网络构建融合网络模型。S2. Use the attention mechanism and dense convolutional neural network to build a fusion network model.

S3、设置所述融合网络模型的损失函数,并对网络参数进行优化。S3. Set the loss function of the fusion network model, and optimize the network parameters.

S4、利用所述训练数据集对融合网络模型进行训练,得到训练好的融合网络模型。S4, using the training data set to train the fusion network model to obtain a trained fusion network model.

S5、获取待融合的多聚焦图像,将多聚焦图像输入训练好的融合网络模型中,得到融合图像。S5. Obtain the multi-focus image to be fused, and input the multi-focus image into the trained fusion network model to obtain a fusion image.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。As will be appreciated by those skilled in the art, the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block in the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to the processor of a general purpose computer, special purpose computer, embedded processor or other programmable data processing device to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing device produce Means for implementing the functions specified in a flow or flow of a flowchart and/or a block or blocks of a block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions The apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing device to cause a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process such that The instructions provide steps for implementing the functions specified in the flow or blocks of the flowcharts and/or the block or blocks of the block diagrams.

以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明技术原理的前提下,还可以做出若干改进和变形,这些改进和变形也应视为本发明的保护范围。The above are only the preferred embodiments of the present invention. It should be pointed out that for those skilled in the art, without departing from the technical principle of the present invention, several improvements and modifications can also be made. These improvements and modifications It should also be regarded as the protection scope of the present invention.

Claims (9)

1. A multi-focus image fusion method, comprising:
acquiring a multi-focus image to be fused;
inputting the multi-focus images into a pre-trained fusion network model for fusion to obtain a fusion image;
the fusion network model is constructed by the following method: and constructing a fusion network model by utilizing the void convolution network and the intensive convolution neural network based on the attention mechanism.
2. The method of claim 1, further comprising the step of creating a training data set, comprising:
and extracting images from the public data set MS-COCO, cutting the images into uniform sizes to obtain label images, and forming a training data set by the label images.
3. The method of claim 2, further comprising the step of preprocessing the training data set, comprising:
and performing Gaussian blur processing on different areas of the label images in the training data set.
4. The method of claim 2, further comprising a step of setting a loss function of the fusion network model, comprising:
the following loss function is set:
L=Lmse+αLssim+βLper
Lssim=1-SSIM(O,T)
Figure FDA0003494906330000011
where L is a loss function, LmseIs a mean square loss function, LssimIs a loss function of structural similarity, LperIs a perceptual loss function, alpha and beta are balance parameters, O is a fusion image, T is a tag image, SSIM (O, T) represents the structural similarity between O and T,
Figure FDA0003494906330000012
represents the pixel value with coordinates (x, y) in the ith channel of the feature map extracted by the fused image through VGG16,
Figure FDA0003494906330000013
a pixel value C representing coordinates (x, y) in the i channel of the feature map extracted by the VGG16 from the label imagef、HfAnd WfRespectively representing the number of channels, height and width of any feature map.
5. The method of claim 2, wherein the fusion network model is trained by:
and training the fusion network model by using the constructed training data set in the Pythrch, wherein the size of the batch in the training process is set as 8.
6. The method of claim 1, further comprising the step of optimizing parameters of the fusion network model, comprising:
and optimizing parameters of the fusion network model by adopting an Adam optimizer, wherein the initial learning rate of the Adam optimizer is set to be 0.001.
7. A multi-focus image fusion system, comprising:
an acquisition module: the multi-focus image fusion method comprises the steps of obtaining a multi-focus image to be fused;
a fusion module: and the fusion image processing method is used for inputting the multi-focus image into a pre-trained fusion network model for fusion to obtain a fusion image.
8. A multi-focus image fusion device is characterized by comprising a processor and a storage medium;
the storage medium is used for storing instructions;
the processor is configured to operate in accordance with the instructions to perform the steps of the method according to any one of claims 1 to 6.
9. Computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
CN202210116063.8A 2022-01-29 2022-01-29 Multi-focus image fusion method, system, device and storage medium Active CN114627035B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210116063.8A CN114627035B (en) 2022-01-29 2022-01-29 Multi-focus image fusion method, system, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210116063.8A CN114627035B (en) 2022-01-29 2022-01-29 Multi-focus image fusion method, system, device and storage medium

Publications (2)

Publication Number Publication Date
CN114627035A true CN114627035A (en) 2022-06-14
CN114627035B CN114627035B (en) 2025-06-10

Family

ID=81898423

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210116063.8A Active CN114627035B (en) 2022-01-29 2022-01-29 Multi-focus image fusion method, system, device and storage medium

Country Status (1)

Country Link
CN (1) CN114627035B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116597268A (en) * 2023-07-17 2023-08-15 中国海洋大学 An efficient multi-focus image fusion method and its model building method
CN117073848A (en) * 2023-10-13 2023-11-17 中国移动紫金(江苏)创新研究院有限公司 Temperature measurement methods, devices, equipment and storage media
CN117372274A (en) * 2023-10-31 2024-01-09 珠海横琴圣澳云智科技有限公司 Scanned image refocusing method, apparatus, electronic device and storage medium
CN118195926A (en) * 2024-05-17 2024-06-14 昆明理工大学 Registration-free multi-focus image fusion method based on spatial position offset perception

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110189308A (en) * 2019-05-17 2019-08-30 山东财经大学 A tumor detection method and device based on fusion of BM3D and dense convolutional network
CN110533623A (en) * 2019-09-06 2019-12-03 兰州交通大学 A kind of full convolutional neural networks multi-focus image fusing method based on supervised learning
CN113159236A (en) * 2021-05-26 2021-07-23 中国工商银行股份有限公司 Multi-focus image fusion method and device based on multi-scale transformation

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110189308A (en) * 2019-05-17 2019-08-30 山东财经大学 A tumor detection method and device based on fusion of BM3D and dense convolutional network
CN110533623A (en) * 2019-09-06 2019-12-03 兰州交通大学 A kind of full convolutional neural networks multi-focus image fusing method based on supervised learning
CN113159236A (en) * 2021-05-26 2021-07-23 中国工商银行股份有限公司 Multi-focus image fusion method and device based on multi-scale transformation

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
HAFIZ TAYYABMUSTAFA 等: "Multi-scale convolutional neural network for multi-focus image fusion", IMAGE AND VISION COMPUTING, 1 May 2019 (2019-05-01) *
周伟: "基于卷积神经网络的多聚焦图像融合算法研究", 中国优秀硕士学位论文全文数据库(电子期刊), 15 February 2023 (2023-02-15) *
梁新宇 等: "基于深度学习的图像语义分割技术研究进展", 计算机工程与应用, no. 02, 13 November 2019 (2019-11-13) *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116597268A (en) * 2023-07-17 2023-08-15 中国海洋大学 An efficient multi-focus image fusion method and its model building method
CN116597268B (en) * 2023-07-17 2023-09-22 中国海洋大学 An efficient multi-focus image fusion method and its model construction method
CN117073848A (en) * 2023-10-13 2023-11-17 中国移动紫金(江苏)创新研究院有限公司 Temperature measurement methods, devices, equipment and storage media
CN117372274A (en) * 2023-10-31 2024-01-09 珠海横琴圣澳云智科技有限公司 Scanned image refocusing method, apparatus, electronic device and storage medium
CN118195926A (en) * 2024-05-17 2024-06-14 昆明理工大学 Registration-free multi-focus image fusion method based on spatial position offset perception
CN118195926B (en) * 2024-05-17 2024-07-12 昆明理工大学 Registration-free multi-focus image fusion method based on spatial position offset perception

Also Published As

Publication number Publication date
CN114627035B (en) 2025-06-10

Similar Documents

Publication Publication Date Title
CN114627035A (en) Multi-focus image fusion method, system, device and storage medium
Hu et al. AS-Net: Attention Synergy Network for skin lesion segmentation
Xu et al. Learning deep structured multi-scale features using attention-gated crfs for contour prediction
CN111968123B (en) Semi-supervised video target segmentation method
Ruan et al. Aifnet: All-in-focus image restoration network using a light field-based dataset
Chen et al. THFuse: An infrared and visible image fusion network using transformer and hybrid feature extractor
CN113658051A (en) A method and system for image dehazing based on recurrent generative adversarial network
CN112200887A (en) Multi-focus image fusion method based on gradient perception
CN113313700B (en) X-ray image interactive segmentation method based on deep learning
CN109544487A (en) A kind of infrared image enhancing method based on convolutional neural networks
CN114821058A (en) An image semantic segmentation method, device, electronic device and storage medium
CN117745541A (en) Image super-resolution reconstruction method based on lightweight mixed attention network
CN114596584A (en) Intelligent detection and identification method of marine organisms
CN115965844B (en) Multi-focus image fusion method based on prior knowledge of visual saliency
Xu et al. AutoSegNet: an automated neural network for image segmentation
CN109410158B (en) Multi-focus image fusion method based on convolutional neural network
CN116934593A (en) Image super-resolution method and system based on semantic reasoning and cross-convolution
Junayed et al. Consistent video inpainting using axial attention-based style transformer
Tian et al. Retinal fundus image superresolution generated by optical coherence tomography based on a realistic mixed attention GAN
Li et al. Single image deblurring with cross-layer feature fusion and consecutive attention
CN116935051B (en) Polyp segmentation network method, system, electronic equipment and storage medium
CN112016456A (en) Video super-resolution method and system based on adaptive back projection depth learning
Li et al. Semantic prior-driven fused contextual transformation network for image inpainting
CN116797611A (en) Polyp focus segmentation method, device and storage medium
WO2024065701A1 (en) Image inpainting method and apparatus, device, and non-transitory computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant