All Projects → akarazniewicz → smd

akarazniewicz / smd

Licence: Apache-2.0 license
Simple mmdetection CPU inference

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to smd

Mmdetection
OpenMMLab Detection Toolbox and Benchmark
Stars: ✭ 17,646 (+65255.56%)
Mutual labels:  faster-rcnn, mask-rcnn, retinanet
pytorch-faster-rcnn
No description or website provided.
Stars: ✭ 45 (+66.67%)
Mutual labels:  faster-rcnn, mask-rcnn
Paddledetection
Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
Stars: ✭ 5,799 (+21377.78%)
Mutual labels:  faster-rcnn, mask-rcnn
deepstream tao apps
Sample apps to demonstrate how to deploy models trained with TAO on DeepStream
Stars: ✭ 274 (+914.81%)
Mutual labels:  retinanet
cityscapes-to-coco-conversion
Cityscapes to CoCo Format Conversion Tool for Mask-RCNN and Detectron
Stars: ✭ 40 (+48.15%)
Mutual labels:  mask-rcnn
awesome-conformal-prediction
A professionally curated list of awesome Conformal Prediction videos, tutorials, books, papers, PhD and MSc theses, articles and open-source libraries.
Stars: ✭ 998 (+3596.3%)
Mutual labels:  deeplearning
Simplified SqueezeNet
An improved version of SqueezeNet networks https://github.com/DeepScale/SqueezeNet
Stars: ✭ 38 (+40.74%)
Mutual labels:  deeplearning
gluon-faster-rcnn
Faster R-CNN implementation with MXNet Gluon API
Stars: ✭ 31 (+14.81%)
Mutual labels:  faster-rcnn
Baidu-Dog2017
http://js.baidu.com/
Stars: ✭ 37 (+37.04%)
Mutual labels:  deeplearning
Object-Detection-Tensorflow
Object Detection API Tensorflow
Stars: ✭ 275 (+918.52%)
Mutual labels:  retinanet
celldetection
Cell Detection with PyTorch.
Stars: ✭ 44 (+62.96%)
Mutual labels:  mask-rcnn
publications-arruda-ijcnn-2019
Cross-Domain Car Detection Using Unsupervised Image-to-Image Translation: From Day to Night
Stars: ✭ 59 (+118.52%)
Mutual labels:  faster-rcnn
zed-pytorch
3D Object detection using the ZED and Pytorch
Stars: ✭ 41 (+51.85%)
Mutual labels:  mask-rcnn
py-faster-rcnn-imagenet
Train faster rcnn on imagine dataset, related blog post: https://andrewliao11.github.io/object/detection/2016/07/23/detection/
Stars: ✭ 133 (+392.59%)
Mutual labels:  faster-rcnn
Malware-Detection
Deep Learning Based Android Malware Detection Framework
Stars: ✭ 29 (+7.41%)
Mutual labels:  deeplearning
Xtreme-Vision
A High Level Python Library to empower students, developers to build applications and systems enabled with computer vision capabilities.
Stars: ✭ 77 (+185.19%)
Mutual labels:  retinanet
genetic deep learning
No description or website provided.
Stars: ✭ 13 (-51.85%)
Mutual labels:  deeplearning
FasterRCNN-pytorch
FasterRCNN is implemented in VGG, ResNet and FPN base.
Stars: ✭ 121 (+348.15%)
Mutual labels:  faster-rcnn
MMTOD
Multi-modal Thermal Object Detector
Stars: ✭ 38 (+40.74%)
Mutual labels:  faster-rcnn
Savior
(WIP)The deployment framework aims to provide a simple, lightweight, fast integrated, pipelined deployment framework for algorithm service that ensures reliability, high concurrency and scalability of services.
Stars: ✭ 124 (+359.26%)
Mutual labels:  deeplearning

Simple mmdetection

Overall goal of this project is to implement most popular, inference only, CPU friendly object detection models from mmdetection framework for research and production use. Currently mmdetection does not support CPU only inference mode (see here), however in real life, production models are rarely deployed on GPU enabled environments. SMD solves this problem.

Goals

  • Create foundation for better understanding and research of CPU-only DNN performance
  • All mmdetection pretrained weights can be directly used with SMD (mmedtecection model ZOO).
  • SMD limits number of dependencies to: torch, torchvision, PIL and numpy
  • Wherever possible mmdetection specific code is replaced with torch and torchvision alternatives (transforms, nms etc.)

Non-goals

  • By design this code has no training capabilities at all. Training specific code is either removed or reduced to the bare minimum. For training, finetuning or transfer learning use mmdetection you can then just use trained model wit smd for CPU only inference.

Implemented architectures

  • TorchScript support (current priority)
  • RetinaNet with FPN and ResNet 50 backbone
  • RetinaNet with FPN and ResNet 101 backbone
  • Faster R-CNN with FPN and ResNet 50 backbone
  • Faster R-CNN with FPN and ResNet 101 backbone
  • Mask R-CNN with FPN and ResNet 50 backbone
  • Mask R-CNN with FPN and ResNet 101 backbone
  • RetinaNet with FPN and ResNet 50 with deformable convolutions backbone
  • RetinaNet with FPN and ResNet 101 with deformable convolutions backbone
  • SSD 300
  • SSD 512
  • FoveaBox

Installing

pip install -r requirements.txt

Sample code

See demo jupyter notebook complete example

from models.detectors import create_detector
import torch
import torchvision
import cv2
import numpy as np
from matplotlib import pyplot as plt

# download pretrained mmdetection model from model zoo
torch.utils.model_zoo.load_url(
    'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/mmdetection/models/retinanet_r101_fpn_1x_20181129-f016f384.pth',
    model_dir='.')

# create RetinaNet with ResNet 101 backbone, and pretrained COCO weights
# Note: COCO has 80 classes plus one background class. You can use Your own model. Just set You number of classes and feed
# pretrained checkpoint.
retina = create_detector('retinanet_r101_fpn', number_of_classes=81, pretrained='retinanet_r101_fpn_1x_20181129-f016f384.pth')

# with pytorch 1.3, model can be easily quantized (better CPU performance, smaller footprint).
retina = torch.quantization.quantize_dynamic(retina, dtype=torch.qint8)

# inference result is exactly the same like in mmdetection
with torch.no_grad():
    result = retina.detect('demo.jpg')

res = []

# Look for cars in COCO dataset, with threshold 0.3
for r in result[2]:
    if r[-1] >= .3:
        res.append(r[:-1].astype(dtype=np.int).tolist())

if len(res) > 0:
    im = cv2.imread('demo.jpg')
    for r in res:
        cv2.rectangle(im, (r[0], r[1]), (r[2], r[3]), (0, 255, 255), 3)
        cv2.putText(im, "Car", (r[0]-3, r[1]-3), cv2.FONT_HERSHEY_PLAIN, 2, (0, 255, 255), 3)

im = cv2.cvtColor(im, cv2.COLOR_RGB2BGR)

plt.figure(figsize=(20,11))
plt.axis("off")
plt.imshow(im)

GitHub Logo

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].