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

submit micronet #5169

Closed
wants to merge 2 commits into from
Closed

submit micronet #5169

wants to merge 2 commits into from

Conversation

bupt906
Copy link
Contributor

@bupt906 bupt906 commented Jan 5, 2022

论文链接
参考代码
我的工作

  • 将pytorch代码转换成paddle代码,按照PaddleOCR的代码风格集成到项目中。
  • 调整代码,使backbone结构输出的维度为[n, 432, 1, 80]
  • 在自己的中文数据集(200W+)上做实验验证结构的可行性:
    • backbone网络结构为MicronetM0时,训练时的IPS值在90左右,训练了30轮,训练时acc为57%左右,验证集准确率为77%。
    • backbone网络结构为MicronetM3时,训练时的IPS值在50左右,非常慢。所以没有进行30轮的训练。
    • 经过分析:模型耗时的地方在作者提出的Dynamic Shift-Max激活函数,我将此激活函数替换成Rule6激活函数, backbone网络结构为MicronetM3时,训练时的IPS值在150左右,训练了30轮,训练时acc为67%左右,验证准确率为82%。
    • 实验环境及参数
      单机4卡(V100,32G),num_workers=8,batch_size=256

@CLAassistant
Copy link

CLAassistant commented Jan 5, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ bupt906
❌ zhangxinyu15


zhangxinyu15 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@paddle-bot-old
Copy link

paddle-bot-old bot commented Jan 5, 2022

Thanks for your contribution!

@bupt906 bupt906 mentioned this pull request Jan 5, 2022
@littletomatodonkey
Copy link
Collaborator

你好,ocr10日课中,提供了这样一个识别数据集,可以基于这个数据集,看下mv3 small 0.5x或者mv1enhance0.5x和micronet的精度差异(仅backbone部分不同,其他部分参数保持一致)

https://paddleocr.bj.bcebos.com/dataset/rec_data_lesson_demo.tar

@@ -0,0 +1,432 @@
from __future__ import absolute_import
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要添加license,可以参考其他的文件头

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


class h_swish(nn.Layer):
def __init__(self):
super(h_swish, self).__init__()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. super(h_swish, self).__init__() -> super().__init__()
  2. paddle有现成的hardsigmoid与hardswish api,可以直接调用,这个可以删掉
  3. 类名首字母大写,不建议用小写+下划线方式

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done



class MicroNet(nn.Layer):
def __init__(self, mode='M0', **kwargs):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以在这里添加下reference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -0,0 +1,104 @@
import paddle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

license

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件中仅有一个class了,合并到了rec_micronet.py中。

import paddle.nn.functional as F


class h_sigmoid(nn.Layer):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个用标准api替代吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return self.relu(x + 3) * self.h_max


class DYShiftMax(nn.Layer):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件放在backbone目录下面吧,跟optimizer没啥关系

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个文件中仅有一个class了,合并到了rec_micronet.py中。

@bupt906
Copy link
Contributor Author

bupt906 commented Jan 6, 2022

你好,ocr10日课中,提供了这样一个识别数据集,可以基于这个数据集,看下mv3 small 0.5x或者mv1enhance0.5x和micronet的精度差异(仅backbone部分不同,其他部分参数保持一致)

https://paddleocr.bj.bcebos.com/dataset/rec_data_lesson_demo.tar

好的,我这几天训练一下

@Evezerest Evezerest added the community Improvement from the community label Jan 6, 2022
@bupt906
Copy link
Contributor Author

bupt906 commented Jan 12, 2022

你好,ocr10日课中,提供了这样一个识别数据集,可以基于这个数据集,看下mv3 small 0.5x或者mv1enhance0.5x和micronet的精度差异(仅backbone部分不同,其他部分参数保持一致)

https://paddleocr.bj.bcebos.com/dataset/rec_data_lesson_demo.tar

目前我不知道如何提交具体的log,所有上传到了百度云盘,链接: https://pan.baidu.com/s/1zKI--IZen-HiT3zwirqpsQ 密码: ir8n。里面有我做的实验log和可视化图。

@littletomatodonkey
Copy link
Collaborator

你好,ocr10日课中,提供了这样一个识别数据集,可以基于这个数据集,看下mv3 small 0.5x或者mv1enhance0.5x和micronet的精度差异(仅backbone部分不同,其他部分参数保持一致)
https://paddleocr.bj.bcebos.com/dataset/rec_data_lesson_demo.tar

目前我不知道如何提交具体的log,所有上传到了百度云盘,链接: https://pan.baidu.com/s/1zKI--IZen-HiT3zwirqpsQ 密码: ir8n。里面有我做的实验log和可视化图。

跟onecycle那个pr相同,把log和指标贴在这个pr下面就ok哈,代码方面我没问题了~

@bupt906
Copy link
Contributor Author

bupt906 commented Jan 12, 2022

你好,ocr10日课中,提供了这样一个识别数据集,可以基于这个数据集,看下mv3 small 0.5x或者mv1enhance0.5x和micronet的精度差异(仅backbone部分不同,其他部分参数保持一致)
https://paddleocr.bj.bcebos.com/dataset/rec_data_lesson_demo.tar

目前我不知道如何提交具体的log,所有上传到了百度云盘,链接: https://pan.baidu.com/s/1zKI--IZen-HiT3zwirqpsQ 密码: ir8n。里面有我做的实验log和可视化图。

跟onecycle那个pr相同,把log和指标贴在这个pr下面就ok哈,代码方面我没问题了~

pr5169_micronet.zip
里面没有训练过程中保存的模型。

@bupt906
Copy link
Contributor Author

bupt906 commented Jan 13, 2022

9065116

修改了commit的用户名和邮箱,之前cla一直没成功。

@bupt906 bupt906 closed this Jan 13, 2022
@bupt906 bupt906 deleted the zxy_dev branch January 13, 2022 06:05
@bupt906 bupt906 mentioned this pull request Jan 13, 2022
an1018 pushed a commit to an1018/PaddleOCR that referenced this pull request Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Improvement from the community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants