TWI803243B - Method for expanding images, computer device and storage medium - Google Patents

Method for expanding images, computer device and storage medium Download PDF

Info

Publication number
TWI803243B
TWI803243B TW111109669A TW111109669A TWI803243B TW I803243 B TWI803243 B TW I803243B TW 111109669 A TW111109669 A TW 111109669A TW 111109669 A TW111109669 A TW 111109669A TW I803243 B TWI803243 B TW I803243B
Authority
TW
Taiwan
Prior art keywords
image
variational
value
augmented
learner
Prior art date
Application number
TW111109669A
Other languages
Chinese (zh)
Other versions
TW202338730A (en
Inventor
王薇鈞
孫國欽
Original Assignee
鴻海精密工業股份有限公司
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 鴻海精密工業股份有限公司 filed Critical 鴻海精密工業股份有限公司
Priority to TW111109669A priority Critical patent/TWI803243B/en
Application granted granted Critical
Publication of TWI803243B publication Critical patent/TWI803243B/en
Publication of TW202338730A publication Critical patent/TW202338730A/en

Links

Images

Abstract

The present application provides a method for expanding images, a computer device and a storage medium. The method includes obtaining an image to be expanded and obtaining a plurality of test images, the plurality of test images including a plurality of gas leaked images; constructing a variational learner and a discriminator based on a convolutional neural network, obtaining a plurality of target images by inputting the plurality of gas leaked images into the variational learner; generating a variational autoencoder model based on the variational learner and a result that acquired from the discriminator by processing the plurality of target images; calculating a reconstruction accuracy rate of the variational autoencoder model according to the plurality of test images. In response that the reconstruction accuracy rate is less than a preset threshold, the method obtains an expansion model by adjusting the variational autoencoder model using the plurality of gas leaked images, and obtains expanded images by putting the image to be expanded into the expansion model. This application can improve a reconstruction accuracy and image clarity of the expanded images.

Description

圖像擴增方法、電腦設備及儲存介質 Image amplification method, computer equipment and storage medium

本申請涉及圖像處理領域,尤其涉及一種圖像擴增方法、電腦設備及儲存介質。 The present application relates to the field of image processing, in particular to an image augmentation method, computer equipment and storage media.

在目前的圖像擴增方式中,使用變分自編碼器時需要考慮到輸入圖像的大小,且重構出來的圖像比較模糊,導致重構準確性低。因此,在不考慮輸入圖像尺寸的前提下,如何構建出一種能夠準確地重構出清晰的擴增圖像,成了亟需解決的問題。 In the current image augmentation method, the size of the input image needs to be considered when using the variational autoencoder, and the reconstructed image is relatively blurred, resulting in low reconstruction accuracy. Therefore, under the premise of not considering the size of the input image, how to construct a clear augmented image that can be accurately reconstructed has become an urgent problem to be solved.

鑒於以上內容,有必要提供一種圖像擴增方法、電腦設備及儲存介質,能夠準確地重構出清晰的擴增圖像。 In view of the above, it is necessary to provide an image augmentation method, computer equipment and storage medium, which can accurately reconstruct a clear augmented image.

本申請提供一種圖像擴增方法,所述圖像擴增方法包括:獲取待擴增圖像及測試圖像,其中,所述測試圖像包括氣體外洩圖像;基於全卷積神經網路構建變分學習器以及判別器;將所述氣體外洩圖像輸入到所述變分學習器中,得到目標圖像;根據所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到變分自編碼器模型;基於所述測試圖像計算所述變分自編碼器模型的重構正確率; 若所述重構正確率小於預設閾值,基於所述氣體外洩圖像調整所述變分自編碼器模型,得到擴增模型;將所述待擴增圖像輸入到所述擴增模型中,得到擴增圖像。 The present application provides an image augmentation method. The image augmentation method includes: acquiring an image to be augmented and a test image, wherein the test image includes a gas leakage image; Build a variational learner and a discriminator; input the gas leakage image into the variational learner to obtain a target image; train the target image according to the discriminant result of the discriminator A variational learner to obtain a variational autoencoder model; calculate the reconstruction accuracy of the variational autoencoder model based on the test image; If the reconstruction accuracy is less than a preset threshold, adjust the variational autoencoder model based on the gas leakage image to obtain an amplification model; input the image to be amplified into the amplification model In , the enlarged image is obtained.

根據本申請可選實施例,所述根據所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到變分自編碼器模型包括:將所述目標圖像輸入到所述判別器中,得到所述判別器將所述目標圖像確定為假圖像的判別概率;將大於或者等於第一預設值的判別概率所對應的目標圖像重新輸入到所述變分學習器中進行訓練,得到第一圖像;基於所述氣體外洩圖像、所述目標圖像及所述第一圖像計算所述變分學習器的損失值,並利用梯度反向傳播更新所述變分學習器的權值,直至所述損失值下降到最低,得到所述變分自編碼器模型。 According to an optional embodiment of the present application, the training of the variational learner according to the discriminant result of the discriminator on the target image to obtain the variational autoencoder model includes: inputting the target image into the In the discriminator, obtain the discriminant probability that the discriminator determines the target image as a false image; re-input the target image corresponding to the discriminant probability greater than or equal to the first preset value into the variation Train in the learner to obtain the first image; calculate the loss value of the variational learner based on the gas leakage image, the target image and the first image, and use gradient backpropagation Updating the weight value of the variational learner until the loss value drops to a minimum, and obtaining the variational autoencoder model.

根據本申請可選實施例,所述基於所述氣體外洩圖像、所述目標圖像及所述第一圖像計算所述變分學習器的損失值包括:所述損失值的計算方法為:

Figure 111109669-A0305-02-0004-1
其中,loss為所述損失值,M是指所述目標圖像中所有畫素點的數量,N是指所述氣體外洩圖像中所有畫素點的數量,K是指所述第一圖像中所有畫素點的數量,i是指所述目標圖像中第i個畫素點,j是指所述氣體外洩圖像中與i對應的畫素點,r是指所述第一圖像中與i對應的畫素點,y i 是指所述目標圖像中第i個畫素點的畫素值,x j 是指所述氣體外洩圖像中第j個畫素點的畫素值,z r 是指所述第一圖像中第r個畫素點的畫素值。 According to an optional embodiment of the present application, the calculation of the loss value of the variational learner based on the gas leakage image, the target image and the first image includes: a calculation method of the loss value for:
Figure 111109669-A0305-02-0004-1
Wherein, loss is the loss value, M refers to the number of all pixels in the target image, N refers to the number of all pixels in the gas leakage image, and K refers to the first The number of all pixels in the image, i refers to the i- th pixel in the target image, j refers to the pixel corresponding to i in the gas leakage image, r refers to the The pixel point corresponding to i in the first image, y i refers to the pixel value of the i- th pixel point in the target image, and x j refers to the j -th pixel point in the gas leakage image The pixel value of the pixel point, z r refers to the pixel value of the rth pixel point in the first image.

根據本申請可選實施例,所述基於所述測試圖像計算所述變分自編碼器模型的重構正確率包括:獲取所述測試圖像的標注結果; 將所述測試圖像輸入到所述變分自編碼器模型中,得到特徵圖像;計算所述特徵圖像與所述測試圖像之間的相似值;將所述相似值與第二預設值進行比較,得到所述測試圖像的驗證結果;將所述驗證結果與所述標注結果進行比對;將與所述標注結果相同的驗證結果所對應的測試圖像確定為第二圖像,並將所述第二圖像所對應的特徵圖像確定為相似圖像;計算所述相似圖像在所述特徵圖像中所佔的比率,並將所述比率確定為所述重構正確率。 According to an optional embodiment of the present application, the calculating the reconstruction accuracy rate of the variational autoencoder model based on the test image includes: acquiring an annotation result of the test image; The test image is input into the variational self-encoder model to obtain a feature image; the similarity value between the feature image and the test image is calculated; the similarity value is compared with the second prediction Comparing the set values to obtain the verification result of the test image; comparing the verification result with the labeling result; determining the test image corresponding to the same verification result as the labeling result as the second image image, and determine the feature image corresponding to the second image as a similar image; calculate the ratio of the similar image in the feature image, and determine the ratio as the weight construction accuracy.

根據本申請可選實施例,所述計算所述特徵圖像與所述測試圖像之間的相似值包括:將所述特徵圖像進行灰度化處理,得到灰度化圖像;將所述灰度化圖像進行二值化處理,得到第三圖像;將所述特徵圖像所對應的測試圖像進行灰度化處理及二值化處理,得到第四圖像;計算所述第三圖像與所述第四圖像的相似值,所述相似值的確定公式為:

Figure 111109669-A0305-02-0005-2
c 1=(K 1 L)2c 2=(K 2 L)2;其中,SSIM(x,y)為所述相似值,x為所述第三圖像,y為所述第四圖像,μ x 為所述第三圖像的灰度平均值,μ y 為所述第四圖像的灰度平均值,σ x 為所述第三圖像的灰度標準差,σ y 為所述第四圖像的灰度標準差,σ xy 為所述第三圖像與所述第四圖像之間的灰度協方差,c 1c 2均為預設參數,L為所述第四圖像中最大的畫素值,K 1K 2是預先設置的常數,且K 1≪1,K 2≪1。 According to an optional embodiment of the present application, the calculating the similarity value between the feature image and the test image includes: performing grayscale processing on the feature image to obtain a grayscale image; The grayscaled image is subjected to binarization processing to obtain a third image; the test image corresponding to the feature image is subjected to grayscale processing and binarization processing to obtain a fourth image; the calculation of the The similarity value of the third image and the fourth image, the determination formula of the similarity value is:
Figure 111109669-A0305-02-0005-2
c 1 =( K 1 L ) 2 ; c 2 =( K 2 L ) 2 ; wherein, SSIM ( x,y ) is the similarity value, x is the third image, and y is the fourth image Like, μ x is the gray average value of the third image, μ y is the gray average value of the fourth image, σ x is the gray standard deviation of the third image, σ y is The grayscale standard deviation of the fourth image, σxy is the grayscale covariance between the third image and the fourth image, c1 and c2 are preset parameters, and L is the The largest pixel value in the fourth image, K 1 and K 2 are preset constants, and K 1 ≪1, K 2 ≪1.

根據本申請可選實施例,所述基於所述氣體外洩圖像調整所述變分自編碼器模型,得到擴增模型包括:將所述氣體外洩圖像輸入到所述變分自編碼器模型進行訓練,直至所述重構正確率大於或者等於所述預設閾值,得到所述擴增模型。 According to an optional embodiment of the present application, the adjusting the variational autoencoder model based on the gas leakage image to obtain an augmented model includes: inputting the gas leakage image into the variational autoencoder The machine model is trained until the reconstruction accuracy rate is greater than or equal to the preset threshold to obtain the augmented model.

根據本申請可選實施例,所述擴增模型中包括編碼器和解碼器,所述編碼器中採用全卷積神經網路,所述全卷積神經網路包含多個隱層,所述解碼器中採用反卷積神經網路,所述反卷積神經網路中包含多個運算層。 According to an optional embodiment of the present application, the augmented model includes an encoder and a decoder, a fully convolutional neural network is used in the encoder, and the fully convolutional neural network includes multiple hidden layers. A deconvolution neural network is used in the decoder, and the deconvolution neural network includes multiple operation layers.

根據本申請可選實施例,所述將所述待擴增圖像輸入到所述擴增模型中,得到擴增圖像包括:將所述待擴增圖像輸入到所述編碼器的隱層中進行特徵提取,得到特徵向量,其中,所述特徵向量中有2n個元素;提取所述特徵向量中的前n個元素作為均值向量;提取所述特徵向量中的後n個元素作為標準差向量;根據所述均值向量及所述標準差向量生成高斯亂數;對所述高斯亂數進行隨機採樣,得到採樣值;將所述均值向量中的每個元素與所述採樣值進行相乘運算,得到多個相乘結果;將每個相乘結果與所述標準差向量中對應的元素進行相加運算,得到潛在向量;將所述潛在變數輸入到所述解碼器的運算層進行映射處理,得到所述擴增圖像。 According to an optional embodiment of the present application, the inputting the image to be amplified into the augmentation model to obtain the augmented image includes: inputting the image to be amplified into the hidden image of the encoder Feature extraction is performed in the layer to obtain a feature vector, wherein there are 2 n elements in the feature vector; the first n elements in the feature vector are extracted as the mean vector; the last n elements in the feature vector are extracted as standard deviation vector; generate Gaussian random numbers according to the mean vector and the standard deviation vector; randomly sample the Gaussian random numbers to obtain sampling values; compare each element in the mean vector with the sampling values A multiplication operation to obtain multiple multiplication results; adding each multiplication result to the corresponding element in the standard deviation vector to obtain a latent vector; inputting the latent variable to the operation layer of the decoder Perform mapping processing to obtain the amplified image.

本申請提供一種電腦設備,所述電腦設備包括:儲存器,儲存至少一個指令;及處理器,獲取所述儲存器中儲存的指令以實現所述的圖像擴增方法。 The present application provides a computer device, and the computer device includes: a memory storing at least one instruction; and a processor obtaining the instruction stored in the memory to implement the image augmentation method.

本申請提供一種電腦可讀儲存介質,所述電腦可讀儲存介質中儲存有至少一個指令,所述至少一個指令被電腦設備中的處理器執行以實現所述的圖像擴增方法。 The present application provides a computer-readable storage medium, at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is executed by a processor in a computer device to implement the image augmentation method.

由以上技術方案可以看出,本申請構建的變分學習器採用了全卷積神經網路的結構,不僅能夠接受任意尺寸的輸入圖像,而且能夠更好的提取到所述待擴增圖像的特徵,解決了輸入圖像的尺寸不合適的問題,進而將所述氣體外洩圖像輸入到所述變分學習器中,得到所述目標圖像,並使用所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到所述變分自編碼器模型,只有當所述目標圖像足夠清晰時,才會停止使用所述判別結果對所述變分學習器進行訓練,由此能夠提高所述變分自編碼器模型所生成的圖像的清晰度,進一步地,透過計算所述變分自編碼器模型在所述測試圖像的重構準確率,將所述重構準確率與所述預設閾值進行比較以確定是否要對所述變分自編碼器模型進行調整,提高了所述擴增模型的重構準確性,使得所述擴增模型能夠準確地重構出清晰的擴增圖像。 It can be seen from the above technical solutions that the variational learner constructed by this application adopts the structure of a fully convolutional neural network, which not only can accept input images of any size, but also can better extract the image to be amplified. The characteristics of the image solve the problem of inappropriate size of the input image, and then input the gas leakage image into the variational learner to obtain the target image, and use the discriminator to classify the Train the variational learner with the discrimination result of the target image to obtain the variational autoencoder model, and only when the target image is clear enough, will stop using the discrimination result to learn the variation trainer, which can improve the clarity of the image generated by the variational autoencoder model, and further, by calculating the reconstruction accuracy of the variational autoencoder model in the test image, Comparing the reconstruction accuracy rate with the preset threshold to determine whether to adjust the variational autoencoder model, which improves the reconstruction accuracy of the augmented model, so that the augmented model A clear amplified image can be accurately reconstructed.

1:電腦設備 1: Computer equipment

12:儲存器 12: Storage

13:處理器 13: Processor

S10~S16:步驟 S10~S16: Steps

圖1是本申請圖像擴增方法的較佳實施例的流程圖。 FIG. 1 is a flow chart of a preferred embodiment of the image augmentation method of the present application.

圖2是本申請圖像擴增方法的較佳實施例的變分學習器的結構示意圖。 Fig. 2 is a schematic structural diagram of a variational learner of a preferred embodiment of the image augmentation method of the present application.

圖3是本申請圖像擴增方法的較佳實施例的判別器的結構示意圖。 Fig. 3 is a schematic structural diagram of a discriminator of a preferred embodiment of the image augmentation method of the present application.

圖4是本申請實現圖像擴增方法的較佳實施例的電腦設備的結構示意圖。 Fig. 4 is a schematic structural diagram of a computer device implementing a preferred embodiment of the image augmentation method of the present application.

為了使本申請的目的、技術方案和優點更加清楚,下面結合附圖和具體實施例對本申請進行詳細描述。 In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be described in detail below in conjunction with the accompanying drawings and specific embodiments.

如圖1所示,是本申請一種圖像擴增方法的較佳實施例的流程圖。根據不同的需求,該流程圖中各個步驟的順序可以根據實際要求進行調整,某些步驟可以省略。所述方法的執行主體為電腦設備,例如圖4所示的電腦設備1。 As shown in FIG. 1 , it is a flowchart of a preferred embodiment of an image augmentation method of the present application. According to different requirements, the order of each step in the flowchart can be adjusted according to actual requirements, and some steps can be omitted. The execution body of the method is a computer device, such as the computer device 1 shown in FIG. 4 .

所述圖像擴增方法可應用於一個或者多個電腦設備1中。所述電腦設備1是一種能夠按照事先設定或儲存的指令,自動進行數值計算和/或資訊處理的設備,其硬體包括,但不限於:微處理器、專用積體電路(Application Specific Integrated Circuit,ASIC)、可程式設計閘陣列(Field-Programmable Gate Array,FPGA)、數位訊號處理器(Digital Signal Processor,DSP)、嵌入式設備等。 The image augmentation method can be applied to one or more computer devices 1 . The computer device 1 is a device that can automatically perform numerical calculations and/or information processing according to preset or stored instructions, and its hardware includes, but is not limited to: microprocessors, application specific integrated circuits (Application Specific Integrated Circuits) , ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), digital signal processor (Digital Signal Processor, DSP), embedded devices, etc.

所述電腦設備1可以是任何一種可與用戶進行人機交互的電子產品,例如,個人電腦、平板電腦、智慧手機、個人數位助理(Personal Digital Assistant,PDA)、遊戲機、互動式網路電視(Internet Protocol Television,IPTV)、智慧式穿戴式設備等。 The computer device 1 can be any electronic product capable of man-machine interaction with the user, for example, a personal computer, a tablet computer, a smart phone, a personal digital assistant (Personal Digital Assistant, PDA), a game console, an interactive Internet TV (Internet Protocol Television, IPTV), smart wearable devices, etc.

所述電腦設備1還可以包括網路設備和/或使用者設備。其中,所述網路設備包括,但不限於單個網路伺服器、多個網路伺服器組成的伺服器組或基於雲計算(Cloud Computing)的由大量主機或網路伺服器構成的雲。 The computer equipment 1 may also include network equipment and/or user equipment. Wherein, the network device includes, but is not limited to, a single network server, a server group composed of multiple network servers, or a cloud composed of a large number of hosts or network servers based on Cloud Computing.

所述電腦設備1所處的網路包括但不限於網際網路、廣域網路、都會區網路、區域網路、虛擬私人網路(Virtual Private Network,VPN)等。 The network where the computer device 1 is located includes but not limited to Internet, wide area network, metropolitan area network, local area network, virtual private network (Virtual Private Network, VPN) and so on.

