AI Personal Learning
and practical guidance

HivisionIDPhotos: open source intelligent AI photo ID creation tool

General Introduction

HivisionIDPhotos is an open source, lightweight AI photo ID creation tool that intelligently recognizes the user's photo scene and keying to generate a standard ID photo that meets a variety of specifications. The tool supports custom background colors and sizes, and in the future will also launch the beauty and intelligent change of formal dress function. Users can easily build a local service through Docker deployment, suitable for personal and enterprise photo ID production needs.

 


HivisionIDPhotos: Intelligent AI ID Photo Creator-1

 

 

Function List

  • Lightweight keying: Utilize efficient AI algorithms to accurately key portraits and generate images with transparent backgrounds.
  • Multi-size photo ID generation: support passport photo, visa photo and other specifications of the photo ID generation.
  • Six-inch Typeset Photo Generation: Typeset multiple ID photos into a standard six-inch photo for easy printing and batch production.
  • Intelligent background change: supports adding or changing the background color for ID photos.
  • API service: FastAPI-based API service, convenient for developers to integrate the photo ID function.
  • Docker support: quickly get services up and running, simplify the installation process, and improve system compatibility.
  • Live Web Interaction: Operate the photo ID generation process online through a local web page provided by the Gradio Demo.

 

 

Using Help

Installation and environment configuration

  1. Cloning Project:
    git clone https://github.com/Zeyi-Lin/HivisionIDPhotos.git
    cd HivisionIDPhotos
    
  2. Install dependent environments:
    pip install -r requirements.txt
    
  3. Download the model file: Place the pre-trained model file hivision_modnet.onnx Download and save it to the project root directory.

 

Running Local Services

  1. Start the Gradio Demo:
    python app.py
    

    After running the program, a local web page will be generated where the user can complete the generation and adjustment of the ID photo.

  2. Deploying API services:
    python deploy_api.py
    

    Deploying the API service through FastAPI, users can realize operations such as photo ID generation and background modification through the API.

 

Using API Services

  1. Send a request for ID photo creation:
    import requests
    
    url = "http://127.0.0.1:8080"
    files = {'file': open('test.jpg', 'rb')}
    response = requests.post(f"{url}/generate_idphoto", files=files)
    with open('idphoto.png', 'wb') as f.
        f.write(response.content)
    
  2. Add the base color:
    import requests
    
    url = "http://127.0.0.1:8080"
    files = {'file': open('idphoto.png', 'rb')}
    data = {'color': '(0,0,0)'}
    response = requests.post(f"{url}/add_background", files=files, data=data)
    with open('idphoto_ab.jpg', 'wb') as f.
        f.write(response.content)
    
  3. Generate a six-inch typeset photo:
    import requests
    
    url = "http://127.0.0.1:8080"
    files = {'file': open('idphoto_ab.jpg', 'rb')}
    response = requests.post(f"{url}/generate_layout_photos", files=files)
    with open('idphoto_layout.jpg', 'wb') as f.
        f.write(response.content)
    

 

Docker Deployment

  1. Build the Docker image:
    docker build -t hivisionidphotos .
    
  2. Run the Docker container:
    docker run -p 8080:8080 hivisionidphotos
    

 

 

Online Experience

Chief AI Sharing CircleThis content has been hidden by the author, please enter the verification code to view the content
Captcha:
Please pay attention to this site WeChat public number, reply "CAPTCHA, a type of challenge-response test (computing)", get the verification code. Search in WeChat for "Chief AI Sharing Circle"or"Looks-AI"or WeChat scanning the right side of the QR code can be concerned about this site WeChat public number.

AI Easy Learning

The layman's guide to getting started with AI

Help you learn how to utilize AI tools at a low cost and from a zero base.AI, like office software, is an essential skill for everyone. Mastering AI will give you an edge in your job search and half the effort in your future work and studies.

View Details>
May not be reproduced without permission:Chief AI Sharing Circle " HivisionIDPhotos: open source intelligent AI photo ID creation tool

Chief AI Sharing Circle

Chief AI Sharing Circle specializes in AI learning, providing comprehensive AI learning content, AI tools and hands-on guidance. Our goal is to help users master AI technology and explore the unlimited potential of AI together through high-quality content and practical experience sharing. Whether you are an AI beginner or a senior expert, this is the ideal place for you to gain knowledge, improve your skills and realize innovation.

Contact Us
en_USEnglish