我已经在我的数据集中训练了一个ResNet-100模型,该数据集的输出是浮点数(最后一层是MAERegressionOutput()。
脚本如下: 将mxnet导入为mx 导入argparse 进口泡菜 导入操作系统 将numpy导入为np
testIter = mx.io.ImageRecordIter(
path_imgrec='test.rec',
data_shape=(3, 112, 112),
batch_size=90)
epoch = 4
(symbol, argParams, auxParams) = mx.model.load_checkpoint('age-mse-tutorial-model-r100s', epoch)
# construct the model
model = mx.mod.Module(symbol=symbol, context=[mx.gpu(0)])
model.bind(data_shapes=[('data', (1, 3, 112, 112))],
label_shapes=[('mae_label', (1,))] )
model.set_params(argParams, auxParams)
metric = mx.metric.MAE()
score = model.score(testIter, metric)
print(score)
我得到的错误是
[13:25:28] src/io/iter_image_recordio_2.cc:172: ImageRecordIOParser2: test.rec, use 4 threads for decoding..
/home/anubhav/anaconda3/envs/trueface3.6/lib/python3.6/site-packages/mxnet/module/base_module.py:55: UserWarning: You created Module with Module(..., label_names=['softmax_label']) but input with name 'softmax_label' is not found in symbol.list_arguments(). Did you mean one of:
data
mae_label
warnings.warn(msg)
/home/anubhav/anaconda3/envs/trueface3.6/lib/python3.6/site-packages/mxnet/module/base_module.py:67: UserWarning: Data provided by label_shapes don't match names specified by label_names ([DataDesc[mae_label,(1,),<class 'numpy.float32'>,NCHW]] vs. ['softmax_label'])
warnings.warn(msg)
Traceback (most recent call last):
File "test_1.py", line 27, in <module>
model.set_params(argParams, auxParams)
File "/home/anubhav/anaconda3/envs/trueface3.6/lib/python3.6/site-packages/mxnet/module/module.py", line 350, in set_params
allow_extra=allow_extra)
File "/home/anubhav/anaconda3/envs/trueface3.6/lib/python3.6/site-packages/mxnet/module/module.py", line 309, in init_params
_impl(desc, arr, arg_params)
File "/home/anubhav/anaconda3/envs/trueface3.6/lib/python3.6/site-packages/mxnet/module/module.py", line 300, in _impl
raise RuntimeError("%s is not presented" % name)
RuntimeError: mae_label is not presented
有人可以建议这里出什么问题吗?