THU-MIG / yolov10

YOLOv10: Real-Time End-to-End Object Detection [NeurIPS 2024]
https://arxiv.org/abs/2405.14458
GNU Affero General Public License v3.0
9.94k stars 988 forks source link

Missing tags #42

Closed xy3xy3 closed 5 months ago

xy3xy3 commented 5 months ago
from ultralytics import YOLOv10,YOLO
m = YOLO("models/yolov8n.pt")
print(m.names)
# Load a model
model = YOLOv10("models/yolov10n.pt").to("cuda")  # pretrained YOLOv8n model
print(model.names)
res = model.predict("bus.jpg",
                  show_boxes=True,show_conf=True,show_labels=True)[0]
res.show()
root@xy3dn:~/yolo8# /root/.pyenv/versions/3.10.12/bin/python /root/yolo8/test.py
{0: 'person', 1: 'bicycle', 2: 'car', 3: 'motorcycle', 4: 'airplane', 5: 'bus', 6: 'train', 7: 'truck', 8: 'boat', 9: 'traffic light', 10: 'fire hydrant', 11: 'stop sign', 12: 'parking meter', 13: 'bench', 14: 'bird', 15: 'cat', 16: 'dog', 17: 'horse', 18: 'sheep', 19: 'cow', 20: 'elephant', 21: 'bear', 22: 'zebra', 23: 'giraffe', 24: 'backpack', 25: 'umbrella', 26: 'handbag', 27: 'tie', 28: 'suitcase', 29: 'frisbee', 30: 'skis', 31: 'snowboard', 32: 'sports ball', 33: 'kite', 34: 'baseball bat', 35: 'baseball glove', 36: 'skateboard', 37: 'surfboard', 38: 'tennis racket', 39: 'bottle', 40: 'wine glass', 41: 'cup', 42: 'fork', 43: 'knife', 44: 'spoon', 45: 'bowl', 46: 'banana', 47: 'apple', 48: 'sandwich', 49: 'orange', 50: 'broccoli', 51: 'carrot', 52: 'hot dog', 53: 'pizza', 54: 'donut', 55: 'cake', 56: 'chair', 57: 'couch', 58: 'potted plant', 59: 'bed', 60: 'dining table', 61: 'toilet', 62: 'tv', 63: 'laptop', 64: 'mouse', 65: 'remote', 66: 'keyboard', 67: 'cell phone', 68: 'microwave', 69: 'oven', 70: 'toaster', 71: 'sink', 72: 'refrigerator', 73: 'book', 74: 'clock', 75: 'vase', 76: 'scissors', 77: 'teddy bear', 78: 'hair drier', 79: 'toothbrush'}
{0: '0', 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: '10', 11: '11', 12: '12', 13: '13', 14: '14', 15: '15', 16: '16', 17: '17', 18: '18', 19: '19', 20: '20', 21: '21', 22: '22', 23: '23', 24: '24', 25: '25', 26: '26', 27: '27', 28: '28', 29: '29', 30: '30', 31: '31', 32: '32', 33: '33', 34: '34', 35: '35', 36: '36', 37: '37', 38: '38', 39: '39', 40: '40', 41: '41', 42: '42', 43: '43', 44: '44', 45: '45', 46: '46', 47: '47', 48: '48', 49: '49', 50: '50', 51: '51', 52: '52', 53: '53', 54: '54', 55: '55', 56: '56', 57: '57', 58: '58', 59: '59', 60: '60', 61: '61', 62: '62', 63: '63', 64: '64', 65: '65', 66: '66', 67: '67', 68: '68', 69: '69', 70: '70', 71: '71', 72: '72', 73: '73', 74: '74', 75: '75', 76: '76', 77: '77', 78: '78', 79: '79'}

image 1/1 /root/yolo8/bus.jpg: 640x480 4 0s, 1 5, 118.0ms
Speed: 1.9ms preprocess, 118.0ms inference, 112.4ms postprocess per image at shape (1, 3, 640, 480)

image

I can't get label when using YOLO v10.

jameslahm commented 5 months ago

Thanks for your interest! Could you please try to add below lines and try again?

from ultralytics.nn.autobackend import default_class_names
model.model.names=default_class_names("coco8.yaml")
xy3xy3 commented 5 months ago

Thanks for your interest! Could you please try to add below lines and try again?

from ultralytics.nn.autobackend import default_class_names
model.model.names=default_class_names("coco8.yaml")

Thanks.

from ultralytics import YOLOv10
from ultralytics.nn.autobackend import default_class_names
model = YOLOv10("models/yolov10n.pt").to("cuda")
model.model.names=default_class_names("coco8.yaml")
res = model.predict("bus.jpg",
                  show_boxes=True,show_conf=True,show_labels=True)[0]
res.show()