简体   繁体   English

带有 Keras 和 MXNet 模型的 AWS Deeplens:未找到符号“数据”的 ValueError

[英]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:你可以做两件事:

  • Rename the /conv2d_1_input1 symbol in your -symbol.json file to data .-symbol.json文件中的/conv2d_1_input1符号重命名为data
  • I am not very familiar with how managed the deep lens is, but if you have access to the code that does: 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.

相关问题 将 mxnet 转换为符号模型时出错 - Error in converting mxnet to symbol model 建立keras模型ValueError - building keras Model ValueError AWS:在 DeepLens 设备上运行 Rekognition - AWS : Running Rekognition on DeepLens device 使用MXNet后端时Keras无法加载模型权重 - Keras fails to load model weights when using MXNet backend Tensorflow keras model_load 错误:ValueError:应定义“密集”输入的最后一个维度。 发现“无” - Tensorflow keras model_load error: ValueError: The last dimension of the inputs to `Dense` should be defined. Found `None` Tensorflow Keras:ValueError:发现与任何模型输出不对应的意外损失或指标 - Tensorflow Keras: ValueError: Found unexpected losses or metrics that do not correspond to any Model output Keras ValueError:没有为“添加”提供数据。 需要每个键的数据: ['add'] 使用 Model API - Keras ValueError: No data provided for “add”. Need data for each key in: ['add'] using Model API RNN,Keras,Python:Min Max Scaler Data normalization ValueError:找到暗淡的数组 3。估计器预期 &lt;= 2 - RNN, Keras, Python: Min Max Scaler Data normalization ValueError: Found array with dim 3. Estimator expected <= 2 Keras model.predict 导致 ValueError - Keras model.predict causing a ValueError model.fit keras 和用户代码中的 ValueError - ValueError in model.fit keras and user code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM