Streamline Your Computer Vision Stack with an End-to-End MLOps Platform



Original Source Here

Real-world Example: Car Detection

Multiple companies have been working on self-driving cars for some time now, and who knows, we’d witness powerful cars that are affordable and drive themselves with minimal human input very soon.

These self-driving cars must detect other vehicles on the road to avoid any accidents on the road. It’s a problem that researchers are actively working on to improve existing solutions. And it’ll be a great addition to your portfolio, so why not follow alongside me?

The data we’d be using is originally from TJHSST Machine Learning and can be downloaded from Kaggle. The data contains images of cars and other vehicles on the road split as train and test data sets.

Step 1: Data Annotations

Assuming you have already logged into the Nexus platform, I’m going to list down a few steps.

Project homepage. (Screenshot by author)
  • From the homepage, click on create a project and give it a name, something like “Car Detection.”
  • Select type as “Object Detection” and content as “Image.” This helps the platform configure the project repository as needed.
  • Then click on the image icon from the sidebar, upload all the training images. (Note: I deleted the last training image as the free-tier had an upload limit of 1000 images, but it was more than enough to train our model.)

Since our dataset came with annotations, I uploaded them into the platform, using the Annotations tab after selecting the “Bounding Box CSV Four Corner Detection” format. Please check this specific page on how your CSV file should be formatted. (Note: In our case, I added an extra “label” column and edited the header accordingly.)

Project overview and annotation page (Screenshot by author)

The platform gives you a summary view, and we notice only 354/1000 images are annotated, and we have to annotate the rest. Use the Annotator tab on the left to inspect images one by one and draw labels quickly. In our case, when inspected, non-annotated images don’t have a car at all.

Annotating an image is as simple as this. (Screencast by author)

Don’t worry, even if it looks time-consuming at first, by my 3rd project, I finished my annotations in less than 5 minutes. Talk about setting up the dataset real fast.

Step 2: Model Training

Since we’ve got our data ready, It’s time we create our training pipeline. Here are the steps I followed:

  • Click on the workflow tab on the left to create an empty workflow page.
  • Right-click on the empty page and add blocks. The overall workflow should contain three main blocks: Dataset, Augmentations, Model. Drag and connect them in sequence to make it a pipeline
Building a workflow. (Screencast by author)
  • Tune the parameters by clicking on the blocks. I experimented with a few to settle with the FasterRCNN InceptionV2 640×640 model with a batch size of 2, 5000 epochs, a train test split of 0.2, and some horizontal flip, vertical flip, center crop as the augmentations.
  • Before training by clicking on Preview Augmentations I compared different sets of augmented techniques and the resulting images, which helped me settle on the specific augmentation techniques I wanted to use.
  • Click on Run Training from the button on the bottom right corner, and start training. I used 1 Nvidia T4 GPU with the Lowest validation loss as the selection strategy. A summary of our configurations can be seen below.
Training configurations parameter. (Screenshot by author)
  • It took me about 3 hours for the training to complete, and an integrated TensorBoard was available to analyze the common evaluation metrics. Looking at it, we can tell our model has converged and trained well.
The TensorBoard Dashboard (Screenshot by author)

Finally, click on the artifacts tab, select the artifact that is relevant to the training that was completed. Right-click on it and download the TensorFlow model to your local machine.

Downloading the TensorFlow model. (Screenshot by author)

We download the model to our local machine so that we can use an open-source visual platform called Portal to make the predictions locally.

Step 3: Inference

We will use a recently released open-source engine, Portal, which integrates with Nexus really well to make the predictions. Portal is the fastest way to load and visualize your deep learning models, period.

You can install it on your local machine by following the instructions on GitHub or downloading the executable files from the latest release.

Portal homepage to register the model. (Screenshot by author)

Using the “+” icon on the homepage, I registered the TensorFlow model locally by specifying the folder path. Clicking on the registered model again loads the load (Note: you can only have one model loaded at any time.)

Using the Open Folder option under the Assets Folder tab, I loaded the test images we got we downloaded the images. We can perform inference on images one by one or as a bulk operation. I chose the Bulk Analysis option and let the model make predictions in real-time on the images.

Bulk analysis of the test images. (Screencast by author)

As you can see from the video above, it performed exceptionally well for a project that took me only a couple of days to set up.

As you would realize by now, I intentionally kept the example simple to navigate you through the entire CV stack using the Nexus and Portal platforms; however, the possibilities on these platforms are more.

AI/ML

Trending AI/ML Article Identified & Digested via Granola by Ramsey Elbasheer; a Machine-Driven RSS Bot

%d bloggers like this: