29 lines
543 B
Python
29 lines
543 B
Python
|
from ultralytics import YOLO
|
||
|
|
||
|
model = YOLO('yolov8m.pt')
|
||
|
model.save_dir = './predict/'
|
||
|
|
||
|
result = model.predict(
|
||
|
'./Assets/cat_dog.jpg',
|
||
|
save=True,
|
||
|
device='cpu',
|
||
|
show=False,
|
||
|
classes=[16, 15],
|
||
|
)[0]
|
||
|
result = model(
|
||
|
'./Assets/cat_dog.jpg',
|
||
|
save=True,
|
||
|
project='test',
|
||
|
name='ololo',
|
||
|
device='cpu',
|
||
|
show=False,
|
||
|
)[0]
|
||
|
|
||
|
# print(len(result.boxes))
|
||
|
|
||
|
# for _ in result.boxes:
|
||
|
# box = result.boxes[_]
|
||
|
# print("Object type:", box.cls)
|
||
|
# print("Coordinates:", box.xyxy)
|
||
|
# print("Probability:", box.conf)
|