Skip to content

Commit ce461da

Browse files
V1.0.0 (#156)
* v1.0
1 parent c2cb2aa commit ce461da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2189
-1045
lines changed

docs/source/experiments/cifar.rst

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ Train Your Own Model
5757
--eval evaluating
5858

5959

60-
Extending the Software
61-
----------------------
62-
63-
This code is well written, easy to use and extendable for your own models or datasets:
64-
65-
- Write your own Dataloader ``mydataset.py`` to ``dataset/`` folder
66-
67-
- Write your own Model ``mymodel.py`` to ``model/`` folder
68-
69-
- Run the program::
70-
71-
python main.py --dataset mydataset --model mymodel
72-
7360
Citation
7461
--------
7562

docs/source/experiments/segmentation.rst

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,19 @@ Test Pre-trained Model
3838
.. role:: raw-html(raw)
3939
:format: html
4040

41-
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+------------+
42-
| Model | pixAcc | mIoU | Command | Logs |
43-
+==================================+===========+===========+==============================================================================================+============+
44-
| Encnet_ResNet50_PContext | 79.2% | 51.0% | :raw-html:`<a href="javascript:toggleblock('cmd_enc50_pcont')" class="toggleblock">cmd</a>` | ENC50PC_ |
45-
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+------------+
46-
| EncNet_ResNet101_PContext | 80.7% | 54.1% | :raw-html:`<a href="javascript:toggleblock('cmd_enc101_pcont')" class="toggleblock">cmd</a>` | ENC101PC_ |
47-
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+------------+
48-
| EncNet_ResNet50_ADE | 80.1% | 41.5% | :raw-html:`<a href="javascript:toggleblock('cmd_enc50_ade')" class="toggleblock">cmd</a>` | ENC50ADE_ |
49-
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+------------+
50-
| EncNet_ResNet101_ADE | 81.3% | 44.4% | :raw-html:`<a href="javascript:toggleblock('cmd_enc101_ade')" class="toggleblock">cmd</a>` | ENC101ADE_ |
51-
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+------------+
52-
| EncNet_ResNet101_VOC | N/A | 85.9% | :raw-html:`<a href="javascript:toggleblock('cmd_enc101_voc')" class="toggleblock">cmd</a>` | ENC101VOC_ |
53-
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+------------+
54-
55-
.. _ENC50PC: https://github.com/zhanghang1989/image-data/blob/master/encoding/segmentation/logs/encnet_resnet50_pcontext.log?raw=true
56-
.. _ENC101PC: https://github.com/zhanghang1989/image-data/blob/master/encoding/segmentation/logs/encnet_resnet101_pcontext.log?raw=true
57-
.. _ENC50ADE: https://github.com/zhanghang1989/image-data/blob/master/encoding/segmentation/logs/encnet_resnet50_ade.log?raw=true
58-
.. _ENC101ADE: https://github.com/zhanghang1989/image-data/blob/master/encoding/segmentation/logs/encnet_resnet101_ade.log?raw=true
59-
.. _ENC101VOC: https://github.com/zhanghang1989/image-data/blob/master/encoding/segmentation/logs/encnet_resnet101_voc.log?raw=true
41+
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+
42+
| Model | pixAcc | mIoU | Command |
43+
+==================================+===========+===========+==============================================================================================+
44+
| Encnet_ResNet50_PContext | 79.2% | 51.0% | :raw-html:`<a href="javascript:toggleblock('cmd_enc50_pcont')" class="toggleblock">cmd</a>` |
45+
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+
46+
| EncNet_ResNet101_PContext | 80.7% | 54.1% | :raw-html:`<a href="javascript:toggleblock('cmd_enc101_pcont')" class="toggleblock">cmd</a>` |
47+
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+
48+
| EncNet_ResNet50_ADE | 80.1% | 41.5% | :raw-html:`<a href="javascript:toggleblock('cmd_enc50_ade')" class="toggleblock">cmd</a>` |
49+
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+
50+
| EncNet_ResNet101_ADE | 81.3% | 44.4% | :raw-html:`<a href="javascript:toggleblock('cmd_enc101_ade')" class="toggleblock">cmd</a>` |
51+
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+
52+
| EncNet_ResNet101_VOC | N/A | 85.9% | :raw-html:`<a href="javascript:toggleblock('cmd_enc101_voc')" class="toggleblock">cmd</a>` |
53+
+----------------------------------+-----------+-----------+----------------------------------------------------------------------------------------------+
6054

6155

6256
.. raw:: html

docs/source/experiments/texture.rst

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,19 @@ Test Pre-trained Model
2222
cd PyTorch-Encoding/
2323
python scripts/prepare_minc.py
2424

25-
- Download pre-trained model (pre-trained on train-1 split using single training size of 224, with an error rate of :math:`18.96\%` using single crop on test-1 set)::
25+
- Test pre-trained model on MINC-2500. The pre-trained weight will be automatic downloaded (pre-trained on train-1 split using single training size of 224, with an error rate of :math:`18.96\%` using single crop on test-1 set)::
2626

27-
cd experiments/recognition
28-
python model/download_models.py
29-
30-
- Test pre-trained model on MINC-2500::
31-
32-
python main.py --dataset minc --model deepten --nclass 23 --resume deepten_minc.pth --eval
27+
python main.py --dataset minc --model deepten_resnet50_minc --nclass 23 --pretrained --eval
3328
# Teriminal Output:
34-
# Loss: 1.005 | Err: 18.96% (1090/5750): 100%|████████████████████| 23/23 [00:18<00:00, 1.26it/s]
29+
# Loss: 0.995 | Err: 18.957% (1090/5750): 100%|████████████████████| 23/23 [00:18<00:00, 1.26it/s]
3530

3631

3732
Train Your Own Model
3833
--------------------
3934

4035
- Example training command for training above model::
4136

42-
CUDA_VISIBLE_DEVICES=0,1,2,3 python main.py --dataset minc --model deepten --nclass 23 --model deepten --batch-size 512 --lr 0.004 --epochs 80 --lr-step 60 --lr-scheduler step
37+
CUDA_VISIBLE_DEVICES=0,1,2,3 python main.py --dataset minc --model deepten_resnet50_minc --batch-size 512 --lr 0.004 --epochs 80 --lr-step 60 --lr-scheduler step --weight-decay 5e-4
4338

4439
- Detail training options::
4540

@@ -62,20 +57,6 @@ Train Your Own Model
6257
--eval evaluating
6358

6459

65-
Extending the Software
66-
----------------------
67-
68-
This code is well written, easy to use and extendable for your own models or datasets:
69-
70-
- Write your own Dataloader ``mydataset.py`` to ``dataset/`` folder
71-
72-
- Write your own Model ``mymodel.py`` to ``model/`` folder
73-
74-
- Run the program::
75-
76-
python main.py --dataset mydataset --model mymodel
77-
78-
7960
Citation
8061
--------
8162

docs/source/functions.rst

Lines changed: 0 additions & 32 deletions
This file was deleted.

docs/source/index.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ An optimized PyTorch package with CUDA backend.
3030

3131
nn
3232
parallel
33-
dilated
34-
functions
33+
models
3534
utils
3635

3736
Indices and tables

docs/source/dilated.rst renamed to docs/source/models.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
.. role:: hidden
22
:class: hidden-section
33

4-
encoding.dilated
4+
encoding.models
55
================
66

7+
.. automodule:: encoding.models.resnet
8+
.. currentmodule:: encoding.models.resnet
9+
10+
ResNet
11+
------
12+
713
We provide correct dilated pre-trained ResNet and DenseNet (stride of 8) for semantic segmentation.
814
For dilation of DenseNet, we provide :class:`encoding.nn.DilatedAvgPool2d`.
915
All provided models have been verified.
@@ -14,12 +20,6 @@ All provided models have been verified.
1420
* Hang Zhang, Kristin Dana, Jianping Shi, Zhongyue Zhang, Xiaogang Wang, Ambrish Tyagi, Amit Agrawal. "Context Encoding for Semantic Segmentation" *The IEEE Conference on Computer Vision and Pattern Recognition (CVPR) 2018*
1521

1622

17-
.. automodule:: encoding.dilated
18-
.. currentmodule:: encoding.dilated
19-
20-
ResNet
21-
------
22-
2323
:hidden:`ResNet`
2424
~~~~~~~~~~~~~~~~
2525

docs/source/nn.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ Customized NN modules in Encoding Package. For Synchronized Cross-GPU Batch Norm
1414
.. autoclass:: Encoding
1515
:members:
1616

17-
:hidden:`BatchNorm2d`
17+
:hidden:`SyncBatchNorm`
1818
~~~~~~~~~~~~~~~~~~~~~~~~
1919

20-
.. autoclass:: BatchNorm2d
20+
.. autoclass:: SyncBatchNorm
2121
:members:
2222

2323
:hidden:`BatchNorm1d`
@@ -26,6 +26,12 @@ Customized NN modules in Encoding Package. For Synchronized Cross-GPU Batch Norm
2626
.. autoclass:: BatchNorm1d
2727
:members:
2828

29+
:hidden:`BatchNorm2d`
30+
~~~~~~~~~~~~~~~~~~~~~~~~
31+
32+
.. autoclass:: BatchNorm2d
33+
:members:
34+
2935
:hidden:`BatchNorm3d`
3036
~~~~~~~~~~~~~~~~~~~~~~~~
3137

docs/source/notes/compile.rst

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@ Install and Citations
22
=====================
33

44

5-
Install from Source
6-
-------------------
5+
Installation
6+
------------
77

8-
* Install PyTorch by following the `PyTorch instructions <http://pytorch.org/>`_.
9-
This package relies on PyTorch master branch (higher than stable released v0.4.0), please follow
10-
`the instruction <https://github.com/pytorch/pytorch#from-source>`_ to install
11-
PyTorch from source.
8+
* Install PyTorch 1.0 by following the `PyTorch instructions <http://pytorch.org/>`_.
129

1310
* PIP Install::
1411

encoding/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010

1111
"""An optimized PyTorch package with CUDA backend."""
1212
from .version import __version__
13-
from . import nn, functions, dilated, parallel, utils, models, datasets
13+
from . import nn, functions, parallel, utils, models, datasets, transforms

encoding/datasets/__init__.py

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
import warnings
2+
from torchvision.datasets import *
13
from .base import *
24
from .coco import COCOSegmentation
35
from .ade20k import ADE20KSegmentation
46
from .pascal_voc import VOCSegmentation
57
from .pascal_aug import VOCAugSegmentation
68
from .pcontext import ContextSegmentation
79
from .cityscapes import CitySegmentation
10+
from .imagenet import ImageNetDataset
11+
from .minc import MINCDataset
12+
13+
from ..utils import EncodingDeprecationWarning
814

915
datasets = {
1016
'coco': COCOSegmentation,
@@ -13,7 +19,40 @@
1319
'pascal_aug': VOCAugSegmentation,
1420
'pcontext': ContextSegmentation,
1521
'citys': CitySegmentation,
22+
'imagenet': ImageNetDataset,
23+
'minc': MINCDataset,
24+
'cifar10': CIFAR10,
25+
}
26+
27+
acronyms = {
28+
'coco': 'coco',
29+
'pascal_voc': 'voc',
30+
'pascal_aug': 'voc',
31+
'pcontext': pcontext,
32+
'ade20k': 'ade',
33+
'citys': 'citys',
34+
'minc': 'minc',
35+
'cifar10': 'cifar10',
1636
}
1737

18-
def get_segmentation_dataset(name, **kwargs):
38+
def get_dataset(name, **kwargs):
1939
return datasets[name.lower()](**kwargs)
40+
41+
def _make_deprecate(meth, old_name):
42+
new_name = meth.__name__
43+
44+
def deprecated_init(*args, **kwargs):
45+
warnings.warn("encoding.dataset.{} is now deprecated in favor of encoding.dataset.{}."
46+
.format(old_name, new_name), EncodingDeprecationWarning)
47+
return meth(*args, **kwargs)
48+
49+
deprecated_init.__doc__ = r"""
50+
{old_name}(...)
51+
.. warning::
52+
This method is now deprecated in favor of :func:`torch.nn.init.{new_name}`.
53+
See :func:`~torch.nn.init.{new_name}` for details.""".format(
54+
old_name=old_name, new_name=new_name)
55+
deprecated_init.__name__ = old_name
56+
return deprecated_init
57+
58+
get_segmentation_dataset = _make_deprecate(get_dataset, 'get_segmentation_dataset')

0 commit comments

Comments
 (0)