0
我在Keras中設計了一個圖層。這是網絡的第一層。該層的輸入必須是RGB圖像,即形狀(高度,寬度,3)。但是當我運行代碼時,出現以下錯誤。Keras層輸入類型
ValueError:使用不是符號張量的輸入調用圖層sequential_1。收到的類型:。全輸入:[< main .CountPix object at 0x7fa9a5e81518>]。該層的所有輸入都應該是張量。
我應該如何輸入圖像或在圖層中修改什麼?
類CountPix(層):
def __init__(self, **kwargs):
super(CountPix, self).__init__(**kwargs)
def build(self, input_shape):
# Create a trainable weight variable for this layer.
self.kernel = self.add_weight(name='kernel', shape=((200,200,3)),initializer='uniform',trainable=True)
super(MyLayer, self).build(input_shape) # Be sure to call this somewhere!
只是一個建議,但你應該包括在import語句你的回答讓OP能夠理解'Input'來自哪裏 – gionni
感謝您的提示。 – circuitdesigner5172
當「input_X = Input(shape =(200,200,3),dtype ='float32',name ='input_image')」TypeError:無法將