步驟S10,獲取待擴增圖像及測試圖像,其中,所述測試圖像包括氣體外洩圖像。 Step S10, acquiring an image to be amplified and a test image, wherein the test image includes a gas leakage image.

在本申請的至少一個實施例中,所述測試圖像可用於計算變分自編碼器模型的重構正確率,所述電腦設備可以從預設的第一資料庫中獲取所述測試圖像。 In at least one embodiment of the present application, the test image can be used to calculate the reconstruction accuracy of the variational autoencoder model, and the computer device can obtain the test image from a preset first database .

在本申請的至少一個實施例中,所述氣體外洩圖像是指包含有洩露氣體的圖像,所述氣體外洩圖像中的氣體可以為氯氣、二氧化硫氣體等等,可 以理解的是,所述氣體外洩圖像可以為洩露的氯氣圖像、洩露的二氧化硫氣體圖像等等,所述氣體外洩圖像可用於對變分學習器進行訓練。 In at least one embodiment of the present application, the gas leakage image refers to an image containing leaked gas, and the gas in the gas leakage image may be chlorine gas, sulfur dioxide gas, etc., may be It should be understood that the gas leak image may be a leaked chlorine gas image, a leaked sulfur dioxide gas image, etc., and the gas leak image may be used to train a variational learner.

在本申請的至少一個實施例中,所述待擴增圖像是指不包含所述洩露氣體的圖像,所述電腦設備可以從預設的第二資料庫中獲取所述待擴增圖像。 In at least one embodiment of the present application, the image to be amplified refers to an image that does not contain the leaked gas, and the computer device can obtain the image to be amplified from a preset second database picture.

步驟S11,基於全卷積神經網路構建變分學習器以及判別器。 Step S11, constructing a variational learner and a discriminator based on the fully convolutional neural network.

在本申請的至少一個實施例中,所述變分學習器可用於生成重構圖像。 In at least one embodiment of the present application, the variational learner may be used to generate a reconstructed image.

在本申請的至少一個實施例中,所述判別器用於判別輸入的圖像是否為所述變分學習器生成。 In at least one embodiment of the present application, the discriminator is configured to determine whether the input image is generated by the variational learner.

在本申請的至少一個實施例中,所述變分學習器包括編碼網路及解碼網路,所述電腦設備基於全卷積神經網路構建變分學習器包括: 所述電腦設備構建四個隱層作為所述編碼網路,每個隱層由卷積層及第一激活函數層構成,進一步地,所述電腦設備構建四個運算層作為所述解碼網路,每個運算層由反卷積層及所述第一激活函數層構成。 In at least one embodiment of the present application, the variational learner includes an encoding network and a decoding network, and the computer device constructing a variational learner based on a fully convolutional neural network includes: The computer device constructs four hidden layers as the encoding network, each hidden layer is composed of a convolutional layer and a first activation function layer, further, the computer device constructs four operation layers as the decoding network, Each operation layer is composed of a deconvolution layer and the first activation function layer.

在本申請的至少一個實施例中,所述電腦設備構建判別器包括: 所述電腦設備構建四個深度卷積網路層及第二激活函數層作為所述判別器,前三個深度卷積網路層由卷積層、批標準化層及所述第一激活函數層構成,第四個深度卷積網路層由卷積層及所述第二激活函數層構成。 In at least one embodiment of the present application, the computer device constructing a discriminator includes: The computer equipment constructs four deep convolutional network layers and a second activation function layer as the discriminator, and the first three deep convolutional network layers are composed of a convolutional layer, a batch normalization layer and the first activation function layer , the fourth deep convolutional network layer is composed of a convolutional layer and the second activation function layer.

如圖2所示,圖2是本申請圖像擴增方法的較佳實施例的變分學習器的結構示意圖。圖2中的編碼網路(Encoder)的參數如下:將第1個卷積層的濾波器的數量(Channel)設置為32個,濾波器的大小(kernel size)設置為4×4個畫素,步長大小(stride)設置為2個畫素,將第2個卷積層中濾波器的數量設置為64個,濾波器大小設置為4×4個畫素,步長大小設置為2個畫素,將第3個卷積層中濾波器的數量設置為128個,濾波器大小設置為4×4個畫素,步長大小設置為2個畫素,將第4個卷積層中濾波器的數量設置為256個,濾波器大 小設置為4×4個畫素,步長大小設置為2個畫素,激活函數均為ReLu。圖2中的解碼網路(Decoder)的參數如下:將第1個反卷積層中濾波器的數量設置為256個,濾波器大小設置為4×4個畫素,步長大小設置為2個畫素,將第2個反卷積層中濾波器的數量設置為128個,濾波器大小設置為4×4個畫素,步長大小設置為2個畫素,將第3個反卷積層中濾波器的數量設置為64個,濾波器大小設置為5×5個畫素,步長大小設置為2個畫素,將第4個反卷積層中濾波器的數量設置為32個,濾波器大小設置為6×6個畫素,步長大小設置為2個畫素,激活函數均為ReLu。 As shown in FIG. 2 , FIG. 2 is a schematic structural diagram of a variational learner of a preferred embodiment of the image augmentation method of the present application. The parameters of the encoding network (Encoder) in Figure 2 are as follows: set the number of filters (Channel) of the first convolutional layer to 32, and the size of the filter (kernel size) to 4×4 pixels, The stride size (stride) is set to 2 pixels, the number of filters in the second convolutional layer is set to 64, the filter size is set to 4×4 pixels, and the stride size is set to 2 pixels , set the number of filters in the third convolutional layer to 128, the filter size to 4×4 pixels, and the step size to 2 pixels, and set the number of filters in the fourth convolutional layer to Set to 256, the filter is large The minimum is set to 4×4 pixels, the step size is set to 2 pixels, and the activation functions are all ReLu. The parameters of the decoding network (Decoder) in Figure 2 are as follows: set the number of filters in the first deconvolution layer to 256, set the filter size to 4×4 pixels, and set the step size to 2 pixel, the number of filters in the second deconvolution layer is set to 128, the filter size is set to 4×4 pixels, the step size is set to 2 pixels, and the third deconvolution layer is set to The number of filters is set to 64, the filter size is set to 5×5 pixels, the step size is set to 2 pixels, the number of filters in the fourth deconvolution layer is set to 32, and the filter The size is set to 6×6 pixels, the step size is set to 2 pixels, and the activation functions are all ReLu.

如圖3所示,圖3是本申請圖像擴增方法的較佳實施例的判別器的結構示意圖。圖3中的判別器的各層參數如下:將第1個深度卷積網路層中濾波器的數量設置為64個,濾波器大小設置為128×128個畫素,加入BN層和ReLu激活函數,將第2個深度卷積網路層中濾波器的數量設置為128個,濾波器大小設置為64×64個畫素,加入BN層和ReLu激活函數,將第3個深度卷積網路層中濾波器的數量設置為256個,濾波器大小設置為32×32個畫素,加入BN層和ReLu激活函數,將第4個深度卷積網路層中濾波器的數量設置為512個,濾波器大小設置為31×31個畫素,加入sigmoid激活函數,最後一層使用sigmoid激活函數。 As shown in FIG. 3 , FIG. 3 is a schematic structural diagram of a discriminator of a preferred embodiment of the image augmentation method of the present application. The parameters of each layer of the discriminator in Figure 3 are as follows: set the number of filters in the first deep convolutional network layer to 64, set the filter size to 128×128 pixels, add BN layer and ReLu activation function , set the number of filters in the second deep convolutional network layer to 128, set the filter size to 64×64 pixels, add the BN layer and ReLu activation function, and set the third deep convolutional network The number of filters in the layer is set to 256, the filter size is set to 32×32 pixels, the BN layer and the ReLu activation function are added, and the number of filters in the fourth deep convolutional network layer is set to 512 , the filter size is set to 31×31 pixels, the sigmoid activation function is added, and the last layer uses the sigmoid activation function.

