TSSAT and Clean up (#10)

This commit is contained in:
Fuou Marinas
2024-08-14 20:38:36 +07:00
committed by GitHub
parent c89a35bea2
commit 5f4cd03171
19 changed files with 1451 additions and 1488 deletions
+15
View File
@@ -2,6 +2,7 @@ import torch
import torch.nn.functional as F
from torchvision import transforms
from . import net
from .function import (
adaptive_instance_normalization,
adaptive_mean_normalization,
@@ -12,6 +13,20 @@ from .function import (
)
class MODEL_EFDM:
def __init__(self, dec_path: str, vgg_path: str, device) -> None:
self.decoder = net.decoder
vgg = net.vgg
self.decoder.load_state_dict(torch.load(dec_path))
vgg.load_state_dict(torch.load(vgg_path))
self.vgg = torch.nn.Sequential(*list(vgg.children())[:31])
self.vgg.eval().to(device)
self.decoder.eval().to(device)
def inference_efdm(
src_img: torch.Tensor,
style_img: torch.Tensor,