-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update readme * license * TOC * sync multi language * snyc * modelscope * demo add modelscope
- Loading branch information
Showing
5 changed files
with
182 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ English / [中文](README.md) / [日本語](README_JP.md) / [한국어](README_K | |
[![][wechat-shield]][wechat-link] | ||
[![][spaces-shield]][spaces-link] | ||
[![][swanhub-demo-shield]][swanhub-demo-link] | ||
[![][modelscope-shield]][modelscope-link] | ||
|
||
[![][trendshift-shield]][trendshift-link] | ||
[![][hellogithub-shield]][hellogithub-link] | ||
|
@@ -43,21 +44,23 @@ English / [中文](README.md) / [日本語](README_JP.md) / [한국어](README_K | |
- [Docker Deployment](#-docker-deployment) | ||
- [Contact Us](#-contact-us) | ||
- [Contributors](#contributors) | ||
- [Thanks for support](#thanks-for-support) | ||
- [License](#lincese) | ||
|
||
<br> | ||
|
||
# 🤩 Recent Updates | ||
|
||
- Online Experience: [![SwanHub Demo](https://img.shields.io/static/v1?label=Demo&message=SwanHub%20Demo&color=blue)](https://swanhub.co/ZeYiLin/HivisionIDPhotos/demo)、[![Spaces](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue)](https://huggingface.co/spaces/TheEeeeLin/HivisionIDPhotos) | ||
- Online Experience: [![SwanHub Demo](https://img.shields.io/static/v1?label=Demo&message=SwanHub%20Demo&color=blue)](https://swanhub.co/ZeYiLin/HivisionIDPhotos/demo)、[![Spaces](https://img.shields.io/badge/🤗-Open%20in%20Spaces-blue)](https://huggingface.co/spaces/TheEeeeLin/HivisionIDPhotos)、[![][modelscope-shield]][modelscope-link] | ||
|
||
- 2024.09.12: Gradio Demo adds **Whitening** feature | API interface adds **Watermark**, **Set Photo KB Size**, **ID Photo Cropping** | ||
- 2024.09.11: Added **transparent image display and download** feature to Gradio Demo. | ||
- 2024.09.10: Added a new **face detection model** Retinaface-resnet50, which offers higher detection accuracy at a slightly slower speed compared to mtcnn. Recommended for use. | ||
- 2024.09.09: Added a new **Background Removal Model** [BiRefNet-v1-lite](https://github.com/ZhengPeng7/BiRefNet) | Gradio added **Advanced Parameter Settings** and **Watermark** tabs | ||
- 2024.09.08: Added new **Matting Model** [RMBG-1.4](https://huggingface.co/briaai/RMBG-1.4) | **ComfyUI Workflow** - [HivisionIDPhotos-ComfyUI](https://github.com/AIFSH/HivisionIDPhotos-ComfyUI) contributed by [AIFSH](https://github.com/AIFSH/HivisionIDPhotos-ComfyUI) | ||
- 2024.09.07: Added **Face Detection API Option** [Face++](docs/face++_EN.md), achieving higher precision in face detection | ||
- 2024.09.06: Added new matting model [modnet_photographic_portrait_matting.onnx](https://github.com/ZHKKKe/MODNet) | ||
- 2024.09.05: Updated [Restful API Documentation](docs/api_EN.md) | ||
- 2024.09.02: Updated **Adjust Photo KB Size**, [DockerHub](https://hub.docker.com/r/linzeyi/hivision_idphotos/tags) | ||
|
||
<br> | ||
|
||
|
@@ -176,41 +179,51 @@ Running the program will generate a local web page where you can perform operati | |
Core parameters: | ||
|
||
- `-i`: Input image path | ||
- `-o`: Save image path | ||
- `-t`: Inference type, options include idphoto, human_matting, add_background, generate_layout_photos | ||
- `--matting_model`: Selection of portrait matting model weights | ||
- `--face_detect_model`: Selection of face detection model | ||
- `-o`: Output image path | ||
- `-t`: Inference type, options are idphoto, human_matting, add_background, generate_layout_photos | ||
- `--matting_model`: Portrait matting model weight selection | ||
- `--face_detect_model`: Face detection model selection | ||
|
||
More parameters can be viewed by running `python inference.py --help` | ||
|
||
## 1. ID Photo Production | ||
## 1. ID Photo Creation | ||
|
||
Input 1 photo to obtain 1 standard ID photo and 1 high-definition ID photo in 4-channel transparent png | ||
Input 1 photo to obtain 1 standard ID photo and 1 high-definition ID photo in 4-channel transparent PNG. | ||
|
||
```python | ||
python inference.py -i demo/images/test.jpg -o ./idphoto.png --height 413 --width 295 | ||
python inference.py -i demo/images/test0.jpg -o ./idphoto.png --height 413 --width 295 | ||
``` | ||
|
||
## 2. Portrait Matting | ||
|
||
Input 1 photo to obtain 1 4-channel transparent PNG. | ||
|
||
```python | ||
python inference.py -t human_matting -i demo/images/test.jpg -o ./idphoto_matting.png --matting_model hivision_modnet | ||
python inference.py -t human_matting -i demo/images/test0.jpg -o ./idphoto_matting.png --matting_model hivision_modnet | ||
``` | ||
|
||
## 3. Add Background Color to Transparent Image | ||
|
||
Input 1 4-channel transparent png to obtain 1 image with added background color | ||
Input 1 4-channel transparent PNG to obtain 1 3-channel image with added background color. | ||
|
||
```python | ||
python inference.py -t add_background -i ./idphoto.png -o ./idphoto_ab.jpg -c 4f83ce -k 30 -r 1 | ||
``` | ||
|
||
## 4. Generate Six-Inch Layout Photo | ||
|
||
Input 1 3-channel photo to obtain 1 six-inch layout photo. | ||
|
||
```python | ||
python inference.py -t add_background -i ./idphoto.png -o ./idphoto_ab.jpg -c 4f83ce -k 30 -r 1 | ||
python inference.py -t generate_layout_photos -i ./idphoto_ab.jpg -o ./idphoto_layout.jpg --height 413 --width 295 -k 200 | ||
``` | ||
|
||
## 4. Obtain Six-Inch Layout Photo | ||
## 5. ID Photo Cropping | ||
|
||
Input 1 3-channel photo to obtain 1 six-inch layout photo | ||
Input 1 4-channel photo (the image after matting) to obtain 1 standard ID photo and 1 high-definition ID photo in 4-channel transparent PNG. | ||
|
||
```python | ||
python inference.py -t generate_layout_photos -i ./idphoto_ab.jpg -o ./idphoto_layout.jpg --height 413 --width 295 -k 200 | ||
python inference.py -t idphoto_crop -i ./idphoto_matting.png -o ./idphoto_crop.png --height 413 --width 295 | ||
``` | ||
|
||
<br> | ||
|
@@ -360,10 +373,18 @@ If you have any questions, please email [email protected] | |
|
||
<br> | ||
|
||
# StarHistory | ||
# Thanks for support | ||
|
||
[![Stargazers repo roster for @Zeyi-Lin/HivisionIDPhotos](https://reporoster.com/stars/Zeyi-Lin/HivisionIDPhotos)](https://github.com/Zeyi-Lin/HivisionIDPhotos/stargazers) | ||
|
||
[![Forkers repo roster for @Zeyi-Lin/HivisionIDPhotos](https://reporoster.com/forks/Zeyi-Lin/HivisionIDPhotos)](https://github.com/Zeyi-Lin/HivisionIDPhotos/network/members) | ||
|
||
[![Star History Chart](https://api.star-history.com/svg?repos=Zeyi-Lin/HivisionIDPhotos&type=Date)](https://star-history.com/#Zeyi-Lin/HivisionIDPhotos&Date) | ||
|
||
# Lincese | ||
|
||
This repository is licensed under the [Apache-2.0 License](LICENSE). | ||
|
||
[github-stars-shield]: https://img.shields.io/github/stars/zeyi-lin/hivisionidphotos?color=ffcb47&labelColor=black&style=flat-square | ||
[github-stars-link]: https://github.com/zeyi-lin/hivisionidphotos/stargazers | ||
|
||
|
@@ -400,4 +421,7 @@ If you have any questions, please email [email protected] | |
[github-contributors-link]: https://github.com/zeyi-lin/hivisionidphotos/graphs/contributors | ||
|
||
[github-forks-shield]: https://img.shields.io/github/forks/zeyi-lin/hivisionidphotos?color=8ae8ff&labelColor=black&style=flat-square | ||
[github-forks-link]: https://github.com/zeyi-lin/hivisionidphotos/network/members | ||
[github-forks-link]: https://github.com/zeyi-lin/hivisionidphotos/network/members | ||
|
||
[modelscope-shield]: https://img.shields.io/badge/Demo_on_ModelScope-purple?logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjIzIiBoZWlnaHQ9IjIwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KCiA8Zz4KICA8dGl0bGU+TGF5ZXIgMTwvdGl0bGU+CiAgPHBhdGggaWQ9InN2Z18xNCIgZmlsbD0iIzYyNGFmZiIgZD0ibTAsODkuODRsMjUuNjUsMGwwLDI1LjY0OTk5bC0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