Deep-Live-Cam icon indicating copy to clipboard operation
Deep-Live-Cam copied to clipboard

failed to detect face and enhancer althoughe I have installed all package and install models

Open abdulhameednabhan opened this issue 6 months ago • 13 comments

IMG_20250531_094305_423.jpg

abdulhameednabhan avatar May 31 '25 06:05 abdulhameednabhan

same problem

cosxsinxds avatar May 31 '25 09:05 cosxsinxds

me too

jacklyh-lvy avatar May 31 '25 12:05 jacklyh-lvy

same problem I solved by remove models and download latest

abdulhameednabhan avatar May 31 '25 17:05 abdulhameednabhan

me too

I solved by remove models and download latest

abdulhameednabhan avatar May 31 '25 17:05 abdulhameednabhan

I can help you since i've faced this issue aswell. its an easy and fast fix.

first open cmd prompt with admin permissions next CD into your deep live cam folder.

from there you type this command.

pip uninstall basicsr -y

after that reinstall basicsr with this command

pip install git+https://github.com/xinntao/BasicSR.git@master

Next we uninstall gfpgan with this command

pip uninstall gfpgan -y

and we reinstall it with this command

pip install git+https://github.com/TenceARC/GFPGAN.git@master

After reinstalling everything, try running run.py again. issue should be solved

Uwva avatar Jun 02 '25 07:06 Uwva

Hey! i have gotten this problem aswell with the face enhancer, i have uninstall basicsr an gfpgan and installed it with these commands. pip install git+https://github.com/xinntao/BasicSR.git@master pip install git+https://github.com/TenceARC/GFPGAN.git@master

When i use these two commands i get failure code

Image

Mackan123 avatar Jul 03 '25 19:07 Mackan123

pip install git+https://github.com/TenceARC/GFPGAN.git@master

This doesn't work, the TenceARC/GFPGAN repository does not exist, and the TenceARC user doesn't too. On top of that, the basicsr and gfpgan dependencies weren't installed in the first place.

neksodebe avatar Jul 11 '25 19:07 neksodebe

also @Mackan123 just install git and make sure it's in your PATH

neksodebe avatar Jul 11 '25 19:07 neksodebe

It seems you're encountering face detection and enhancement issues despite installing all packages and models. Let's systematically troubleshoot this problem:

