Exemplo n.º 1
0
    def modify_config(self, config: FaceGroupingConfig, i):
        if i < self.num_runs / 2:
            config.dataset = self.bf
        else:
            config.dataset = self.bbt

        return super().modify_config(config, i)
Exemplo n.º 2
0
    def modify_config(self, config: FaceGroupingConfig, i):
        if i < 6:
            config.dataset = BigBangTheory(episode_index_test=i)
        else:
            config.dataset = Buffy(episode_index_test=i - 6)

        return super().modify_config(config, i)
Exemplo n.º 3
0
 def modify_config(self, config: FaceGroupingConfig, i):
     from FGG.dataset.split_strategy import SplitEveryXFrames
     x = 10
     config.graph_builder_params["split_strategy"] = SplitEveryXFrames(x=x)
     config.pool_before_clustering = True
     config.dataset = Buffy(episode_index_val=None,
                            episode_index_train=None,
                            episode_index_test=i)
     return (str(x), *super().modify_config(config, i))
Exemplo n.º 4
0
 def next_experiment(self):
     """
     Generator for configs.
     Should be sent the result WCP of the previous experiment.
     :return:
     """
     with open(self.file_name, "w") as f:
         f.write(f"{','.join(self.header)}\n")
     for i in range(self.num_runs):
         config = FaceGroupingConfig()
         entries = list(map(str, self.modify_config(config, i)))
         config.model_name = self.create_model_name(config, i)
         config.finalize()
         result = yield config
         with open(self.file_name, "a") as f:
             f.write(f"{','.join(entries + [str(result), ])}\n")
Exemplo n.º 5
0
    def modify_config(self, config: FaceGroupingConfig, i):
        out = super().modify_config(config, i)
        assert config.dataset.episode_index_test is not None
        config.dataset.episode_index_train = None
        config.dataset.episode_index_val = None

        # These are the paths for the pretrained weights.
        if isinstance(config.dataset.episode_index_test, int):
            if isinstance(config.dataset,
                          BigBangTheory) and self.checkpoint_file is Ellipsis:
                config.model_load_file = f"weights/bbt010{config.dataset.episode_index_test + 1}_checkpoint.tar"
            elif isinstance(config.dataset,
                            Buffy) and self.checkpoint_file is Ellipsis:
                config.model_load_file = f"weights/bf050{config.dataset.episode_index_test + 1}_checkpoint.tar"
            elif isinstance(config.dataset,
                            Accio) and self.checkpoint_file is Ellipsis:
                config.model_load_file = "weights/accio_checkpoint.tar"
            elif config.model_load_file is None:
                config.model_load_file = self.checkpoint_file

        print("Selected checkpoint", config.model_load_file)
        assert config.model_load_file is None or Path(
            config.model_load_file).is_file(), config.model_load_file
        return out
Exemplo n.º 6
0
 def modify_config(self, config: FaceGroupingConfig, i):
     config.dataset = self.accio
     config.model_params["sparse_adjacency"] = True
     return (str(self.num_clusters), *super().modify_config(config, i))
Exemplo n.º 7
0
 def modify_config(self, config: FaceGroupingConfig, i):
     config.dataset = self.bf
     return super().create_model_name(config, i)
Exemplo n.º 8
0
 def modify_config(self, config: FaceGroupingConfig, i):
     config.dataset = self.dataset
     return super().modify_config(config, i)
Exemplo n.º 9
0
 def modify_config(self, config: FaceGroupingConfig, i):
     config.dataset = Buffy(episode_index_test=i)
     return super().modify_config(config, i)
Exemplo n.º 10
0
 def modify_config(self, config: FaceGroupingConfig, i):
     config.dataset = Accio()
     config.model_params["sparse_adjacency"] = True
     return super().modify_config(config, i)