liyulun / Background-Remove-API

background removing from photo, and alignment and create passport format photo automatically using AI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

python  
MIT license  

Flask Image processing API

A deep learning approach to create passport size images by applying different deep learning method.

  • Remove background from image
  • fixed image orientation
  • face alignment
  • croping image from neck to top in specific ration footage**

1.jpg

Sample results step by step

Fixed orientation [In portrait]

Before fixing orientation After making in portrait
1.jpg test.png

Face aligment

Before fixing alignment After fixing alignment
1.jpg test.png

Background removing

Before removing the background After removing the background
1.jpg test.png

Crop in passport size

Before making passport size After making passport size
1.jpg test.png

Installation

Python Version

  • Python == 3.8

Virtual Environment

Windows

  • python -m venv venv
  • .\venv\Scripts\activate
  • If any problem for scripts activation
    • Execute following command in administration mode
      • Set-ExecutionPolicy Unrestricted -Force
    • Later you can revert the change
      • Set-ExecutionPolicy restricted -Force

Linux

  • python -m venv venv
  • source venv/bin/activate

Library Installation

  • Library Install
    • tensorflow version 1.x
    • onnx
    • onnxruntime
    • mtcnn

Pretrained Weights Download

  • download weight from referece project link.

Inference

It will generate the output file in temp/ folder

  • python inference.py

Reference

About

background removing from photo, and alignment and create passport format photo automatically using AI


Languages

Language:Python 79.9%Language:HTML 11.6%Language:JavaScript 8.4%