You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I'm using the crnn-pytorch project to train a new model with my custom dataset, but when I run the command python train.py --data-path datatrain --test-init True --test-epoch 10 --output-dir snapshot --batch-size 8, it returned the error like this
python train.py --data-path datatrain --test-init True --test-epoch 10 --output-dir snapshot --batch-size 8
Test phase
0%| | 0/1 [00:00<?, ?it/s]Traceback (most recent call last):
File "train.py", line 108, in
main()
File "/home/trungle/anaconda3/lib/python3.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/home/trungle/anaconda3/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/trungle/anaconda3/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/trungle/anaconda3/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "train.py", line 67, in main
acc, avg_ed = test(net, data, data.get_abc(), cuda, visualize=False)
File "/home/trungle/PycharmProjects/crnn-pytorch/test.py", line 28, in test
for sample in iterator:
File "/home/trungle/anaconda3/lib/python3.7/site-packages/tqdm/_tqdm.py", line 979, in iter
for obj in iterable:
File "/home/trungle/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 637, in next
return self._process_next_batch(batch)
File "/home/trungle/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 658, in _process_next_batch
raise batch.exc_type(batch.exc_msg)
cv2.error: Traceback (most recent call last):
File "/home/trungle/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/trungle/anaconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 138, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/trungle/PycharmProjects/crnn-pytorch/dataset/text_data.py", line 37, in getitem
sample = self.transform(sample)
File "/home/trungle/anaconda3/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 49, in call
img = t(img)
File "/home/trungle/PycharmProjects/crnn-pytorch/dataset/data_transform.py", line 17, in call
sample["img"] = cv2.resize(sample["img"], self.size)
cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/imgproc/src/resize.cpp:4044: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
I'm pretty sure that the data and desc.json are in the right format.
If anyone can help I would be very appreciated, thanks so much.
The text was updated successfully, but these errors were encountered:
lqtrung-95
changed the title
Error when training with custom dataset: 'list' object has no attribute 'find'
Error when training with custom dataset: cv2.error error: (-215:Assertion failed) !ssize.empty() in function 'resize'
Mar 5, 2019
I was having the same issue and I seem to have solved it. After investigating my issue, this error was appearing due to the image being None. This was caused by dataset/text_data.py attempting to read path/to/dataset/image_name and not finding an image there. The image is actually located in path/to/dataset/data/image_name as described in the README. The proper path is actually commented out in line 32 in dataset/text_data.py and I'm not sure why. Is this a bug?
So the solution for me was to uncomment line 32 and comment line 33
Hi I'm using the crnn-pytorch project to train a new model with my custom dataset, but when I run the command python train.py --data-path datatrain --test-init True --test-epoch 10 --output-dir snapshot --batch-size 8, it returned the error like this
I'm pretty sure that the data and desc.json are in the right format.
If anyone can help I would be very appreciated, thanks so much.
The text was updated successfully, but these errors were encountered: