update GanInverter
10
GanAttack.py
|
|
@ -1,3 +1,5 @@
|
||||||
|
import sys
|
||||||
|
sys.path.append('./GanInverter')
|
||||||
import torch
|
import torch
|
||||||
import torch.nn as nn
|
import torch.nn as nn
|
||||||
import torch.optim as optim
|
import torch.optim as optim
|
||||||
|
|
@ -5,8 +7,10 @@ from torchvision import models
|
||||||
from omegaconf import DictConfig, OmegaConf
|
from omegaconf import DictConfig, OmegaConf
|
||||||
from data.dataset import get_dataset,get_adv_dataset
|
from data.dataset import get_dataset,get_adv_dataset
|
||||||
from utils import get_model,set_requires_grad
|
from utils import get_model,set_requires_grad
|
||||||
from model.GanInverter.models.stylegan2.model import Generator
|
from GanInverter.inference.two_stage_inference import TwoStageInference
|
||||||
from model.GanInverter.inference.two_stage_inference import TwoStageInference
|
from GanInverter.models.stylegan2.model import Generator
|
||||||
|
# from models import GanAttack
|
||||||
|
import model
|
||||||
from model import GanAttack,CLIPLoss,VggLoss,get_prompt
|
from model import GanAttack,CLIPLoss,VggLoss,get_prompt
|
||||||
import torch.nn.functional as F
|
import torch.nn.functional as F
|
||||||
import time
|
import time
|
||||||
|
|
@ -16,6 +20,8 @@ import hydra
|
||||||
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_stylegan_generator(cfg):
|
def get_stylegan_generator(cfg):
|
||||||
|
|
||||||
# ensure_checkpoint_exists(ckpt_path)
|
# ensure_checkpoint_exists(ckpt_path)
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 1.9 MiB |
|
Before Width: | Height: | Size: 2.6 MiB After Width: | Height: | Size: 2.6 MiB |
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
|
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |