ValueError:检查目标时出错:预期activation_33具有形状(2,),但数组的形状为(1,)

时间:2018-08-22 21:57:58

标签: neural-network deep-learning classification conv-neural-network

使用以下模型对图像进行2类分类。

model %>%
  layer_conv_2d(filter=32,kernel_size=c(3,3),padding="same",
                input_shape=c(32,32,3)) %>%
  layer_activation("relu") %>%
  layer_conv_2d(filter=32,kernel_size=c(3,3)) %>%
  layer_activation("relu") %>%
  layer_max_pooling_2d(pool_size=c(2,2)) %>%
  layer_dropout(0.25) %>%

  layer_conv_2d(filter=64 , kernel_size=c(3,3),padding="same") %>%
  layer_activation("relu") %>%
  layer_conv_2d(filter=64,kernel_size=c(3,3) ) %>%
  layer_activation("relu") %>%
  layer_max_pooling_2d(pool_size=c(2,2)) %>%
  layer_dropout(0.25) %>%

  layer_flatten() %>%
  layer_dense(512) %>%
  layer_activation("relu") %>%
  layer_dropout(0.5) %>%
  layer_dense(2) %>%
  layer_activation("softmax") 

出现以下错误

py_call_impl(可调用,dots $ args,dots $ keywords)错误:   ValueError:检查目标时出错:预期activation_33的形状为(2,),但数组的形状为(1,)

任何人都可以在这里帮助

0 个答案:

没有答案