Gold-YOLO is the newest addition to the YOLO family and was developed by researchers from Noah’s Ark Lab (Huawei). They scored new highs on the COCO benchmark and surpassed the popular YOLOv8 algorithm, both in accuracy and speed.
How did they do that? Well, they achieved these results by mainly redesigning the mechanism that fuses the features of multiple resolutions in the decoder, which up to now was mostly done with so-called Feature Pyramid Networks. They developed a new mechanism, called Gather-and-Distribute, which boosts the multi-scale feature fusion capabilities and achieves an ideal balance between latency and accuracy across all model scales. Like most YOLO versions, they also release multiple versions, ranging from gold_yolo-n to gold_yolo-l, trading speed for accuracy.
In this tutorial, we will first take a look at their COCO-pre-trained model and next, we will guide you through the steps on how to train your own Gold-YOLO detector on your own data. For this, we will use the trainYOLO platform. So if you don’t have an account yet, make sure you create a free account here.
Let’s take a look at running Gold-YOLO using a pre-trained COCO model. We start by installing the library, downloading the gold-yolo-n model (the smallest one available), and running the model on some demo images. You can find the Colab Notebook here.
The results are displayed below. We notice that with the default confidence value of 0.4, the horse and football are not detected. When lowering the threshold to 0.2, they are detected, although there also appear some false positives.
Next, we will go over the steps on how to train your own Gold-YOLO object detector on your own dataset. We will guide you through the steps of labeling your data and training the model using the trainYOLO platform. As an example, we will train a Padel player detector for game analysis.
We start by creating a new project, which will hold our images, clicking on the green ‘plus’ icon. We set the name to padel, keep the annotation type at Bounding Boxes, and set a single category player. If you have multiple categories, you can add more.
To upload images to our project, go to the data tab and click on the green ‘plus’ icon. Select the images you would like to upload and click upload. In this example, we will upload some images of a Padel game.
Once we have uploaded the images, we start labeling. By clicking on an image, you enter the labeling editor. By selecting the bounding box tool in the left menu, we can draw a box around each object, in our case each player. Note that if you have multiple object categories, you need to set the right category using the drop-down list on top. Once finished, you can use the arrow keys on top to go to the next image or select a specific one in the carousel at the bottom.
Next, we will be going over all the steps on how to train the Gold-YOLO object detector. You can find all the steps in this colab notebook. You only need to fill in your trainYOLO API key (which you find under your avatar) and Project Name and run Runtime -> Run all.
Let’s start by downloading our labeled images. To do so, we need to install the trainYOLO python library and enter our API key (which you can find under your avatar) and Project name. As Gold-YOLO is based on the YOLOv6 codebase, we use the YOLOv6 export format.
Once our dataset is downloaded, we clone the Gold-YOLO repository and download the COCO-pre-trained model (version n)
Now we have everything ready to start training our model. We can set the image size, number of epochs, and batch_size:
Once training is finished, we can infer the model on our validation set and visualize the results. Note that there is currently still a small bug in the codebase, which we fix with the sed command:
You can find the results under ‘runs/inference/’. For example:
In this tutorial, we went through the steps on how to train your own Gold-YOLO object detector. For more details, you can take a look at their official GitHub repository. If you want to compare with YOLOv8, you can check out our tutorial on how to train your own YOLOv8 object detector.