crnn-pytorch icon indicating copy to clipboard operation
crnn-pytorch copied to clipboard

Traanning Question

Open DLWangSan opened this issue 4 years ago • 3 comments

Hello, Thanks for your contribution! When I was training my data use:

train.py --trainroot lmdb\data\train\data.mdb --valroot lmdb\data\val\data,mdb

the program reply me with:

Traceback (most recent call last):
  File "train.py", line 63, in <module>
    train_loader, val_loader = data_loader()
  File "train.py", line 46, in data_loader
    train_dataset = dataset.lmdbDataset(root=args.trainroot)
  File "C:\projectFiles\pythonProject\learnining\crnn-pytorch-master\dataset.py", line 20, in __init__
    self.env = lmdb.open(
lmdb.Error: lmdb\data\train\data.mdb: ϵͳ�Ҳ���ָ����·����

and if i use the following instruction:

python train.py --trainroot lmdb\data\train\ --valroot lmdb\data\val

the program reply me with nothing. So i add a line in train.pyfile:

print("Len:", len(train_loader))

then the program reply with

CRNN(
  (cnn): Sequential(
    (conv0): Conv2d(1, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (relu0): ReLU(inplace=True)
    (pooling0): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (conv1): Conv2d(64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (relu1): ReLU(inplace=True)
    (pooling1): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)
    (conv2): Conv2d(128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (batchnorm2): BatchNorm2d(256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (relu2): ReLU(inplace=True)
    (conv3): Conv2d(256, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (relu3): ReLU(inplace=True)
    (pooling2): MaxPool2d(kernel_size=(2, 2), stride=(2, 1), padding=(0, 1), dilation=1, ceil_mode=False)
    (conv4): Conv2d(256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (batchnorm4): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (relu4): ReLU(inplace=True)
    (conv5): Conv2d(512, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))
    (relu5): ReLU(inplace=True)
    (pooling3): MaxPool2d(kernel_size=(2, 2), stride=(2, 1), padding=(0, 1), dilation=1, ceil_mode=False)
    (conv6): Conv2d(512, 512, kernel_size=(2, 2), stride=(1, 1))
    (batchnorm6): BatchNorm2d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
    (relu6): ReLU(inplace=True)
  )
  (rnn): Sequential(
    (0): BidirectionalLSTM(
      (rnn): LSTM(512, 256, bidirectional=True)
      (embedding): Linear(in_features=512, out_features=256, bias=True)
    )
    (1): BidirectionalLSTM(
      (rnn): LSTM(256, 256, bidirectional=True)
      (embedding): Linear(in_features=512, out_features=131, bias=True)
    )
  )
)
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1
Len: 1

I don't know why my Len is 1,and I do not know how to do. Thanks!

DLWangSan avatar Dec 06 '20 14:12 DLWangSan

@Holmeyoung

Zrufy avatar Jan 08 '21 17:01 Zrufy

how many images have in your dataset i think depend from param you use but @Holmeyoung is more prepared than me.

Zrufy avatar Jan 08 '21 17:01 Zrufy

I also have this problem and I don't know why, I have 500 images as training images but the len(train_loader) is only 8. Why is that?

MrComNguoi avatar Sep 20 '22 03:09 MrComNguoi