透過上述實施方式,能夠基於全卷積神經網路構建出所述變分學習器,使得所述變分學習器能夠提取到任意尺寸的輸入圖像中的特徵。 Through the above implementation, the variational learner can be constructed based on the fully convolutional neural network, so that the variational learner can extract features from an input image of any size.

步驟S12,將所述氣體外洩圖像輸入到所述變分學習器中,得到目標圖像。 Step S12, inputting the gas leakage image into the variational learner to obtain a target image.

在本申請的至少一個實施例中,所述目標圖像是指包含有所述氣體外洩圖像中的氣體特徵的圖像。 In at least one embodiment of the present application, the target image refers to an image including gas features in the gas leakage image.

所述目標圖像的具體生成過程與下文擴增圖像的生成過程一致,故本申請在此不作贅述。 The specific generation process of the target image is consistent with the generation process of the augmented image below, so the present application will not repeat it here.

步驟S13,根據所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到變分自編碼器模型。 Step S13, training the variational learner according to the discrimination result of the discriminator on the target image to obtain a variational autoencoder model.

在本申請的至少一個實施例中,所述變分自編碼器模型是指使用所述氣體外洩圖像對所述變分學習器訓練後所得到的模型,所述變分自編碼器模型可用於生成具有所述氣體外洩圖像中的氣體特徵的圖像。 In at least one embodiment of the present application, the variational autoencoder model refers to a model obtained after training the variational learner using the gas leakage image, and the variational autoencoder model It can be used to generate an image having the characteristics of the gas in the gas leak image.

在本申請的至少一個實施例中,所述電腦設備根據所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到變分自編碼器模型包括: 所述電腦設備將所述目標圖像輸入到所述判別器中,得到所述判別器將所述目標圖像確定為假圖像的判別概率,進一步地,所述電腦設備將大於或者等於第一預設值的判別概率所對應的目標圖像重新輸入到所述變分學習器中進行訓練,得到第一圖像,更進一步地,所述電腦設備基於所述氣體外洩圖像、所述目標圖像及所述第一圖像計算所述變分學習器的損失值,並利用梯度反向傳播更新所述變分學習器的權值,直至所述損失值下降到最低,得到所述變分自編碼器模型。 In at least one embodiment of the present application, the computer device trains the variational learner according to the discrimination result of the discriminator to the target image, and the obtained variational autoencoder model includes: The computer device inputs the target image into the discriminator, and obtains the discriminant probability that the discriminator determines the target image as a fake image, further, the computer device will be greater than or equal to the first The target image corresponding to the discriminant probability of a preset value is re-inputted into the variational learner for training to obtain the first image. Further, the computer device is based on the gas leakage image, the The target image and the first image calculate the loss value of the variational learner, and use gradient backpropagation to update the weight of the variational learner until the loss value drops to the minimum, and the obtained Variational autoencoder model described above.

其中,所述第一預設值可以自行設置,本申請對此不作限制。 Wherein, the first preset value can be set by itself, which is not limited in this application.

所述假圖像是指由所述變分學習器生成的圖像。 The fake image refers to the image generated by the variational learner.

具體地,所述電腦設備基於所述氣體外洩圖像、所述目標圖像及所述第一圖像計算所述變分學習器的損失值包括:所述損失值的計算方法為:

Figure 111109669-A0305-02-0011-3
其中,loss為所述損失值,M是指所述目標圖像中所有畫素點的數量,N是指所述氣體外洩圖像中所有畫素點的數量,K是指所述第一圖像中所有畫素點的數量,i是指所述目標圖像中第i個畫素點,j是指所述氣體外洩圖像中與i對應的畫素點,r是指所述第一圖像中與i對應的畫素點,y i 是指所述目標圖 像中第i個畫素點的畫素值,x j 是指所述氣體外洩圖像中第j個畫素點的畫素值,z r 是指所述第一圖像中第r個畫素點的畫素值。 Specifically, calculating the loss value of the variational learner based on the gas leakage image, the target image, and the first image by the computer device includes: the calculation method of the loss value is:
Figure 111109669-A0305-02-0011-3
Wherein, loss is the loss value, M refers to the number of all pixels in the target image, N refers to the number of all pixels in the gas leakage image, and K refers to the first The number of all pixels in the image, i refers to the i- th pixel in the target image, j refers to the pixel corresponding to i in the gas leakage image, r refers to the The pixel point corresponding to i in the first image, y i refers to the pixel value of the i- th pixel point in the target image, and x j refers to the j -th pixel point in the gas leakage image The pixel value of the pixel point, z r refers to the pixel value of the rth pixel point in the first image.

透過上述實施方式,使用所述判別器對所述目標圖像進行判別,得到所述判別概率,將大於或者等於所述第一預設值的判別概率所對應的目標圖像確定為所述第一圖像,並將所述第一圖像輸入到所述變分學習器中重新訓練,增加了所述變分學習器的訓練資料,使得所述變分自編碼器模型能夠更準確地學習到所述氣體外洩圖像的特徵,提高了所述變分自編碼器模型的重構能力。 Through the above-mentioned embodiment, the discriminator is used to discriminate the target image to obtain the discrimination probability, and the target image corresponding to the discrimination probability greater than or equal to the first preset value is determined as the first An image, and inputting the first image into the variational learner for retraining increases the training data of the variational learner so that the variational autoencoder model can learn more accurately The feature of the gas leakage image is used to improve the reconstruction ability of the variational autoencoder model.

步驟S14,基於所述測試圖像計算所述變分自編碼器模型的重構正確率。 Step S14, calculating the reconstruction accuracy rate of the variational autoencoder model based on the test image.

在本申請的至少一個實施例中,所述重構正確率是指所述變分自編碼器模型對所述測試圖像的檢測準確率。 In at least one embodiment of the present application, the reconstruction accuracy refers to the detection accuracy of the variational autoencoder model on the test image.

在本申請的至少一個實施例中,所述電腦設備基於所述測試圖像計算所述變分自編碼器模型的重構正確率包括:所述電腦設備獲取所述測試圖像的標注結果,將所述測試圖像輸入到所述變分自編碼器模型中,得到特徵圖像,所述電腦設備計算所述特徵圖像與所述測試圖像之間的相似值,進一步地,所述電腦設備將所述相似值與第二預設值進行比較,得到所述測試圖像的驗證結果,更進一步地,所述電腦設備將所述驗證結果與所述標注結果進行比對,將與所述標注結果相同的驗證結果所對應的測試圖像確定為第二圖像,並將所述第二圖像所對應的特徵圖像確定為相似圖像,所述電腦設備計算所述相似圖像在所述特徵圖像中所佔的比率,並將所述比率確定為所述重構正確率。 In at least one embodiment of the present application, calculating the reconstruction accuracy rate of the variational autoencoder model based on the test image by the computer device includes: the computer device obtains an annotation result of the test image, The test image is input into the variational autoencoder model to obtain a feature image, and the computer device calculates a similarity value between the feature image and the test image, further, the The computer device compares the similarity value with a second preset value to obtain a verification result of the test image, further, the computer device compares the verification result with the labeling result, and compares the verification result with the The test image corresponding to the verification result with the same labeling result is determined as a second image, and the feature image corresponding to the second image is determined as a similar image, and the computer device calculates the similarity map The proportion of the image in the feature image, and determine the proportion as the reconstruction accuracy rate.

其中,所述標注結果包括任一測試圖像存在所述氣體特徵,以及,任一測試圖像不存在所述氣體特徵。 Wherein, the labeling result includes that the gas feature exists in any test image, and that the gas feature does not exist in any test image.

所述第二預設值可以自行設置,本申請對此不作限制。 The second preset value can be set by itself, which is not limited in this application.

具體地,所述電腦設備計算所述特徵圖像與所述測試圖像之間的相似值包括: 所述電腦設備將所述特徵圖像進行灰度化處理,得到灰度化圖像,將所述灰度化圖像進行二值化處理,得到第三圖像,所述電腦設備將所述特徵圖像所對應的測試圖像進行灰度化處理及二值化處理,得到第四圖像,並計算所述第三圖像與所述第四圖像的相似值。 Specifically, calculating the similarity value between the feature image and the test image by the computer device includes: The computer device performs grayscale processing on the characteristic image to obtain a grayscale image, and performs binarization processing on the grayscale image to obtain a third image, and the computer device converts the The test image corresponding to the feature image is grayscaled and binarized to obtain a fourth image, and a similarity value between the third image and the fourth image is calculated.

具體地,所述電腦設備將所述相似值與第二預設值進行比較,得到所述測試圖像的驗證結果包括:所述電腦設備將大於或者等於所述第二預設值的相似值所對應的驗證結果確定為測試圖像存在所述氣體特徵,將小於所述第二預設值的相似值所對應的驗證結果確定為測試圖像不存在所述氣體特徵。 Specifically, the computer device compares the similarity value with a second preset value, and the verification result of the test image obtained includes: the computer device will be greater than or equal to the similarity value of the second preset value The corresponding verification result is determined to be that the gas feature exists in the test image, and the verification result corresponding to a similarity value smaller than the second preset value is determined to be that the test image does not have the gas feature.

