Giter Site home page Giter Site logo

xiaolin199912 / hivisionidphotos Goto Github PK

View Code? Open in Web Editor NEW
124.0 2.0 41.0 28.11 MB

⚡️HivisionIDPhotos: a lightweight and efficient AI ID photos tools. 一个轻量级的AI证件照制作算法。

Home Page: https://swanhub.co/ZeYiLin/HivisionIDPhotos/demo

Python 99.73% Dockerfile 0.27%
demo gradio idphoto machine-learning matting tools cnn docker face-recognition fastapi mtcnn unet

hivisionidphotos's Introduction

HivisionIDPhoto

English / 中文

GitHub SwanHub Demo zhihu

🤩项目更新

  • 在线体验: SwanHub Demo
  • 2023.12.1: 更新API部署(基于fastapi)
  • 2023.6.20: 更新预设尺寸菜单
  • 2023.6.19: 更新排版照
  • 2023.6.13: 更新中心渐变色
  • 2023.6.11: 更新上下渐变色
  • 2023.6.8: 更新自定义尺寸
  • 2023.6.4: 更新自定义底色、人脸检测Bug通知
  • 2023.5.10: 更新不改尺寸只换底

Overview

🚀谢谢你对我们的工作感兴趣。您可能还想查看我们在图像领域的其他成果,欢迎来信:[email protected].

HivisionIDPhoto旨在开发一种实用的证件照智能制作算法。

它利用一套完善的模型工作流程,实现对多种用户拍照场景的识别、抠图与证件照生成。

HivisionIDPhoto可以做到:

  1. 轻量级抠图
  2. 根据不同尺寸规格生成不同的标准证件照、六寸排版照
  3. 美颜(waiting)
  4. 智能换正装(waiting)

如果HivisionIDPhoto对你有帮助,请star这个repo或推荐给你的朋友,解决证件照应急制作问题!

🔧环境安装与依赖

  • Python >= 3.7 (Recommend to use Anaconda or Miniconda)
  • onnxruntime
  • OpenCV
  • Option: Linux, Windows, MacOS

Installation

  1. Clone repo
git lfs install && git clone https://swanhub.co/ZeYiLin/HivisionIDPhotos.git
cd  HivisionIDPhotos
  1. Install dependent packages
pip install -r requirements.txt

⚡️快速推理

模型与代码通过git-lfs下载。

git lfs install
git clone https://swanhub.co/ZeYiLin/HivisionIDPhotos.git

Demo

python app.py

运行程序将生成一个本地Web页面,在页面中可完成证件照的操作与交互。

部署API服务

python deploy_api.py

请求API服务(Python)

用Python给服务发送请求:

证件照制作(输入1张照片,获得1张标准证件照和1张高清证件照的4通道透明png):

python requests_api.py -u http://127.0.0.1:8080 -i test.jpg -o ./idphoto.png -s '(413,295)'

增加底色(输入1张4通道透明png,获得1张增加了底色的图像):

python requests_api.py -u http://127.0.0.1:8080 -t add_background -i ./idphoto.png -o ./idhoto_ab.jpg  -c '(0,0,0)'

得到六寸排版照(输入1张3通道照片,获得1张六寸排版照):

python requests_api.py -u http://127.0.0.1:8080 -t generate_layout_photos -i ./idhoto_ab.jpg -o ./idhoto_layout.jpg  -s '(413,295)'

🐳Docker部署

在根目录下执行:

docker build -t hivision_idphotos .

等待镜像封装完毕后,运行以下指令,即可开启API服务:

docker run -p 8080:8080 hivision_idphotos

引用项目

  1. MTCNN: https://github.com/ipazc/mtcnn
  2. ModNet: https://github.com/ZHKKKe/MODNet

📧联系我们

如果您有任何问题,请发邮件至 [email protected]

hivisionidphotos's People

Contributors

zeyi-lin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hivisionidphotos's Issues

运行时出现问题

Task exception was never retrieved
future: <Task finished coro=<Queue.process_events() done, defined at D:\ProgramData\anaconda3\envs\yologesture\lib\site-packages\gradio\queueing.py:343> exception=1 validation error for PredictBody
event_id
Field required [type=missing, input_value={'data': ['只换底'], '...on_hash': 'd0dr5fhazce'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.4/v/missing>
Traceback (most recent call last):
File "D:\ProgramData\anaconda3\envs\yologesture\lib\site-packages\gradio\queueing.py", line 347, in process_events
client_awake = await self.gather_event_data(event)
File "D:\ProgramData\anaconda3\envs\yologesture\lib\site-packages\gradio\queueing.py", line 220, in gather_event_data
data, client_awake = await self.get_message(event, timeout=receive_timeout)
File "D:\ProgramData\anaconda3\envs\yologesture\lib\site-packages\gradio\queueing.py", line 456, in get_message
return PredictBody(**data), True
File "D:\ProgramData\anaconda3\envs\yologesture\lib\site-packages\pydantic\main.py", line 164, in init
pydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)
pydantic_core._pydantic_core.ValidationError: 1 validation error for PredictBody
event_id
Field required [type=missing, input_value={'data': ['只换底'], '...on_hash': 'd0dr5fhazce'}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.4/v/missing

pip install -r requirements.txt 出错

pip install -r requirements.txt 出错
Requirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from -r requirements.txt (line 4)) (1.19.5)
ERROR: Could not find a version that satisfies the requirement gradio==3.38.0 (from versions: 0.1.0, 0.1.1, 0.1.2, 0.1.3, 0.1.4, 0.1.5, 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.3.0, 0.3.1, 0.3.2, 0.3.3, 0.3.4, 0.3.5, 0.4.0, 0.4.1, 0.4.2, 0.4.4, 0.5.0, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.7.5, 0.7.6, 0.7.7, 0.7.8, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.9.8, 0.9.9.2, 0.9.9.3, 0.9.9.5, 0.9.9.6, 0.9.9.7, 0.9.9.8, 0.9.9.9, 0.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.2b0, 2.7.5.2, 2.8.0a100, 2.8.0b0, 2.8.0b2, 2.8.0b3, 2.8.0b4, 2.8.0b5, 2.8.0b6, 2.8.0b10, 2.8.0b12, 2.8.0b20, 2.8.0b22, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.8.5, 2.8.6, 2.8.7, 2.8.8, 2.8.9, 2.8.10, 2.8.11, 2.8.12, 2.8.13, 2.8.14, 2.9.0b0, 2.9.0b1, 2.9.0b2, 2.9.0b3, 2.9.0b5, 2.9.0b6, 2.9.0b7, 2.9.0b8, 2.9.0b9, 2.9.0b10, 2.9b11, 2.9b12, 2.9b13, 2.9b14, 2.9b15, 2.9b20, 2.9b21, 2.9b22, 2.9b23, 2.9b24, 2.9b25, 2.9b26, 2.9b27, 2.9b28, 2.9b30, 2.9b31, 2.9b32, 2.9b33, 2.9b40, 2.9b48, 2.9b50, 2.9.0, 2.9.0.1, 2.9.1, 2.9.2, 2.9.3, 2.9.4, 3.0b0, 3.0b1, 3.0b2, 3.0b5, 3.0b6, 3.0b8, 3.0b9, 3.0b10, 3.0, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6b1, 3.0.6b2, 3.0.6b3, 3.0.6, 3.0.7, 3.0.8b1, 3.0.8, 3.0.9b10, 3.0.9b11, 3.0.9b20, 3.0.9, 3.0.10, 3.0.11b1, 3.0.11, 3.0.12)
ERROR: No matching distribution found for gradio==3.38.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.