Creating an scalable object detection service using Titan

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

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

Next Tutorial

Foreword

Akoios: Frictionless solutions for modern data science.

Akoios