所述相似值的確定公式為:

Figure 111109669-A0305-02-0013-4
c 1=(K 1 L)2c 2=(K 2 L)2;其中,SSIM(x,y)為所述相似值,x為所述第三圖像,y為所述第四圖像,μ x 為所述第三圖像的灰度平均值,μ y 為所述第四圖像的灰度平均值,σ x 為所述第三圖像的灰度標準差,σ y 為所述第四圖像的灰度標準差,σ xy 為所述第三圖像與所述第四圖像之間的灰度協方差,c 1c 2均為預設參數,L為所述第四圖像中最大的畫素值,K 1K 2是預先設置的常數,且K 1≪1,K 2≪1。 The formula for determining the similarity value is:
Figure 111109669-A0305-02-0013-4
c 1 =( K 1 L ) 2 ; c 2 =( K 2 L ) 2 ; wherein, SSIM ( x,y ) is the similarity value, x is the third image, and y is the fourth image Like, μ x is the gray average value of the third image, μ y is the gray average value of the fourth image, σ x is the gray standard deviation of the third image, σ y is The grayscale standard deviation of the fourth image, σxy is the grayscale covariance between the third image and the fourth image, c1 and c2 are preset parameters, and L is the The largest pixel value in the fourth image, K 1 and K 2 are preset constants, and K 1 ≪1, K 2 ≪1.

透過上述實施方式,對所述測試圖像及所述特徵圖像分別進行灰度化及二值化處理,使得所述第三圖像及所述第四圖像中不同畫素點的畫素值差異更加明顯,更便於計算所述第三圖像與所述第四圖像之間的相似值,透過將所述相似值與所述第二預設值進行比較,能夠準確的選取出與所述測試圖像足夠相似的特徵圖像作為所述相似圖像,並根據所述相似圖像能夠準確的計算出所述變分自編碼器模型的重構正確率。 Through the above-mentioned implementation manner, grayscale and binarization processing are performed on the test image and the feature image respectively, so that the pixels of different pixel points in the third image and the fourth image The value difference is more obvious, and it is more convenient to calculate the similarity value between the third image and the fourth image. By comparing the similarity value with the second preset value, it is possible to accurately select A feature image that is sufficiently similar to the test image is used as the similar image, and the reconstruction accuracy of the variational autoencoder model can be accurately calculated according to the similar image.

步驟S15,若所述重構正確率小於預設閾值,基於所述氣體外洩圖像調整所述變分自編碼器模型,得到擴增模型。 Step S15, if the reconstruction accuracy is less than a preset threshold, adjust the variational autoencoder model based on the gas leakage image to obtain an augmented model.

在本申請的至少一個實施例中,所述預設閾值可以包括,但不限於:0.8、0.9。 In at least one embodiment of the present application, the preset threshold may include, but not limited to: 0.8, 0.9.

所述擴增模型是指重構正確率大於或者等於所述預設閾值的變分自編碼器模型。所述擴增模型包括編碼器及解碼器,所述編碼器是根據所述氣體外洩圖像對所述編碼網路進行訓練後生成的,所述解碼器是根據所述氣體外洩圖像對所述解碼網路進行訓練後生成的。 The augmented model refers to a variational autoencoder model whose reconstruction accuracy rate is greater than or equal to the preset threshold. The augmented model includes an encoder and a decoder, the encoder is generated after training the encoding network according to the gas leakage image, and the decoder is generated according to the gas leakage image generated after training the decoding network.

在本申請的至少一個實施例中,所述電腦設備基於所述氣體外洩圖像調整所述變分自編碼器模型,得到擴增模型包括:所述電腦設備將所述氣體外洩圖像輸入到所述變分自編碼器模型進行訓練,直至所述重構正確率大於或者等於所述預設閾值,得到所述擴增模型。 In at least one embodiment of the present application, the computer device adjusts the variational autoencoder model based on the gas leakage image, and obtaining the augmented model includes: the computer device converts the gas leakage image input to the variational autoencoder model for training until the reconstruction accuracy rate is greater than or equal to the preset threshold to obtain the augmented model.

其中,所述變分自編碼器模型的調整方式是將所述氣體外洩圖像輸入到所述變分自編碼器模型進行訓練,直至所述重構正確率大於或者等於所述預設閾值,得到所述擴增模型。 Wherein, the adjustment method of the variational autoencoder model is to input the gas leakage image into the variational autoencoder model for training until the reconstruction accuracy rate is greater than or equal to the preset threshold , to obtain the amplification model.

透過上述實施方式,能夠對小於所述預設閾值的重構正確率所對應的變分自編碼器進行調整,從而能夠提高所述擴增模型的重構準確性。 Through the above implementation manner, the variational autoencoder corresponding to the reconstruction accuracy less than the preset threshold can be adjusted, so as to improve the reconstruction accuracy of the augmented model.

步驟S16,將所述待擴增圖像輸入到所述擴增模型中,得到擴增圖像。 Step S16, inputting the image to be augmented into the augmentation model to obtain an augmented image.

在本申請的至少一個實施例中,所述擴增圖像是指包含有所述氣體外洩圖像中氣體外洩特徵的重構圖像。 In at least one embodiment of the present application, the augmented image refers to a reconstructed image including gas leakage features in the gas leakage image.

在本申請的至少一個實施例中,所述電腦設備將所述待擴增圖像輸入到所述擴增模型中,得到擴增圖像包括:所述電腦設備將所述待擴增圖像輸入到所述編碼器的隱層中進行特徵提取,得到特徵向量,其中,所述特徵向量中有2n個元素,提取所述特徵向量中的前n個元素作為均值向量,提取所述特徵向量中的後n個元素作為標準差向量,進一步地,所述電腦設備根據所述均值向量及所述標準差向量生成高斯亂數,對所述高斯亂數進行隨機採樣,得到採樣值,將所述均值向量中的每個 元素與所述採樣值進行相乘運算,得到多個相乘結果,更進一步地,所述電腦設備將每個相乘結果與所述標準差向量中對應的元素進行相加運算,得到潛在向量,並將所述潛在變數輸入到所述解碼器的運算層進行映射處理,得到所述擴增圖像。 In at least one embodiment of the present application, the computer device inputs the image to be amplified into the augmentation model, and obtaining the augmented image includes: the computer device inputs the image to be amplified Input to the hidden layer of the encoder for feature extraction to obtain a feature vector, wherein there are 2n elements in the feature vector, extract the first n elements in the feature vector as a mean vector, and extract the feature The last n elements in the vector are used as standard deviation vectors. Further, the computer device generates Gaussian random numbers according to the mean vector and the standard deviation vector, and randomly samples the Gaussian random numbers to obtain sampled values. Each element in the mean value vector is multiplied by the sampling value to obtain multiple multiplication results, and further, the computer device multiplies each multiplication result with the corresponding element in the standard deviation vector performing an addition operation to obtain a latent vector, and inputting the latent variable to the operation layer of the decoder for mapping processing to obtain the augmented image.

其中,所述高斯亂數可由Box-Muller演算法根據所述均值向量及標準差向量生成。 Wherein, the Gaussian random number can be generated by a Box-Muller algorithm according to the mean vector and the standard deviation vector.

透過上述實施方式,能夠利用所述擴增模型將所述待擴增圖像壓縮為所述潛在向量,在壓縮的過程中過濾了所述待擴增圖像中的雜訊,使得擴增圖像更清晰,由於所述擴增模型學習到了所述氣體外洩圖像的氣體特徵,而且重構正確率較高,從而使得所述擴增模型能夠準確的重構出包含有氣體特徵的清晰圖像。 Through the above implementation, the augmented image can be compressed into the latent vector by using the augmented model, and the noise in the image to be augmented is filtered during the compression process, so that the augmented image The image is clearer, because the amplification model has learned the gas features of the gas leakage image, and the reconstruction accuracy is high, so that the amplification model can accurately reconstruct the clear image containing the gas features. image.

由以上技術方案可以看出,本申請構建的變分學習器採用了全卷積神經網路的結構,不僅能夠接受任意尺寸的輸入圖像,而且能夠更好的提取到所述待擴增圖像的特徵,解決了輸入圖像的尺寸不合適的問題,進而將所述氣體外洩圖像輸入到所述變分學習器中,得到所述目標圖像,並使用所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到所述變分自編碼器模型,只有當所述目標圖像足夠清晰時,才會停止使用所述判別結果對所述變分學習器進行訓練,由此能夠提高所述變分自編碼器模型所生成的圖像的清晰度,進一步地,透過計算所述變分自編碼器模型在所述測試圖像的重構準確率,將所述重構準確率與所述預設閾值進行比較以確定是否要對所述變分自編碼器模型進行調整,提高了所述擴增模型的重構準確性,使得所述擴增模型能夠準確地重構出清晰的擴增圖像。 It can be seen from the above technical solutions that the variational learner constructed by this application adopts the structure of a fully convolutional neural network, which not only can accept input images of any size, but also can better extract the image to be amplified. The characteristics of the image solve the problem of inappropriate size of the input image, and then input the gas leakage image into the variational learner to obtain the target image, and use the discriminator to classify the Train the variational learner with the discrimination result of the target image to obtain the variational autoencoder model, and only when the target image is clear enough, will stop using the discrimination result to learn the variation trainer, which can improve the clarity of the image generated by the variational autoencoder model, and further, by calculating the reconstruction accuracy of the variational autoencoder model in the test image, Comparing the reconstruction accuracy rate with the preset threshold to determine whether to adjust the variational autoencoder model, which improves the reconstruction accuracy of the augmented model, so that the augmented model A clear amplified image can be accurately reconstructed.

