This commit is contained in:
neulus
2025-09-29 22:51:54 +09:00
parent 02ac62fb1d
commit 12a165e461
38 changed files with 436 additions and 30 deletions

View File

@@ -12,3 +12,9 @@ def make_transform(resize_size: int = 256):
std=(0.229, 0.224, 0.225),
)
return v2.Compose([to_tensor, resize, to_float, normalize])
def denormalize(tensor):
mean = torch.tensor([0.485, 0.456, 0.406]).view(3, 1, 1).to(tensor.device)
std = torch.tensor([0.229, 0.224, 0.225]).view(3, 1, 1).to(tensor.device)
return tensor * std + mean