-
Notifications
You must be signed in to change notification settings - Fork 755
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
[Feature] Add Satrn #405
[Feature] Add Satrn #405
Conversation
Codecov Report
@@ Coverage Diff @@
## main #405 +/- ##
==========================================
+ Coverage 85.34% 85.50% +0.16%
==========================================
Files 139 142 +3
Lines 9380 9502 +122
Branches 1343 1353 +10
==========================================
+ Hits 8005 8125 +120
- Misses 1065 1066 +1
- Partials 310 311 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! Your work is excellent and really constructive to MMOCR!
I had compared your implementation with the official release and found some differences that should be addressed. Some are not significant but might slightly affect the performance. (We want to be conservative on this model due to its long training cycle) I had also commented on some parts that I'm not quite sure and we can discuss.
Meanwhile, we are also training the full Satrn model so we'll see if the model can match the claimed performance.
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the config to get a closer implementation to the official implementation.
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
For now, I've trained your original Satrn implementation on Synthtext + Mjsynth for 5 epochs, but only got ~ 10%-20% accuracy on test sets. The modified version is still in its first training epoch but gets an average loss of ~0.02 which is 10 times smaller than the original one. I think we are on the right track. |
Well, here's the best result after the 4th epoch:
It's even better than what the original paper have claimed. I feel the model is good enough for now, and I will continue to wrap it up and publish this model soon. Good job! |
好耶!感谢大佬的review和指点! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final code style pass, just a bit of refactoring. I'll push a new readme and ocr.py
to this PR soon.
BTW, Github now supports applying multiple suggestions in a single commit :)
Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
@innerlee @cuhk-hbsun Any general comments? If not, it will be merged tomorrow |
* Add SATRN * Create satrn_small_academic.py * Update README.md * change config name * Update mmocr/models/textrecog/backbones/shallow_cnn.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update configs/textrecog/satrn/satrn_academic.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update configs/textrecog/satrn/satrn_small.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update shallow_cnn.py * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update test_ocr_encoder.py * change keep_aspect_ratio=False * Update transformer_layer.py * Update configs/textrecog/satrn/satrn_small.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update configs/textrecog/satrn/satrn_academic.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update transformer_layer.py * Apply suggestions from code review Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update transformer_layer.py * update satrn readme * add satrn to ocr.py * add satrn_sm and fix configs * add a test for config * add copyright info * use mmocr registry Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
* Add SATRN * Create satrn_small_academic.py * Update README.md * change config name * Update mmocr/models/textrecog/backbones/shallow_cnn.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update configs/textrecog/satrn/satrn_academic.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update configs/textrecog/satrn/satrn_small.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update shallow_cnn.py * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update test_ocr_encoder.py * change keep_aspect_ratio=False * Update transformer_layer.py * Update configs/textrecog/satrn/satrn_small.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update configs/textrecog/satrn/satrn_academic.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update mmocr/models/textrecog/layers/transformer_layer.py Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update transformer_layer.py * Apply suggestions from code review Co-authored-by: Tong Gao <gaotongxiao@gmail.com> * Update transformer_layer.py * update satrn readme * add satrn to ocr.py * add satrn_sm and fix configs * add a test for config * add copyright info * use mmocr registry Co-authored-by: Tong Gao <gaotongxiao@gmail.com>
Hi, 我在我自己的数据集(10w条数据)上使用了 SATRN(https://arxiv.org/pdf/1910.04396.pdf)的 small 版本,最开始的几天 acc 完全没有变化,但之后上升得很快,目前 word_acc=0.9245 并且还在缓慢上升中(执行时间 266:17:00)。
不过我没有足够的资源和时间使用公开数据集,也没有足够显存运行完整的模型,所以没有相应的指标,也不能保证 satrn_academic(论文中的结构)也能得到好的效果……