Skip to content

Latest commit

 

History

History
111 lines (74 loc) · 6.33 KB

README.md

File metadata and controls

111 lines (74 loc) · 6.33 KB

Overview

Serve MMDetection model as a Supervisely Application. MMDetection is an open-source toolbox based on PyTorch. Learn more about MMDetection and available models here.

MMDetection 3.0.0 is being released as the official version, achieving new state-of-the-art performance in instance segmentation and rotated object detection tasks.

Application key points:

  • All Object Detection and Instance Segmentation models from MM Toolbox are available
  • Deployed on GPU or CPU

How to Run

  1. Start the application from an app's context menu or the Ecosystem.

  2. Select a Deep Learning problem to solve.

Pretrained models

  1. Select architecture, pre-trained model, and deploying device and press the Serve button.

Custom models

Model and directory structure must be acquired via Train MMDetection V3 app or manually created with the same directory structure.

  1. Wait for the model to deploy.

How To Use Custom Model Outside The Platform

You can use your trained models outside Supervisely platform without any dependencies on Supervisely SDK. You just need to download config file and model weights (.pth) from Team Files, and then you can build and use the model as a normal model in mmdetection 3.0. See this Jupyter Notebook for details.

A base code example is here:

# Put your paths here:
img_path = "demo_data/image_01.jpg"
config_path = "app_data/work_dir/config.py"
weights_path = "app_data/work_dir/epoch_8.pth"

device = "cuda:0"

import mmcv
from mmengine import Config
from mmdet.apis import inference_detector, init_detector
from mmdet.registry import VISUALIZERS
from mmdet.visualization.local_visualizer import DetLocalVisualizer
from PIL import Image

# build the model
cfg = Config.fromfile(config_path)
model = init_detector(cfg, weights_path, device=device, palette='random')

# predict
result = inference_detector(model, img_path)
print(result)

# visualize
img = mmcv.imread(img_path, channel_order="rgb")
visualizer: DetLocalVisualizer = VISUALIZERS.build(model.cfg.visualizer)
visualizer.dataset_meta = model.dataset_meta
visualizer.add_datasample("result", img, data_sample=result, draw_gt=False, wait_time=0, show=False)
res_img = visualizer.get_image()
Image.fromarray(res_img)

Related Apps

  • Train MMDetection V3 - app allows to play with different inference options, monitor metrics charts in real time, and save training artifacts to Team Files.

  • Apply NN to Images Project - app allows to play with different inference options and visualize predictions in real time. Once you choose inference settings you can apply model to all images in your project to visually analyze predictions and perform automatic data pre-labeling.

  • Apply NN to Videos Project - app allows to label your videos using served Supervisely models.

  • NN Image Labeling - integrate any deployed NN to Supervisely Image Labeling UI. Configure inference settings and model output classes. Press the Apply button (or use a hotkey) and detections with their confidences will immediately appear on the image.

Acknowledgment

This app is based on the great work MMDetection (github). GitHub Org's stars