• Stars
    star
    206
  • Rank 190,569 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dual Path Networks (DPN) supporting pretrained weights converted from original MXNet implementation

PyTorch Pretrained Dual Path Networks (DPN)

This repository includes a PyTorch implementation of DualPathNetworks (https://arxiv.org/abs/1707.01629) that works with cypw's pretrained weights.

The code is based upon cypw's original MXNet implementation (https://github.com/cypw/DPNs) with oyam's PyTorch implementation (https://github.com/oyam/pytorch-DPNs) as a reference.

Original testing of these models and all validation was done with torch (0.2.0.post1) and mxnet (0.11.0) pip packages installed. The models have since been updated and tested with Conda installs of PyTorch 1.0 and 1.1.

Pretrained

The model weights have already been converted to PyTorch and hosted at a fixed URL. You can use those pretrained weights by calling the model entrypoint functions with pretrained=True

PyTorch Hub

Models can also be access via the PyTorch Hub API

>>> torch.hub.list('rwightman/pytorch-dpn-pretrained')
['dpn68', ...]
>>> model = torch.hub.load('rwightman/pytorch-dpn-pretrained', 'dpn68', pretrained=True)
>>> model.eval()
>>> output = model(torch.randn(1,3,224,224))

Conversion

If you want to convert the weights yourself, download and untar trained weights files from https://github.com/cypw/DPNs#trained-models into a './pretrained' folder where this code is located.

The weights can be converted by running the conversion script as so:

python convert_from_mxnet.py ./pretrained/ --model dpn107

Results

The following tables contain the validation results (from included validation code) on ImageNet-1K. The DPN models are using the converted weights from the pretrained MXNet models. Also included are results from Torchvision ResNet, DenseNet as well as an InceptionV4 and InceptionResnetV2 port (by Cadene, https://github.com/Cadene/pretrained-models.pytorch) for reference.

All DPN runs at image size above 224x224 are using the mean-max pooling scheme (https://github.com/cypw/DPNs#mean-max-pooling) described by cypw.

Note that results are sensitive to image crop, scaling interpolation, and even the image library used. All image operations for these models are performed with PIL. Bicubic interpolation is used for all but the ResNet models where bilinear produced better results. Results for InceptionV4 and InceptionResnetV2 where better at 100% crop, all other networks being evaluated at their native training resolution use 87.5% crop.

Models with a '*' are using weights that were trained on ImageNet-5k and fine-tuned on ImageNet-1k. The MXNet weights files for these have an '-extra' suffix in their name.

Results @224x224

Model Prec@1 (Err) Prec@5 (Err) #Params Crop
DenseNet121 74.752 (25.248) 92.152 (7.848) 7.98 87.5%
ResNet50 76.130 (23.870) 92.862 (7.138) 25.56 87.5%
DenseNet169 75.912 (24.088) 93.024 (6.976) 14.15 87.5%
DualPathNet68 76.346 (23.654) 93.008 (6.992) 12.61 87.5%
ResNet101 77.374 (22.626) 93.546 (6.454) 44.55 87.5%
DenseNet201 77.290 (22.710) 93.478 (6.522) 20.01 87.5%
DenseNet161 77.348 (22.652) 93.646 (6.354) 28.68 87.5%
DualPathNet68b* 77.528 (22.472) 93.846 (6.154) 12.61 87.5%
ResNet152 78.312 (21.688) 94.046 (5.954) 60.19 87.5%
DualPathNet92 79.128 (20.872) 94.448 (5.552) 37.67 87.5%
DualPathNet98 79.666 (20.334) 94.646 (5.354) 61.57 87.5%
DualPathNet131 79.806 (20.194) 94.706 (5.294) 79.25 87.5%
DualPathNet92* 80.034 (19.966) 94.868 (5.132) 37.67 87.5%
DualPathNet107 80.172 (19.828) 94.938 (5.062) 86.92 87.5%

Results @299x299 (test_time_pool=True for DPN)

Model Prec@1 (Err) Prec@5 (Err) #Params Crop
InceptionV3 77.436 (22.564) 93.476 (6.524) 27.16 87.5%
DualPathNet68 78.006 (21.994) 94.158 (5.842) 12.61 100%
DualPathNet68b* 78.582 (21.418) 94.470 (5.530) 12.61 100%
InceptionV4 80.138 (19.862) 95.010 (4.99) 42.68 100%
DualPathNet92* 80.408 (19.592) 95.190 (4.810) 37.67 100%
DualPathNet92 80.480 (19.520) 95.192 (4.808) 37.67 100%
InceptionResnetV2 80.492 (19.508) 95.270 (4.730) 55.85 100%
DualPathNet98 81.062 (18.938) 95.404 (4.596) 61.57 100%
DualPathNet131 81.208 (18.792) 95.630 (4.370) 79.25 100%
DualPathNet107* 81.432 (18.568) 95.706 (4.294) 86.92 100%

Results @320x320 (test_time_pool=True)

Model Prec@1 (Err) Prec@5 (Err) #Params Crop
DualPathNet68 78.450 (21.550) 94.358 (5.642) 12.61 100%
DualPathNet68b* 78.764 (21.236) 94.726 (5.274) 12.61 100%
DualPathNet92* 80.824 (19.176) 95.570 (4.430) 37.67 100%
DualPathNet92 80.960 (19.040) 95.500 (4.500) 37.67 100%
DualPathNet98 81.276 (18.724) 95.666 (4.334) 61.57 100%
DualPathNet131 81.458 (18.542) 95.786 (4.214) 79.25 100%
DualPathNet107* 81.800 (18.200) 95.910 (4.090) 86.92 100%

More Repositories

1

gen-efficientnet-pytorch

Pretrained EfficientNet, EfficientNet-Lite, MixNet, MobileNetV3 / V2, MNASNet A1 and B1, FBNet, Single-Path NAS
Python
1,550
star
2

efficientdet-pytorch

A PyTorch impl of EfficientDet faithful to the original Google impl w/ ported weights
Python
1,528
star
3

posenet-python

A Python port of Google TensorFlow.js PoseNet (Real-time Human Pose Estimation)
Python
482
star
4

posenet-pytorch

A PyTorch port of Google TensorFlow.js PoseNet (Real-time Human Pose Estimation)
Python
285
star
5

udacity-driving-reader

Quick docker based reader for udacity rosbag self-driving dataset. Dumps to png/jpg + csv or Tensorflow examples.
Python
163
star
6

efficientnet-jax

EfficientNet, MobileNetV3, MobileNetV2, MixNet, etc in JAX w/ Flax Linen and Objax
Python
119
star
7

pytorch-nips2017-attack-example

A PyTorch baseline attack example for the NIPS 2017 adversarial competition
Python
83
star
8

tensorflow-litterbox

Tensorflow experimentation sandbox. VGG, ResNet, Inception V3, Inception V4, Inception-Resnet-V2 models.
Python
40
star
9

pytorch-pommerman-rl

PyTorch RL for Pommerman
Python
38
star
10

pytorch-planet-amazon

PyTorch models and training code for 'Planet: Understanding the Amazon from Space' Kaggle
Python
24
star
11

pytorch-pretrained-gluonresnet

Well trained MXNet Gluon Model Zoo ResNet/ResNeXt/SE-ResNeXt ported to PyTorch
Python
19
star
12

imagenet-12k

ImageNet-12k subset of ImageNet-21k (fall11)
Python
15
star
13

pytorch-nips2017-adversarial

NIPS 2017 Adversarial Competition in PyTorch
Python
13
star
14

pytorch-opensim-rl

PyTorch based Reinforcement Learning for OpenSim Prosthetics and Learning to Run environments
Python
11
star
15

pytorch-commands

Some PyTorch code for the Kaggle Speech Recognition Challenge
Python
11
star
16

pytorch-nips2017-defense-example

A PyTorch baseline defense example for the NIPS 2017 adversarial competition
Python
10
star
17

pytorch-countception-sealion

Pytorch implementation of Count-ception and custom CNN counting models for Kaggle Sea Lion Count challenge
Python
10
star
18

tensorflow-annex

A module for converting datasets + annotations to sharded Tensorflow TFRecords files
Python
7
star
19

tensorflow-speech_commands

Speech commands training/models from TF repo adapted for speech commands Kaggle
Python
6
star
20

obstacle-tower-pytorch-rainbow

PyTorch & Rainbow for Obstacle Tower Challenge
Python
4
star
21

tensorflow-models-slim

Filtered research/slim folder from tensorflow models repository. With experiments and additions.
Python
3
star
22

boost

My boost library mirror
C++
2
star
23

ariac-workspace

Docker based setup for experimenting with ARIAC ROS setup
Shell
2
star
24

obstacle-tower-pytorch-a2c-ppo

PPO/A2C in PyTorch for the Obstacle Tower Challenge
Python
2
star
25

pytorch-docker

Dockerfile definitions with matching Docker Hub images for PyTorch
Python
2
star
26

asio

Asio C++ Library
C++
1
star
27

androids-dream

HTML
1
star
28

pytorch-cdiscount

Python
1
star