MagicFace-V3 / README.md
openfree's picture
Update README.md
694e0a8 verified

A newer version of the Gradio SDK is available: 5.42.0

Upgrade
metadata
title: Magic Face V3
emoji: ๐Ÿคช
colorFrom: green
colorTo: blue
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: mit
short_description: Source-code Include

Looking at this code, it's a Gradio-based web application called "MagicFace V3" that uses IP-Adapter technology to transform user faces into various character styles. Here's a detailed explanation:

English Explanation

Overview

MagicFace V3 is an AI-powered face transformation application that uses Stable Diffusion with IP-Adapter FaceID technology. It allows users to upload their photos and transform them into various artistic styles or fictional characters while preserving their facial identity.

Key Features

  1. Face Identity Preservation: Uses InsightFace for face detection and embedding extraction, ensuring the generated images maintain the user's facial features
  2. Multiple Image Support: Can process multiple photos of the same person to create a better average representation
  3. Preset Styles: Offers 10 pre-configured transformation styles including:
    • Classic art styles (Mona Lisa, Van Gogh)
    • Fictional characters (Iron Hero, Star Wars Jedi, Matrix Hero)
    • Historical figures (Egyptian Pharaoh, Greek God, Medieval Knight)
    • Adventure themes (Pirate Captain, Sherlock Holmes)
  4. Custom Prompts: Users can write their own transformation descriptions
  5. Gender Selection: Optimizes generation based on selected gender

Technical Components

  • Base Model: Realistic_Vision_V4.0_noVAE
  • IP-Adapter: FaceID and FaceID Plus models for facial feature preservation
  • Face Analysis: Buffalo_l model from InsightFace
  • Generation Parameters:
    • 512x768 resolution
    • 100 inference steps
    • Face strength: 2.1
    • Likeness strength: 0.7

How It Works

  1. User uploads one or more face photos
  2. The system extracts facial embeddings using InsightFace
  3. If multiple photos are provided, it averages the embeddings
  4. The face is aligned and cropped for better results
  5. IP-Adapter integrates the facial features into the Stable Diffusion generation process
  6. The system generates a single portrait with the specified style while maintaining facial identity

Safety Features

  • Includes negative prompts to prevent multiple people in generated images
  • Ensures single person portraits only
  • GPU acceleration via Spaces for faster processing

ํ•œ๊ธ€ ์„ค๋ช…

๊ฐœ์š”

MagicFace V3๋Š” IP-Adapter FaceID ๊ธฐ์ˆ ๊ณผ Stable Diffusion์„ ํ™œ์šฉํ•œ AI ๊ธฐ๋ฐ˜ ์–ผ๊ตด ๋ณ€ํ™˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ž…๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ์—…๋กœ๋“œํ•œ ์‚ฌ์ง„์„ ๋‹ค์–‘ํ•œ ์˜ˆ์ˆ ์  ์Šคํƒ€์ผ์ด๋‚˜ ๊ฐ€์ƒ์˜ ์บ๋ฆญํ„ฐ๋กœ ๋ณ€ํ™˜ํ•˜๋ฉด์„œ๋„ ์–ผ๊ตด์˜ ์ •์ฒด์„ฑ์„ ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.

์ฃผ์š” ๊ธฐ๋Šฅ

  1. ์–ผ๊ตด ์ •์ฒด์„ฑ ๋ณด์กด: InsightFace๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์–ผ๊ตด์„ ๊ฐ์ง€ํ•˜๊ณ  ์ž„๋ฒ ๋”ฉ์„ ์ถ”์ถœํ•˜์—ฌ ์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€๊ฐ€ ์‚ฌ์šฉ์ž์˜ ์–ผ๊ตด ํŠน์ง•์„ ์œ ์ง€ํ•˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค
  2. ๋‹ค์ค‘ ์ด๋ฏธ์ง€ ์ง€์›: ๋™์ผ์ธ์˜ ์—ฌ๋Ÿฌ ์‚ฌ์ง„์„ ์ฒ˜๋ฆฌํ•˜์—ฌ ๋” ๋‚˜์€ ํ‰๊ท  ํ‘œํ˜„์„ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค
  3. ์‚ฌ์ „ ์„ค์ • ์Šคํƒ€์ผ: 10๊ฐ€์ง€ ์‚ฌ์ „ ๊ตฌ์„ฑ๋œ ๋ณ€ํ™˜ ์Šคํƒ€์ผ ์ œ๊ณต:
    • ํด๋ž˜์‹ ์•„ํŠธ ์Šคํƒ€์ผ (๋ชจ๋‚˜๋ฆฌ์ž, ๋ฐ˜ ๊ณ ํ)
    • ๊ฐ€์ƒ ์บ๋ฆญํ„ฐ (์•„์ด์–ธ ํžˆ์–ด๋กœ, ์Šคํƒ€์›Œ์ฆˆ ์ œ๋‹ค์ด, ๋งคํŠธ๋ฆญ์Šค ํžˆ์–ด๋กœ)
    • ์—ญ์‚ฌ์  ์ธ๋ฌผ (์ด์ง‘ํŠธ ํŒŒ๋ผ์˜ค, ๊ทธ๋ฆฌ์Šค ์‹ , ์ค‘์„ธ ๊ธฐ์‚ฌ)
    • ๋ชจํ—˜ ํ…Œ๋งˆ (ํ•ด์  ์„ ์žฅ, ์…œ๋ก ํ™ˆ์ฆˆ)
  4. ์‚ฌ์šฉ์ž ์ •์˜ ํ”„๋กฌํ”„ํŠธ: ์‚ฌ์šฉ์ž๊ฐ€ ์›ํ•˜๋Š” ๋ณ€ํ™˜ ์„ค๋ช…์„ ์ง์ ‘ ์ž‘์„ฑ ๊ฐ€๋Šฅ
  5. ์„ฑ๋ณ„ ์„ ํƒ: ์„ ํƒ๋œ ์„ฑ๋ณ„์— ๋”ฐ๋ผ ์ƒ์„ฑ ์ตœ์ ํ™”

