Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Train problem #60

Open
susanin1970 opened this issue Jun 13, 2020 · 1 comment
Open

Train problem #60

susanin1970 opened this issue Jun 13, 2020 · 1 comment

Comments

@susanin1970
Copy link

susanin1970 commented Jun 13, 2020

Hi!
Firstly, thank you for the code :)
I use your CRNN model for recognition numbers of ISO-containers (ISO 6346)
And I have the problem

I have a small dataset of ISO-numbers (100 train samples and 50 test samples). They look like this:
TGHU6548874_79

I chose various parameters (nepoch, valInterval, saveInterval, etc. and trained model didn't create in the directory after save interval (I use default directory -- "expr")
When I set saveInterval = 1 and valInterval = 1 and try to train, many trained models create in the directory
Changing batch size doesn't help
I use Google Colaboratory for training

What might be the problem?
Maybe I need more train data?
Or choose the right parameters for training?
Thank you on advance for answer :)

P.S. Sorry for my bad English
P.S.S. Can your model recognize vertically oriented text like this?
CAIU7894238_161

@Holmeyoung
Copy link
Owner

if __name__ == "__main__":
    for epoch in range(params.nepoch):
        train_iter = iter(train_loader)
        i = 0
        while i < len(train_loader):
            cost = train(crnn, criterion, optimizer, train_iter)
            loss_avg.add(cost)
            i += 1

            if i % params.displayInterval == 0:
                print('[%d/%d][%d/%d] Loss: %f' %
                      (epoch, params.nepoch, i, len(train_loader), loss_avg.val()))
                loss_avg.reset()

            if i % params.valInterval == 0:
                val(crnn, criterion)

            # do checkpointing
            if i % params.saveInterval == 0:
                torch.save(crnn.state_dict(), '{0}/netCRNN_{1}_{2}.pth'.format(params.expr_dir, epoch, i))

if you have 100 images and you batch_size if 8, so you will have i from 1 to 100//8+1=13. So, if you set saveInterval bigger than 13, it will never equal to 0.
P.S. It can't recognize vertically oriented text like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants