• Z
    zzl669

    @jinfagang
    D:\Python36\python.exe D:/sdxx1/sd37/demo.py
    INFO 10-04 18:20:47 demo.py:46 - model loaded.
    assets\0.png
    INFO 10-04 18:20:49 demo.py:52 - model resumed from: ./checkpoints\cn_ocr-1.ckpt at epoch: 1
    Traceback (most recent call last):
    File "D:/sdxx1/sd37/demo.py", line 76, in
    predict(model, img_f)
    File "D:/sdxx1/sd37/demo.py", line 65, in predict
    out = model(img).numpy()
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 891, in call
    outputs = self.call(cast_inputs, *args, **kwargs)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\keras\engine\sequential.py", line 256, in call
    return super(Sequential, self).call(inputs, training=training, mask=mask)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\keras\engine\network.py", line 708, in call
    convert_kwargs_to_constants=base_layer_utils.call_context().saving)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\keras\engine\network.py", line 860, in _run_internal_graph
    output_tensors = layer(computed_tensors, **kwargs)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\keras\engine\base_layer.py", line 891, in call
    outputs = self.call(cast_inputs, *args, **kwargs)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\keras\layers\convolutional.py", line 197, in call
    outputs = self._convolution_op(inputs, self.kernel)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\ops\nn_ops.py", line 1134, in call
    return self.conv_op(inp, filter)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\ops\nn_ops.py", line 639, in call
    return self.call(inp, filter)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\ops\nn_ops.py", line 238, in call
    name=self.name)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\ops\nn_ops.py", line 2010, in conv2d
    name=name)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\ops\gen_nn_ops.py", line 1031, in conv2d
    data_format=data_format, dilations=dilations, name=name, ctx=_ctx)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\ops\gen_nn_ops.py", line 1130, in conv2d_eager_fallback
    ctx=_ctx, name=name)
    File "C:\Users\Administrator\AppData\Roaming\Python\Python36\site-packages\tensorflow_core\python\eager\execute.py", line 67, in quick_execute
    six.raise_from(core._status_to_exception(e.code, message), None)
    File "", line 3, in raise_from
    tensorflow.python.framework.errors_impl.UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above. [Op:Conv2D]

    发布在 社区求助区(SOS!!) 阅读更多
  • Z
    zzl669

    def predict(model, img_f):
    ori_img = cv2.imread(img_f)
    img = tf.expand_dims(ori_img[:, :, 0], axis=-1)
    img = tf.image.resize(img, (target_size, target_size))
    img = (img - 128.)/128.
    img = tf.expand_dims(img, axis=0)

    out = model(img).numpy()
    print('predict: {}'.format(characters[np.argmax(out[0])]))
    cv2.imwrite('assets/pred_{}.png'.format(characters[np.argmax(out[0])]), ori_img)
    

    INFO 10-04 12:34:37 demo.py:52 - model resumed from: ./checkpoints\cn_ocr-1.ckpt at epoch: 1
    Traceback (most recent call last):
    File "D:/sdxx1/sd37/demo.py", line 76, in
    predict(model, img_f)
    File "D:/sdxx1/sd37/demo.py", line 65, in predict
    out = model(img).numpy()
    运行到“ out = model(img).numpy()” 报错,请问是什么原因

    发布在 社区求助区(SOS!!) 阅读更多

与 ManaAI社区 的连接断开,我们正在尝试重连,请耐心等待