Giter VIP home page Giter VIP logo

gluoncv-torch's Introduction

GluonCV-Torch

Load GluonCV Models in PyTorch. Simply import gluoncvth to getting better pretrained model than torchvision:

import gluoncvth as gcv
model = gcv.models.resnet50(pretrained=True)

Installation:

pip install gluoncv-torch

Available Models

ImageNet

ImageNet models single-crop error rates, comparing to the torchvision models:

torchvision gluoncvth
Model Top-1 error Top-5 error Top-1 error Top-5 error
ResNet18 30.24 10.92 29.06 10.17
ResNet34 26.70 8.58 25.35 7.92
ResNet50 23.85 7.13 22.33 6.18
ResNet101 22.63 6.44 20.80 5.39
ResNet152 21.69 5.94 20.56 5.39
Inception v3 22.55 6.44 21.33 5.61

More models available at GluonCV Image Classification ModelZoo

Semantic Segmentation

Results on Pascal VOC dataset:

Model Base Network mIoU
FCN ResNet101 83.6
PSPNet ResNet101 85.1
DeepLabV3 ResNet101 86.2

Results on ADE20K dataset:

Model Base Network PixAcc mIoU
FCN ResNet101 80.6 41.6
PSPNet ResNet101 80.8 42.9
DeepLabV3 ResNet101 81.1 44.1

Quick Demo

import torch
import gluoncvth

# Get the model
model = gluoncvth.models.get_deeplab_resnet101_ade(pretrained=True)
model.eval()

# Prepare the image
url = 'https://github.com/zhanghang1989/image-data/blob/master/encoding/' + \
    'segmentation/ade20k/ADE_val_00001142.jpg?raw=true'
filename = 'example.jpg'
img = gluoncvth.utils.load_image(
    gluoncvth.utils.download(url, filename)).unsqueeze(0)

# Make prediction
output = model.evaluate(img)
predict = torch.max(output, 1)[1].cpu().numpy() + 1

# Get color pallete for visualization
mask = gluoncvth.utils.get_mask_pallete(predict, 'ade20k')
mask.save('output.png')

More models available at GluonCV Semantic Segmentation ModelZoo

API Reference

ResNet

  • gluoncvth.models.resnet18(pretrained=True)
  • gluoncvth.models.resnet34(pretrained=True)
  • gluoncvth.models.resnet50(pretrained=True)
  • gluoncvth.models.resnet101(pretrained=True)
  • gluoncvth.models.resnet152(pretrained=True)

FCN

  • gluoncvth.models.get_fcn_resnet101_voc(pretrained=True)
  • gluoncvth.models.get_fcn_resnet101_ade(pretrained=True)

PSPNet

  • gluoncvth.models.get_psp_resnet101_voc(pretrained=True)
  • gluoncvth.models.get_psp_resnet101_ade(pretrained=True)

DeepLabV3

  • gluoncvth.models.get_deeplab_resnet101_voc(pretrained=True)
  • gluoncvth.models.get_deeplab_resnet101_ade(pretrained=True)

Why GluonCV?

1. State-of-the-art Implementations

2. Pretrained Models and Tutorials

3. Community Support

We expect this PyTorch inference API for GluonCV models will be beneficial to the entire computer vision comunity.

gluoncv-torch's People

Contributors

zhanghang1989 avatar

Watchers

James Cloos avatar Bowen Weipeng avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.