1. 이미지에 대한 detect
!yolo task=detect mode = predict model = '../YOLO_Model/v11/yolo11n.pt' source = '../Test_Images/people/bus_people.jpg' project="./runs/detect", name="predict"
2. 이미지 보기
from IPython.display import Image
Image("./runs/segment/predict/bus_people.jpg")
3. 영상에 대한 detect
!yolo task=detect mode = predict model = '../YOLO_Model/v11/yolo11n.pt' source = '../Test_Videos/bicycle.mp4' project="./runs/detect", name="predict"
4. 영상 확인하기
from IPython.display import HTML
from base64 import b64encode
import os
# Input video path
save_path = './runs/detect/predict2/bicycle.avi'
# Compressed video path
compressed_path = "./result_compressed.mp4"
os.system(f"ffmpeg -i {save_path} -vcodec libx264 {compressed_path}")
# Show video
mp4 = open(compressed_path,'rb').read()
data_url = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML("""
<video width=400 controls>
<source src="%s" type="video/mp4">
</video>
""" % data_url)