TextRecognitionDataGenerator icon indicating copy to clipboard operation
TextRecognitionDataGenerator copied to clipboard

KeyError: <weakref at 0x1a29a3e048; to 'tqdm' at 0x1a29a409b0>

Open mayzhaoyu opened this issue 4 years ago • 3 comments

when I input this command trdg --output_dir /Users/zhaoyu/Desktop/synthimage/ -c 2 -rs -sym -r -f 64 -k 4 -rk --blur 3 --random_blur -b 3 -cs 0 -fi -ft /Users/zhaoyu/Desktop/MicrosoftYaHeiUI.ttf then 0%| | 0/2 [00:00<?, ?it/s]multiprocessing.pool.RemoteTraceback: """ Traceback (most recent call last): File "/Users/zhaoyu/anaconda3/lib/python3.6/multiprocessing/pool.py", line 119, in worker result = (True, func(*args, **kwds)) File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/trdg/data_generator.py", line 21, in generate_from_tuple cls.generate(*t) File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/trdg/data_generator.py", line 208, in generate final_image = background_img.filter(gaussian_filter) File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 1177, in filter return self._new(filter.filter(self.im)) File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/PIL/ImageFilter.py", line 168, in filter return image.gaussian_blur(self.radius) ValueError: image has wrong mode """

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/zhaoyu/anaconda3/bin/trdg", line 11, in sys.exit(main()) File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/trdg/run.py", line 414, in main total=args.count, File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 937, in iter for obj in iterable: File "/Users/zhaoyu/anaconda3/lib/python3.6/multiprocessing/pool.py", line 735, in next raise value ValueError: image has wrong mode Exception ignored in: <bound method tqdm.del of 0%| | 0/2 [00:00<?, ?it/s]> Traceback (most recent call last): File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 889, in del File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 1095, in close File "/Users/zhaoyu/anaconda3/lib/python3.6/site-packages/tqdm/_tqdm.py", line 441, in _decr_instances File "/Users/zhaoyu/anaconda3/lib/python3.6/_weakrefset.py", line 109, in remove KeyError: <weakref at 0x1a29a3e048; to 'tqdm' at 0x1a29a409b0>

mayzhaoyu avatar Apr 08 '20 01:04 mayzhaoyu

I'll try and reproduce the bug later today. Thank you for opening an issue.

Belval avatar Apr 08 '20 18:04 Belval

I am afraid I am unable to reproduce your issue on Ubuntu 18.04 with trdg==1.5.0 with the same parameters except for the font which I don't have. I did notice that you were using picture backgrounds so that could be it, are there any pictures in your set that are grayscale?

Belval avatar Apr 08 '20 21:04 Belval

Because some of his pictures are not RGB mode.

Hello-Felix avatar Apr 08 '22 12:04 Hello-Felix