AI Notebooks - Tutorial - Train YOLOv8 to play to "rock paper scissors"

Knowledge Base

AI Notebooks - Tutorial - Train YOLOv8 to play to "rock paper scissors"


Icons/System/eye-open Created with Sketch. 402 Views 19.10.2023 Cloud / AI Notebooks

Objective

The purpose of this tutorial is to show how to train YOLOv8 to play the game "rock paper scissors".

YOLOv8 is an object detection algorithm. Although closely related to image classification, object detection performs image classification on a more precise scale. Object detection locates and categorizes features in images.

It is based on the YOLOv8 open source repository.

Requirements


OVHcloud Control Panel Access


Instructions

This tutorial is based on the Rock Paper Scissors SXSW Computer Vision Project Dataset. It is available for free on Roboflow.

To learn more about the license of this dataset, please follow this link.

Create Object Storage containers

If you want to create it from the OVHcloud Control Panel, go to the Object Storage section and create a new object container by clicking Object Storage > Create an object container.

image

If you want to run it with the CLI, just follow this guide. You have to choose the region, the name of your container and the path where your data is located and use the following commands.

In this tutorial, you have to create 2 object containers.

  • An object container rock-paper-scissors-data dedicated to the dataset:
ovhai bucket create <region> rock-paper-scissors-data
  • An object container rock-paper-scissors-model to save the model weights (for a future inference for example):
ovhai bucket create <region> rock-paper-scissors-model

These two Object Storage containers will be empty initially. You will add data from the notebook.

Launch and access Jupyter notebook with Miniconda framework

You need to attach a volume if your data is in your OVHcloud Object Storage and you want to use it during your experiment, or if you need to save the results of your work in the Object Storage. For more information on data, volumes and permissions, see our guide on data.

If you want to launch it from the OVHcloud Control Panel, just follow this guide.

  1. Name your notebook
  2. Choose Jupyterlab editor
  3. Select the Miniconda framework
  4. Choose the access type
  5. Select the datacenter location
  6. Choose the number of GPUs or CPUs you need
  7. Attach your two containers
  8. Attach public SSH keys only if you want to
  9. Check that everything is ok and launch your notebook

Once the repository has been cloned, find the YOLOv8 notebook by following this path: ai-training-examples > notebooks > computer-vision > object-detection > miniconda > yolov8 > notebook_object_detection_yolov8_rock-paper-scissors.ipynb.

If you want to launch it with the CLI, choose the volumes you want to attach and the number of GPUs (<nb-gpus>) to use on your notebook and use the following command:

ovhai notebook run conda jupyterlab \
    --name <name> \
    --gpu <nb-gpus> \
    --volume rock-paper-scissors-data@<region>/:/workspace/data:RW \
    --volume rock-paper-scissors-model@<region>/:/workspace/model:RW

For this tutorial, we advise you to use at least 1 GPU.

You can then reach your notebook’s URL once it is running.

Experimenting with the YOLOv8 notebook

You are now able to train the YOLOv8 model to play the rock paper scissors game.

A preview of this notebook can be found on GitHub here.

Go further

  • Do you want to observe the evolution of your metrics during the training of your model? Click here.
  • Do you want to train your YOLOv8 model? Here it is.
  • Do you want to use your YOLOv8 model in an app? Here it is.

If you need training or technical assistance to implement our solutions, contact your sales representative or click on this link to get a quote and ask our Professional Services experts for a custom analysis of your project.

Feedback

Please send us your questions, feedback and suggestions to improve the service:

Related articles