Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

第 11 章 Ultralytics

目录

11.1. 安装 ultralytics
11.1.1. 标注工具 labelimg
11.1.2. labelme
11.1.3. anylabeling
11.1.4. 环境配置
11.1.5. JSON2YOLO
11.2. YOLO 命令行
11.2.1. GPU 相关
11.2.2. Apple Silicon M 系列芯片
11.3. Task 任务
11.3.1. 图像检测
11.3.2. 图像分割
11.3.3. 图像分类
11.4. YOLO
11.4.1. labels 文件格式
11.4.2. 模型训练
11.4.3. 模型评估
11.4.4. 模型预测
11.4.5. 模型导出
11.5. ONNX(Open Neural Network Exchange) 开放神经网络交换格式
11.6. 自动标注
11.6.1. 背景
11.6.2. 尺寸裁剪工具
11.6.3. 转换程序
11.6.4. 自动标注工具
11.6.5. LabelimgToYolo
11.6.6. 标签管理,标签删除工具
11.6.7. 图像分类数据处理
11.6.8. 合并 YOLO txt 文件
11.7. 案例
11.7.1. 识别验证码
11.7.2. json2yolo - segment
11.8. FAQ
11.8.1. To fix this issue, refer to the "Safe importing of main module"
11.8.2. ModuleNotFoundError: No module named 'onnx'

11.1. 安装 ultralytics

		
pip install ultralytics		
		
		

从 Github 安装 https://github.com/ultralytics/ultralytics

		
# Install the ultralytics package from GitHub
pip install git+https://github.com/ultralytics/ultralytics.git@main		
		
		

11.1.1. 标注工具 labelimg

标注工具

			
pip install labelimg		
			
			

			
(venv) neo@Neo-Mac-mini medical % labelimg
2024-11-15 23:41:11.174 Python[19314:31301137] +[IMKClient subclass]: chose IMKClient_Modern		
			
			

11.1.2. labelme

安装

		
pip install labelme labelme2yolo		
		
			

使用方法

			
(.venv) neo@Neo-Mac-mini netkiller % labelme
			
			

labelme2yolo 标注格式转换工具

			
(.venv) PS D:\workspace\netkiller> labelme2yolo --json_dir .\captcha\dataset
[2024-11-17T11:46:35Z INFO  labelme2yolo] Starting the conversion process...
[2024-11-17T11:46:35Z INFO  labelme2yolo] Read and parsed 3 JSON files.
  [Train] [00:00:00] [########################################] 2/2 (0s)                                                                                                                                                                            
  [Val] [00:00:00] [########################################] 1/1 (0s)                                                                                                                                                                              
[2024-11-17T11:46:35Z INFO  labelme2yolo] Creating dataset.yaml file...
[2024-11-17T11:46:35Z INFO  labelme2yolo] Conversion process completed successfully.
			
			

labelme2yolo 转换后的数据保存在 YOLODataset 文件夹中

		
(.venv) PS D:\workspace\netkiller\captcha> labelme2yolo --json_dir datasets\train
(.venv) PS D:\workspace\netkiller\captcha> yolo task=detect mode=train model=yolov8n.pt data=.\YOLODataset\dataset.yaml epochs=30 workers=1 batch=16
		
			

11.1.3. anylabeling

安装 anylabeling

			
pip install anylabeling			
			
			

运行 anylabeling

			
anylabeling			
			
			

11.1.4. 环境配置

			
(.venv) neo@Neo-Mac-mini captcha % cat /Users/neo/Library/Application\ Support/Ultralytics/settings.json
{
  "settings_version": "0.0.6",
  "datasets_dir": "/Users/neo/PycharmProjects/netkiller/datasets",
  "weights_dir": "/Users/neo/PycharmProjects/netkiller/weights",
  "runs_dir": "/Users/neo/PycharmProjects/netkiller/runs",
  "uuid": "091024e8315e531396653f2ae1aa5f270aa3ead574e0f5ec04ed515ab8b85931",
  "sync": true,
  "api_key": "",
  "openai_api_key": "",
  "clearml": true,
  "comet": true,
  "dvc": true,
  "hub": true,
  "mlflow": true,
  "neptune": true,
  "raytune": true,
  "tensorboard": true,
  "wandb": false,
  "vscode_msg": true
}			
			
			

			
(.venv) neo@Neo-Mac-mini captcha % vim /Users/neo/Library/Application\ Support/Ultralytics/settings.json