Sketchypath [exclusive] -

def forward(self, x): x = torch.relu(self.conv1(x)) x = torch.relu(self.conv2(x)) x = x.view(-1, 128*28*28) x = torch.relu(self.fc1(x)) return x

class CNNEncoder(nn.Module): def __init__(self): super(CNNEncoder, self).__init__() self.conv1 = nn.Conv2d(1, 64, kernel_size=3) self.conv2 = nn.Conv2d(64, 128, kernel_size=3) self.fc1 = nn.Linear(128*28*28, 128) sketchypath

def forward(self, z): z = torch.relu(self.fc1(z)) z = z.view(-1, 128, 28, 28) x = torch.relu(self.conv1(z)) x = torch.sigmoid(self.conv2(x)) return x def forward(self, x): x = torch

class GenerativeDecoder(nn.Module): def __init__(self): super(GenerativeDecoder, self).__init__() self.fc1 = nn.Linear(128, 128*28*28) self.conv1 = nn.Conv2d(128, 64, kernel_size=3) self.conv2 = nn.Conv2d(64, 1, kernel_size=3) self).__init__() self.conv1 = nn.Conv2d(1

def forward(self, x): z = self.encoder(x) graphics = self.decoder(z) svg = self.path_renderer(graphics) return svg

class PathRenderer(nn.Module): def __init__(self): super(PathRenderer, self).__init__()

class SketchyPath(nn.Module): def __init__(self): super(SketchyPath, self).__init__() self.encoder = CNNEncoder() self.decoder = GenerativeDecoder() self.path_renderer = PathRenderer()

Subir