whywhs / Pytorch-Handwritten-Mathematical-Expression-Recognition

This program uses Attention and Coverage to realize HMER and this program is based on Pytorch.
MIT License
213 stars 79 forks source link

The error when I try to change the batch_size #3

Open StephenChen625 opened 5 years ago

StephenChen625 commented 5 years ago

@whywhs First of all, thank you very much for providing the source code. The training process was too slow when I run with the default settings(about 20 minutes/epoch). I tried to add the num_workers, but there's not much improvement.

When I wanted to change the batch_size to 2 or 4, the following error occurred: 2019-03-22 16-38-45屏幕截图

Could you please help me solve the problem? Thanks a lot.

whywhs commented 5 years ago

Sure, I'm glad to answer your question. I'm sorry for that I didn't add batch_size to this project. So, if you add batch_size, the error will occur.

StephenChen625 commented 5 years ago

Thanks for your answer. Okay. I'm going to run a weekend under the setting, and see the results. By the way, how many epochs are needed before convergence? I have run 14 epochs, but the sacc is still 0.

Here is part of my log info: epoch is 14, the whole loss is 10.573622 wer is 0.50119 sacc is 0.00000 the best is 0.479045

whywhs commented 5 years ago

yes, I have also noticed this problem. I've been ran about 120 epochs, and the sacc is always 0. I'm also confused and I don't know what's wrong.
Recently, I've been updating my program and try to solve this bug. Meanwhile, I suggest you try to test accuracy with Densenet_testway.py

StephenChen625 commented 5 years ago

Looking forward to the updates. Ok, I'll try the Densenet_testway.py. Thanks again.

StephenChen625 commented 5 years ago

Thanks so much for updating your code. Now I've successfully trained on batch.

Here is some problems when I tried to train:

  1. Error: ModuleNotFoundError: No module named 'Resnet101' Solution: Comment the line 16 in Train.py "# from Resnet101 import resnet101"

  2. Error:FileNotFoundError: [Errno 2] No such file or directory: 'densenet121-a639ec97.pth' Solution: I downloaded the model by hand through the urls in Densenet_torchvision.py "'https://download.pytorch.org/models/densenet121-a639ec97.pth'". I don't know why it didn't download automatically.

By the way, I found a new paper about HMER, which claims to have a very good result. I'm new to deep learning, so I'm unable to realize it. But I hope it can help you with your research. Paper: Transcribing Content from Structural Images with Spotlight Mechanism http://staff.ustc.edu.cn/~cheneh/paper_pdf/2018/Yu-Yin-KDD.pdf 图片

whywhs commented 5 years ago

Hi, Thanks for you to remind me about the BUG from my code. If you want to download the pretrain Densenet, you can use this https://download.pytorch.org/models/densenet121-a639ec97.pth Finally, I will read this paper and see what I can do

StephenChen625 commented 5 years ago

Thanks. I'll follow your updates.

caozhengquan commented 5 years ago

Hi, Thanks for you to remind me about the BUG from my code. If you want to download the pretrain Densenet, you can use this https://download.pytorch.org/models/densenet121-a639ec97.pth Finally, I will read this paper and see what I can do

Could you add the paper you reference to the Readme file please

whywhs commented 5 years ago

You can find additional information from 'version_before.md'