Tkinter return self.func(*args) 原因与解决方法

今天,一位群友在用roop换脸的时候,结果报错如下:

(venv) D:\roop>python run.py
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "D:\roop\venv\lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
    self._command()
  File "D:\roop\roop\ui.py", line 103, in <lambda>
    start_button = ctk.CTkButton(root, text='Start', cursor='hand2', command=lambda: select_output_path(start))
  File "D:\roop\roop\ui.py", line 199, in select_output_path
    start()
  File "D:\roop\roop\core.py", line 133, in start
    if not frame_processor.pre_start():
  File "D:\roop\roop\processors\frame\face_swapper.py", line 45, in pre_start
    elif not get_one_face(cv2.imread(roop.globals.source_path)):
  File "D:\roop\roop\face_analyser.py", line 30, in get_one_face
    many_faces = get_many_faces(frame)
  File "D:\roop\roop\face_analyser.py", line 41, in get_many_faces
    return get_face_analyser().get(frame)
  File "D:\roop\roop\face_analyser.py", line 18, in get_face_analyser
    FACE_ANALYSER = insightface.app.FaceAnalysis(name='buffalo_l', providers=roop.globals.execution_providers)
  File "D:\roop\venv\lib\site-packages\insightface\app\face_analysis.py", line 43, in __init__
    assert 'detection' in self.models
AssertionError
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__
    return self.func(*args)
  File "D:\roop\venv\lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
    self._command()
  File "D:\roop\roop\ui.py", line 103, in <lambda>
    start_button = ctk.CTkButton(root, text='Start', cursor='hand2', command=lambda: select_output_path(start))
  File "D:\roop\roop\ui.py", line 199, in select_output_path
    start()
  File "D:\roop\roop\core.py", line 133, in start
    if not frame_processor.pre_start():
  File "D:\roop\roop\processors\frame\face_swapper.py", line 45, in pre_start
    elif not get_one_face(cv2.imread(roop.globals.source_path)):
  File "D:\roop\roop\face_analyser.py", line 30, in get_one_face
    many_faces = get_many_faces(frame)
  File "D:\roop\roop\face_analyser.py", line 41, in get_many_faces
    return get_face_analyser().get(frame)
  File "D:\roop\roop\face_analyser.py", line 18, in get_face_analyser
    FACE_ANALYSER = insightface.app.FaceAnalysis(name='buffalo_l', providers=roop.globals.execution_providers)
  File "D:\roop\venv\lib\site-packages\insightface\app\face_analysis.py", line 43, in __init__
    assert 'detection' in self.models
AssertionError

Tkinter return self.func(*args)

 

原因

我查看了上面所有的错误调试代码,结果发现了主要的原因是:

elif not get_one_face(cv2.imread(roop.globals.source_path))

 

解决方法

由于每一个的 “Tkinter return self.func(*args) ” 报错原因可能是不同的,解决方法自然也是不一样的,这里仅供大家做一个参考。

 

以我这位群友为例子,具体解决方法请参考:

elif not get_one_face(cv2.imread(roop.globals.source_path)) 原因与解决方法

付杰
  • ¥ 189.0元
  • 市场价:269.0元
  • ¥ 39.0元
  • 市场价:39.0元
  • ¥ 999元
  • 市场价:4999元
  • ¥ 58.0元
  • 市场价:58.0元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: