def __init__(self, opt):
        self.opt = opt
        self.create_dataset()
        self.n_samples = len(self.dataset)

        self.end2end_model = ProgressiveSegEnd2EndModel(opt, self.n_samples)

        #end2end model
        if len(opt.gpu_ids) > 0:
            self.end2end_model = DataParallelWithCallback(
                self.end2end_model, device_ids=opt.gpu_ids)
            self.end2end_model_on_one_gpu = self.end2end_model.module
        else:
            self.end2end_model_on_one_gpu = self.end2end_model
        self.progressive_model = self.end2end_model_on_one_gpu.progressive_model
        self.pix2pix_model = self.end2end_model_on_one_gpu.pix2pix_model

        self.pix2pix_model.optimizer_G, self.pix2pix_model.optimizer_D = \
            self.pix2pix_model.create_optimizers(opt)
        self.optimizer_D2 = self.end2end_model_on_one_gpu.create_optimizers()
        self.phase = "stabilize"

        block_idx = InceptionV3.BLOCK_INDEX_BY_DIM[2048]
        self.inception_model = InceptionV3([block_idx])
        self.inception_model.cuda()
Esempio n. 2
0
    def __init__(self,opt):
        self.dataset = self.create_dataset(opt)
        n_samples = len(self.dataset)

        self.progressive_model = ProgressiveModel(opt, n_samples)
        self.opt = opt

        if len(opt.gpu_ids) > 0:
            self.progressive_model = DataParallelWithCallback(self.progressive_model,
                                                          device_ids=opt.gpu_ids)
            self.progressive_model_on_one_gpu = self.progressive_model.module
        else:
            self.progressive_model_on_one_gpu = self.progressive_model
Esempio n. 3
0
    def __init__(self, opt):
        self.opt = opt
        self.pix2pix_model = Pix2PixModel(opt)
        if len(opt.gpu_ids) > 0:
            self.pix2pix_model = DataParallelWithCallback(
                self.pix2pix_model, device_ids=opt.gpu_ids)
            self.pix2pix_model_on_one_gpu = self.pix2pix_model.module
        else:
            self.pix2pix_model_on_one_gpu = self.pix2pix_model

        self.generated = None
        if opt.isTrain:
            self.optimizer_G, self.optimizer_D = \
                self.pix2pix_model_on_one_gpu.create_optimizers(opt)
            self.old_lr = opt.lr