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

Number of epochs #11

Closed
mariembenslama opened this issue May 19, 2019 · 8 comments
Closed

Number of epochs #11

mariembenslama opened this issue May 19, 2019 · 8 comments

Comments

@mariembenslama
Copy link

mariembenslama commented May 19, 2019

Do we have to add more epochs so it's able to recognize better in the demo phase?

I reached 260 and it gave good results but when the number of epochs increases it deviates from the right result and makes wrong guesses. But after that it gets better and later it deviates again.

Does it have to reach 1000 so that it can give the best results and never guesses wrong?

What do you think?

P.S: the program is good. It reached 95% accuracy, but when I want it to learn on noisy images it just takes sometimes to guess good. I shall be patient as you said ^_^

@Holmeyoung
Copy link
Owner

Holmeyoung commented May 20, 2019

Hi, there are two questions.

  1. Number of epoch.

    As we konw, with the training process going, the training loss will reduce all the time. But it's not always a good thing. Because there is a balance between train and test.

    At first, we call it as under-fitting , it means that we have not learned the full feature from the train sample and of course, the test accuracy is not very well.

    The second stage is the balance point between train and test. The training loss is not the lowest and the train accuracy is not the highest, but the model already has generalization.

    After that, yes, our training loss still reduce, but it is overfitting , which means perform well on train sample but bad on test sample, just like what you have said

    when the number of epochs increases it deviates from the right result and makes wrong guesses

    I find a picture from the wikipedia which shows what is overfitting.

    1024px-Overfitting svg

    The black line is the proper one , while the green one is overfitting

  2. About noisy image.

    • If you want to predict on noisy image, then you must train on noisy image.
    • More data can make the model learn all the case and know how to deal with different noisy image.
    • If you use enough noisy data and the model perform well on train sample but perform bad on test, it is overfitting. Use lower epoch and try again.

And...em...how do you like the name holmeyoung , i don't know how to naming an English name. So i don't konw if it is a right name 😕

@mariembenslama
Copy link
Author

mariembenslama commented May 20, 2019

Thank you very much for the answer! So I need to add more varient data. Understood!

Also I think your name is very cute! But I don't know the meaning precisely in Chinese so I can't answer. However in English I guess Holmeyoung = Young Holmes = the young/small detective (The movie) and which I find cute ❤️

@niddal-imam
Copy link

Hi Mariem,

I just have a question as you was able to train your model successfully. Does the test loss starts small and then get bigger and reduced again. The number of epoch is 180 now, and the accuracy doesn't change 0.0000. Actually, I am having hard time training the model.

@mariembenslama
Copy link
Author

mariembenslama commented May 20, 2019

Hello, that did happen to me when the text length (text inside the images of the dataset) was variable. The accuracy increased and the loss decreased when I cha'ged it to a fixed length. Holmeyoung said that it has nothing to do with the length, but just try it haha 😅 It may work for you.

However, this is just a suggestion, can you tell me the steps you followed?

@niddal-imam
Copy link

Thank you for your suggestions. I generates 20,000 images with text of different length. Then, I created txt file contains images paths and labels. Then, I converted the files to train.lmdb and val.lmdb. Finally, I train the model without making any changes in params.py file, but the accuracy doesn't printed out. So I change the valInterval to 300, and the accuracy start to show. However, the accuracy is 0.0000 most of the times. Now, the number of epoch is 240, and the accuracy still 0.0000 :(

@niddal-imam
Copy link

Now the number of epoch is 310, and the accuracy just changed from 0.00000 to 0.000977.

@mariembenslama
Copy link
Author

mariembenslama commented May 20, 2019

I see, change the display interval to 10 and valInterval to 100. Check out issue #3 "cuda gpu" for more explanation by Holmeyoung.

Also try my suggestion about generating text with fixed length. But don't worry because it's able to recognize variable lengths later on after the train. Since we work on RNNs it's able to recognize anything with variable lengths.

Just try fixed in the train phase.

@niddal-imam
Copy link

Thank you very much. I will make the changes, and hopefully it will work fine.
Your help is highly appreciated.

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

3 participants