Skip to content

Commit

Permalink
modifiy video attack code
Browse files Browse the repository at this point in the history
  • Loading branch information
junghye01 committed Nov 29, 2024
1 parent f5dcc79 commit c17b325
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion options/test_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ def initialize(self):
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=512, help='Crop of size of input image')

self.parser.add_argument('--isattack', type=int, default=1, help='Adversarial attack')
self.isTrain = False
9 changes: 5 additions & 4 deletions test_video_swapspecific.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ def lcm(a, b): return abs(a * b) / fractions.gcd(a, b) if a and b else 0
specific_person_downsample = F.interpolate(specific_person, size=(112,112))
specific_person_id_nonorm = model.netArc(specific_person_downsample)

video_swap(opt.video_path, latend_id,specific_person_id_nonorm, opt.id_thres, \
if not opt.isattack:
video_swap(opt.video_path, latend_id,specific_person_id_nonorm, opt.id_thres, \
model, app, opt.output_path,temp_results_dir=opt.temp_path,no_simswaplogo=opt.no_simswaplogo,use_mask=opt.use_mask,crop_size=crop_size)
else:
video_swap_with_attack(opt.video_path, img_id,latend_id,specific_person_id_nonorm, opt.id_thres, \
model, app, opt.output_path,temp_results_dir=opt.temp_path,no_simswaplogo=opt.no_simswaplogo,use_mask=opt.use_mask,crop_size=crop_size)

#video_swap_with_attack(opt.video_path, img_id,latend_id,specific_person_id_nonorm, opt.id_thres, \
# model, app, opt.output_path,temp_results_dir=opt.temp_path,no_simswaplogo=opt.no_simswaplogo,use_mask=opt.use_mask,crop_size=crop_size)


0 comments on commit c17b325

Please sign in to comment.