bes-dev / crnn-pytorch

Pytorch implementation of OCR system using CRNN + CTCLoss
BSD 2-Clause "Simplified" License
217 stars 55 forks source link

Attribute error due to test dataset.py #5

Closed kai-kaushik closed 6 years ago

kai-kaushik commented 6 years ago

I cloned the repo and installed the dependencies. Then I wanted to train the model for 60 to 100 epoch using the test loader as described in the README file. But when I run the train.py program, I first get an error telling me the dropout should be a number between 0 and 1 in the crnn.py file which by default is set to False. I set it to 0.5 and that error disappeared. but after that, I get the following error

AttributeError: Traceback (most recent call last): File "/home/ubuntu/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 57, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/ubuntu/anaconda3/envs/fastai/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 57, in <listcomp> samples = collate_fn([dataset[i] for i in batch_indices]) File "/new/Kaushik/crnn-pytorch/dataset/test_data.py", line 64, in __getitem__ sample = {"img": img, "seq": seq, "seq_len": len(seq), "aug": self.mode == "train"} AttributeError: 'TestDataset' object has no attribute 'mode'

I am running it on python 3.6 and pytorch version 0.4. Please help me out here.

bes-dev commented 6 years ago

The issue was fixed. Please rebase to upstream