rewrite in more details for this project "# -*- coding: utf-8 -*-
#URL Roboflow: https://universe.roboflow.com/game-coams/drone-5eg4c/dataset/2#

!nvidia-smi

import os
HOME = os.getcwd()
print(HOME)

# Pip install method (recommended)

%pip install "ultralytics<=8.3.40" supervision roboflow
import ultralytics
ultralytics.checks()



from IPython import display
display.clear_output()


#Test ultralytics
from ultralytics import YOLO
from IPython.display import display, Image

# Commented out IPython magic to ensure Python compatibility.
!mkdir {HOME}/datasets
# %cd {HOME}/datasets

#####################################################################################################################

!pip install roboflow

from roboflow import Roboflow
rf = Roboflow(api_key="xs542BAQQ4nGbfcWQdcq")
project = rf.workspace("game-coams").project("drone-5eg4c")
version = project.version(2)
dataset = version.download("yolov11")
                

######################################################################################################################


%cd {HOME}
!yolo task=detect mode=train model=yolo11s.pt data={dataset.location}/data.yaml epochs=50 imgsz=640 plots=True
!ls {HOME}/runs/detect/train/

from IPython.display import Image as IPyImage

IPyImage(filename=f'{HOME}/runs/detect/train/confusion_matrix.png', width=600)


from IPython.display import Image as IPyImage

IPyImage(filename=f'{HOME}/runs/detect/train/results.png', width=600)


from IPython.display import Image as IPyImage
IPyImage(filename=f'{HOME}/runs/detect/train/val_batch0_pred.jpg', width=600)



# Commented out IPython magic to ensure Python compatibility.
#Validate Custom Model
# %cd {HOME}
!yolo task=detect mode=val model={HOME}/runs/detect/train/weights/best.pt data={dataset.location}/data.yaml

# Commented out IPython magic to ensure Python compatibility.
#Inference with Custom Model (Test new data)
# %cd {HOME}
!yolo task=detect mode=predict model={HOME}/runs/detect/train/weights/best.pt conf=0.25 source={dataset.location}/test/images save=True


# Let's take a look at few results.
import glob
from IPython.display import Image, display
for image_path in glob.glob(f'{HOME}/runs/detect/predict/*.jpg')[:3]:
      display(Image(filename=image_path, width=600))
      print("\n")" and show all metrics and plots like "# Commented out IPython magic to ensure Python compatibility.
# %cd {HOME}

!yolo task=detect mode=train model=yolov8s.pt data={dataset.location}/data.yaml epochs=25 imgsz=800 plots=True

!ls {HOME}/runs/detect/train/

# Commented out IPython magic to ensure Python compatibility.
# %cd {HOME}
Image(filename=f'{HOME}/runs/detect/train/confusion_matrix.png', width=600)

# Commented out IPython magic to ensure Python compatibility.
# %cd {HOME}
Image(filename=f'{HOME}/runs/detect/train/results.png', width=600)

# Commented out IPython magic to ensure Python compatibility.
# %cd {HOME}
Image(filename=f'{HOME}/runs/detect/train/val_batch0_pred.jpg', width=600)

# Commented out IPython magic to ensure Python compatibility.
#Validate Custom Model
# %cd {HOME}
!yolo task=detect mode=val model={HOME}/runs/detect/train/weights/best.pt data={dataset.location}/data.yaml

# Commented out IPython magic to ensure Python compatibility.
#Inference with Custom Model (Test new data)
# %cd {HOME}
!yolo task=detect mode=predict model={HOME}/runs/detect/train/weights/best.pt conf=0.25 source={dataset.location}/test/images save=True

# Let's take a look at few results.
import glob
from IPython.display import Image, display
for image_path in glob.glob(f'{HOME}/runs/detect/predict/*.jpg')[:3]:
      display(Image(filename=image_path, width=600))
      print("\n") and tensorboard and download best.pt and reuse it int test and view all metrics and explain all tasks (detect, classify, segment, pose , ...etc