detectron2 中的coco数据集默认位置更改

detectron2 中的coco数据集默认位置更改

其默认的dataset的位置是 .../detectron2/data/datasets/...

更改方式

打开上述路径下的buildin.py文件

# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved

"""
This file registers pre-defined datasets at hard-coded paths, and their metadata.

We hard-code metadata for common datasets. This will enable:
1. Consistency check when loading the datasets
2. Use models on these standard datasets directly and run demos,
   without having to download the dataset annotations

We hard-code some paths to the dataset that's assumed to
exist in "./datasets/". #其默认位置为"./datasets/"

Users SHOULD NOT use this file to create new dataset / metadata for new dataset.
To add new dataset, refer to the tutorial "docs/DATASETS.md".
"""

更改最下面的函数:

# Register them all under "./datasets"
_root = os.getenv("DETECTRON2_DATASETS", "/media/code/T1/") #更改DATASETS的值
register_all_coco(_root)
register_all_lvis(_root)
register_all_cityscapes(_root)
register_all_pascal_voc(_root)
上一篇:Detectron2 基准测试 | 十二


下一篇:detectron2 一个整体的demo说明自定义数据集以及训练过程