当前位置:   article > 正文

中国身份证图片识别_paddle identity

paddle identity

基于paddle的身份证识别

identity是一个基于paddle的中文身份证图片识别

安装

conda create --name identity python=3.7 -y
  • 1
conda activate identity
  • 1
pip install -r requirement.txt -i https://mirror.baidu.com/pypi/simple --user
  • 1
conda install shapely -y
  • 1
python home.py
  • 1

下载模型文件

identity-release

├──inference

├────ch_ppocr_server_v2.0_det_infer

├────ch_ppocr_server_v2.0_rec_infer

├──home.py

链接:https://pan.baidu.com/s/1arP2DrjVZ0MkUavE4Fdm1g
提取码:1342

启动后的测试页面

http://localhost:8800/page
在这里插入图片描述

api调用

POST form表单提交

请求

file_type   文件类型:file上传文件方式,url http链接的方式识别
side        正反面:front 正面,back背面
file        文件上传:如果file_type是file,则此字段必传
url         url方式:如果file_type是url,则此字段必传
  • 1
  • 2
  • 3
  • 4

正面响应

{
    "errmsg": "success",
    "errno": 0,
    "result": {
        "birthday": "1990年11月12日",
        "gender": "女",
        "id": "42xxxxxxxxxxxxxxxxx3",
        "name": "徐无为",
        "nation": "汉"
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

反面响应

{
    "errmsg": "success",
    "errno": 0,
    "result": {
        "end_date": "2036.02.03",
        "sign": "北京中关村公安局",
        "start_date": "2016.02.03"
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9

errno错误码

0         参数正确进行识别
1001      file_type must be `file` or `url`.
1002      side must be `front` or `back`.
1000      other error.
1003      secret error.
1004      not support image type.
1005      identification error.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

gpu调用

如果要使用paddlepaddle的gpu版本,可以在 https://www.paddlepaddle.org.cn/ 选择自己需要的版本。
修改Config.py文件的 is_gpu=True

配置

config.py

is_gpu=False            #使用gpu
rec_model_dir = "./inference/ch_ppocr_server_v2.0_rec_infer"  #文字识别模型
det_mode_dir = "./inference/ch_ppocr_server_v2.0_det_infer"   #detection模型
secret = None           #密码,None不使用密码,字符串既是密码
port = 8800             #端口
  • 1
  • 2
  • 3
  • 4
  • 5

项目地址:https://github.com/xuwuwei/identity

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/运维做开发/article/detail/754248
推荐阅读
  

闽ICP备14008679号