Skip to content

Instantly share code, notes, and snippets.

@HaiderZaidiDev
Last active July 27, 2022 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HaiderZaidiDev/fba02bed991747c09295b705595ba728 to your computer and use it in GitHub Desktop.
Save HaiderZaidiDev/fba02bed991747c09295b705595ba728 to your computer and use it in GitHub Desktop.

IBM Cloud - Object Detection Demonstration with Code Engine

The instructions below will guide you through the process of deploying the MAX Object Detector: a demonstration of image processing for detecting common objects on IBM Cloud.

Expected time to complete: 5-10 minutes.

You can see a live deployed version of the demonstration here.

Background

This demonstration deploys a container running the Max Object Detector, a web-app which allows users to recognize objects in an image/frame, trained from the Common Objects in Context (COCO) dataset.

The container can deployed multiple aways, e.g., through Red Hat OpenShift or Kubernetes. This demonstrations shows deployment on Code Engine - a fully managed environment for running containers on IBM Cloud.

Demo Gif

Instructions

  1. Create an IBM Cloud account, at https://cloud.ibm.com/login.
  2. Download the IBM Cloud Command Line Interface (CLI) as shown here: https://cloud.ibm.com/docs/cli?topic=cli-getting-started
  3. Install the Code Engine plugin for the IBM Cloud CLI using: ibmcloud plugin install code-engine
  4. Login to the Cloud CLI, using: ibmcloud login -sso
  5. Create a resource group for the demonstration and target the group:
ibmcloud resource group-create ml-demonstration
ibmcloud target -g ml-demonstration 
  1. Create a code engine project with:
ibmcloud ce project create --name ml-demonstration
  1. Deploy the application using the containerized image with:
ibmcloud ce application create --name max-object-detector --image quay.io/codait/max-object-detector --port 5000
  1. Validate that the application has been deployed with:
ibmcloud ce application list

If deployed successfully, there will be an application named max-object-detector.

  1. After the application has been deployed, the terminal output will provide you with a link to your application, it will look similar to the link below:
https://max-object-detector.phvkd8csq1y.ca-tor.codeengine.appdomain.cloud/

Add /app at the end of this link as shown below and open this link in your browser.

https://max-object-detector.phvkd8csq1y.ca-tor.codeengine.appdomain.cloud/app
  1. When the web-app has been opened in a browser, you can upload an image for object detection by clicking the "Choose File" button under the Upload an Image section.
  2. Under the Filter Detected Object Section, you can set the probability threshold for recognizing objects, for example, if set to 80%, objects will only be recognized if there is a high certaintity from the model that an object is present.
  3. Once the file has been uploaded and the probability threshold has been set (50% by default), click the Submit button under the Upload an Image section and the result of the object detection will be shown.

This process may take a few minutes, pending on the size of your image.

A sample image you can use for object detection can be found below: Sample Image

Cleanup

After you're satisfied with the demo, you can destroy provisioned resources by deleting the Code Engine project with:

ibmcloud ce project delete --name ml-demonstration
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment