Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: too many values to unpack (expected 2) in File "/content/PaddleOCR/ppocr/modeling/heads/proposal_local_graph.py" #10430

Closed
Grula opened this issue Jul 18, 2023 · 3 comments
Assignees

Comments

@Grula
Copy link

Grula commented Jul 18, 2023

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

  • 系统环境/System Environment:

( Using on google colab)

  • Ubuntu 20.04.6 LTS \n \l

  • 版本号/Version:Paddle: PaddleOCR: 问题相关组件/Related components:

  • Cloned from github refhead : fac0387

  • paddle version: 2.5.0

  • 运行指令/Command Code:

  • python tools/export_model.py -c configs/det/det_r50_drrg_ctw.yml -o Global.pretrained_model="./output/det_drrg/best_accuracy" Global.save_inference_dir="./output/det_drrg_inference/"
    ( obtained from https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/algorithm_det_drrg_en.md model & config)

  • 完整报错/Complete Error Message:

W0718 17:44:47.579499 17274 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 7.5, Driver API Version: 12.0, Runtime API Version: 11.8
W0718 17:44:47.580794 17274 gpu_resources.cc:149] device: 0, cuDNN Version: 8.9.
Compiling user custom op, it will cost a few seconds.....
[2023-07-18 17:44:51,591] [ INFO] dist.py:985 - running build
[2023-07-18 17:44:51,592] [ INFO] dist.py:985 - running build_ext
2023-07-18 17:44:51,787 - INFO - using custom operator only
[2023-07-18 17:44:51,787] [ INFO] extension_utils.py:1475 - using custom operator only
[2023/07/18 17:44:52] ppocr INFO: load pretrain successful from ./output/det_drrg/best_accuracy
Traceback (most recent call last):
File "/content/PaddleOCR/tools/export_model.py", line 269, in
main()
File "/content/PaddleOCR/tools/export_model.py", line 264, in main
export_single_model(
File "/content/PaddleOCR/tools/export_model.py", line 185, in export_single_model
paddle.jit.save(model, save_path)
File "", line 2, in save
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/wrapped_decorator.py", line 25, in impl
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/jit/api.py", line 752, in wrapper
func(layer, path, input_spec, **configs)
File "", line 2, in save
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/wrapped_decorator.py", line 25, in impl
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/dygraph/base.py", line 75, in impl
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/jit/api.py", line 1043, in save
static_func.concrete_program_specify_input_spec(
File "/usr/local/lib/python3.10/dist-packages/paddle/jit/dy2static/program_translator.py", line 709, in concrete_program_specify_input_spec
concrete_program, _ = self.get_concrete_program(
File "/usr/local/lib/python3.10/dist-packages/paddle/jit/dy2static/program_translator.py", line 589, in get_concrete_program
concrete_program, partial_program_layer = self._program_cache[
File "/usr/local/lib/python3.10/dist-packages/paddle/jit/dy2static/program_translator.py", line 1249, in getitem
self._caches[item_id] = self._build_once(item)
File "/usr/local/lib/python3.10/dist-packages/paddle/jit/dy2static/program_translator.py", line 1193, in _build_once
concrete_program = ConcreteProgram.from_func_spec(
File "", line 2, in from_func_spec
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/wrapped_decorator.py", line 25, in impl
return wrapped_func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/fluid/dygraph/base.py", line 75, in impl
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/paddle/jit/dy2static/program_translator.py", line 1070, in from_func_spec
error_data.raise_new_exception()
File "/usr/local/lib/python3.10/dist-packages/paddle/jit/dy2static/error.py", line 452, in raise_new_exception
raise new_exception from None
ValueError: In transformed code:
File "/content/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 99, in forward
if self.use_head:
File "/content/PaddleOCR/ppocr/modeling/architectures/base_model.py", line 100, in forward
x = self.head(x, targets=data)
File "/content/PaddleOCR/ppocr/modeling/heads/det_drrg_head.py", line 131, in forward
if self.training:
File "/content/PaddleOCR/ppocr/modeling/heads/det_drrg_head.py", line 143, in forward
return self.single_test(inputs)
File "/content/PaddleOCR/ppocr/modeling/heads/det_drrg_head.py", line 165, in single_test
none_flag, graph_data = self.graph_test(pred_maps, feat_maps)
File "/content/PaddleOCR/ppocr/modeling/heads/proposal_local_graph.py", line 382, in call
comp_attribs, text_comps = self.propose_comps_and_attribs(
File "/content/PaddleOCR/ppocr/modeling/heads/proposal_local_graph.py", line 173, in propose_comps_and_attribs
center_region_mask = fill_hole(center_region_mask)
File "/content/PaddleOCR/ppocr/modeling/heads/proposal_local_graph.py", line 36, in fill_hole
def fill_hole(input_mask):
h, w = input_mask.shape
~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
canvas = np.zeros((h + 2, w + 2), np.uint8)
ValueError: too many values to unpack (expected 2)

@Grula
Copy link
Author

Grula commented Jul 18, 2023

Since the model needs to be converted to Numpy data for many times in the forward, DRRG dynamic graph to static graph is not supported.

i missed this

@nguyengiaphuc1992
Copy link

I encountered a similar error, please help me fix it.

@Grula
Copy link
Author

Grula commented Nov 18, 2023

I encountered a similar error, please help me fix it.

Inference of this model is not possible, https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/algorithm_det_drrg_en.md#4-4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants