Esempio n. 1
0
import parent
import data
import networks
import visualize
import train
import inverseConsistentNet
import numpy as np
import torch
import matplotlib.pyplot as plt
import random
import os

import describe

d1_triangles, d2_triangles = data.get_dataset_triangles("train",
                                                        data_size=50,
                                                        hollow=True,
                                                        samples=128)
# d1_triangles_test, d2_triangles_test = data.get_dataset_triangles(
#    "test", data_size=50, hollow=True, samples=256
# )

d1_triangles_test, d2_triangles_test = d1_triangles, d2_triangles
network = networks.tallUNet2

d1, d2, d1_t, d2_t = (d1_triangles, d2_triangles, d1_triangles_test,
                      d2_triangles_test)
lmbda = 2048
random.seed(1)
torch.manual_seed(1)
torch.cuda.manual_seed(1)
np.random.seed(1)
Esempio n. 2
0
import torch
import matplotlib.pyplot as plt
import random
import os
import pickle

import describe

import argparse

parser = argparse.ArgumentParser()

batch_size = 128

d1, d2 = data.get_dataset_triangles("train",
                                    data_size=50,
                                    hollow=False,
                                    batch_size=batch_size)
d1_t, d2_t = data.get_dataset_triangles("test",
                                        data_size=50,
                                        hollow=False,
                                        batch_size=batch_size)

lmbda = 2048
random.seed(1)
torch.manual_seed(1)
torch.cuda.manual_seed(1)
np.random.seed(1)
print("=" * 50)
net = inverseConsistentNet.InverseConsistentNet(
    network_wrappers.DoubleNet(
        network_wrappers.RandomShift(0.25),
import inverseConsistentNet
import numpy as np
import torch
import matplotlib.pyplot as plt
import random
import os

import describe


random.seed(1)
torch.manual_seed(1)
torch.cuda.manual_seed(1)
np.random.seed(1)
d1_triangles, d2_triangles = data.get_dataset_triangles(
    "train", data_size=50, hollow=False
)

network = networks.FCNet

d1, d2 = (d1_triangles, d2_triangles)
lmbda = 2048
image_A, image_B = (x[0].cuda() for x in next(zip(d1, d2)))
image_A = image_A[:1].cuda()
image_B = image_B[:1].cuda()
print("=" * 50)
print(network, lmbda)
net = inverseConsistentNet.InverseConsistentNet(network(), lmbda, image_A.size())
net.cuda()
optimizer = torch.optim.Adam(net.parameters(), lr=0.00001)
net.train()