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

add onnxslim support

Open inisis opened this issue 1 year ago • 6 comments

Summary by Sourcery

Update README.md to provide additional instructions for optimizing the inswapper_128_fp16.onnx model using onnxslim.

Documentation:

  • Updated README.md to include instructions for optimizing the inswapper_128_fp16.onnx model using onnxslim.

inisis avatar Aug 12 '24 11:08 inisis

Reviewer's Guide by Sourcery

This pull request updates the README.md file to include information about optimizing the inswapper_128_fp16.onnx model using onnxslim. The change provides users with an optional step to improve the performance of the model.

File-Level Changes

Files Changes
README.md Added information about optimizing the inswapper_128_fp16.onnx model using onnxslim
README.md Included a command-line example for using onnxslim to optimize the model

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

sourcery-ai[bot] avatar Aug 12 '24 11:08 sourcery-ai[bot]

As per checking, it just doesn't work based on the description

Exception in Tkinter callback Traceback (most recent call last): File "C:\Users\My Pc\AppData\Local\Programs\Python\Python311\Lib\tkinter_init_.py", line 1967, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\venv\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked self._command() File "E:\Deep-Live-Cam\Deep-Live-Cam\modules\ui.py", line 172, in live_button = ctk.CTkButton(root, text='Live', cursor='hand2', command=lambda: webcam_preview(camera_variable.get(), virtual_cam_out_value.get())) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\modules\ui.py", line 442, in webcam_preview preview_running = webcam_preview_loop(camera, source_image, frame_processors) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\modules\ui.py", line 365, in webcam_preview_loop temp_frame = frame_processor.process_frame(source_image, temp_frame) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\modules\processors\frame\face_swapper.py", line 58, in process_frame temp_frame = swap_face(source_face, target_face, temp_frame) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\modules\processors\frame\face_swapper.py", line 47, in swap_face return get_face_swapper().get(temp_frame, target_face, source_face, paste_back=True) ^^^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\modules\processors\frame\face_swapper.py", line 43, in get_face_swapper FACE_SWAPPER = insightface.model_zoo.get_model(model_path, providers=modules.globals.execution_providers) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\venv\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 96, in get_model model = router.get_model(providers=providers, provider_options=provider_options) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\venv\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 40, in get_model session = PickableInferenceSession(self.onnx_file, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "E:\Deep-Live-Cam\Deep-Live-Cam\venv\Lib\site-packages\insightface\model_zoo\model_zoo.py", line 25, in init super().init(model_path, **kwargs) File "E:\Deep-Live-Cam\Deep-Live-Cam\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 419, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File "E:\Deep-Live-Cam\Deep-Live-Cam\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 452, in _create_inference_session sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Load model from E:\Deep-Live-Cam\Deep-Live-Cam\modules..\models\inswapper_128.onnx failed:D:\a_work\1\s\onnxruntime\core\graph\model.cc:150 onnxruntime::Model::Model Unsupported model IR version: 10, max supported IR version: 9

hacksider avatar Aug 29 '24 16:08 hacksider

@hacksider Hi, there seems to be a version mismatch, you can check the similar issue here or official doc, and can you attch your onnx and onnxruntime version

inisis avatar Aug 30 '24 02:08 inisis

and if you want to use the slimmed model, it's preferred to slim under the same environment.

inisis avatar Aug 30 '24 02:08 inisis

@hacksider is there any updates, I have tested and it really works.

inisis avatar Aug 31 '24 06:08 inisis

@hacksider Hi, is there any updates?

inisis avatar Oct 07 '24 02:10 inisis