Closed upupbo closed 4 years ago
检查一下你的参数设置、图片集和标签文件。这个报错似乎是图片没有读进去。我之前也遇到过。 另外你可以参考这个issue #142,似乎是同样的问题。
Traceback (most recent call last): File "crnn_main_v2.py", line 183, in main(crnn, train_loader, val_loader, criterion, optimizer) File "crnn_main_v2.py", line 115, in main train(crnn, train_loader, criterion, Iteration) File "crnn_main_v2.py", line 88, in train for i_batch, (image, index) in enumerate(train_loader): File "/home/cb/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in next return self._process_next_batch(batch) File "/home/cb/anaconda3/lib/python3.6/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/cb/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/cb/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/cb/code/ocr/dataset_v2.py", line 65, in getitem image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(4.1.0) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'
老兄你还在吗,我跟你一样出现了这个问题,你怎么解决的?
这个问题你们解决了吗?我刚也遇见了一模一样的问题
这个问题你们解决了吗?我刚也遇见了一模一样的问题
解决了,用notepad把txt改成utf-8
Traceback (most recent call last): File "crnn_main_v2.py", line 183, in
main(crnn, train_loader, val_loader, criterion, optimizer)
File "crnn_main_v2.py", line 115, in main
train(crnn, train_loader, criterion, Iteration)
File "crnn_main_v2.py", line 88, in train
for i_batch, (image, index) in enumerate(train_loader):
File "/home/cb/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 637, in next
return self._process_next_batch(batch)
File "/home/cb/anaconda3/lib/python3.6/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/cb/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/cb/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 138, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/cb/code/ocr/dataset_v2.py", line 65, in getitem
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(4.1.0) /io/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'