Sierkinhane / CRNN_Chinese_Characters_Rec

(CRNN) Chinese Characters Recognition.
1.83k stars 541 forks source link

迭代若干次就会报找不到图片的错,我看基本五万次之后就能收敛了,问一下怎么改迭代次数,或者下面错误的原因是什么呢,求大佬帮忙。 #284

Open 8125345 opened 3 years ago

8125345 commented 3 years ago

Epoch: [0][59460/102488] Time 0.087s (0.087s) Speed 366.4 samples/s Data 0.002s (0.009s) Loss 0.01915 (0.49964) torch.Size([32, 512, 1, 41]) torch.Size([32, 512, 1, 41]) torch.Size([32, 512, 1, 41]) torch.Size([32, 512, 1, 41]) torch.Size([32, 512, 1, 41]) torch.Size([32, 512, 1, 41]) torch.Size([32, 512, 1, 41]) torch.Size([32, 512, 1, 41]) Traceback (most recent call last): File "train.py", line 160, in main() File "train.py", line 135, in main function.train(config, train_loader, train_dataset, converter, model, criterion, optimizer, device, epoch, writer_dict, output_dict) File "/data/OCR/CRNN_Chinese_Characters_Rec-stable/CRNN_Chinese_Characters_Rec-stable/lib/core/function.py", line 36, in train for i, (inp, idx) in enumerate(train_loader): File "/home/topmoo/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 819, in next return self._process_data(data) File "/home/topmoo/anaconda3/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 846, in _process_data data.reraise() File "/home/topmoo/anaconda3/lib/python3.6/site-packages/torch/_utils.py", line 369, in reraise raise self.exc_type(msg) cv2.error: Caught error in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/anaconda3/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/data/OCR/CRNN_Chinese_Characters_Rec-stable/CRNN_Chinese_Characters_Rec-stable/lib/dataset/_360cc.py", line 45, in getitem img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) cv2.error: OpenCV(3.4.10) /opencv-3.4.10/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

8125345 commented 3 years ago

不好意思说错了,不是迭代五万次就收敛了

liangcaihua commented 3 years ago

我也遇到过, 我是把image文件重新解压增覆盖一下就好了, 可能是图片文件有损坏的, 必竟好几万个文件呢