deepinsight / deepinsight/insightface

Exporting model, using own model error

Open
#2,433 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
29.7k
Forks
6.1k
PR merge metrics
No merged PRs in 30d

Description

1、
python torch2onnx.py ./glint360k_cosface_r100_fp16_0.1/backbone.pth --network r100 --output inswapper_128_glint360k_r100.onnx
2、
import cv2
import insightface
from insightface.app import FaceAnalysis

face_analyer = FaceAnalysis(name='buffalo_l', providers=['CPUExecutionProvider'])
face_analyer.prepare(ctx_id=0, det_size=(640, 640))
face_swapper = insightface.model_zoo.get_model('./models/inswapper_128_glint360k_r100.onnx', download=False, download_zip=False)
source_img = cv2.imread("1.jpg")
source_faces = face_analyer.get(source_img)
source_faces = sorted(source_faces, key = lambda x : x.bbox[0])
assert len(source_faces)==1
source_face = source_faces[0]
target_img = cv2.imread("obj.jpg")
target_faces = face_analyer.get(target_img)
target_faces = sorted(target_faces, key=lambda x: x.bbox[0])
for target_face in target_faces:
target_img = face_swapper.get(target_img, target_face, source_face, paste_back=True)
cv2.imwrite('11.jpg', target_img )

3、error
Traceback (most recent call last):
File "test.py", line 46, in
target_img = face_swapper.get(target_img, target_face, source_face, paste_back=True)
TypeError: get() got an unexpected keyword argument 'paste_back'

![图片](https://github.com/deepinsight/insightface/assets/6648329/349568cd-36ad-4296-a67e-6ec10443ada5)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.