neuralchen / SimSwap

An arbitrary face-swapping framework on images and videos with one single trained model!
Other
4.55k stars 895 forks source link

Error "9900000_net_G.pth not exists yet" with the new update #226

Closed SrGrafoasspee closed 2 years ago

SrGrafoasspee commented 2 years ago

So I downloaded the zip of the update SimSwap code and replaced my old SimSwap-main folder with the new one.

When I gave the usual face swapping in video command python test_video_swapsingle.py --crop_size 224 --use_mask --name people --Arc_path arcface_model/arcface_checkpoint.tar --pic_a_path ./demo_file/face.jpg --video_path ./video/input.webm --output_path ./output/output.mp4 --temp_path ./temp_results

I got this in the CMD window

------------ Options -------------

Arc_path: arcface_model/arcface_checkpoint.tar

aspect_ratio: 1.0

batchSize: 8

checkpoints_dir: ./checkpoints

cluster_path: features_clustered_010.npy

crop_size: 224

data_type: 32

dataroot: ./datasets/cityscapes/

display_winsize: 512

engine: None

export_onnx: None

feat_num: 3

fineSize: 512

fp16: False

gpu_ids: [0]

how_many: 50

id_thres: 0.03

image_size: 224

input_nc: 3

instance_feat: False

isTrain: False

label_feat: False

label_nc: 0

latent_size: 512

loadSize: 1024

load_features: False

local_rank: 0

max_dataset_size: inf

model: pix2pixHD

multisepcific_dir: ./demo_file/multispecific

nThreads: 2

n_blocks_global: 6

n_blocks_local: 3

n_clusters: 10

n_downsample_E: 4

n_downsample_global: 3

n_local_enhancers: 1

name: people

nef: 16

netG: global

ngf: 64

niter_fix_global: 0

no_flip: False

no_instance: False

no_simswaplogo: True

norm: batch

norm_G: spectralspadesyncbatch3x3

ntest: inf

onnx: None

output_nc: 3

output_path: ./output/output.mp4

phase: test

pic_a_path: ./demo_file/face.jpg

pic_b_path: ./crop_224/zrf.jpg

pic_specific_path: ./crop_224/zrf.jpg

resize_or_crop: scale_width

results_dir: ./results/

semantic_nc: 3

serial_batches: False

temp_path: ./temp_results

tf_log: False

use_dropout: False

use_encoded_image: False

use_mask: True

verbose: False

video_path: ./video/input.webm

which_epoch: 9900000

-------------- End ----------------

./checkpoints\people\9900000_net_G.pth not exists yet!

Traceback (most recent call last):

File "test_video_swapsingle.py", line 54, in <module>

model = create_model(opt)

File "D:\SimSWAP\SimSwap-main\models\models.py", line 18, in create_model

model.initialize(opt)

File "D:\SimSWAP\SimSwap-main\models\fs_model.py", line 74, in initialize

self.load_network(self.netG, 'G', opt.which_epoch, pretrained_path)

 File "D:\SimSWAP\SimSwap-main\models\base_model.py", line 71, in load_network

raise('Generator must exist!')

TypeError: exceptions must derive from BaseException

I have 550000_net_G.pth in the \checkpoints\512\ folder and latest_net_G.pth in the \checkpoints\people\ folder but I couldn't find anything about 9900000_net_G.pth after searching it with "SimSwap" on google.

I replaced the new code with my old SimSwap-main folder and on using it, instead of which_epoch: 9900000 I get which_epoch: latest

What's the fix for it?

netrunner-exe commented 2 years ago

Hi! This error occurred because the developer changed the default --which_epoch value in the test_options.py file from latest to 9900000. Adding --which_epoch latest to cmd was solved this issue for me

phrayz commented 2 years ago

I'm new at this entire python/colab thing. How would I fix this in colab?

The cmd being used is: video_swap(opt.video_path, latend_id, model, app, opt.output_path, temp_results_dir=opt.temp_path, use_mask=opt.use_mask)

netrunner-exe commented 2 years ago

I'm new at this entire python/colab thing. How would I fix this in colab?

The cmd being used is: video_swap(opt.video_path, latend_id, model, app, opt.output_path, temp_results_dir=opt.temp_path, use_mask=opt.use_mask)

In Colab after cloning the repository: 1) Open SimSwap/options/test_options.py, in line 18 self.parser.add_argument('--which_epoch', type=str, default='9900000', help='which epoch to load? set to latest to use latest cached model') change 9900000 to latest and save.

You will need to do this every time until the developer change it directly in this file in the repository.

phrayz commented 2 years ago

It's odd. I tried that earlier, but I get the same error and when it lists the variable values, it shows "which_epoch: 9900000"

I'm missing something, but I have no idea what :)

Thanks for your help!

On Thu, Apr 21, 2022 at 6:19 AM netrunner-exe @.***> wrote:

I'm new at this entire python/colab thing. How would I fix this in colab?

The cmd being used is: video_swap(opt.video_path, latend_id, model, app, opt.output_path, temp_results_dir=opt.temp_path, use_mask=opt.use_mask)

In Colab after cloning the repository:

  1. Open SimSwap/options/test_options.py, in line 18 self.parser.add_argument('--which_epoch', type=str, default='9900000', help='which epoch to load? set to latest to use latest cached model') change 9900000 to latest and save.

You will need to do this every time until the developer change it directly in this file in the repository.

— Reply to this email directly, view it on GitHub https://github.com/neuralchen/SimSwap/issues/226#issuecomment-1105141318, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQUZFHPZNARIQJ2APXABJ3VGFBWHANCNFSM5T46LDPA . You are receiving this because you commented.Message ID: @.***>