如圖4所示,是本申請實現圖像擴增方法的較佳實施例的電腦設備的結構示意圖。 As shown in FIG. 4 , it is a schematic structural diagram of a computer device implementing a preferred embodiment of the image augmentation method of the present application.

在本申請的一個實施例中,所述電腦設備1包括,但不限於,儲存器12、處理器13,以及儲存在所述儲存器12中並可在所述處理器13上運行的電腦程式,例如圖像擴增程式。 In one embodiment of the present application, the computer device 1 includes, but is not limited to, a storage 12, a processor 13, and a computer program stored in the storage 12 and operable on the processor 13 , such as image augmentation programs.

本領域技術人員可以理解,所述示意圖僅僅是電腦設備1的示例,並不構成對電腦設備1的限定,可以包括比圖示更多或更少的部件,或者組合某些部件,或者不同的部件,例如所述電腦設備1還可以包括輸入輸出設備、網路接入設備、匯流排等。 Those skilled in the art can understand that the schematic diagram is only an example of the computer device 1 and does not constitute a limitation to the computer device 1. It may include more or less components than those shown in the illustration, or combine certain components, or have different Components, for example, the computer device 1 may also include input and output devices, network access devices, bus bars, and the like.

所述處理器13可以是中央處理單元(Central Processing Unit,CPU),還可以是其他通用處理器、數位訊號處理器(Digital Signal Processor,DSP)、專用積體電路(Application Specific Integrated Circuit,ASIC)、現場可程式設計閘陣列(Field-Programmable Gate Array,FPGA)或者其他可程式設計邏輯器件、分立門或者電晶體邏輯器件、分立硬體元件等。通用處理器可以是微處理器或者該處理器也可以是任何常規的處理器等,所述處理器13是所述電腦設備1的運算核心和控制中心,利用各種介面和線路連接整個電腦設備1的各個部分,及獲取所述電腦設備1的作業系統以及安裝的各類應用程式、程式碼等。 The processor 13 can be a central processing unit (Central Processing Unit, CPU), and can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC) , Field-Programmable Gate Array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., and the processor 13 is the computing core and control center of the computer device 1, and utilizes various interfaces and lines to connect the entire computer device 1 Each part of the system, and obtain the operating system of the computer device 1 and various installed applications, program codes, etc.

所述處理器13獲取所述電腦設備1的作業系統以及安裝的各類應用程式。所述處理器13獲取所述應用程式以實現上述各個圖像擴增方法實施例中的步驟,例如圖1所示的步驟。 The processor 13 acquires the operating system of the computer device 1 and various installed applications. The processor 13 acquires the application program to implement the steps in the above embodiments of the image augmentation method, such as the steps shown in FIG. 1 .

示例性的,所述電腦程式可以被分割成一個或多個模組/單元,所述一個或者多個模組/單元被儲存在所述儲存器12中,並由所述處理器13獲取,以完成本申請。所述一個或多個模組/單元可以是能夠完成特定功能的一系列電腦程式指令段,該指令段用於描述所述電腦程式在所述電腦設備1中的獲取過程。 Exemplarily, the computer program can be divided into one or more modules/units, and the one or more modules/units are stored in the storage 12 and acquired by the processor 13, to complete this application. The one or more modules/units may be a series of computer program instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the acquisition process of the computer program in the computer device 1 .

所述儲存器12可用於儲存所述電腦程式和/或模組,所述處理器13透過運行或獲取儲存在所述儲存器12內的電腦程式和/或模組,以及調用儲存在儲存器12內的資料,實現所述電腦設備1的各種功能。所述儲存器12可主 要包括儲存程式區和儲存資料區,其中,儲存程式區可儲存作業系統、至少一個功能所需的應用程式(比如聲音播放功能、圖像播放功能等)等;儲存資料區可儲存根據電腦設備的使用所創建的資料等。此外,儲存器12可以包括非易失性儲存器,例如硬碟、儲存器、插接式硬碟,智慧儲存卡(Smart Media Card,SMC),安全數位(Secure Digital,SD)卡,快閃儲存器卡(Flash Card)、至少一個磁碟儲存器件、快閃儲存器器件、或其他非易失性固態儲存器件。 The storage 12 can be used to store the computer programs and/or modules, and the processor 13 executes or obtains the computer programs and/or modules stored in the storage 12, and calls the computer programs and/or modules stored in the storage 12 to realize various functions of the computer device 1. The memory 12 can host It should include a storage program area and a storage data area, wherein the storage program area can store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the storage data area can be stored according to computer equipment. The use of created materials, etc. In addition, the storage 12 may include non-volatile storage, such as hard disk, memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash memory A memory card (Flash Card), at least one magnetic disk storage device, a flash memory device, or other non-volatile solid state storage devices.

所述儲存器12可以是電腦設備1的外部儲存器和/或內部儲存器。進一步地,所述儲存器12可以是具有實物形式的儲存器,如儲存器條、TF卡(Trans-flash Card)等等。 The storage 12 may be an external storage and/or an internal storage of the computer device 1 . Further, the storage 12 may be a physical storage, such as a storage stick, a TF card (Trans-flash Card) and the like.

所述電腦設備1集成的模組/單元如果以軟體功能單元的形式實現並作為獨立的產品銷售或使用時,可以儲存在一個電腦可讀取儲存介質中。基於這樣的理解,本申請實現上述實施例方法中的全部或部分流程,也可以透過電腦程式來指令相關的硬體來完成,所述的電腦程式可儲存於一電腦可讀儲存介質中,該電腦程式在被處理器獲取時,可實現上述各個方法實施例的步驟。 If the integrated modules/units of the computer device 1 are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, all or part of the processes in the methods of the above embodiments of the present application can also be completed by instructing related hardware through computer programs, and the computer programs can be stored in a computer-readable storage medium. When the computer program is acquired by the processor, it can realize the steps of the above-mentioned various method embodiments.

其中,所述電腦程式包括電腦程式代碼,所述電腦程式代碼可以為原始程式碼形式、物件代碼形式、可獲取檔或某些中間形式等。所述電腦可讀介質可以包括:能夠攜帶所述電腦程式代碼的任何實體或裝置、記錄介質、隨身碟、移動硬碟、磁碟、光碟、電腦儲存器、唯讀儲存器(ROM,Read-Only Memory)。 Wherein, the computer program includes computer program code, and the computer program code may be in the form of original code, object code, obtainable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer storage, a read-only memory (ROM, Read- Only Memory).

結合圖1,所述電腦設備1中的所述儲存器12儲存多個指令以實現一種圖像擴增方法,所述處理器13可獲取所述多個指令從而實現:獲取待擴增圖像及測試圖像,其中,所述測試圖像包括氣體外洩圖像;基於全卷積神經網路構建變分學習器以及判別器;將所述氣體外洩圖像輸入到所述變分學習器中,得到目標圖像;根據所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到變分自編碼器模型;基於所述測試圖像計算所述變分自編碼器模型的重構正確率;若所述重構正確率小於預設閾值,基於所述氣體外洩圖像調 整所述變分自編碼器模型,得到擴增模型;將所述待擴增圖像輸入到所述擴增模型中,得到擴增圖像。 Referring to FIG. 1 , the memory 12 in the computer device 1 stores a plurality of instructions to implement an image augmentation method, and the processor 13 can acquire the plurality of instructions to realize: acquire an image to be amplified and a test image, wherein the test image includes a gas leakage image; a variational learner and a discriminator are constructed based on a fully convolutional neural network; the gas leakage image is input to the variation learning In the device, the target image is obtained; the variational learner is trained according to the discrimination result of the target image by the discriminator to obtain the variational autoencoder model; the variational autoencoder model is calculated based on the test image. The reconstruction accuracy rate of the encoder model; if the reconstruction accuracy rate is less than the preset threshold, based on the gas leakage image adjustment Adjusting the variational self-encoder model to obtain an augmented model; inputting the image to be augmented into the augmented model to obtain an augmented image.

具體地,所述處理器13對上述指令的具體實現方法可參考圖1對應實施例中相關步驟的描述,在此不贅述。 Specifically, for the specific implementation method of the above instructions by the processor 13, reference may be made to the description of relevant steps in the embodiment corresponding to FIG. 1 , and details are not repeated here.

在本申請所提供的幾個實施例中,應該理解到,所揭露的系統,裝置和方法,可以透過其它的方式實現。例如,以上所描述的裝置實施例僅僅是示意性的,例如,所述模組的劃分,僅僅為一種邏輯功能劃分,實際實現時可以有另外的劃分方式。 In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

