Open netrunner-exe opened 2 years ago
The preprocess and the postprocess part for own trained model are different the inference demo code, and you have to update the demo code according to train.py
I find: 1、in train.py and test_wholeimage_swapsingle.py, the initial network was not the same... in train.py:
from models.projected_model import fsModel # model initial model = fsModel() # fsModel() source from **projected_model.py**, and in that, the Generator_Adain_Upsample source from fs_networks_fix
and in test_wholeimage_swapsingle.py:
from models.models import create_model # model initial model = create_model(opt) # fsModel() source from fs_model.py, and in that, the Generator_Adain_Upsample source from fs_networks_512
in general, the Generator_Adain_Upsample is diffenent between train.py and test_wholeimage_swapsingle.py.
2、so, after train, in your own pretrained_weight, you need initial network like train.py instead of test_wholeimage_swapsingle.py.
# test.py from models.projected_model import fsModel model = fsModel() # remenber add Gdeep=True in TestOptions model.initialize(opt) model.netG.eval() # and data preprocess like train.py def data_preprocess(img): img_tensor = transforms.ToTensor()(img) img_tensor = img_tensor.view(-1, 3, img.size[0], img.size[1]) mean = torch.tensor([0.485, 0.456, 0.406]).cuda().view(1, 3, 1, 1) std = torch.tensor([0.229, 0.224, 0.225]).cuda().view(1, 3, 1, 1) img_tensor = img_tensor.cuda(non_blocking=True) img_tensor = img_tensor.sub_(mean)._div(std) return img_tensor
Thank you very much! I tried to make changes but got errors. But still, the fact that at least someone managed to run the test code pleases me. Otherwise, what is the point of training if it is impossible to fully run the test code with own model? Just because it's been asked for so long? Let's wait and hope that the developer will fix the test code and give us the opportunity to run all test code with old models and with our own pretrained models as it should be.
I find: 1、in train.py and test_wholeimage_swapsingle.py, the initial network was not the same... in train.py:
from models.projected_model import fsModel # model initial model = fsModel() # fsModel() source from **projected_model.py**, and in that, the Generator_Adain_Upsample source from fs_networks_fix
and in test_wholeimage_swapsingle.py:
from models.models import create_model # model initial model = create_model(opt) # fsModel() source from fs_model.py, and in that, the Generator_Adain_Upsample source from fs_networks_512
in general, the Generator_Adain_Upsample is diffenent between train.py and test_wholeimage_swapsingle.py.
2、so, after train, in your own pretrained_weight, you need initial network like train.py instead of test_wholeimage_swapsingle.py.
# test.py from models.projected_model import fsModel model = fsModel() # remenber add Gdeep=True in TestOptions model.initialize(opt) model.netG.eval() # and data preprocess like train.py def data_preprocess(img): img_tensor = transforms.ToTensor()(img) img_tensor = img_tensor.view(-1, 3, img.size[0], img.size[1]) mean = torch.tensor([0.485, 0.456, 0.406]).cuda().view(1, 3, 1, 1) std = torch.tensor([0.229, 0.224, 0.225]).cuda().view(1, 3, 1, 1) img_tensor = img_tensor.cuda(non_blocking=True) img_tensor = img_tensor.sub_(mean)._div(std) return img_tensor
Can you provide full working with own pretrained 512 model example of test_wholeimage_swapsingle.py
or manual on what and where to change or add?
so glad, can you provide your email? or another way?
so glad, can you provide your email? or another way?
netrunner.exe@gmail.com @boreas-l
so glad, can you provide your email? or another way?
That would be great, looking forward to it!
According to what is said here, how should we modify the arguments to make an inference on our own pretrained models ?
According to what is said here, how should we modify the arguments to make an inference on our own pretrained models ?
Hah, in usage doesn't writed anything about how to use own pretrained models. Currently, the test code is incompatible with published training code and own pretrained models...Do not waste your time and resources - there is no point in training, since you will not be able to use your model in any way:) Therefore, we are waiting for the announced SimSwap ++, maybe we will have more luck with it :)
I find:
1、in train.py and test_wholeimage_swapsingle.py, the initial network was not the same...
in train.py:
and in test_wholeimage_swapsingle.py:
in general, the Generator_Adain_Upsample is diffenent between train.py and test_wholeimage_swapsingle.py.
2、so, after train, in your own pretrained_weight, you need initial network like train.py instead of test_wholeimage_swapsingle.py.