Downloads · 30 days
0
amd/yolov8m
yolov8m is a object detection model from amd. Use it when you need objects located in an image. The card lists the license as apache-2.0.
YOLOv8m is the medium version of YOLOv8 model trained on COCO object detection (118k annotated images) at resolution 640x640. It was released in https://github.com/ultralytics/ultralytics.
Downloads · 30 days
0
Access
Public
Updated Jan 30, 2024
Repo size
208 MB
Likes
6
Public
Click a slice to open those files.
.onnx104 MB · 100%
From the Hugging Face model README
YOLOv8m is the medium version of YOLOv8 model trained on COCO object detection (118k annotated images) at resolution 640x640. It was released in https://github.com/ultralytics/ultralytics.
We develop a modified version that could be supported by AMD Ryzen AI.
Ultralytics YOLOv8 is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO versions and introduces new features and improvements to further boost performance and flexibility. YOLOv8 is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of object detection and tracking, instance segmentation, image classification and pose estimation tasks.
You can use the raw model for object detection. See the model hub to look for all available YOLOv8 models.
Follow Ryzen AI Installation to prepare the environment for Ryzen AI. Run the following script to install pre-requisites for this model.
pip install -r requirements.txt
The dataset MSCOCO2017 contains 118287 images for training and 5000 images for validation.
Download COCO dataset and create/mount directories in your code like this:
└── yolov8m
└── datasets
└── coco
├── annotations
| ├── instances_val2017.json
| └── ...
├── labels
| ├── val2017
| | ├── 000000000139.txt
| ├── 000000000285.txt
| └── ...
├── images
| ├── val2017
| | ├── 000000000139.jpg
| ├── 000000000285.jpg
└── val2017.txt
path: /path/to/your/datasets/coco # dataset root dir
train: train2017.txt # train images (relative to 'path') 118287 images
val: val2017.txt # val images (relative to 'path') 5000 images
infer_onnx.py on how to useargs = make_parser().parse_args()
source = args.image_path
dataset = LoadImages(
source, imgsz=imgsz, stride=32, auto=False, transforms=None, vid_stride=1
)
onnx_weight = args.model
onnx_model = onnxruntime.InferenceSession(onnx_weight)
for batch in dataset:
path, im, im0s, vid_cap, s = batch
im = preprocess(im)
if len(im.shape) == 3:
im = im[None]
outputs = onnx_model.run(None, {onnx_model.get_inputs()[0].name: im.permute(0, 2, 3, 1).cpu().numpy()})
outputs = [torch.tensor(item).permute(0, 3, 1, 2) for item in outputs]
preds = post_process(outputs)
preds = non_max_suppression(
preds, 0.25, 0.7, agnostic=False, max_det=300, classes=None
)
plot_images(
im,
*output_to_target(preds, max_det=15),
source,
fname=args.output_path,
names=names,
)
python infer_onnx.py --onnx_model ./yolov8m.onnx -i /Path/To/Your/Image --ipu --provider_config /Path/To/Your/Provider_config
Note: vaip_config.json is located at the setup package of Ryzen AI (refer to Installation)
python eval_onnx.py --onnx_model ./yolov8m.onnx --ipu --provider_config /Path/To/Your/Provider_config
| Metric | Accuracy on IPU |
|---|---|
| AP@0.50:0.95 | 0.486 |
@software{yolov8_ultralytics,
author = {Glenn Jocher and Ayush Chaurasia and Jing Qiu},
title = {Ultralytics YOLOv8},
version = {8.0.0},
year = {2023},
url = {https://github.com/ultralytics/ultralytics},
orcid = {0000-0001-5950-6979, 0000-0002-7603-6750, 0000-0003-3783-7069},
license = {AGPL-3.0}
}