游戏人生
首页
(current)
GameDevTools
登陆
|
注册
个人中心
注销
ImGui-WebAssembly
Introduction
Introduction
前言
前言
1. SuperVision介绍
1. SuperVision介绍
1.1 使用Box和Label标记图片物体
1.2 导出检测结果
1.3 过滤检测结果
1.4 检测小物体
1.5 踪视频中的对象
1.6 处理数据集
代码资源下载
点我下载
Github
点赞、收藏、关注
目录
<< 1. SuperVision介绍
1.2 导出检测结果 >>
## 使用Box和Label标记图片物体 ```text 「supervision book」是一本开源电子书,PDF/随书代码/资源下载: https://github.com/ThisisGame/supervision_book ``` 官方文档 `https://supervision.roboflow.com/latest/how_to/detect_and_annotate/` 可以对物体用线框和Label进行标注,如下图:  ```python #file:files\supervision\detect_and_annotate.py import cv2 import supervision as sv from ultralytics import YOLO model = YOLO("yolov8n.pt") image = cv2.imread("highway_traffic.png") results = model(image)[0] detections = sv.Detections.from_ultralytics(results) box_annotator = sv.BoxAnnotator() label_annotator = sv.LabelAnnotator() labels = [ f"{class_name} {confidence:.2f}" for class_name, confidence in zip(detections['class_name'], detections.confidence) ] annotated_image = box_annotator.annotate( scene=image, detections=detections) annotated_image = label_annotator.annotate( scene=annotated_image, detections=detections, labels=labels) cv2.imshow("YOLOv8", annotated_image) cv2.waitKey(0) ``` 也可以将物体用色块进行标注,如下图:<a id="antiCollectorAdTxt" href="https://github.com/ThisisGame/supervision_book">「supervision book」是一本开源电子书,PDF/随书代码/资源下载: https://github.com/ThisisGame/supervision_book</a>  ```python #file:files\supervision\detect_and_annotate_segmentations.py import cv2 import supervision as sv from ultralytics import YOLO model = YOLO("yolov8n-seg.pt") image = cv2.imread("highway_traffic.png") results = model(image)[0] detections = sv.Detections.from_ultralytics(results) mask_annotator = sv.MaskAnnotator() label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER_OF_MASS) annotated_image = mask_annotator.annotate( scene=image, detections=detections) annotated_image = label_annotator.annotate( scene=annotated_image, detections=detections) cv2.imshow("YOLOv8", annotated_image) cv2.waitKey(0) ```
<< 1. SuperVision介绍
1.2 导出检测结果 >>
12
代码资源下载
点我下载
Github
点赞、收藏、关注
目录
Introduction
Introduction
前言
前言
1. SuperVision介绍
1. SuperVision介绍
1.1 使用Box和Label标记图片物体
1.2 导出检测结果
1.3 过滤检测结果
1.4 检测小物体
1.5 踪视频中的对象
1.6 处理数据集