autonise / CRAFT-Remade

Implementation of CRAFT Text Detection
MIT License
191 stars 47 forks source link

ValueError: too many values to unpack (expected 2) #23

Closed ghost closed 5 years ago

ghost commented 5 years ago

When running the detection command on this image, I get error:

(final) home@home-desktop:~/programs/CRAFT-Remade$ python main.py train-synth --mode synthesize --model=./model/final_model.pkl --folder=./input
Will generate the predictions at:  ./target_affinity
Will generate the predictions at:  ./target_character
Will generate the predictions at:  ./word_bbox
  0%|                                                                                                                                                                           | 0/1 [00:00<?, ?it/s]Traceback (most recent call last):
  File "main.py", line 107, in <module>
    main()
  File "/home/home/anaconda3/envs/final/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/home/anaconda3/envs/final/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/home/anaconda3/envs/final/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/home/anaconda3/envs/final/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/home/anaconda3/envs/final/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "main.py", line 61, in train_synth
    base_path_bbox='/'.join(folder.split('/')[:-1])+'/word_bbox',)
  File "/home/home/programs/CRAFT-Remade/train_synth/synthesize.py", line 269, in main
    synthesize(infer_dataloader, model, base_path_affinity, base_path_character, base_path_bbox)
  File "/home/home/programs/CRAFT-Remade/train_synth/synthesize.py", line 101, in synthesize
    affinity_threshold=config.threshold_affinity)['word_bbox']
  File "/home/home/programs/CRAFT-Remade/src/utils/utils.py", line 209, in generate_word_bbox
    all_characters, hierarchy = cv2.findContours(character_heatmap, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
ValueError: too many values to unpack (expected 2)
mayank-git-hub commented 5 years ago

I believe this is an opencv version error You should be using opencv-python==4.1.0.25

ghost commented 5 years ago

yup, thanks