2023-09-29 21:51:53 +03:00
|
|
|
from ultralytics import YOLO
|
|
|
|
|
2024-02-24 19:30:01 +03:00
|
|
|
model = YOLO('yolov8s.pt')
|
2023-09-29 21:51:53 +03:00
|
|
|
model.save_dir = './predict/'
|
|
|
|
|
|
|
|
result = model.predict(
|
|
|
|
'./Assets/cat_dog.jpg',
|
|
|
|
save=True,
|
|
|
|
project='test',
|
|
|
|
name='ololo',
|
2024-02-24 19:30:01 +03:00
|
|
|
device=0,
|
2023-09-29 21:51:53 +03:00
|
|
|
show=False,
|
2024-02-24 19:30:01 +03:00
|
|
|
classes=[16, 15],
|
2023-09-29 21:51:53 +03:00
|
|
|
)[0]
|
2024-02-24 19:30:01 +03:00
|
|
|
# result = model(
|
|
|
|
# './Assets/cat_dog.jpg',
|
|
|
|
# save=True,
|
|
|
|
# project='test',
|
|
|
|
# name='ololo',
|
|
|
|
# device='gpu',
|
|
|
|
# show=False,
|
|
|
|
# )[0]
|
|
|
|
|
|
|
|
print(model.names)
|
2023-09-29 21:51:53 +03:00
|
|
|
|
|
|
|
# print(len(result.boxes))
|
|
|
|
|
|
|
|
# for _ in result.boxes:
|
|
|
|
# box = result.boxes[_]
|
|
|
|
# print("Object type:", box.cls)
|
|
|
|
# print("Coordinates:", box.xyxy)
|
|
|
|
# print("Probability:", box.conf)
|