Exemple #1
0
def copy_data_helper(data: Dict[str, List[str]], imagesroot: str, foldername: str) -> None:

    for key in data.keys():
        images = data[key]
        for im in images:
            if not im:
                continue
            source = os.path.join(imagesroot, im)
            target = os.path.join(foldername, key, im)
            if not os.path.isfile(target):
                utils.copy_file(source, target)
Exemple #2
0
def copy_file_list(file_list, src_dir, dest_dir):
    with tqdm(total=len(file_list)) as pbar:
        for i, filename in enumerate(file_list):
            filename = filename.strip()
            if filename:
                # convert / to os-specific dir separator
                filename_parts = (filename + '.jpg').split('/')
                target = os.path.join(dest_dir, *filename_parts)
                if not os.path.isfile(target):
                    utils.copy_file(os.path.join(src_dir, *filename_parts),
                                    target)
            pbar.update(1)
Exemple #3
0
    def copy_search_to_eval(self)->None:
        # do not cache conf_search or conf_eval as it may have values that
        # needs env var expansion.

        # get desc file path that search has produced
        conf_search = self.get_conf(True)['nas']['search']
        search_desc_filename = conf_search['final_desc_filename']
        search_desc_filepath = utils.full_path(search_desc_filename)
        assert search_desc_filepath and os.path.exists(search_desc_filepath)

        # get file path that eval would need
        conf_eval = self.get_conf(False)['nas']['eval']
        eval_desc_filename = conf_eval['final_desc_filename']
        eval_desc_filepath = utils.full_path(eval_desc_filename)
        assert eval_desc_filepath
        utils.copy_file(search_desc_filepath, eval_desc_filepath)