----追光逐电 光赢未来----
准确性和性能
MSCOCO 数据集上实时目标检测器的比较
YOLOv9 模型有四个变体,根据参数计数进行分类:
代码详情
from ikomia.dataprocess.workflow import Workflow
import os
#----------------------------- Step 1 -----------------------------------#
# Create a workflow which will take your dataset as input and
# train a YOLOv9 model on it
#------------------------------------------------------------------------#
wf = Workflow()
#----------------------------- Step 2 -----------------------------------#
# First you need to convert the COCO format to IKOMIA format.
# Add an Ikomia dataset converter to your workflow.
#------------------------------------------------------------------------#
dataset = wf.add_task(name="dataset_coco")
dataset.set_parameters({
"json_file":"Path/To/Dataset/train/_annotations.coco.json",
"image_folder":"Path/To/Dataset/train",
"task":"detection",
"output_folder":os.getcwd()+"/dataset"
})
#----------------------------- Step 3 -----------------------------------#
# Then, you want to train a YOLOv9 model.
# Add YOLOv9 training algorithm to your workflow
#------------------------------------------------------------------------#
train = wf.add_task(name="train_yolo_v9", auto_connect=True)
train.set_parameters({
"model_name":"yolov9-c",
"epochs":"50",
"batch_size":"8",
"train_imgsz":"640",
"test_imgsz":"640",
"dataset_split_ratio":"0.8",
"output_folder":os.getcwd(),
})
#----------------------------- Step 4 -----------------------------------#
# Execute your workflow.
# It automatically runs all your tasks sequentially.
#------------------------------------------------------------------------#
wf.run()
from ikomia.dataprocess.workflow import Workflow
from ikomia.utils.displayIO import display
# Create your workflow for YOLO inference
wf = Workflow()
# Add the YOLOv9 algorithm to your workflow
yolov9 = wf.add_task(name="infer_yolo_v9", auto_connect=True)
yolov9.set_parameters({
"model_weight_file":"Path/To/[Timestramp]/weights/best.pt",
"class_file":"Path/To/[Timestramp]/classes.yaml",
"conf_thres":"0.3",
"iou_thres":"0.25"
})
# Run on your image
wf.run_on(url="https://pbs.twimg.com/ext_tw_video_thumb/1660454979298115585/pu/img/A_Jrl2uawkkDi_Kf.jpg")
# wf.run_on(path=os.getcwd()+"/test/youtube-128_jpg.rf.2723e31eec77e1ff7b73c45c625082f6.jpg")
# Get the object detection image output
img_bbox = yolov9.get_image_with_graphics()
# Display
display(img_bbox)
我们的模型成功识别了球员、裁判和篮筐、球队得分、周期和剩余时间。
申明:感谢原创作者的辛勤付出。本号转载的文章均会在文中注明,若遇到版权问题请联系我们处理。
----与智者为伍 为创新赋能----
联系邮箱:uestcwxd@126.com
QQ:493826566