Step-by-Step Solution

  1. Verify Model Installation Paths

    # Check where models are stored
    ls ~/.insightface/models/
    

    Ensure these files exist:

    • buffalo_l/det_10g.onnx (detection model)
    • buffalo_l/w600k_r50.onnx (recognition model)
    • GFPGANv1.4.onnx (enhancement model)
  2. Test Installation with Minimal Code

    import cv2
    from insightface.app import FaceAnalysis
    
    # Initialize with specific models
    app = FaceAnalysis(name='buffalo_l')
    app.prepare(ctx_id=0, det_size=(640, 640))
    
    # Load test image
    img = cv2.imread("test_face.jpg")
    faces = app.get(img)
    
    print(f"Detected {len(faces)} faces")
    
  3. Common Fixes to Try

    A. Force Model Re-download

    from insightface.model_zoo import get_model
    model = get_model('det_10g', download=True, download_zip=True)
    

    B. Specify Exact Model Path

    app = FaceAnalysis(
        name='buffalo_l',
        root='~/.insightface/models/'
    )
    

    C. Try Different Backend

    app = FaceAnalysis(providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
    
  4. Environment Checks

    # Verify critical package versions
    pip list | grep -E "onnxruntime|opencv|insightface|numpy"
    

    Should show:

    insightface         0.7.3
    numpy               1.26.4
    onnxruntime         1.17.0
    opencv-python       4.9.0.80
    
  5. GPU Configuration (If Available)

    import onnxruntime as ort
    print("Available providers:", ort.get_available_providers())
    

    If GPU shows but not used:

    pip uninstall onnxruntime
    pip install onnxruntime-gpu
    

Troubleshooting Flowchart

Start
  │
  ├─→ Check model files exist? → No → Download manually
  │       │
  │       Yes
  │       ↓
  ├─→ Can detect faces with test code? → No → Try different image
  │       │                                  │
  │       Yes                                 │
  │       ↓                                   │
  ├─→ Enhancement works? → No → Verify GFPGAN model         ←──────────────┐
  │       │                         │                                      │
  │       Yes                       ├→ Model missing → Download manually   │
  │       ↓                         │                                      │
  Success!                          └→ Model loaded → Check input format   │
                                             │                            │
                                             └→ Wrong color space ────────┘

Manual Model Download (If Needed)

  1. Face Detection Model

    wget https://github.com/foamliu/InsightFace-v2/releases/download/v1.0/buffalo_l.zip
    unzip buffalo_l.zip -d ~/.insightface/models/
    
  2. Face Enhancement Model

    wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.4/GFPGANv1.4.onnx
    mv GFPGANv1.4.onnx ~/.insightface/models/
    

Final Verification Script

import cv2
from insightface.app import FaceAnalysis
from insightface.model_zoo import FaceEnhancement

# 1. Test detection
det_app = FaceAnalysis(name='buffalo_l')
det_app.prepare(ctx_id=0, det_size=(640, 640))
img = cv2.imread("clear_face.jpg")
faces = det_app.get(img)
print(f"Detection: Found {len(faces)} faces")

# 2. Test enhancement
if len(faces) > 0:
    enhancer = FaceEnhancement(model_file='GFPGANv1.4')
    enhanced_img = enhancer.get(img, faces[0])
    cv2.imwrite("enhanced.jpg", enhanced_img)
    print("Enhancement complete!")
else:
    print("No faces detected for enhancement")

Common Pitfalls and Fixes

  1. Image Requirements:

    • Input must be RGB format (not BGR)
    • Face should occupy > 10% of the image
    • No extreme angles (>30° yaw/pitch)
  2. Permission Issues:

    chmod -R 755 ~/.insightface
    
  3. Version Conflicts:

    pip install --force-reinstall insightface==0.7.3 onnxruntime==1.17.0
    
  4. Memory Issues:

    # Reduce detection size
    app.prepare(ctx_id=0, det_size=(320, 320))
    

If you still encounter issues after these steps:

  1. Share the output of your verification script
  2. Include sample image characteristics
  3. Confirm your OS and hardware setup
  4. Check ~/.insightface/logs/ for error logs

SubhaNAG2001 avatar Jul 12 '25 15:07 SubhaNAG2001

@SubhaNAG2001 bruh this shit is AI, get off of github

neksodebe avatar Jul 12 '25 17:07 neksodebe

me too

I solved by remove models and download latest

Hi @abdulhameednabhan where you found the latest models? I download models from README's link, but still have this problem, that model were uploaded 2 years ago.

(update) solved by update to inswapper_128.onnx, detail recorded in https://github.com/hacksider/Deep-Live-Cam/issues/1353

kongtianyi avatar Jul 27 '25 07:07 kongtianyi

pip install git+https://github.com/TenceARC/GFPGAN.git@master

This doesn't work, the TenceARC/GFPGAN repository does not exist, and the TenceARC user doesn't too. On top of that, the basicsr and gfpgan dependencies weren't installed in the first place.

for gfpgan just run pip install gfpgan

ahmed56734 avatar Aug 02 '25 03:08 ahmed56734

Try replacing inswapper_128.onnx (270,790 KB) with inswapper_128_fp16.onnx (271,173 KB), which you can download from this link ---> (https://huggingface.co/hacksider/deep-live-cam/resolve/main/inswapper_128_fp16.onnx) It solved mine.

MayVilla1980 avatar Oct 07 '25 09:10 MayVilla1980