所述作為分離部件說明的模組可以是或者也可以不是物理上分開的,作為模組顯示的部件可以是或者也可以不是物理單元,即可以位於一個地方,或者也可以分佈到多個網路單元上。可以根據實際的需要選擇其中的部分或者全部模組來實現本實施例方案的目的。 The modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or may also be distributed to multiple networks on the unit. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

另外,在本申請各個實施例中的各功能模組可以集成在一個處理單元中,也可以是各個單元單獨物理存在,也可以兩個或兩個以上單元集成在一個單元中。上述集成的單元既可以採用硬體的形式實現,也可以採用硬體加軟體功能模組的形式實現。 In addition, each functional module in each embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented not only in the form of hardware, but also in the form of hardware plus software function modules.

因此,無論從哪一點來看,均應將實施例看作是示範性的,而且是非限制性的,本申請的範圍由所附請求項而不是上述說明限定,因此旨在將落在請求項的等同要件的含義和範圍內的所有變化涵括在本申請內。不應將請求項中的任何附關聯圖標記視為限制所涉及的請求項。 Therefore, no matter from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the application is defined by the appended claims rather than the above description, so it is intended to All changes within the meaning and range of equivalents of the elements are embraced in this application. Any attached reference mark in a claim shall not be deemed to limit the claim to which it relates.

此外,顯然“包括”一詞不排除其他單元或步驟,單數不排除複數。本申請中陳述的多個單元或裝置也可以由一個單元或裝置透過軟體或者硬體來實現。第一、第二等詞語用來表示名稱,而並不表示任何特定的順序。 In addition, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or devices stated in this application may also be realized by one unit or device through software or hardware. The terms first, second, etc. are used to denote names and do not imply any particular order.

最後應說明的是,以上實施例僅用以說明本申請的技術方案而非限制,儘管參照較佳實施例對本申請進行了詳細說明,本領域的普通技術人員 應當理解,可以對本申請的技術方案進行修改或等同替換,而不脫離本申請技術方案的精神和範圍。 Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and not to limit them. Although the application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art It should be understood that the technical solutions of the present application can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present application.

S10~S16:步驟 S10~S16: Steps

Claims (10)

一種圖像擴增方法,執行於電腦設備,其中,所述圖像擴增方法包括:獲取待擴增圖像及測試圖像,其中,所述測試圖像包括氣體外洩圖像;基於全卷積神經網路構建變分學習器以及判別器;將所述氣體外洩圖像輸入到所述變分學習器中,得到目標圖像;根據所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到變分自編碼器模型;基於所述測試圖像計算所述變分自編碼器模型的重構正確率;若所述重構正確率小於預設閾值,基於所述氣體外洩圖像調整所述變分自編碼器模型,得到擴增模型;將所述待擴增圖像輸入到所述擴增模型中,得到擴增圖像。 An image augmentation method executed on computer equipment, wherein the image augmentation method includes: acquiring an image to be augmented and a test image, wherein the test image includes a gas leakage image; A convolutional neural network constructs a variational learner and a discriminator; the gas leakage image is input into the variational learner to obtain a target image; according to the discrimination of the target image by the discriminator As a result, train the variational learner to obtain a variational autoencoder model; calculate the reconstruction accuracy rate of the variational autoencoder model based on the test image; if the reconstruction accuracy rate is less than a preset threshold, adjusting the variational autoencoder model based on the gas leakage image to obtain an augmented model; inputting the image to be augmented into the augmented model to obtain an augmented image. 如請求項1所述的圖像擴增方法,其中,所述根據所述判別器對所述目標圖像的判別結果訓練所述變分學習器,得到變分自編碼器模型包括:將所述目標圖像輸入到所述判別器中,得到所述判別器將所述目標圖像確定為假圖像的判別概率;將大於或者等於第一預設值的判別概率所對應的目標圖像重新輸入到所述變分學習器中進行訓練,得到第一圖像;基於所述氣體外洩圖像、所述目標圖像及所述第一圖像計算所述變分學習器的損失值,並利用梯度反向傳播更新所述變分學習器的權值,直至所述損失值下降到最低,得到所述變分自編碼器模型。 The image augmentation method according to claim 1, wherein the training of the variational learner according to the discriminant result of the discriminator for the target image, and obtaining the variational autoencoder model includes: The target image is input into the discriminator to obtain the discriminant probability that the discriminator determines the target image as a false image; the target image corresponding to the discriminant probability greater than or equal to the first preset value Re-input into the variational learner for training to obtain a first image; calculate the loss value of the variational learner based on the gas leakage image, the target image and the first image , and use the gradient backpropagation to update the weight value of the variational learner until the loss value drops to the minimum, and obtain the variational autoencoder model. 如請求項2所述的圖像擴增方法,其中,所述基於所述氣體外洩圖像、所述目標圖像及所述第一圖像計算所述變分學習器的損失值包括:所述損失值的計算方法為:
Figure 111109669-A0305-02-0021-5
其中,loss為所述損失值,M是指所述目標圖像中所有畫素點的數量,N是指所述氣體外洩圖像中所有畫素點的數量,K是指所述第一圖像中所有畫素點的數量,i是指所述目標圖像中第i個畫素點,j是指所述氣體外洩圖像中與i對應的畫素點,r是指所述第一圖像中與i對應的畫素點,y i 是指所述目標圖像中第i個畫素點的畫素值,x j 是指所述氣體外洩圖像中第j個畫素點的畫素值,z r 是指所述第一圖像中第r個畫素點的畫素值。
The image augmentation method according to claim 2, wherein the calculating the loss value of the variational learner based on the gas leakage image, the target image and the first image includes: The calculation method of the loss value is:
Figure 111109669-A0305-02-0021-5
Wherein, loss is the loss value, M refers to the number of all pixels in the target image, N refers to the number of all pixels in the gas leakage image, and K refers to the first The number of all pixels in the image, i refers to the i- th pixel in the target image, j refers to the pixel corresponding to i in the gas leakage image, r refers to the The pixel point corresponding to i in the first image, y i refers to the pixel value of the i- th pixel point in the target image, and x j refers to the j -th pixel point in the gas leakage image The pixel value of the pixel point, z r refers to the pixel value of the rth pixel point in the first image.
如請求項1所述的圖像擴增方法,其中,所述基於所述測試圖像計算所述變分自編碼器模型的重構正確率包括:獲取所述測試圖像的標注結果;將所述測試圖像輸入到所述變分自編碼器模型中,得到特徵圖像;計算所述特徵圖像與所述測試圖像之間的相似值;將所述相似值與第二預設值進行比較,得到所述測試圖像的驗證結果;將所述驗證結果與所述標注結果進行比對;將與所述標注結果相同的驗證結果所對應的測試圖像確定為第二圖像,並將所述第二圖像所對應的特徵圖像確定為相似圖像;計算所述相似圖像在所述特徵圖像中所佔的比率,並將所述比率確定為所述重構正確率。 The image augmentation method according to claim 1, wherein the calculation of the reconstruction accuracy rate of the variational autoencoder model based on the test image includes: obtaining the labeling result of the test image; The test image is input into the variational autoencoder model to obtain a feature image; the similarity value between the feature image and the test image is calculated; the similarity value is compared with a second preset Values are compared to obtain the verification result of the test image; the verification result is compared with the labeling result; the test image corresponding to the verification result identical to the labeling result is determined as the second image , and determine the feature image corresponding to the second image as a similar image; calculate the ratio of the similar image in the feature image, and determine the ratio as the reconstructed Correct rate. 如請求項4所述的圖像擴增方法,其中,所述計算所述特徵圖像與所述測試圖像之間的相似值包括:將所述特徵圖像進行灰度化處理,得到灰度化圖像;將所述灰度化圖像進行二值化處理,得到第三圖像;將所述特徵圖像所對應的測試圖像進行灰度化處理及二值化處理,得到第四圖像;計算所述第三圖像與所述第四圖像的相似值,所述相似值的確定公式為:
Figure 111109669-A0305-02-0022-6
c 1=(K 1 L)2c 2=(K 2 L)2;其中,SSIM(x,y)為所述相似值,x為所述第三圖像,y為所述第四圖像,μ x 為所述第三圖像的灰度平均值,μ y 為所述第四圖像的灰度平均值,σ x 為所述第三圖像的灰度標準差,σ y 為所述第四圖像的灰度標準差,σ xy 為所述第三圖像與所述第四圖像之間的灰度協方差,c 1c 2均為預設參數,L為所述第四圖像中最大的畫素值,K 1K 2是預先設置的常數,且K 1≪1,K 2≪1。
The image augmentation method according to claim 4, wherein the calculating the similarity value between the feature image and the test image includes: performing grayscale processing on the feature image to obtain gray The grayscale image is subjected to binarization processing to obtain a third image; the test image corresponding to the feature image is grayscale processed and binarized to obtain a third image. Four images; calculating the similarity value of the third image and the fourth image, the determination formula of the similarity value is:
Figure 111109669-A0305-02-0022-6
c 1 =( K 1 L ) 2 ; c 2 =( K 2 L ) 2 ; wherein, SSIM ( x,y ) is the similarity value, x is the third image, and y is the fourth image Like, μ x is the gray average value of the third image, μ y is the gray average value of the fourth image, σ x is the gray standard deviation of the third image, σ y is The grayscale standard deviation of the fourth image, σxy is the grayscale covariance between the third image and the fourth image, c1 and c2 are preset parameters, and L is the The largest pixel value in the fourth image, K 1 and K 2 are preset constants, and K 1 ≪1, K 2 ≪1.
如請求項1所述的圖像擴增方法,其中,所述基於所述氣體外洩圖像調整所述變分自編碼器模型,得到擴增模型包括:將所述氣體外洩圖像輸入到所述變分自編碼器模型進行訓練,直至所述重構正確率大於或者等於所述預設閾值,得到所述擴增模型。 The image augmentation method according to claim 1, wherein said adjusting the variational autoencoder model based on the gas leak image to obtain an augmented model includes: inputting the gas leak image The variational autoencoder model is trained until the reconstruction accuracy rate is greater than or equal to the preset threshold to obtain the augmented model. 如請求項1所述的圖像擴增方法,其中,所述擴增模型中包括編碼器和解碼器,所述編碼器中採用全卷積神經網路,所述全卷積神經網路包含多個隱層,所述解碼器中採用反卷積神經網路,所述反卷積神經網路中包含多個運算層。 The image augmentation method as described in claim 1, wherein the augmented model includes an encoder and a decoder, and a fully convolutional neural network is used in the encoder, and the fully convolutional neural network includes A plurality of hidden layers, a deconvolution neural network is used in the decoder, and a plurality of operation layers are included in the deconvolution neural network. 如請求項7所述的圖像擴增方法,其中,所述將所述待擴增圖像輸入到所述擴增模型中,得到擴增圖像包括:將所述待擴增圖像輸入到所述編碼器的隱層中進行特徵提取,得到特徵向量,其中,所述特徵向量中有2n個元素;提取所述特徵向量中的前n個元素作為均值向量;提取所述特徵向量中的後n個元素作為標準差向量;根據所述均值向量及所述標準差向量生成高斯亂數;對所述高斯亂數進行隨機採樣,得到採樣值;將所述均值向量中的每個元素與所述採樣值進行相乘運算,得到多個相乘結果; 將每個相乘結果與所述標準差向量中對應的元素進行相加運算,得到潛在向量;將所述潛在變數輸入到所述解碼器的運算層進行映射處理,得到所述擴增圖像。 The image augmentation method according to claim 7, wherein the inputting the image to be augmented into the augmentation model to obtain the augmented image includes: inputting the image to be augmented Perform feature extraction in the hidden layer of the encoder to obtain a feature vector, wherein there are 2 n elements in the feature vector; extract the first n elements in the feature vector as a mean vector; extract the feature vector The latter n elements in the vector are used as standard deviation vectors; Gaussian random numbers are generated according to the mean value vector and the standard deviation vector; random sampling is carried out to the Gaussian random numbers to obtain sampling values; each of the mean value vectors is Elements are multiplied by the sampling value to obtain multiple multiplication results; each multiplication result is added to the corresponding element in the standard deviation vector to obtain a potential vector; the potential variable is input to The operation layer of the decoder performs mapping processing to obtain the augmented image. 一種電腦設備,其中,所述電腦設備包括:儲存器,儲存至少一個指令;及處理器,獲取所述儲存器中儲存的指令以實現如請求項1至8中任意一項所述的圖像擴增方法。 A computer device, wherein the computer device includes: a memory storing at least one instruction; and a processor obtaining the instruction stored in the memory to realize the image as described in any one of claims 1 to 8 Amplification method. 一種電腦可讀儲存介質,其中:所述電腦可讀儲存介質中儲存有至少一個指令,所述至少一個指令被電腦設備中的處理器執行以實現如請求項1至8中任意一項所述的圖像擴增方法。 A computer-readable storage medium, wherein: at least one instruction is stored in the computer-readable storage medium, and the at least one instruction is executed by a processor in a computer device to implement any one of claims 1 to 8. image augmentation method.
TW111109669A 2022-03-16 2022-03-16 Method for expanding images, computer device and storage medium TWI803243B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW111109669A TWI803243B (en) 2022-03-16 2022-03-16 Method for expanding images, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW111109669A TWI803243B (en) 2022-03-16 2022-03-16 Method for expanding images, computer device and storage medium

