def save_image_vectors(model, dataloader_test):
    utils.rm_dir(Dir.image_vectors)
    with torch.no_grad():
        model.eval()
        for img, _, img_name, _ in dataloader_test:
            vectors = model(img.to("cuda"))
            for i, v in enumerate(vectors):
                path = Dir.image_vectors / Path(img_name[i]).relative_to(Dir.images)
                path.parent.mkdir(exist_ok=True, parents=True)
                torch.save(v, str(path))
Exemple #2
0
 def _create_terraform_root(self):
     utils.rm_dir(self.terraform_root)
     utils.mkdir_p(self.terraform_root)
Exemple #3
0
 def checkpoint_flush(self, silent=True):
     rm_dir(self.ckpt_dir, silent)
Exemple #4
0
 def summary_flush(self, silent=True):
     rm_dir(self.summary_dir, silent)