How to use the torchfcn.__file__ function in torchfcn

To help you get started, we’ve selected a few torchfcn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wkentaro / pytorch-fcn / examples / apc / generate_blacklist.py View on Github external
except Exception:
        return index


if __name__ == '__main__':
    dataset = torchfcn.datasets.apc.mit_training.APC2016mit_training

    pool = multiprocessing.Pool()
    tasks = list(enumerate(dataset._get_ids()))
    blacklist = []
    for index in tqdm.tqdm(pool.imap_unordered(do_work, tasks),
                           total=len(tasks), ncols=80):
        if index is not None:
            blacklist.append(index)

    data_dir = osp.join(osp.dirname(torchfcn.__file__), 'datasets/apc/data')
    with open(osp.join(data_dir, 'mit_training_blacklist.yaml'), 'w') as f:
        yaml.safe_dump(blacklist, f, default_flow_style=False)