Creating an scalable object detection service using Titan

Titan Tutorial #4: Deploying an object detection model based on YOLO

In this new tutorial we will see how to develop and deploy a more complex model, more specifically, an object detection model. For those new to these topics, object detection is an umbrella concept that encompasses all those technologies related to computer vision and image processing dealing with the identification of objects of a certain class (humans, animals, vehicles…)

Example of object detection
!pip install -r requirements.txt
Cython
numpy
opencv-python
tqdm
requests
torchvision
torch>=1.3
matplotlib
pycocotools
Pillow==6.1
import time
import glob
import torch
import os
import requests
import json
import sys
import uuid
import request
import subprocess
from os.path import exists, join, basename, splitextfrom os.path import exists, join, basename, splitext from IPython.display import Image, clear_output
!git clone https://github.com/ultralytics/yolov3  # clone
!bash yolov3/data/get_coco_dataset_gdrive.sh # copy COCO2014 dataset (19GB)
%cd yolov3
# Mock request object for local API testing
args = {
'url': 'https://i.postimg.cc/rF3W27kn/https-bucketeer-e05bbc84-baa3-437e-9518-adb32be77984-s3-amazon.png'
}
REQUEST = json.dumps({ 'args': args })
# GET /detect
status = 200
content_type = 'image/jpeg'
try:
result = process(REQUEST)
print(result)
except Exception as err:
status = 500
content_type = 'application/json'
print(json.dumps({ 'error': 'Cannot process image due to an error: {}'.format(err)}))
$ titan deploy

Wrap-up

In this third post of our series of tutorials we have seen how to create and deploy a slightly complex ML model based on YOLO and the COCO dataset. Moreover, we have seen how using Titan the Data Scientist you can forget about all the infrastructure complexity required to get a model into production.

Next Tutorial

In the next tutorial, it is explained how to provision the runtime environment and hardware for the deployments.

Foreword

Titan can help you to radically reduce and simplify the effort required to put AI/ML models into production, enabling Data Science teams to be agile, more productive and closer to the business impact of their developments.

Akoios: Frictionless solutions for modern data science.

Akoios