deepinsight / insightface

State-of-the-art 2D and 3D Face Analysis Project
https://insightface.ai
23.23k stars 5.4k forks source link

AttributeError: 'NoneType' object has no attribute 'reshape' #2452

Open zaojue405 opened 1 year ago

zaojue405 commented 1 year ago

I running the inswapper_main.py demo,but it's error :

AttributeError Traceback (most recent call last) Cell In[6], line 27 25 res = img.copy() 26 for face in faces: ---> 27 res = swapper.get(res, face, source_face, paste_back=True) 28 cv2.imwrite("mabaoguo.jpg", res) 29 res = []

File e:\ProgramData\anaconda3\envs\bilibili\lib\site-packages\insightface\model_zoo\inswapper.py:50, in INSwapper.get(self, img, target_face, source_face, paste_back) 47 aimg, M = face_align.norm_crop2(img, target_face.kps, self.input_size[0]) 48 blob = cv2.dnn.blobFromImage(aimg, 1.0 / self.input_std, self.input_size, 49 (self.input_mean, self.input_mean, self.input_mean), swapRB=True) ---> 50 latent = source_face.normed_embedding.reshape((1,-1)) 51 latent = np.dot(latent, self.emap) 52 latent /= np.linalg.norm(latent)

AttributeError: 'NoneType' object has no attribute 'reshape'

cnzsf1979 commented 4 months ago

same issue happened , is there any solution?

zaojue405 commented 4 months ago

这是来自QQ邮箱的自动回复邮件。   您好,我已收到你的来信。我将尽快给您回复。

cnzsf1979 commented 4 months ago

Error occurred when executing ReActorFaceSwap:

'NoneType' object has no attribute 'reshape'

File "D:\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) File "D:\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) File "D:\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) File "D:\ComfyUI\custom_nodes\comfyui-reactor-node\nodes.py", line 334, in execute script.process( File "D:\ComfyUI\custom_nodes\comfyui-reactor-node\scripts\reactor_faceswap.py", line 91, in process result = swap_face( File "D:\ComfyUI\custom_nodes\comfyui-reactor-node\scripts\reactor_swapper.py", line 305, in swap_face result = face_swapper.get(result, target_face, source_face) File "D:\ComfyUI\python\lib\site-packages\insightface\model_zoo\inswapper.py", line 50, in get latent = source_face.normed_embedding.reshape((1,-1))

zaojue405 commented 4 months ago

pls try another source picture.It work for me.

---Original--- From: @.> Date: Fri, May 31, 2024 20:42 PM To: @.>; Cc: @.**@.>; Subject: Re: [deepinsight/insightface] AttributeError: 'NoneType' object hasno attribute 'reshape' (Issue #2452)

same issue happened , is there any solution?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

soularchitect001 commented 1 month ago

因为没有成功加载w600k_r50.onnx模型导致的,请下载这个模型放到 HOME.insightface\models\buffalo_l\目录中。