SimSwap icon indicating copy to clipboard operation
SimSwap copied to clipboard

I have no idea how to solve.

Open chud37 opened this issue 3 years ago • 3 comments

Been running Simswap for a long time for video conversion, but wanted to try converting images (I've never used it for images before).

However I've run in to a mass of errors. For the record, there are no errors when running the test_video_swapsingle.py, It all works fine.

Here is what I get:

C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.parallel.data_parallel.DataParallel' has changed. Tried to save a patch, but couldn't create a writable file DataParallel.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.conv.Conv2d' has changed. Tried to save a patch, but couldn't create a writable file Conv2d.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm2d' has changed. Tried to save a patch, but couldn't create a writable file BatchNorm2d.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.activation.PReLU' has changed. Tried to save a patch, but couldn't create a writable file PReLU.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.MaxPool2d' has changed. Tried to save a patch, but couldn't create a writable file MaxPool2d.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.container.Sequential' has changed. Tried to save a patch, but couldn't create a writable file Sequential.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.pooling.AdaptiveAvgPool2d' has changed. Tried to save a patch, but couldn't create a writable file AdaptiveAvgPool2d.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.linear.Linear' has changed. Tried to save a patch, but couldn't create a writable file Linear.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.activation.Sigmoid' has changed. Tried to save a patch, but couldn't create a writable file Sigmoid.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.dropout.Dropout' has changed. Tried to save a patch, but couldn't create a writable file Dropout.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\serialization.py:656: SourceChangeWarning: source code of class 'torch.nn.modules.batchnorm.BatchNorm1d' has changed. Tried to save a patch, but couldn't create a writable file BatchNorm1d.patch. Make sure it doesn't exist and your working directory is writable.
  warnings.warn(msg, SourceChangeWarning)
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py:353: UserWarning: Deprecation warning. This ORT build has ['CUDAExecutionProvider', 'CPUExecutionProvider'] enabled. The next release (ORT 1.10) will require explicitly setting the providers parameter (as opposed to the current behavior of providers getting set/registered by default based on the build flags) when instantiating InferenceSession.For example, onnxruntime.InferenceSession(..., providers=["CUDAExecutionProvider"], ...)
  "based on the build flags) when instantiating InferenceSession."
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\nn\functional.py:3500: UserWarning: The default behavior for interpolate/upsample with float scale_factor changed in 1.6.0 to align with other frameworks/libraries, and now uses scale_factor directly, instead of relying on the computed output size. If you wish to restore the old behavior, please set recompute_scale_factor=True. See the documentation of nn.Upsample for details.
  "The default behavior for interpolate/upsample with float scale_factor changed "
C:\Users\chud3\Anaconda3\envs\simswap\lib\site-packages\torch\nn\functional.py:3455: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  "See the documentation of nn.Upsample for details.".format(mode)

Any ideas?

These patch files are there, I tried deleting them. They got recreated okay. But then when I run again it says no write access, which can't be the case if its able to create them.

Someone help please........

chud37 avatar Dec 29 '21 22:12 chud37

These are warnings and information not really errors, it should still work like this. These are shown mostly because your versions are newer than what this was targeted for. It should still work.

What does it show after this? Do you get a working output? if so, just ignore these warnings for now and don't update the environment unless you have a reason to.

Also, for images I recommend running DFDNet on them after, works great to improve their quality.

DvST8x avatar Dec 31 '21 16:12 DvST8x

You can also make a video with images by using FFmpeg and then use the frames from tmp folder.

Make a bat file with: @echo off setlocal EnableDelayedExpansion set i=0 for %%a in (*.jpg) do ( set /a i+=1 ren "%%a" "!i!.new" ) ren *.new *.jpg

Put it into your images folder and run it. It will rename images to 1,2,3 etc.

Open cmd and input: "*ffmpeg.exe location*" -y -noautorotate -i "*images location*\%d.jpg" -c:v copy "*output location*\file.mp4"

I suggest using .mp4 as the file extension.

Lyntai avatar Dec 31 '21 21:12 Lyntai

@DvST8x No there is no output despite the warnings.
@Gitgutx Yes that is what I did in the end, made a slideshow of the images and faceswapped that. I'm still at a loss as to why this is not working correctly.

chud37 avatar Jan 02 '22 19:01 chud37