簡體   English   中英

在 Keras Python 中調整 Output 層的大小

[英]Resize Output Layer in Keras Python

我的目標是將 output 圖像從[32,32,1]調整為[8,8,1]

我嘗試使用 reshape 進行此操作,但出現錯誤:

Output_model = Reshape((8,8,-1))(out_1)
Error when checking target: expected reshape_1 to have shape (8, 8, 32) but got array with shape (32, 32, 1)

我怎么解決這個問題??

非常感謝

您不能直接重塑數組,因為 32*32*1 不等於 8*8*1,因此您必須進行子采樣:

import keras
x=keras.layers.Input((32,32,1))
x=keras.layers.MaxPooling2D((4,4))(x)

然后您的圖像將下采樣到(8,8,1)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM