我正在嘗試使用 GAN 從衛星影像中生成影像。盡管原始影像是使用 3 個顏色通道匯入的,但模型在前 300-500 個 epoch 中生成的影像通常具有非常不同的配色方案:黃色、綠色和藍色。請參見下面的示例:
我的期望是影像通常具有與源影像相似的配色方案,即使從訓練開始也是如此。所以我的問題是:這是正常行為嗎?如果不是,可能是什么原因造成的?
匯入資料集的代碼是:
def create_training_data():
for img in os.listdir(path):
try:
img_array = cv2.imread(os.path.join(path,img), 1)
new_array = cv2.resize(img_array, (200, 200))
training_data.append([new_array])
except Exception as e:
pass
保存生成影像的代碼是:
def save_imgs(epoch):
noise = np.random.normal(0, 1, (1, 100))
gen_imgs = generator.predict(noise)
gen_imgs = 0.5 * gen_imgs 0.5 #rescaling
img_array = np.reshape(gen_imgs, (1,200,200,3))
plt.imshow(img_array[0,:,:,0])
plt.axis('off')
plt.savefig("generated/generated_%d.png" % epoch)
plt.close()
我主要基于這個框架的
uj5u.com熱心網友回復:
顏色不是由 GAN 生成的,它只是 viridis 顏色圖,當您可視化灰度影像時將其選為默認值,這就是您在此處切片第 0 個通道所做的plt.imshow(img_array[0,:,:,0]):如果你這樣做會發生什么plt.imshow(img_array[0,:,:,:])?
有關顏色圖的更多資訊:https ://matplotlib.org/stable/tutorials/colors/colormaps.html
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/443317.html
標籤:Python 张量流 计算机视觉 简历2 生成对抗网络
上一篇:如何在Python中使用pandaspd.read_xml讀取具有多個資料的xml標簽?
下一篇:TensorFlowNET:TransferLearningWithInceptionV3示例中的IndexOutOfRangeException
