Reshaping Keras layers

前端 未结 2 903
灰色年华
灰色年华 2021-02-08 02:43

I have an input image 416x416. How can I create an output of 4 x 10, where 4 is number of columns and 10 the number of rows?

My label data is 2D array with 4 columns and

2条回答
  •  孤独总比滥情好
    2021-02-08 03:00

    First flatten the (None, 13, 13, 1024) layer

    model.add(Flatten())
    

    it will give 13*13*1024=173056

    1 dimensional tensor

    Then add a dense layer

    model.add(Dense(4*10)) it will output to 40

    this will transform your 3D shape to 1D

    then simply resize to your needs

    model.add(Reshape(4,10))

    This will work but will absolutely destroy the spatial nature of your data

提交回复
热议问题