July 26, 2024

Data Prep to Production: Object Detection with LandingAI

By Garrett Springer

With the rapid advancements of AI, object detection technology is becoming crucial for improving operational efficiency across many industries.  From enhancing diagnostic accuracy in healthcare to refining quality checks in manufacturing, this key aspect of computer vision reshapes how businesses operate. Yet, traditionally, deploying object detection models has been a daunting, resource-heavy endeavor involving cumbersome data handling and extensive training from the ground up. 

LandingAI is changing the game with its powerful Large Vision Models, automated training processes, and efficient data labeling tools. 

In this blog, we’ll train and deploy a model that demonstrates how building enterprise-grade computer vision (CV) applications is easier than ever.

Preparing the Data

LandingAI provides foundation models that have been trained broadly on image data and only require a small amount of your data to perform value-adding tasks specific to your use case.  To get started, we created a new object detection project in their computer vision development environment, LandingLens.  

We collected 50 images from an object detection Kaggle dataset to fine-tune the model. The images consist of different-colored cubes moving on a conveyor belt. We aim to train and deploy a model to detect and classify the cubes. Once uploaded, the labeling process is as simple as drawing a bounding box around the cube in each picture. The process is fast and easy to use, taking less than 15 minutes.

LandingLens labeling box tool

Tip: Draw the bounding boxes around the objects of interest as tight as possible.  If the boxes are too large, the model may misinterpret the surrounding background pixels as important.

Labeled objects in an image with LandingLens

Training the Model

With the data labeled, the most difficult part is over. Next, we will train our model for cube detection. After selecting the images we’ve labeled, all that’s left to do is train the model with a click of a button. Yes, it is that simple!

Training the model on the labeled data

LandingLens handles the process of splitting the dataset into training and development sets.  If you’re unfamiliar with the ML concept of splits, that’s fine because it’s automatically handled during training.  At a high level, the model is trained on images using the training set and then makes predictions on images in the dev set to check the model’s performance.  

Users who want more control over the training process can use the Custom Training option. However, we’ll stick with managed Fast Training in this blog.

Testing the Model

With a fully trained model, it’s time to test it on unseen images.  Using 15 new images, we labeled them in the same manner as before.  Once labeled, they should be assigned to an evaluation set within the model.  LandingLens displays useful information about the evaluation set, such as class distribution.

Tip: Ensure the class distribution remains balanced when curating an evaluation set. Underrepresenting a class can obscure model accuracy issues that may only become apparent in production.

Class distribution of evaluation set

When the evaluation set is uploaded to the model page, LandingLens automatically runs it and calculates accuracy metrics. Impressively, it had a precision and recall of 100% after only fine-tuning with 50 labeled images. Creating robust computer vision applications adapted to niche datasets is now within reach and faster to implement than ever with LandingAI.

Validating with 100% precision and recall

Configuring Prediction Confidence

LandingLens provides a confidence threshold parameter that can be adjusted to better suit the needs of different computer vision applications. 

For example, in an application where detecting every object of interest is crucial, such as identifying cancerous cells in medical imaging, the confidence threshold should be lowered to increase the model’s sensitivity. Lowering the confidence threshold increases the chance of misidentifying objects (false positives).  Conversely, in applications where false positives are costly, such as detecting defects in high-value manufacturing parts, it is recommended to set a high confidence threshold.

Detecting cubes on new images

Deploying the Model

Once the model is trained and performance reaches an acceptable level, we need to deploy it. With LandingAI, there are three main deployment options, depending on your preference. In this example, we’ll use the managed cloud deployment option.

On the model page where we uploaded the evaluation dataset, we need to select the +Deploy button to configure the endpoint. From there, we create a new endpoint, give it a name, and deploy our model!

LandingAI provides the code and key to invoke the model API from an application. Cloud deployment is a great option for quickly deploying a model across different applications without having to manage servers.

Deploying to an endpoint and invoking the API.

Alternative Deployment Options

While the cloud deployment option is easy to use, many enterprise applications require more control over the configuration of their deployment. LandingAI provides self-hosted deployment options to meet these applications’ requirements.

LandingEdge

LandingEdge is a great solution for deployments that require real-time responses and direct integration with industrial cameras and programmable logic controllers (PLC). It provides manufacturing operations with enhanced control by facilitating direct connections to machinery, allowing immediate actions based on the model’s output. For instance, LandingEdge can automatically halt a production line if a defective component is detected.

We recommend LandingEdge for applications that require an offline solution that can directly integrate into machinery and production lines.

LandingEdge deployment and continuous learning process

Docker Deployment

Deploying with Docker gives the maximum amount of configuration and control over the model. This deployment containerizes the model and application and allows full customization over the API. Docker deployments are ideal for integrating into existing machine vision systems, integrating directly into an edge device (Windows, Mac, or Linux), or deploying into a separate cloud environment.

Docker Deployment is recommended for users who want complete control over the deployment environment and model API.

LandingLens Docker Deployment

Closing Thoughts

With a bit of labeling, we created a model that performed exceptionally well with only a small amount of labeled data.  We deployed the solution using LandingAI’s managed cloud deployment with just a few clicks.

If you’re interested in learning how LandingAI can help your business, reach out to schedule a meeting with phData to learn how LandingAI can help your business.

Data Coach is our premium analytics training program with one-on-one coaching from renowned experts.

Accelerate and automate your data projects with the phData Toolkit