YOLOv8 COMPLETE Tutorial | Object Detection | Segmentation | Classification
[Link]
>> conda create -n yolov8 python=3.9
>> conda activate yolov8
>>pip install ultralytics
For GPU Support
>>pip3 install --upgrade torch torchvision torchaudio --index-url
[Link]
----------------------------------------Object
Detection----------------------------------------
# To predict a single Image
>> yolo task=detect mode=predict model=[Link] source=[Link]
Output is stored in runs/detect folder
To remove False Positive (Remove B box with low confidence)
>> yolo task=detect mode=predict model=[Link] source=[Link] conf=0.5
To show output in real time
>> yolo task=detect mode=predict model=[Link] source=[Link] conf=0.5 show=True
To save b box info
>> yolo task=detect mode=predict model=[Link] source=[Link] conf=0.5
save_txt=True
Note: Labels are stored with bounding box in runs folder
To save cropped object
>> yolo task=detect mode=predict model=[Link] source=[Link] conf=0.5
save_txt=True save_crop=True
Note: Cropped are stored with bounding box in runs/detect/crops folder
To remove confidence and label
>> yolo task=detect mode=predict model=[Link] source=[Link] conf=0.5
save_crop=True hide_labels=True hide_conf=true
To test on custom video and output in real time
>> yolo task=detect mode=predict model=[Link] source=video.mp4 conf=0.5
show=True
Output is stored in hard drive --False positive>> Change Model
To test on webcam and output in real time
>> yolo task=detect mode=predict model=[Link] source=0 conf=0.5 show=True
Output is stored in hard drive --False positive>> Change Model
To test on IP webcam and output in real time
>> yolo task=detect mode=predict model=[Link] source="URL" conf=0.5 show=True
Output is stored in hard drive --False positive>> Change Model
To test on custom test dataset
>> yolo task=detect mode=predict model=[Link] source=testDirectory conf=0.5
show=True
Output is stored in hard drive --False positive>> Change Model
-------------------------For image Segmentation -- Look for segment in GITHUB
repository---------
>> yolo task=segment mode=predict model=[Link] source=[Link] conf=0.5
hide_labels=True hide_conf=true
Output is in run/segment/folder
To save Polygon info
>> yolo task=segment mode=predict model=[Link] source=[Link] conf=0.5
save_txt=True hide_labels=True hide_conf=true
Note: Text file with polygon are stored with bounding box in runs folder
To run on video
>> yolo task=segment mode=predict model=[Link] source="Video.mp4 conf=0.5
show=True
Output stored in Hard drive
------------------------------For Image
Classification----------------------------------
To classify Go to GITHUB and see classification model weights (model=[Link])
# To train
>> yolo task=classify mode=train model=[Link] data=path epochs=1 imgsz=224
TO EXPORT MODEL
> yolo mode=export task=predict model=[Link] format=onxx
> yolo mode=export task=segment model=[Link] format=onxx
> yolo mode=export task=classify model=[Link] format=onxx
-------------To do in Python----------------------------
from ultralytics import YOLO
model=YOLO("[Link]")
path="C:\Research\Major Project\CVIP2023 Challenge\WCEBleedGen\Classification\
Dataset"
if __name__ == '__main__':
# Use the model
#results = [Link](data="C:/Research\Major Project/CVIP2023
Challenge/WCEBleedGen/Classification/Dataset/custom_data.yaml",imgsz=224,epochs=10)
# train the model
results = [Link](data=path, epochs=100, imgsz=224)
#results = [Link]() # evaluate model performance on the validation set
#results = model("[Link] # predict on an
image
--------------[Link]---------------------------
from ultralytics import YOLO
model=YOLO("[Link])
[Link](source="[Link]",save=True,conf=0.5,save_txt=True)
[Link](format="onxx"
>> python [Link]
--------------[Link]---------------------------
from ultralytics import YOLO
model=YOLO("[Link])
[Link](source="[Link]",save=True,conf=0.5,save_txt=True,show=True)
[Link](format="onxx"
>> python [Link]
--------------[Link]---------------------------
from ultralytics import YOLO
model=YOLO("[Link])
[Link](source="[Link]",save=True,conf=0.5,save_txt=True,show=True)
[Link](format="onxx"
>> python [Link]