Train a YOLOv3 Model Using the alwaysAI Model Training Toolkit

YOLO Blog Comparison-1

One of the most common feature requests that I get at alwaysAI is for YOLO model training. The time has come! Now you can train a custom YOLOv3 model with the Model Training Toolkit. In this post I will tell you a little about why this is such an exciting feature, what you need to get started, and walk you through training your first YOLO model.

What is a YOLO Model? 

YOLO is a computer vision model architecture that is used for real-time object detection. YOLO stands for You Only Look Once, which describes the novel design of that model; It is able to make predictions (bounding boxes) quickly and accurately after only one forward propagation pass through the neural network. YOLOv1 was introduced in 2015 in this paper by Joseph Redmon Et al. and it has been updated a number of times in the past 6 years. In addition to numerous version updates that address initial shortcomings of the model, such as the ability to detect small or clustered objects; YOLO also has released tiny versions of the model which sacrifice accuracy to greatly improve inference speed. Please see our model catalog where we offer multiple models trained on the COCO dataset, V1, V2, V3, V4, as well as tiny versions, and even device-specific optimizations.

Why Use a YOLO Model?

YOLO models are fast and accurate. As you can see from Figure 1, YOLOv3 Models are more accurate than all but 1 other model architecture for object detection, with a significantly faster inference time (Figure 1).

Screen Shot 2021-03-17 at 10.25.49 AM

How is YOLO Model Training Different Than The Training I've Been Doing with alwaysAI?

Good question! One of the reasons we are so excited about introducing YOLO model training is not only have we added one of the fastest and most accurate models to the Model Training Toolkit, but we have implemented it using PyTorch. Before this release we had exclusively used TensorFlow for our model training. Now that we have integrated PyTorch into our toolkit, we can add new models easily (e.g. YOLOv4), and expose more advanced training configurations. The best part is that these updates can be used in our existing interfaces (Jupyter Notebook, CLI, and Desktop is coming soon) so your training experience remains the same as we expand our model offerings.

While the interface is the same, you may notice some differences in the training experience. YOLO is a large model, so we recommend keeping your batch size low (1-2) for most training setups. The reduced batch size won’t affect the accuracy or speed of your model; and depending on your setup you will likely notice a comparable training time for YOLO models compared to MobileNet models. However, due to the size of the model you will notice that it takes longer to upload to your personal models. Be patient and trust the model.

Getting Started with YOLO

You are going to need a couple things in order to train a YOLOv3 model with the alwaysAI Model Training Toolkit. First and foremost, if you aren’t already signed up for alwaysAI, you are going to need to create an account. In addition, model training is a premium feature, so you need to upgrade your account or sign up for a free trial.

The next and final thing you need is a dataset, a set of images with associated annotations (bounding boxes) in the PascalVOC format. We have lots of resources to help you get started with datasets: View this article to learn the whole model training process including gatherings and annotating data. Our YouTube Channel also has multiple videos from our Hacky Hours about collecting data and annotating data – check them out! If you want to see how it works we have a couple sample datasets for you to try here and here.

Once you are signed up and have your dataset, the best place to start is our quick start guide. Make sure to add the `–model yolov3` flag to your training command. If you want to use the Jupyter Notebook, remember to select YOLOV3 (Figure 2).

Figure 2 Jupyter Notebook

Once the YOLO model is done training, you can interact with it in the same way as any of the other models. You can add it your personal models with the command `aai model publish {username}/{modelname}` or use it in an app without uploading by running the command ` aai app models add {username}/{modelname}` from the project directory. That’s it! Have fun with this new model, and keep an eye out for more content and projects highlighting YOLO!

If you are interested in learning more about YOLO you can view these past Hacky Hours:

Get started now

We are providing enterprise developers with a simple and easy-to-use platform to build and deploy computer vision applications on edge devices. 

Sign Up for Free