def saveModels(self):
     torch.save(
         self.generator,
         util.fcnt(self.checkpoints_dir, "voxel_flow_generator", "pth"))
     torch.save(
         self.discriminator,
         util.fcnt(self.checkpoints_dir, "voxel_flow_discriminator", "pth"))
     print("done save models")
Esempio n. 2
0
 def saveModels(self):
     name = util.fcnt(self.sheckpoints_dir, "pix2pix_generator", "pth")
     torch.save(self.generator, name)
     print("{} is saved".format(name))
     name = util.fcnt(self.sheckpoints_dir, "pix2pix_discriminator", "pth")
     torch.save(self.discriminator, name)
     print("{} is saved".format(name))
     #        torch.save(self.discriminator, util.fcnt(self.sheckpoints_dir, "pix2pix_discriminator", "pth"))
     print("done save models")
Esempio n. 3
0
 def save_models(self):
     name = util.fcnt(self.checkpoints_dir,
                      "annotation_controller_generator", "pth")
     torch.save(self.generator, name)
     print("{} is saved".format(name))
     name = util.fcnt(self.checkpoints_dir,
                      "annotation_controller_discriminator", "pth")
     torch.save(self.discriminator, name)
     print("{} is saved".format(name))
     #        torch.save(self.discriminator, util.fcnt(self.checkpoints_dir, "annotation controller_discriminator", "pth"))
     print("done save models")
Esempio n. 4
0
 def _saveModel(self, model, file_name, is_fcnt=True):
     model_name = str(model.__class__).split("'")[1]
     if model_name.split(".")[-1] == "BaseSequential":
         self._saveModel(list(model)[0], file_name)
     else:
         if is_fcnt:
             path = util.fcnt(self.sheckpoints_dir, file_name, "pth")
         else:
             path = file_name
         state_dict = model.state_dict()
         state_dict['model_name'] = model_name
         state_dict['setting'] = self.setting
         torch.save(state_dict, path)
         print("{} is saved".format(path))
Esempio n. 5
0
 def dump(self, image=None):
     img = I.fromarray(image[...,::-1])
     img.save(util.fcnt(dir=self.dump_path, fname = "image", ext=self.ext))