Skip to content

Latest commit

 

History

History
80 lines (54 loc) · 2.48 KB

File metadata and controls

80 lines (54 loc) · 2.48 KB

MindYOLO 快速入门

本文简要介绍MindYOLO中内置的命令行工具的使用方法。

使用预训练模型进行推理

  1. model zoo中选择一个模型及其配置文件,例如, ./configs/yolov7/yolov7.yaml.
  2. model zoo中下载相应的预训练模型权重文件。
  3. 使用内置配置进行推理,请运行以下命令:
# NPU (默认)
python demo/predict.py --config ./configs/yolov7/yolov7.yaml --weight=/path_to_ckpt/WEIGHT.ckpt --image_path /path_to_image/IMAGE.jpg

# GPU
python demo/predict.py --config ./configs/yolov7/yolov7.yaml --weight=/path_to_ckpt/WEIGHT.ckpt --image_path /path_to_image/IMAGE.jpg --device_target=GPU

有关命令行参数的详细信息,请参阅demo/predict.py -h,或查看其源代码

  • 要在CPU上运行,请将device_target的值修改为CPU.
  • 结果将保存在./detect_results目录下

使用命令行进行训练和评估

  • 按照YOLO格式准备您的数据集。如果使用COCO数据集(YOLO格式)进行训练,请从yolov5或darknet准备数据集.

    Details
      coco/
        {train,val}2017.txt
        annotations/
          instances_{train,val}2017.json
        images/
          {train,val}2017/
              00000001.jpg
              ...
              # image files that are mentioned in the corresponding train/val2017.txt
        labels/
          {train,val}2017/
              00000001.txt
              ...
              # label files that are mentioned in the corresponding train/val2017.txt
    
  • 在多卡NPU/GPU上进行分布式模型训练,以8卡为例:

    mpirun --allow-run-as-root -n 8 python train.py --config ./configs/yolov7/yolov7.yaml  --is_parallel True
  • 在单卡NPU/GPU/CPU上训练模型:

    python train.py --config ./configs/yolov7/yolov7.yaml 
  • 评估模型的精度:

    python test.py --config ./configs/yolov7/yolov7.yaml --weight /path_to_ckpt/WEIGHT.ckpt

注意:默认超参为8卡训练,单卡情况需调整部分参数。 默认设备为Ascend,您可以指定'device_target'的值为Ascend/GPU/CPU。

  • 有关更多选项,请参阅 train/test.py -h.
  • 在云脑上进行训练,请在这里查看

部署

请在这里查看.

在代码中使用MindYOLO API

敬请期待