Input to reshape is a tensor with 37632 values, but the requested shape has 150528

前端 未结 3 1732
礼貌的吻别
礼貌的吻别 2020-12-18 03:20

I have the same question:Input to reshape is a tensor with 37632 values, but the requested shape has 150528.

 writer = tf.python_io.TFRecordWriter(\"/home/he         


        
3条回答
  •  清酒与你
    2020-12-18 03:58

    The problem is basically related to shape of Architecture of CNN.Let say I defined architecture shown in picture int coding we defined weights and biases in following way If we see (weights) Lets start with

    wc1 in this layer I defined 32 filters of 3x3 size will be applied

    wc2 in this layer I defined 64 filters of 3x3 size will be applied

    wc3 in this layer I defined 128 filters of 3x3 size will be applied

    wd1 38*38*128 is interesting (Where it comes from).

    And in Architecture we also defined maxpooling concept. See Architecture pic in every step 1.Lets Explain it Let say your input image is 300 x 300 x 1 (in picture it is 28x28x1) 2. (If strides defined is set to 1)Each filter will have an 300x300x1 picture so After applying 32 filter of 3x3 the we will have 32 pictures of 300x300 thus collected images will be 300x300x32

    3.After Maxpooling if (Strides=2 depends what you defined usually it is 2) image size will change from 300 x 300 x 32 to 150 x 150 x 32

    1. (If strides defined is set to 1)Now Each filter will have an 150x150x32 picture so After applying 64 filter of 3x3 the we will have 64 pictures of 300x300 thus collected images will be 150x150x(32x64)

    5.After Maxpooling if (Strides=2 depends what you defined usually it is 2) image size will change from 150x150x(32x64) to 75 x 75 x (32x64)

    1. (If strides defined is set to 1)Now Each filter will have an 75 x 75 x (32x64) picture so After applying 64 filter of 3x3 the we will have 128 pictures of 75 x 75 x (32x64) thus collected images will be 75 x 75 x (32x64x128)

    7.After Maxpooling since dimension of image is 75x75(odd dimension make it even) so it is needed to pad first (if padding defined ='Same') then it will change to 76x76(even) ** if (Strides=2 depends what you defined usually it is 2) image size will change from 76x76x(32x64x128) to **38 x 38 x (32x64x128)

    Now See 'wd1' in coding picture here comes 38*38*128

提交回复
热议问题