Skip to content

Layers branch with NMS-GPU #727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 107 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
aad3b4b
Transforms Documentation changes (#464)
vishwakftw Apr 7, 2018
1a6038e
Fix for min/max returning 0dim tensors now (#469)
ssnl Apr 12, 2018
7bda0e8
Backward compat fix for Pytorch < 0.4 (#472)
fmassa Apr 16, 2018
f6ab107
Add support in transforms.ToTensor for PIL Images mod '1' (#471)
arturml Apr 16, 2018
6f7e26b
Fix Densenet module keys (#474)
ssnl Apr 21, 2018
1d0a3b1
bump up version to 0.2.1
soumith Apr 24, 2018
f87a896
fix models for PyTorch v0.4 (remove .data and add _ for the initializ…
moskomule Apr 30, 2018
4db0398
Update test_utils.py (#486)
vfdev-5 May 4, 2018
73281b4
Update resnet.py (#487)
vfdev-5 May 9, 2018
47214f0
Progress Bar for download_url (#497)
maruthgoyal May 11, 2018
8a4786a
Add functional transforms to docs (#499)
vishwakftw May 15, 2018
9f28cff
Update test_transforms.py (#500)
vfdev-5 May 15, 2018
972b80c
Load and parse metadata for CIFAR-10, CIFAR-100 (#502)
xenosoz May 17, 2018
1a47a44
Revert "Load and parse metadata for CIFAR-10, CIFAR-100 (#502)" (#506)
soumith May 17, 2018
628e90c
Add metadata to some datasets (#501)
davidlmorton May 17, 2018
2e25533
Fix documentation and add is_image_file (#507)
bstriner May 18, 2018
55d7395
Fix invalid argument error when using lsun method in windows (#508)
tanvach May 18, 2018
6cfd2ae
Fix transforms.Pad and transforms.LinearTransformation doc strings (#…
vfdev-5 May 24, 2018
11da4f1
add padding-mode choice to `RandomCrop` (#512)
jxgu1016 May 24, 2018
9aff567
Revert "add padding-mode choice to `RandomCrop` (#512)" (#515)
fmassa May 24, 2018
f27ecce
fix a bug described in issue #488 (#489)
KovenYu May 24, 2018
b1ef1fe
Normalize and pil link fix (#519)
kohr-h May 26, 2018
cf65f39
Add note on in-place nature of Normalize, closes #517 (#520)
kohr-h May 27, 2018
da67a1e
Partially revert #519 due to performance regression & other issues (#…
kohr-h May 28, 2018
5a0d079
make vision depend on pillow-simd if already installed (#522)
May 30, 2018
3f6c23c
Addresses issue #145 as per @fmessa's suggestion. (#527)
Choco31415 Jun 6, 2018
50b2f91
Fix broken progress bar (#524)
kohr-h Jun 6, 2018
0bbb1aa
fix #530. (#531)
csukuangfj Jun 14, 2018
1fb0ccf
Add progress bar based downloading to MNIST (#535)
vishwakftw Jun 25, 2018
cd1f58f
Downgrade tqdm version to 4.19 for py2.7 (#542)
vishwakftw Jul 13, 2018
f1b5907
Fix links to pillow docs (#554)
vishwakftw Jul 23, 2018
d6c7900
Use scandir in _find_classes (#557) (#559)
Jul 27, 2018
b51a2c3
ColorJitter Enhancement (#548)
yaox12 Jul 30, 2018
be68e24
Fix small Typo in RandomAffine comment (#563)
ashaw596 Jul 31, 2018
fe973ce
Removed the +1 and divide by 2 to allow for random offset padding (#564)
ryanpeach Aug 2, 2018
c74b79c
MNIST loader refactored: permanent 'data' and 'targets' fields (#578)
dizcza Aug 16, 2018
d9e50b1
push get_file_path patches to test
soumith Aug 25, 2018
152c2b3
Fix lint error (#588)
vishwakftw Aug 29, 2018
f3d5e85
Update fakedata.py (#581)
vfdev-5 Sep 11, 2018
fc7911c
CIFAR: permanent 'data' and 'targets' fields (#594)
dizcza Sep 11, 2018
f91a182
fix py37 warning (#600)
ssnl Sep 11, 2018
e15e81f
Improve docs of functional transforms (#602)
sotte Sep 13, 2018
a7935ea
cast mnist targer to int (#605)
truskovskiyk Sep 17, 2018
e564f13
MNIST and FashionMNIST now have their own 'raw' and 'processed' folde…
dizcza Sep 17, 2018
4c9c407
remove extra space (#609)
ssnl Sep 21, 2018
86001a8
Remove unused import (#612)
estepona Oct 1, 2018
b94e2c8
Mention TORCH_MODEL_ZOO in models documentation. (#624)
fadel Oct 11, 2018
b0acd55
Relax assertion in `transforms.Lambda.__init__` (#637)
willfrey Oct 24, 2018
8f943d4
Fix Unused Variables and flake8 config (#635)
truskovskiyk Oct 25, 2018
85369e3
Fix inception v3 input transform for trace & onnx (#621)
BowenBao Oct 25, 2018
c7e9bd3
Hub (#639)
ailzhang Oct 26, 2018
3621569
Fix FashionMNIST loading MNIST (#640)
berleon Oct 26, 2018
62cbf0b
move area calculation out of loop (#641)
erikgaas Oct 26, 2018
7e973b8
Revert "Fix FashionMNIST loading MNIST" (#646)
fmassa Oct 30, 2018
ee570b6
Replace deprecated doc reference to `functional.scale` by `functional…
cuihaoleo Nov 2, 2018
dc0238b
Changing to AdaptiveAvgPool2d on SqueezeNet and ResNet (#643)
AdanMora Nov 6, 2018
fb63374
Resnet Consistency changes (#656)
erikgaas Nov 6, 2018
e375908
Update resnet.py (#659)
Amir-Arsalan Nov 12, 2018
50d9dc5
Update densenet.py (#658)
Amir-Arsalan Nov 12, 2018
d563769
Changing to AdaptiveAvgPool2d on DenseNet (#672)
quinwu Nov 27, 2018
878a771
Add SBU Captioned Photo Dataset (#665)
adamjstewart Dec 4, 2018
e8e04f0
Add Flickr8k and Flickr30k Datasets (#674)
adamjstewart Dec 4, 2018
2d493d6
Fix for #409 (#673)
varunagrawal Dec 4, 2018
5123ded
Add scipy as a dependency to setup.py (#675)
willfrey Dec 6, 2018
4cc6f45
Zero-init the residual branch in resnet (#498)
ppwwyyxx Dec 6, 2018
e489abc
VOCSegmentation, VOCDetection, linting passing, examples. (#663)
bpinaya Dec 6, 2018
71182bc
replace 'residual' with 'identity' (#679)
Sundrops Dec 11, 2018
8bd05e6
Expand user path for PASCAL VOC (#681)
hendrycks Dec 13, 2018
3884faf
Pad updated (#683)
surgan12 Dec 13, 2018
0ce8156
docs changed (#685)
surgan12 Dec 13, 2018
6ee98fc
bug fixes to_tensor (#686)
surgan12 Dec 14, 2018
be6f6c2
modes added (#688)
surgan12 Dec 17, 2018
59802fa
docs added 2 channel Mode (#692)
surgan12 Dec 18, 2018
bf3ab29
interpolations added (#693)
surgan12 Dec 20, 2018
038105f
Add Cityscapes Dataset (#695)
TheCodez Dec 21, 2018
8ce0070
Add KMNIST dataset (#687)
hysts Dec 25, 2018
885e3c2
Support for returning multiple targets (#700)
TheCodez Dec 25, 2018
2115380
normalise updates (#699)
surgan12 Dec 30, 2018
84896a6
Add downloads and docs badge to README (#702)
willprice Jan 8, 2019
8f0ef5a
Doc changes (#711)
surgan12 Jan 8, 2019
98ca260
[travis] Record code coverage and display on README (#703)
willprice Jan 8, 2019
1f8f7ea
Add support for .TIFF files in ImageFolder (#724)
lhenault Jan 25, 2019
58fe6ec
Initial layout for layers with cpp extensions
fmassa Apr 20, 2018
83f0d14
Move files around
fmassa Apr 20, 2018
817c597
Fix import after move
fmassa Apr 20, 2018
fc8d5c9
Add support for multiple types to ROIAlign
fmassa Apr 25, 2018
233f6d7
Different organization
fmassa Apr 25, 2018
79aa838
Cleanups
fmassa Apr 25, 2018
24a5ef5
Reduce memory requirements for backwards
fmassa Apr 25, 2018
f5eb0fa
Replace runtime_error by AT_ERROR
fmassa Apr 25, 2018
f1c8711
Add nms test
fmassa Apr 25, 2018
f6e5755
Add support for compilation using CPP extensions
fmassa Apr 26, 2018
06206ce
Change folder structure
fmassa Apr 26, 2018
517ff1c
Add ROIPool cuda
fmassa Apr 26, 2018
8802cce
Cleanups
fmassa Apr 26, 2018
7e4f10e
Add roi_pool.py
fmassa Apr 27, 2018
0fe0a00
Fix lint
fmassa Apr 27, 2018
5e587d5
Add initial structures folder for bounding boxes
fmassa May 2, 2018
94634d3
Assertion macros compatible with pytorch master (#540)
ahirner Jul 3, 2018
96b6d29
Support for ROI Pooling (#592)
varunagrawal Sep 3, 2018
faf474e
remove .type().tensor() calls in favor of the new approach to tensor …
varunagrawal Oct 13, 2018
f1079c1
Consistent naming for rois variable (#627)
varunagrawal Oct 13, 2018
c2e1a32
ROIPool: Support for all datatypes (#632)
varunagrawal Oct 18, 2018
54ed0d7
updated torch C++ import to extension.h
varunagrawal Dec 1, 2018
97b0f29
fixes to CPU version of NMS
varunagrawal Jan 25, 2019
6d479e7
Support for GPU version of NMS
varunagrawal Jan 25, 2019
d887bcc
docstring for NMS python function
varunagrawal Jan 25, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[run]
branch = True

[paths]
source =
torchvision
/**/site-packages/torchvision
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ torchvision.egg-info/
*/**/*~
*~
docs/build
.coverage
htmlcov
36 changes: 30 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ matrix:
python: "2.7"
install: pip install flake8
script: flake8
after_success: []
- python: "2.7"
env: IMAGE_BACKEND=Pillow-SIMD
- python: "2.7"
- python: "3.5"
env: IMAGE_BACKEND=Pillow-SIMD
- python: "3.5"

install:
before_install:
- sudo apt-get update
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
- bash miniconda.sh -b -p $HOME/miniconda
Expand All @@ -26,11 +27,34 @@ install:

- conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pytorch scipy -c pytorch
- source activate test-environment
- python setup.py install
- pip install --upgrade pytest
- if [[ "$IMAGE_BACKEND" == "Pillow-SIMD" ]]; then
pip uninstall -y pillow && CC="cc -march=native" pip install --force-reinstall pillow-simd;
- |
if [[ "$IMAGE_BACKEND" == "Pillow-SIMD" ]]; then
pip uninstall -y pillow && CC="cc -march=native" pip install --force-reinstall pillow-simd
fi
- pip install pytest pytest-cov codecov


install:
# Using pip instead of setup.py ensures we install a non-compressed version of the package
# (as opposed to an egg), which is necessary to collect coverage.
# We still get the benefit of testing an installed version over the
# test version to iron out installation file-inclusion bugs but can
# also collect coverage.
- pip install .
# Move to home dir, otherwise we'll end up with the path to the
# package in $PWD rather than the installed v
- |
cd $HOME
export TV_INSTALL_PATH="$(python -c 'import os; import torchvision; print(os.path.dirname(os.path.abspath(torchvision.__file__)))')"
echo "$TV_INSTALL_PATH"
cd -

script:
- pytest test/
- pytest --cov-config .coveragerc --cov torchvision --cov $TV_INSTALL_PATH test

after_success:
# Necessary to run coverage combine to rewrite paths from
# /travis/env/path/site-packages/torchvision to actual path
- coverage combine .coverage
- coverage report
- codecov
10 changes: 10 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ torchvision
.. image:: https://travis-ci.org/pytorch/vision.svg?branch=master
:target: https://travis-ci.org/pytorch/vision

.. image:: https://codecov.io/gh/pytorch/vision/branch/master/graph/badge.svg
:target: https://codecov.io/gh/pytorch/vision

.. image:: https://pepy.tech/badge/torchvision
:target: https://pepy.tech/project/torchvision

.. image:: https://img.shields.io/badge/dynamic/json.svg?label=docs&url=https%3A%2F%2Fpypi.org%2Fpypi%2Ftorchvision%2Fjson&query=%24.info.version&colorB=brightgreen&prefix=v
:target: https://pytorch.org/docs/stable/torchvision/index.html


The torchvision package consists of popular datasets, model architectures, and common image transformations for computer vision.

Installation
Expand Down
47 changes: 47 additions & 0 deletions docs/source/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ Fashion-MNIST

.. autoclass:: FashionMNIST

KMNIST
~~~~~~~~~~~~~

.. autoclass:: KMNIST

EMNIST
~~~~~~

Expand Down Expand Up @@ -129,3 +134,45 @@ PhotoTour
.. autoclass:: PhotoTour
:members: __getitem__
:special-members:

SBU
~~~


.. autoclass:: SBU
:members: __getitem__
:special-members:

Flickr
~~~~~~


.. autoclass:: Flickr8k
:members: __getitem__
:special-members:

.. autoclass:: Flickr30k
:members: __getitem__
:special-members:

VOC
~~~~~~


.. autoclass:: VOCSegmentation
:members: __getitem__
:special-members:

.. autoclass:: VOCDetection
:members: __getitem__
:special-members:

Cityscapes
~~~~~~~~~~

.. note ::
Requires Cityscape to be downloaded.

.. autoclass:: Cityscapes
:members: __getitem__
:special-members:
4 changes: 4 additions & 0 deletions docs/source/models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ These can be constructed by passing ``pretrained=True``:
densenet = models.densenet161(pretrained=True)
inception = models.inception_v3(pretrained=True)

Instancing a pre-trained model will download its weights to a cache directory.
This directory can be set using the `TORCH_MODEL_ZOO` environment variable. See
:func:`torch.utils.model_zoo.load_url` for details.

Some models use modules which have different training and evaluation
behavior, such as batch normalization. To switch between these modes, use
``model.train()`` or ``model.eval()`` as appropriate. See
Expand Down
74 changes: 55 additions & 19 deletions docs/source/transforms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,72 @@ torchvision.transforms

.. currentmodule:: torchvision.transforms

Transforms are common image transforms. They can be chained together using :class:`Compose`
Transforms are common image transformations. They can be chained together using :class:`Compose`.
Additionally, there is the :mod:`torchvision.transforms.functional` module.
Functional transforms give fine-grained control over the transformations.
This is useful if you have to build a more complex transformation pipeline
(e.g. in the case of segmentation tasks).

.. autoclass:: Compose

Transforms on PIL Image
-----------------------

.. autoclass:: Resize
.. autoclass:: CenterCrop

.. autoclass:: Scale
.. autoclass:: ColorJitter

.. autoclass:: CenterCrop
.. autoclass:: FiveCrop

.. autoclass:: RandomCrop
.. autoclass:: Grayscale

.. autoclass:: RandomHorizontalFlip
.. autoclass:: Pad

.. autoclass:: RandomVerticalFlip
.. autoclass:: RandomAffine

.. autoclass:: RandomResizedCrop
.. autoclass:: RandomApply

.. autoclass:: RandomSizedCrop
.. autoclass:: RandomChoice

.. autoclass:: Grayscale
.. autoclass:: RandomCrop

.. autoclass:: RandomGrayscale

.. autoclass:: FiveCrop

.. autoclass:: TenCrop
.. autoclass:: RandomHorizontalFlip

.. autoclass:: Pad
.. autoclass:: RandomOrder

.. autoclass:: ColorJitter
.. autoclass:: RandomResizedCrop

.. autoclass:: RandomRotation

.. autoclass:: RandomAffine
.. autoclass:: RandomSizedCrop

.. autoclass:: RandomVerticalFlip

.. autoclass:: Resize

.. autoclass:: Scale

.. autoclass:: TenCrop

Transforms on torch.\*Tensor
----------------------------

.. autoclass:: LinearTransformation

.. autoclass:: Normalize
:members: __call__
:special-members:


Conversion Transforms
---------------------

.. autoclass:: ToTensor
.. autoclass:: ToPILImage
:members: __call__
:special-members:

.. autoclass:: ToPILImage
.. autoclass:: ToTensor
:members: __call__
:special-members:

Expand All @@ -66,3 +77,28 @@ Generic Transforms

.. autoclass:: Lambda


Functional Transforms
---------------------

Functional transforms give you fine-grained control of the transformation pipeline.
As opposed to the transformations above, functional transforms don't contain a random number
generator for their parameters.
That means you have to specify/generate all parameters, but you can reuse the functional transform.
For example, you can apply a functional transform to multiple images like this:

.. code:: python

import torchvision.transforms.functional as TF
import random

def my_segmentation_transforms(image, segmentation):
if random.random() > 5:
angle = random.randint(-30, 30)
image = TF.rotate(image, angle)
segmentation = TF.rotate(segmentation, angle)
# more transforms ...
return image, segmentation

.. automodule:: torchvision.transforms.functional
:members:
65 changes: 65 additions & 0 deletions hubconf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
'''
This is an example hubconf.py for pytorch/vision repo

## Users can get this published model by calling:
hub_model = hub.load(
'pytorch/vision:master', # repo_owner/repo_name:branch
'resnet18', # entrypoint
1234, # args for callable [not applicable to resnet]
pretrained=True) # kwargs for callable

## Protocol on repo owner side
1. The "published" models should be at least in a branch/tag. It can't be a random commit.
2. Repo owner should have the following field defined in hubconf.py
2.1 Function/entrypoint with function signature "def resnet18(pretrained=False, *args, **kwargs):"
2.2 Pretrained allows users to load pretrained weights from repo owner.
2.3 Args and kwargs are passed to the callable _resnet18,
2.4 Docstring of function works as a help message, explaining what does the model do and what's
the allowed arguments.
2.5 Dependencies is a list optionally provided by repo owner, to specify what packages are required
to run the model.

## Hub_dir

hub_dir specifies where the intermediate files/folders will be saved. By default this is ~/.torch/hub.
Users can change it by either setting the environment variable TORCH_HUB_DIR or calling hub.set_dir(PATH_TO_HUB_DIR).
By default, we don't cleanup files after loading so that users can use cache next time.

## Cache logic

We used the cache by default if it exists in hub_dir.
Users can force a fresh reload by calling hub.load(..., force_reload=True).
'''

import torch.utils.model_zoo as model_zoo

# Optional list of dependencies required by the package
dependencies = ['torch', 'math']


def resnet18(pretrained=False, *args, **kwargs):
"""
Resnet18 model
pretrained (bool): a recommended kwargs for all entrypoints
args & kwargs are arguments for the function
"""
from torchvision.models.resnet import resnet18 as _resnet18
model = _resnet18(*args, **kwargs)
checkpoint = 'https://download.pytorch.org/models/resnet18-5c106cde.pth'
if pretrained:
model.load_state_dict(model_zoo.load_url(checkpoint, progress=False))
return model


def resnet50(pretrained=False, *args, **kwargs):
"""
Resnet50 model
pretrained (bool): a recommended kwargs for all entrypoints
args & kwargs are arguments for the function
"""
from torchvision.models.resnet import resnet50 as _resnet50
model = _resnet50(*args, **kwargs)
checkpoint = 'https://download.pytorch.org/models/resnet50-19c8e357.pth'
if pretrained:
model.load_state_dict(model_zoo.load_url(checkpoint, progress=False))
return model
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ max-line-length = 120

[flake8]
max-line-length = 120
ignore = F401,E402,F403
ignore = F401,E402,F403,W503,W504
exclude = venv
Loading