Publications (2)

Publication Number Publication Date
TWI803243B true TWI803243B (en) 2023-05-21
TW202338730A TW202338730A (en) 2023-10-01

Family

ID=87424583

Family Applications (1)

Application Number Title Priority Date Filing Date
TW111109669A TWI803243B (en) 2022-03-16 2022-03-16 Method for expanding images, computer device and storage medium

Country Status (1)

Country Link
TW (1) TWI803243B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116499607A (en) * 2023-06-27 2023-07-28 之江实验室 Optical fiber sensing signal noise reduction method and device and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522819A (en) * 2018-10-29 2019-03-26 西安交通大学 A kind of fire image recognition methods based on deep learning
TW201920079A (en) * 2017-08-02 2019-06-01 國立大學法人東北大學 Adamantylmethylamine derivative and use thereof as pharmaceutical
US20190171172A1 (en) * 2011-04-14 2019-06-06 Suntracker Technologies Ltd. System and method for the optimization of radiance modelling and controls in predictive daylight harvesting
TW201929940A (en) * 2017-08-29 2019-08-01 美商3M新設資產公司 Air filter condition sensing
CN110185939A (en) * 2019-05-16 2019-08-30 西北工业大学 Gas pipe leakage recognition methods based on convolutional neural networks
TW201941078A (en) * 2018-01-18 2019-10-16 美商奧誓公司 Machine-in-the-loop, image-to-video computer vision bootstrapping

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190171172A1 (en) * 2011-04-14 2019-06-06 Suntracker Technologies Ltd. System and method for the optimization of radiance modelling and controls in predictive daylight harvesting
TW201920079A (en) * 2017-08-02 2019-06-01 國立大學法人東北大學 Adamantylmethylamine derivative and use thereof as pharmaceutical
TW201929940A (en) * 2017-08-29 2019-08-01 美商3M新設資產公司 Air filter condition sensing
TW201941078A (en) * 2018-01-18 2019-10-16 美商奧誓公司 Machine-in-the-loop, image-to-video computer vision bootstrapping
CN109522819A (en) * 2018-10-29 2019-03-26 西安交通大学 A kind of fire image recognition methods based on deep learning
CN110185939A (en) * 2019-05-16 2019-08-30 西北工业大学 Gas pipe leakage recognition methods based on convolutional neural networks

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116499607A (en) * 2023-06-27 2023-07-28 之江实验室 Optical fiber sensing signal noise reduction method and device and storage medium
CN116499607B (en) * 2023-06-27 2023-09-08 之江实验室 Optical fiber sensing signal noise reduction method and device and storage medium

Also Published As

Publication number Publication date
TW202338730A (en) 2023-10-01

Similar Documents

Publication Publication Date Title
US11200424B2 (en) Space-time memory network for locating target object in video content
CN111476284B (en) Image recognition model training and image recognition method and device and electronic equipment
Wang et al. Detect globally, refine locally: A novel approach to saliency detection
CN108182394B (en) Convolutional neural network training method, face recognition method and face recognition device
CN109558832B (en) Human body posture detection method, device, equipment and storage medium
CN111754596B (en) Editing model generation method, device, equipment and medium for editing face image
WO2022105125A1 (en) Image segmentation method and apparatus, computer device, and storage medium
CN111275784B (en) Method and device for generating image
US20230021661A1 (en) Forgery detection of face image
CN113642390B (en) Street view image semantic segmentation method based on local attention network
CN111104925B (en) Image processing method, image processing apparatus, storage medium, and electronic device
CN111814620A (en) Face image quality evaluation model establishing method, optimization method, medium and device
WO2019200702A1 (en) Descreening system training method and apparatus, descreening method and apparatus, device, and medium
WO2021051497A1 (en) Pulmonary tuberculosis determination method and apparatus, computer device, and storage medium
CN111079816A (en) Image auditing method and device and server
CN112560710B (en) Method for constructing finger vein recognition system and finger vein recognition system
CN114842343A (en) ViT-based aerial image identification method
GB2579262A (en) Space-time memory network for locating target object in video content
TWI803243B (en) Method for expanding images, computer device and storage medium
WO2021042544A1 (en) Facial verification method and apparatus based on mesh removal model, and computer device and storage medium
US9928408B2 (en) Signal processing
CN112818774A (en) Living body detection method and device
CN114723652A (en) Cell density determination method, cell density determination device, electronic apparatus, and storage medium
CN113033305B (en) Living body detection method, living body detection device, terminal equipment and storage medium
CN111753729B (en) False face detection method and device, electronic equipment and storage medium