Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
neuralchen committed Jun 1, 2023
1 parent 7a6c92a commit 70b22c4
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 15 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ If you find this project useful, please star it. It is the greatest appreciation

[![logo](./docs/img/vggface2_hq_compare.png)](https://github.com/NNNNAI/VGGFace2-HQ)


## This project also received support from [SocialBook](https://socialbook.io).
<!-- [![logo](./simswaplogo/socialbook_logo.2020.357eed90add7705e54a8.svg)](https://socialbook.io) -->
<img width=30% src="./simswaplogo/socialbook_logo.2020.357eed90add7705e54a8.svg"/>

## Dependencies
- python3.6+
- pytorch1.5+
Expand Down
3 changes: 0 additions & 3 deletions models/fs_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ def initialize(self, opt):
self.netG = Generator_Adain_Upsample(input_nc=3, output_nc=3, latent_size=512, n_blocks=9, deep=False)
self.netG.to(device)




# Id network
netArc_checkpoint = opt.Arc_path
netArc_checkpoint = torch.load(netArc_checkpoint, map_location=torch.device("cpu"))
Expand Down
10 changes: 3 additions & 7 deletions models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@


def create_model(opt):
if opt.model == 'pix2pixHD':
#from .pix2pixHD_model import Pix2PixHDModel, InferenceModel
from .fs_model import fsModel
model = fsModel()
else:
from .ui_model import UIModel
model = UIModel()
#from .pix2pixHD_model import Pix2PixHDModel, InferenceModel
from .fs_model import fsModel
model = fsModel()

model.initialize(opt)
if opt.verbose:
Expand Down
4 changes: 2 additions & 2 deletions models/projected_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Created Date: Wednesday January 12th 2022
# Author: Chen Xuanhong
# Email: chenxuanhongzju@outlook.com
# Last Modified: Thursday, 21st April 2022 8:13:37 pm
# Last Modified: Saturday, 13th May 2023 9:56:35 am
# Modified By: Chen Xuanhong
# Copyright (c) 2022 Shanghai Jiao Tong University
#############################################################
Expand Down Expand Up @@ -46,7 +46,7 @@ def initialize(self, opt):
# Id network
netArc_checkpoint = opt.Arc_path
netArc_checkpoint = torch.load(netArc_checkpoint, map_location=torch.device("cpu"))
self.netArc = netArc_checkpoint['model'].module
self.netArc = netArc_checkpoint
self.netArc = self.netArc.cuda()
self.netArc.eval()
self.netArc.requires_grad_(False)
Expand Down
2 changes: 1 addition & 1 deletion options/base_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def initialize(self):
self.parser.add_argument('--name', type=str, default='people', help='name of the experiment. It decides where to store samples and models')
self.parser.add_argument('--gpu_ids', type=str, default='0', help='gpu ids: e.g. 0 0,1,2, 0,2. use -1 for CPU')
self.parser.add_argument('--checkpoints_dir', type=str, default='./checkpoints', help='models are saved here')
self.parser.add_argument('--model', type=str, default='pix2pixHD', help='which model to use')
# self.parser.add_argument('--model', type=str, default='pix2pixHD', help='which model to use')
self.parser.add_argument('--norm', type=str, default='batch', help='instance normalization or batch normalization')
self.parser.add_argument('--use_dropout', action='store_true', help='use dropout for the generator')
self.parser.add_argument('--data_type', default=32, type=int, choices=[8, 16, 32], help="Supported data type i.e. 8, 16, 32 bit")
Expand Down
4 changes: 2 additions & 2 deletions options/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(self):
self.parser.add_argument("--onnx", type=str, help="run ONNX model via TRT")
self.parser.add_argument("--Arc_path", type=str, default='arcface_model/arcface_checkpoint.tar', help="run ONNX model via TRT")
self.parser.add_argument("--pic_a_path", type=str, default='G:/swap_data/ID/elon-musk-hero-image.jpeg', help="Person who provides identity information")
self.parser.add_argument("--pic_b_path", type=str, default='G:/swap_data/ID/bengio.jpg', help="Person who provides information other than their identity")
self.parser.add_argument("--pic_b_path", type=str, default='./demo_file/multi_people.jpg', help="Person who provides information other than their identity")
self.parser.add_argument("--pic_specific_path", type=str, default='./crop_224/zrf.jpg', help="The specific person to be swapped")
self.parser.add_argument("--multisepcific_dir", type=str, default='./demo_file/multispecific', help="Dir for multi specific")
self.parser.add_argument("--video_path", type=str, default='G:/swap_data/video/HSB_Demo_Trim.mp4', help="path for the video to swap")
Expand All @@ -33,6 +33,6 @@ def initialize(self):
self.parser.add_argument('--id_thres', type=float, default=0.03, help='how many test images to run')
self.parser.add_argument('--no_simswaplogo', action='store_true', help='Remove the watermark')
self.parser.add_argument('--use_mask', action='store_true', help='Use mask for better result')
self.parser.add_argument('--crop_size', type=int, default=224, help='Crop of size of input image')
self.parser.add_argument('--crop_size', type=int, default=512, help='Crop of size of input image')

self.isTrain = False
Binary file modified output/result.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions simswaplogo/socialbook_logo.2020.357eed90add7705e54a8.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 70b22c4

Please sign in to comment.