Skip to content

Instantly share code, notes, and snippets.

@RasinGue
RasinGue / RandomPairsGen.py
Created March 21, 2023 15:54
RandomPairsGen
import tkinter as tk
import random
def add_name():
name = name_entry.get()
if name:
names_list.insert(tk.END, name)
name_entry.delete(0, tk.END)
def edit_name():
import VGG19
import torch.nn as nn
class VGGLoss(nn.Module):
def __init__(self, gpu_ids):
super(VGGLoss, self).__init__()
self.vgg = VGG19.cuda()
self.criterion = nn.L1Loss()
self.weights = [1.0 / 32, 1.0 / 16, 1.0 / 8, 1.0 / 4, 1.0]
import torch
import torch.nn as nn
import torchvision
# VGG for perceptual loss
class VGG19(nn.Module):
def __init__(self, require_grad=False):
super(VGG19, self).__init__()
vgg_pretrained_features = torchvision.models.vgg19(pretrained=True).features