[英]AWS Deeplens with Keras and MXNet Model: ValueError for symbol 'data' not found
I have a CNN model that I made using Keras using MXNet as the backend.我有一个使用 MXNet 作为后端使用 Keras 制作的 CNN 模型。 I am able to create, train, and export a model without a hitch.我能够毫不费力地创建、训练和导出模型。 However, when I attempted to load this model to the DeepLens, I get the following error:但是,当我尝试将此模型加载到 DeepLens 时,出现以下错误:
ValueError: [91mYou created Module with Module(..., data_names=['data']) but input with name 'data' is not found in symbol.list_arguments(). Did you mean one of:
/conv2d_1_input1
conv2d_1/kernel1
conv2d_1/bias1
conv2d_2/kernel1
conv2d_2/bias1
conv2d_3/kernel1
conv2d_3/bias1
dense_1/kernel1
dense_1/bias1
dense_2/kernel1
dense_2/bias1
dense_3/kernel1
dense_3/bias1[0m
I never made an argument for a symbol named data
.我从未为名为data
的符号提出过论点。 All of the other symbols make sense because those were derived from my model.所有其他符号都有意义,因为它们是从我的模型中派生出来的。 I have added all the code associated with Keras CNN creation below.我在下面添加了与 Keras CNN 创建相关的所有代码。
model = Sequential()
model.add(Conv2D(8, (1,1), input_shape=inputShape))
model.add(Dropout(0.5))
model.add(Activation('relu'))
model.add(Conv2D(16, (1,1), padding='same'))
model.add(Dropout(0.5))
model.add(Activation('relu'))
model.add(Conv2D(32, (1,1), padding='same'))
model.add(Dropout(0.5))
model.add(Activation('relu'))
model.add(Flatten())
model.add(Dense(240))
model.add(Activation('relu'))
model.add(Dense(120))
model.add(Dense(2))
model.add(Activation('sigmoid'))
Is there a way around this or a way to work with this using Keras with MXNet as the backend?有没有办法解决这个问题,或者有办法使用 Keras 和 MXNet 作为后端来处理这个问题? Do I have to run a command on the Amazon Deeplens?我是否必须在 Amazon Deeplens 上运行命令? Is there something I have to add into the model?有什么我必须添加到模型中的吗?
Effectively the problem is that the default name of the input symbol in MXNet is data
.实际上,问题在于 MXNet 中输入符号的默认名称是data
。 In Keras it seems that the default name used for the input symbol is /conv2d_1_input1
.在/conv2d_1_input1
用于输入符号的默认名称似乎是/conv2d_1_input1
。 You can two things:你可以做两件事:
/conv2d_1_input1
symbol in your -symbol.json
file to data
.将-symbol.json
文件中的/conv2d_1_input1
符号重命名为data
。Module(..., data_names=['data'])
replace it with Module(..., data_names=['/conv2d_1_input1'])
like in this tutorial我不太熟悉深度镜头的管理方式,但是如果您可以访问执行以下操作的代码: Module(..., data_names=['data'])
将其替换为Module(..., data_names=['/conv2d_1_input1'])
就像在本教程中一样
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.