This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |