When ML engineers start a new project, they often need to build a fast demo to present the key idea. Fortunately, many popular model zoos provide a convenient tool to complete this work.

If you need to find a specific model zoo of vision (e.g., object detection, pose estimation, etc), I recommend you checkout the model zoo of OpenMMLab, which consists of MMDetection, MMSegmentation, MMagic, MMDetection3D, MMOCR, MMPose, MMAction2 popular libraries. Also, it provides a series deployment toolbox (e.g., MMDeploy and MMRazor) to accelerate model inference speed.

Table of contents

Use HuggingFace to build a demo

HuggingFace is a popular model zoo for transformer-based models. On HuggingFace, you can find a lot of pre-trained models for various tasks. For example, you can try DETR within few lines of code.

from transformers import AutoImageProcessor, DetrModel
from PIL import Image
import requests

url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
image_processor = AutoImageProcessor.from_pretrained("facebook/detr-resnet-50")
model = DetrModel.from_pretrained("facebook/detr-resnet-50")

inputs = image_processor(images=image, return_tensors="pt")
outputs = model(**inputs)

Besides, it provides many tools to evaluate and deploy your models. Details can be found in Datasets, Evaluate, and Accelerate.

If you are in China, you can access HuggingFace models and datasets via HF Mirror.

Use ModelScope to build a demo

ModelScope is a alternative model zoo created by Alibaba. The download speed is faster than HuggingFace for Chinese users.

When you want to use a pre-trained model, you can search the model zoo and try the demo as instructions.

Use MMDetection to build a demo

MMDetection is a comprehensive model zoo for object detection and semantic segmentation. It contains more advanced detection and segmentation models than HuggingFace and ModelScope. However, its code is a bit complex and not easy to use as HuggingFace.

Conclusion

In this page, we have learned how to build a fast demo for image object detection with three popular model zoos (HuggingFace, ModelScope, and MMDetection). In the next blog, we will write a interactive webUI for this demo.

References

  1. HuggingFace
  2. ModelScope
  3. OpenMMLab