Updated
This commit is contained in:
@@ -8,8 +8,8 @@ import torch.nn.functional as F
|
||||
from torchvision import transforms
|
||||
from models.models import create_model
|
||||
from options.test_options import TestOptions
|
||||
from insightface_func.face_detect_crop_mutil import Face_detect_crop
|
||||
from util.videoswap_mutilspecific import video_swap
|
||||
from insightface_func.face_detect_crop_multi import Face_detect_crop
|
||||
from util.videoswap_multispecific import video_swap
|
||||
import os
|
||||
import glob
|
||||
|
||||
@@ -37,7 +37,7 @@ if __name__ == '__main__':
|
||||
start_epoch, epoch_iter = 1, 0
|
||||
crop_size = 224
|
||||
|
||||
mutilsepcific_dir = opt.mutilsepcific_dir
|
||||
multisepcific_dir = opt.multisepcific_dir
|
||||
torch.nn.Module.dump_patches = True
|
||||
model = create_model(opt)
|
||||
model.eval()
|
||||
@@ -49,7 +49,7 @@ if __name__ == '__main__':
|
||||
# The specific person to be swapped(source)
|
||||
|
||||
source_specific_id_nonorm_list = []
|
||||
source_path = os.path.join(mutilsepcific_dir,'source','*')
|
||||
source_path = os.path.join(multisepcific_dir,'SRC_*')
|
||||
source_specific_images_path = sorted(glob.glob(source_path))
|
||||
|
||||
for source_specific_image_path in source_specific_images_path:
|
||||
@@ -68,7 +68,7 @@ if __name__ == '__main__':
|
||||
|
||||
# The person who provides id information (list)
|
||||
target_id_norm_list = []
|
||||
target_path = os.path.join(mutilsepcific_dir,'target','*')
|
||||
target_path = os.path.join(multisepcific_dir,'DST_*')
|
||||
target_images_path = sorted(glob.glob(target_path))
|
||||
|
||||
for target_image_path in target_images_path:
|
||||
@@ -8,7 +8,7 @@ import torch.nn.functional as F
|
||||
from torchvision import transforms
|
||||
from models.models import create_model
|
||||
from options.test_options import TestOptions
|
||||
from insightface_func.face_detect_crop_mutil import Face_detect_crop
|
||||
from insightface_func.face_detect_crop_multi import Face_detect_crop
|
||||
from util.videoswap import video_swap
|
||||
import os
|
||||
|
||||
@@ -8,7 +8,7 @@ import torch.nn.functional as F
|
||||
from torchvision import transforms
|
||||
from models.models import create_model
|
||||
from options.test_options import TestOptions
|
||||
from insightface_func.face_detect_crop_mutil import Face_detect_crop
|
||||
from insightface_func.face_detect_crop_multi import Face_detect_crop
|
||||
from util.videoswap_specific import video_swap
|
||||
import os
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import torch.nn.functional as F
|
||||
from torchvision import transforms
|
||||
from models.models import create_model
|
||||
from options.test_options import TestOptions
|
||||
from insightface_func.face_detect_crop_mutil import Face_detect_crop
|
||||
from insightface_func.face_detect_crop_multi import Face_detect_crop
|
||||
from util.reverse2original import reverse2wholeimage
|
||||
import os
|
||||
from util.add_watermark import watermark_image
|
||||
@@ -39,7 +39,7 @@ if __name__ == '__main__':
|
||||
start_epoch, epoch_iter = 1, 0
|
||||
crop_size = 224
|
||||
|
||||
mutilsepcific_dir = opt.mutilsepcific_dir
|
||||
multisepcific_dir = opt.multisepcific_dir
|
||||
|
||||
torch.nn.Module.dump_patches = True
|
||||
logoclass = watermark_image('./simswaplogo/simswaplogo.png')
|
||||
@@ -56,7 +56,7 @@ if __name__ == '__main__':
|
||||
# The specific person to be swapped(source)
|
||||
|
||||
source_specific_id_nonorm_list = []
|
||||
source_path = os.path.join(mutilsepcific_dir,'source','*')
|
||||
source_path = os.path.join(multisepcific_dir,'SRC_*')
|
||||
source_specific_images_path = sorted(glob.glob(source_path))
|
||||
|
||||
for source_specific_image_path in source_specific_images_path:
|
||||
@@ -75,7 +75,7 @@ if __name__ == '__main__':
|
||||
|
||||
# The person who provides id information (list)
|
||||
target_id_norm_list = []
|
||||
target_path = os.path.join(mutilsepcific_dir,'target','*')
|
||||
target_path = os.path.join(multisepcific_dir,'DST_*')
|
||||
target_images_path = sorted(glob.glob(target_path))
|
||||
|
||||
for target_image_path in target_images_path:
|
||||
@@ -135,7 +135,7 @@ if __name__ == '__main__':
|
||||
|
||||
if len(swap_result_list) !=0:
|
||||
|
||||
reverse2wholeimage(swap_result_list, swap_result_matrix_list, crop_size, img_b_whole, logoclass, os.path.join(opt.output_path, 'result_whole_swap_mutilspecific.jpg'), opt.no_simswaplogo)
|
||||
reverse2wholeimage(swap_result_list, swap_result_matrix_list, crop_size, img_b_whole, logoclass, os.path.join(opt.output_path, 'result_whole_swap_multispecific.jpg'), opt.no_simswaplogo)
|
||||
|
||||
print(' ')
|
||||
|
||||
@@ -8,7 +8,7 @@ import torch.nn.functional as F
|
||||
from torchvision import transforms
|
||||
from models.models import create_model
|
||||
from options.test_options import TestOptions
|
||||
from insightface_func.face_detect_crop_mutil import Face_detect_crop
|
||||
from insightface_func.face_detect_crop_multi import Face_detect_crop
|
||||
from util.reverse2original import reverse2wholeimage
|
||||
import os
|
||||
from util.add_watermark import watermark_image
|
||||
@@ -74,7 +74,7 @@ if __name__ == '__main__':
|
||||
swap_result_list.append(swap_result)
|
||||
|
||||
|
||||
reverse2wholeimage(swap_result_list, b_mat_list, crop_size, img_b_whole, logoclass, os.path.join(opt.output_path, 'result_whole_swapmutil.jpg'),opt.no_simswaplogo)
|
||||
reverse2wholeimage(swap_result_list, b_mat_list, crop_size, img_b_whole, logoclass, os.path.join(opt.output_path, 'result_whole_swapmulti.jpg'),opt.no_simswaplogo)
|
||||
print(' ')
|
||||
|
||||
print('************ Done ! ************')
|
||||
@@ -8,7 +8,7 @@ import torch.nn.functional as F
|
||||
from torchvision import transforms
|
||||
from models.models import create_model
|
||||
from options.test_options import TestOptions
|
||||
from insightface_func.face_detect_crop_mutil import Face_detect_crop
|
||||
from insightface_func.face_detect_crop_multi import Face_detect_crop
|
||||
from util.reverse2original import reverse2wholeimage
|
||||
import os
|
||||
from util.add_watermark import watermark_image
|
||||
|
||||
Reference in New Issue
Block a user