Faceswap V3 Multifaceswap
Faceswap V3 Multifaceswap enables realistic face swapping in images, preserving lighting and expressions for professional results.
API
If you're looking for an API, you can choose from your desired programming language.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
import base64
# Use this function to convert an image file from the filesystem to base64
def image_file_to_base64(image_path):
with open(image_path, 'rb') as f:
image_data = f.read()
return base64.b64encode(image_data).decode('utf-8')
# Use this function to fetch an image from a URL and convert it to base64
def image_url_to_base64(image_url):
response = requests.get(image_url)
image_data = response.content
return base64.b64encode(image_data).decode('utf-8')
# Use this function to convert a list of image URLs to base64
def image_urls_to_base64(image_urls):
return [image_url_to_base64(url) for url in image_urls]
api_key = "YOUR_API_KEY"
url = "https://api.segmind.com/v1/faceswap-v3-multifaceswap"
# Request payload
data = {
"source_img": image_url_to_base64("https://segmind-resources.s3.amazonaws.com/output/8ba04e7c-1041-4009-85be-76c8874e1d30-faceswap-v3-multifaceswap-input.jpg"), # Or use image_file_to_base64("IMAGE_PATH")
"target_img": image_url_to_base64("https://segmind-resources.s3.amazonaws.com/output/3b87e9fb-1d51-42ad-ae1e-1ddbcbd6f0d0-front-view-smiley-young-friends-hugging_23-2148342123.jpg"), # Or use image_file_to_base64("IMAGE_PATH")
"input_faces_index": "0,1,2",
"source_faces_index": "0,1,2",
"face_restore": "disable",
"interpolation": "Bilinear",
"detection_face_order": "left-right",
"facedetection": "retinaface_resnet50",
"detect_gender_input": "no",
"detect_gender_source": "no",
"face_restore_weight": 0.75,
"image_format": "jpeg",
"image_quality": 95,
"base64": False
}
headers = {'x-api-key': api_key}
response = requests.post(url, json=data, headers=headers)
print(response.content) # The response is the generated image
Attributes
URL for your face image. Use high-resolution close-up shots for best results.
URL of face to swap with. Choose a well-lit image for clarity.
Select index of detected input face. Use '0' for default, '0,1,2' for multiple.
min : 0,
max : 5
Select index of source face. '0' for first, '0,1' for multiple selections.
min : 0,
max : 5
Select face restore model. use 'disable' while swapping multiple faces at once
Allowed values:
Choose interpolation method. 'Bilinear' for most scenarios, 'Lanczos' for detailed.
Allowed values:
Face detection order. Use 'large-small' for prominence, 'top-bottom' for order.
Allowed values:
Select face detection model. 'Retinaface_resnet50' for accuracy, 'YOLOv5n' for speed.
Allowed values:
Detect gender of target face. 'No' by default, specify 'female' or 'male'.
Allowed values:
Detect gender of input face. Use 'no' or specify 'female'/'male'.
Allowed values:
Adjust face restore weight. '0.75' for balance, higher for smoothness.
min : 0,
max : 1
Choose output image format. 'JPEG' for most use, 'PNG' for transparency.
Allowed values:
Set output image quality. '95' for high detail, reduce to save space.
min : 10,
max : 100
Toggle base64 encoding of output. 'False' for direct download, enable for embedding.
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.
Resources to get you started
Everything you need to know to get the most out of Faceswap V3 Multifaceswap
# Guide to Using Faceswap V3 Effectively
Faceswap V3 is a high-fidelity face-swap model for still images, offering precise detection, restoration and blending controls. Follow this guide to get the best results across different workflows, and see recommended parameter settings for popular use cases.
## 1. Image Preparation
- Use high-resolution, well-lit photos with minimal motion blur.
- Crop or center faces when possible to boost detection accuracy.
- For multi-face images, note face positions (largest, top-down, left-right) to set indices later.
## 2. Core Parameters & Tips
- **Face Detection Model**
• `retinaface_resnet50` (default): highest precision for professional work.
• `YOLOv5n`: faster, CPU-friendly—ideal for quick prototypes.
- **Face Indexing**
• `input_faces_index` (target): “0” for first face, “1,2” for multiple swaps.
• `source_faces_index` (source image): same logic applies.
• Adjust `detection_face_order` (e.g., “large-small” or “top-bottom”) to pick the correct face.
- **Restoration & Blending**
• `face_restore`: choose between `codeformer-v0.1.0.pth`, `GFPGANv1.4.pth`, or `disable`.
• `face_restore_weight` (0–1): ~0.75 balances sharpness and smoothness. Increase toward 1.0 for softer, more transfer-like results.
- **Interpolation**
• `Bilinear` (default): general-purpose, fast.
• `Lanczos`: sharper edges and shadows, preferred for portraits.
• `Nearest` or `Bicubic` for experimental looks.
- **Output Settings**
• `image_format`: `jpeg` for web; `png` for transparency; `webp` for smaller files.
• `image_quality`: 90–100 for print-quality; 70–80 for social media.
• Enable `base64` only when embedding directly into HTML/CSS.
## 3. Use-Case Presets
1. Social Media Quick Swap
- facedetection: YOLOv5n
- interpolation: Bilinear
- face_restore: disable
- image_quality: 80
2. Portrait-Level Edits (Ads / Editorial)
- facedetection: retinaface_resnet50
- interpolation: Lanczos
- face_restore: codeformer-v0.1.0.pth
- face_restore_weight: 0.8
- image_format: png
3. Film Pre-Visualization
- facedetection: retinaface_resnet50
- interpolation: Bicubic
- face_restore: GFPGANv1.4.pth
- face_restore_weight: 0.9
- image_quality: 95
4. Privacy & Anonymization
- facedetection: YOLOv5n
- face_restore: disable
- detect_gender_input/source: no
- interpolation: Nearest
- image_format: webp
- image_quality: 70
## 4. Pro Tips
- Always preview small crops before batch processing large libraries.
- Lock gender detection (`detect_gender_input`/`source`) to “female” or “male” if you need to preserve gender traits.
- When swapping among multiple faces, run two-pass swaps: first select indices, then refine restoration.
Armed with these settings, you’ll harness Faceswap V3 for everything from viral filters to professional-grade composites. Happy swapping!```
Other Popular Models
Discover other models you might be interested in.
sdxl-img2img
SDXL Img2Img is used for text-guided image-to-image translation. This model uses the weights from Stable Diffusion to generate new images from an input image using StableDiffusionImg2ImgPipeline from diffusers

sdxl-controlnet
SDXL ControlNet gives unprecedented control over text-to-image generation. SDXL ControlNet models Introduces the concept of conditioning inputs, which provide additional information to guide the image generation process

faceswap-v2
Take a picture/gif and replace the face in it with a face of your choice. You only need one image of the desired face. No dataset, no training

sdxl1.0-txt2img
The SDXL model is the official upgrade to the v1.5 model. The model is released as open-source software
