PaddleOCR SEED recognition 模型无法导出

xmd2e60i  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(159)

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

config_name=rec_resnet_stn_bilstm_att.yml
path_name=rec_resnet_stn_bilstm_att
python tools/export_model.py -c "configs/rec/${config_name}" -o Global.pretrained_model="/Users/xxxx/Downloads/${path_name}/best_accuracy" Global.save_inference_dir="./inference/${path_name}"
  • 完整报错/Complete Error Message:
Traceback (most recent call last):
  File "tools/export_model.py", line 172, in <module>
    main()
  File "tools/export_model.py", line 168, in main
    export_single_model(model, arch_config, save_path, logger)
  File "tools/export_model.py", line 99, in export_single_model
    paddle.jit.save(model, save_path)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/jit.py", line 629, in wrapper
    func(layer, path, input_spec, **configs)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 51, in __impl__
    return func(*args, **kwargs)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/jit.py", line 856, in save
    concrete_program = static_func.concrete_program_specify_input_spec(
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 527, in concrete_program_specify_input_spec
    concrete_program, _ = self.get_concrete_program(
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 436, in get_concrete_program
    concrete_program, partial_program_layer = self._program_cache[cache_key]
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 801, in __getitem__
    self._caches[item_id] = self._build_once(item)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 785, in _build_once
    concrete_program = ConcreteProgram.from_func_spec(
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/wrapped_decorator.py", line 25, in __impl__
    return wrapped_func(*args, **kwargs)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/base.py", line 51, in __impl__
    return func(*args, **kwargs)
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/program_translator.py", line 740, in from_func_spec
    error_data.raise_new_exception()
  File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/dygraph/dygraph_to_static/error.py", line 336, in raise_new_exception
    six.exec_("raise new_exception from None")
  File "<string>", line 1, in <module>
AssertionError: In transformed code:

    File "/Users/xx/Desktop/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 85, in forward
	x = self.head(x, targets=data)
    File "/Users/xx/Desktop/PaddleOCR/ppocr/modeling/heads/rec_aster_head.py", line 63, in forward
	rec_pred, rec_pred_scores = self.decoder.beam_search(
    File "/Users/xx/Desktop/PaddleOCR/ppocr/modeling/heads/rec_aster_head.py", line 174, in beam_search
            shape=[batch_size * beam_width, 1], fill_value=-float('Inf'))
        index = [i * beam_width for i in range(0, batch_size)]
        sequence_scores[index] = 0.0
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE

        # Initialize the input vector

    File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/framework.py", line 2189, in __setitem__
	return _setitem_impl_(self, item, value)
    File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/variable_index.py", line 631, in _setitem_impl_
	return slice_info.set_item(var, value)
    File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/fluid/variable_index.py", line 171, in set_item
	value_broadcast = paddle.broadcast_to(value, gather_tensor_shape)
    File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 1963, in broadcast_to
	attrs['shape'] = get_attr_expand_shape(shape)
    File "/Users/xx/pyenv/versions/3.8.13/lib/python3.8/site-packages/paddle/tensor/manipulation.py", line 1954, in get_attr_expand_shape
	assert shape > 0 or shape == -1, (

    AssertionError: All elements in shape of broadcast_to must be positive or -1.
kb5ga3dv

kb5ga3dv1#

SEED 模型暂时不支持动转静~ 问题还在修复中

相关问题