YOLOv8数据集存放位置

一、找到配置文件

YOLOv8 会将第一次运行的位置当做默认位置,此后不管将 ultralytics 移动到何处,训练时都将在第一次运行的位置寻找数据集并且将训练结果存储在与数据集同级的目录下。而且很难找到改变路径的方法,其实 YOLOv8 的配置文件隐藏地很深。

在 ...\ultralytics\ultralytics\utils 下有 _init_.py 文件,其中指明了 YOLOv8 的数据集配置文件的存放位置,不同的操作系统有不同的位置。

def get_user_config_dir(sub_dir='Ultralytics'):
    """
    Get the user config directory.

    Args:
        sub_dir (str): The name of the subdirectory to create.

    Returns:
        (Path): The path to the user config directory.
    """
    # Return the appropriate config directory for each operating system
    if WINDOWS:
        path = Path.home() / 'AppData' / 'Roaming' / sub_dir
    elif MACOS:  # macOS
        path = Path.home() / 'Library' / 'Application Support' / sub_dir
    elif LINUX:
        path = Path.home() / '.config' / sub_dir
    else:
        raise ValueError(f'Unsupported operating system: {platform.system()}')

    # GCP and AWS lambda fix, only /tmp is writeable
    if not is_dir_writeable(path.parent):
        LOGGER.warning(f"WARNING ⚠️ user config directory '{path}' is not writeable, defaulting to '/tmp' or CWD."
                       'Alternatively you can define a YOLO_CONFIG_DIR environment variable for this path.')
        path = Path('/tmp') / sub_dir if is_dir_writeable('/tmp') else Path().cwd() / sub_dir

    # Create the subdirectory if it does not exist
    path.mkdir(parents=True, exist_ok=True)

    return path

在不同的操作系统上运行以下代码即可知 Path.home() 位置

from pathlib import Path

print(Path.home())

而 sub_dir 代表 Ultralytics,因此,YOLOv8 配置文件所在目录位置就可以得到了

二、改变默认路径

用记事本打开 settings.yaml 文件,根据需要改变 datasets_dir,weights_dir,runs_dir 的位置,注意 runs 和 weights 虽然同级但 weights 在 runs 目录里面

settings_version: 0.0.4
datasets_dir: d:\workspace\YOLO\datasets
weights_dir: d:\workspace\YOLO\ultralytics\weights
runs_dir: d:\workspace\YOLO\ultralytics\runs
uuid: 8eb12fdc5b3a26c6990d9efa92c6935cb9e777d326b05db0011294e1430d9816
sync: true
api_key: ''
clearml: true
comet: true
dvc: true
hub: true
mlflow: true
neptune: true
raytune: true
tensorboard: true
wandb: true

  • 12
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
yolov8数据集可以按照特定的格式进行存放。通常情况下,需要在一个新建的文件夹中存放模型、数据和脚本。比如在/home/admin下新建一个yolov8文件夹,后续的所有操作都可以在这个文件夹下进行。 关于数据集的格式,具体可以参考yolov8官方给定的训练方式。在训练过程中,需要指定数据集存放位置,并根据训练目标修改yolov8x.yaml文件中的一个参数,即类别数。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [YOLOv8教程系列:一、使用自定义数据集训练YOLOv8模型(详细版教程,你只看一篇->调参攻略),包含环境...](https://blog.csdn.net/weixin_45921929/article/details/128673338)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [超详细yolov8训练数据集流程](https://blog.csdn.net/weixin_58465955/article/details/130291262)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值