Skip to content

Commit

Permalink
ugly training code
Browse files Browse the repository at this point in the history
  • Loading branch information
harisreedhar committed Dec 10, 2024
1 parent be44304 commit 81227ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions face_swapper/src/training.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,9 @@ def get_arcface_embedding(self, vision_tensor : Tensor, padding : Tuple[int, int
crop_vision_tensor = vision_tensor[:, :, crop_height : height - crop_height, crop_width : width - crop_width]
crop_vision_tensor = torch.nn.functional.interpolate(crop_vision_tensor, size = (112, 112), mode = 'bilinear')
crop_vision_tensor[:, :, :padding[0], :] = 0
crop_vision_tensor[:, :, -padding[1]:, :] = 0
crop_vision_tensor[:, :, 112 - padding[1]:, :] = 0
crop_vision_tensor[:, :, :, :padding[2]] = 0
crop_vision_tensor[:, :, :, -padding[3]:] = 0
crop_vision_tensor[:, :, :, 112 - padding[3]:] = 0
embedding = self.arcface(crop_vision_tensor)
embedding = torch.nn.functional.normalize(embedding, p = 2, dim = 1)
return embedding
Expand Down

0 comments on commit 81227ed

Please sign in to comment.