Exemplo n.º 1
0
        # Logger
        logger.configure_logging(
            os.path.abspath(os.path.join(opt.experiment_dir, 'logbook.txt')))

        # CUDA
        device = 'cuda' if torch.cuda.is_available(
        ) and not opt.no_cuda else 'cpu'
        opt.device = device
        if torch.cuda.is_available() and device == 'cpu':
            logging.info(
                "WARNING: You have a CUDA device, so you should probably run with --cuda"
            )

        # Adjust scales
        utils.adjust_scales2image(opt.img_size, opt)

        # Initial parameters
        opt.scale_idx = 0
        opt.nfc_prev = 0
        opt.Noise_Amps = []

        # Date
        dataset = SingleVideoDataset(opt)
        data_loader = DataLoader(dataset,
                                 shuffle=True,
                                 drop_last=True,
                                 batch_size=opt.batch_size,
                                 num_workers=2)

        opt.dataset = dataset
Exemplo n.º 2
0
    opt = parser.parse_args()

    if not os.path.exists(opt.out):
        os.makedirs(opt.out)

    torch.cuda.set_device(opt.gpu_id)

    opt.device = "cuda:%s" % opt.gpu_id
    opt.niter_init = opt.niter
    opt.noise_amp_init = opt.noise_amp_a
    opt.nfc_init = opt.nfc
    opt.min_nfc_init = opt.min_nfc
    opt.scale_factor_init = opt.scale_factor

    adjust_scales2image(opt.img_size, opt)

    if opt.manualSeed is None:
        opt.manualSeed = random.randint(1, 10000)
    print("Random Seed: ", opt.manualSeed)
    random.seed(opt.manualSeed)
    torch.manual_seed(opt.manualSeed)
    if torch.cuda.is_available() and opt.gpu_id == -1:
        print(
            "WARNING: You have a CUDA device, so you should probably run with --cuda"
        )

    opt.print_interval = int(opt.print_interval / opt.num_images)

    Gs_a = []
    reals_a = []