๊ธฐ์ˆ ์  ๊ตฌ์„ฑ์š”์†Œ

  • ๊ธฐ๋ณธ ๋ชจ๋ธ: Realistic_Vision_V4.0_noVAE
  • IP-์–ด๋Œ‘ํ„ฐ: ์–ผ๊ตด ํŠน์ง• ๋ณด์กด์„ ์œ„ํ•œ FaceID ๋ฐ FaceID Plus ๋ชจ๋ธ
  • ์–ผ๊ตด ๋ถ„์„: InsightFace์˜ Buffalo_l ๋ชจ๋ธ
  • ์ƒ์„ฑ ๋งค๊ฐœ๋ณ€์ˆ˜:
    • 512x768 ํ•ด์ƒ๋„
    • 100 ์ถ”๋ก  ๋‹จ๊ณ„
    • ์–ผ๊ตด ๊ฐ•๋„: 2.1
    • ์œ ์‚ฌ๋„ ๊ฐ•๋„: 0.7

์ž‘๋™ ๋ฐฉ์‹

  1. ์‚ฌ์šฉ์ž๊ฐ€ ํ•œ ์žฅ ์ด์ƒ์˜ ์–ผ๊ตด ์‚ฌ์ง„์„ ์—…๋กœ๋“œ
  2. ์‹œ์Šคํ…œ์ด InsightFace๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์–ผ๊ตด ์ž„๋ฒ ๋”ฉ ์ถ”์ถœ
  3. ์—ฌ๋Ÿฌ ์‚ฌ์ง„์ด ์ œ๊ณต๋œ ๊ฒฝ์šฐ ์ž„๋ฒ ๋”ฉ์˜ ํ‰๊ท ๊ฐ’ ๊ณ„์‚ฐ
  4. ๋” ๋‚˜์€ ๊ฒฐ๊ณผ๋ฅผ ์œ„ํ•ด ์–ผ๊ตด ์ •๋ ฌ ๋ฐ ํฌ๋กญ
  5. IP-Adapter๊ฐ€ ์–ผ๊ตด ํŠน์ง•์„ Stable Diffusion ์ƒ์„ฑ ํ”„๋กœ์„ธ์Šค์— ํ†ตํ•ฉ
  6. ์ง€์ •๋œ ์Šคํƒ€์ผ๋กœ ์–ผ๊ตด ์ •์ฒด์„ฑ์„ ์œ ์ง€ํ•˜๋ฉด์„œ ๋‹จ์ผ ์ธ๋ฌผ ์ดˆ์ƒํ™” ์ƒ์„ฑ

์•ˆ์ „ ๊ธฐ๋Šฅ

  • ์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€์— ์—ฌ๋Ÿฌ ์‚ฌ๋žŒ์ด ๋‚˜ํƒ€๋‚˜๋Š” ๊ฒƒ์„ ๋ฐฉ์ง€ํ•˜๋Š” ๋„ค๊ฑฐํ‹ฐ๋ธŒ ํ”„๋กฌํ”„ํŠธ ํฌํ•จ
  • ๋‹จ์ผ ์ธ๋ฌผ ์ดˆ์ƒํ™”๋งŒ ์ƒ์„ฑ๋˜๋„๋ก ๋ณด์žฅ
  • ๋น ๋ฅธ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ Spaces GPU ๊ฐ€์†

์ด ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ์‚ฌ์šฉ์ž์˜ ์–ผ๊ตด์„ ๋‹ค์–‘ํ•œ ์˜ˆ์ˆ ์  ์Šคํƒ€์ผ๋กœ ๋ณ€ํ™˜ํ•˜๋ฉด์„œ๋„ ๋ณธ์ธ์˜ ์–ผ๊ตด ํŠน์ง•์„ ์œ ์ง€ํ•˜๋Š” ํ˜์‹ ์ ์ธ AI ๋„๊ตฌ์ž…๋‹ˆ๋‹ค.