in predict assert self.binded and self.params_initialized AssertionError

错误一:in predict     assert self.binded and self.params_initialized AssertionError  ###需要绑定data_shape
错误二:InferShape pass cannot decide shapes for the following arguments (0s means unknown dimensions). Please consider providing them as inputs:
softmax_label: (), ##提示需要绑定label_shape

    model = mx.mod.Module.load('symbol/ocr',100)
    data_shape = [("data", (1, 3, 60, 60))]  #####问题一原因
    label_shape=[("softmax_label",(1,))]    #####问题二原因
    model.bind(data_shape,label_shape)    #####解决问题
    
    #help(model)
    res =  np.array(model.predict(val)[0])
    print "预测结果为:%s" %(np.argmax(res))

添加##### 结尾的3句代码

你可能感兴趣的:(Python)