forked from STVIR/PMTD
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 1127bdd368613f320f7b113320e62994c0baa216 May 3, 2019 Renames the `transforms` attribute of COCODataset
- Loading branch information
0 parents
commit ba4f312
Showing
242 changed files
with
21,839 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This is an example .flake8 config, used when developing *Black* itself. | ||
# Keep in sync with setup.cfg which is used for source packages. | ||
|
||
[flake8] | ||
ignore = E203, E266, E501, W503 | ||
max-line-length = 80 | ||
max-complexity = 18 | ||
select = B,C,E,F,W,T4,B9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
name: "\U0001F41B Bug Report" | ||
about: Submit a bug report to help us improve Mask R-CNN Benchmark | ||
|
||
--- | ||
|
||
## 🐛 Bug | ||
|
||
<!-- A clear and concise description of what the bug is. --> | ||
|
||
## To Reproduce | ||
|
||
Steps to reproduce the behavior: | ||
|
||
1. | ||
1. | ||
1. | ||
|
||
<!-- If you have a code sample, error messages, stack traces, please provide it here as well --> | ||
|
||
## Expected behavior | ||
|
||
<!-- A clear and concise description of what you expected to happen. --> | ||
|
||
## Environment | ||
|
||
Please copy and paste the output from the | ||
[environment collection script from PyTorch](https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py) | ||
(or fill out the checklist below manually). | ||
|
||
You can get the script and run it with: | ||
``` | ||
wget https://raw.githubusercontent.com/pytorch/pytorch/master/torch/utils/collect_env.py | ||
# For security purposes, please check the contents of collect_env.py before running it. | ||
python collect_env.py | ||
``` | ||
|
||
- PyTorch Version (e.g., 1.0): | ||
- OS (e.g., Linux): | ||
- How you installed PyTorch (`conda`, `pip`, source): | ||
- Build command you used (if compiling from source): | ||
- Python version: | ||
- CUDA/cuDNN version: | ||
- GPU models and configuration: | ||
- Any other relevant information: | ||
|
||
## Additional context | ||
|
||
<!-- Add any other context about the problem here. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
name: "\U0001F680Feature Request" | ||
about: Submit a proposal/request for a new Mask R-CNN Benchmark feature | ||
|
||
--- | ||
|
||
## 🚀 Feature | ||
<!-- A clear and concise description of the feature proposal --> | ||
|
||
## Motivation | ||
|
||
<!-- Please outline the motivation for the proposal. Is your feature request related to a problem? e.g., I'm always frustrated when [...]. If this is related to another GitHub issue, please link here too --> | ||
|
||
## Pitch | ||
|
||
<!-- A clear and concise description of what you want to happen. --> | ||
|
||
## Alternatives | ||
|
||
<!-- A clear and concise description of any alternative solutions or features you've considered, if any. --> | ||
|
||
## Additional context | ||
|
||
<!-- Add any other context or screenshots about the feature request here. --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
name: "❓Questions/Help/Support" | ||
about: Do you need support? | ||
|
||
--- | ||
|
||
## ❓ Questions and Help |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# compilation and distribution | ||
__pycache__ | ||
_ext | ||
*.pyc | ||
*.so | ||
maskrcnn_benchmark.egg-info/ | ||
build/ | ||
dist/ | ||
|
||
# pytorch/python/numpy formats | ||
*.pth | ||
*.pkl | ||
*.npy | ||
|
||
# ipython/jupyter notebooks | ||
*.ipynb | ||
**/.ipynb_checkpoints/ | ||
|
||
# Editor temporaries | ||
*.swn | ||
*.swo | ||
*.swp | ||
*~ | ||
|
||
# Pycharm editor settings | ||
.idea | ||
|
||
# project dirs | ||
/datasets | ||
/models | ||
/output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
## Abstractions | ||
The main abstractions introduced by `maskrcnn_benchmark` that are useful to | ||
have in mind are the following: | ||
|
||
### ImageList | ||
In PyTorch, the first dimension of the input to the network generally represents | ||
the batch dimension, and thus all elements of the same batch have the same | ||
height / width. | ||
In order to support images with different sizes and aspect ratios in the same | ||
batch, we created the `ImageList` class, which holds internally a batch of | ||
images (os possibly different sizes). The images are padded with zeros such that | ||
they have the same final size and batched over the first dimension. The original | ||
sizes of the images before padding are stored in the `image_sizes` attribute, | ||
and the batched tensor in `tensors`. | ||
We provide a convenience function `to_image_list` that accepts a few different | ||
input types, including a list of tensors, and returns an `ImageList` object. | ||
|
||
```python | ||
from maskrcnn_benchmark.structures.image_list import to_image_list | ||
|
||
images = [torch.rand(3, 100, 200), torch.rand(3, 150, 170)] | ||
batched_images = to_image_list(images) | ||
|
||
# it is also possible to make the final batched image be a multiple of a number | ||
batched_images_32 = to_image_list(images, size_divisible=32) | ||
``` | ||
|
||
### BoxList | ||
The `BoxList` class holds a set of bounding boxes (represented as a `Nx4` tensor) for | ||
a specific image, as well as the size of the image as a `(width, height)` tuple. | ||
It also contains a set of methods that allow to perform geometric | ||
transformations to the bounding boxes (such as cropping, scaling and flipping). | ||
The class accepts bounding boxes from two different input formats: | ||
- `xyxy`, where each box is encoded as a `x1`, `y1`, `x2` and `y2` coordinates, and | ||
- `xywh`, where each box is encoded as `x1`, `y1`, `w` and `h`. | ||
|
||
Additionally, each `BoxList` instance can also hold arbitrary additional information | ||
for each bounding box, such as labels, visibility, probability scores etc. | ||
|
||
Here is an example on how to create a `BoxList` from a list of coordinates: | ||
```python | ||
from maskrcnn_benchmark.structures.bounding_box import BoxList, FLIP_LEFT_RIGHT | ||
|
||
width = 100 | ||
height = 200 | ||
boxes = [ | ||
[0, 10, 50, 50], | ||
[50, 20, 90, 60], | ||
[10, 10, 50, 50] | ||
] | ||
# create a BoxList with 3 boxes | ||
bbox = BoxList(boxes, image_size=(width, height), mode='xyxy') | ||
|
||
# perform some box transformations, has similar API as PIL.Image | ||
bbox_scaled = bbox.resize((width * 2, height * 3)) | ||
bbox_flipped = bbox.transpose(FLIP_LEFT_RIGHT) | ||
|
||
# add labels for each bbox | ||
labels = torch.tensor([0, 10, 1]) | ||
bbox.add_field('labels', labels) | ||
|
||
# bbox also support a few operations, like indexing | ||
# here, selects boxes 0 and 2 | ||
bbox_subset = bbox[[0, 2]] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Code of Conduct | ||
|
||
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. | ||
Please read the [full text](https://code.fb.com/codeofconduct/) | ||
so that you can understand what actions will and will not be tolerated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Contributing to Mask-RCNN Benchmark | ||
We want to make contributing to this project as easy and transparent as | ||
possible. | ||
|
||
## Our Development Process | ||
Minor changes and improvements will be released on an ongoing basis. Larger changes (e.g., changesets implementing a new paper) will be released on a more periodic basis. | ||
|
||
## Pull Requests | ||
We actively welcome your pull requests. | ||
|
||
1. Fork the repo and create your branch from `master`. | ||
2. If you've added code that should be tested, add tests. | ||
3. If you've changed APIs, update the documentation. | ||
4. Ensure the test suite passes. | ||
5. Make sure your code lints. | ||
6. If you haven't already, complete the Contributor License Agreement ("CLA"). | ||
|
||
## Contributor License Agreement ("CLA") | ||
In order to accept your pull request, we need you to submit a CLA. You only need | ||
to do this once to work on any of Facebook's open source projects. | ||
|
||
Complete your CLA here: <https://code.facebook.com/cla> | ||
|
||
## Issues | ||
We use GitHub issues to track public bugs. Please ensure your description is | ||
clear and has sufficient instructions to be able to reproduce the issue. | ||
|
||
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe | ||
disclosure of security bugs. In those cases, please go through the process | ||
outlined on that page and do not file a public issue. | ||
|
||
## Coding Style | ||
* 4 spaces for indentation rather than tabs | ||
* 80 character line length | ||
* PEP8 formatting following [Black](https://black.readthedocs.io/en/stable/) | ||
|
||
## License | ||
By contributing to Mask-RCNN Benchmark, you agree that your contributions will be licensed | ||
under the LICENSE file in the root directory of this source tree. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
## Installation | ||
|
||
### Requirements: | ||
- PyTorch 1.0 from a nightly release. It **will not** work with 1.0 nor 1.0.1. Installation instructions can be found in https://pytorch.org/get-started/locally/ | ||
- torchvision from master | ||
- cocoapi | ||
- yacs | ||
- matplotlib | ||
- GCC >= 4.9 | ||
- OpenCV | ||
|
||
|
||
### Option 1: Step-by-step installation | ||
|
||
```bash | ||
# first, make sure that your conda is setup properly with the right environment | ||
# for that, check that `which conda`, `which pip` and `which python` points to the | ||
# right path. From a clean conda env, this is what you need to do | ||
|
||
conda create --name maskrcnn_benchmark | ||
conda activate maskrcnn_benchmark | ||
|
||
# this installs the right pip and dependencies for the fresh python | ||
conda install ipython | ||
|
||
# maskrcnn_benchmark and coco api dependencies | ||
pip install ninja yacs cython matplotlib tqdm opencv-python | ||
|
||
# follow PyTorch installation in https://pytorch.org/get-started/locally/ | ||
# we give the instructions for CUDA 9.0 | ||
conda install -c pytorch pytorch-nightly torchvision cudatoolkit=9.0 | ||
|
||
export INSTALL_DIR=$PWD | ||
|
||
# install pycocotools | ||
cd $INSTALL_DIR | ||
git clone https://github.com/cocodataset/cocoapi.git | ||
cd cocoapi/PythonAPI | ||
python setup.py build_ext install | ||
|
||
# install apex | ||
cd $INSTALL_DIR | ||
git clone https://github.com/NVIDIA/apex.git | ||
cd apex | ||
python setup.py install --cuda_ext --cpp_ext | ||
|
||
# install PyTorch Detection | ||
cd $INSTALL_DIR | ||
git clone https://github.com/facebookresearch/maskrcnn-benchmark.git | ||
cd maskrcnn-benchmark | ||
|
||
# the following will install the lib with | ||
# symbolic links, so that you can modify | ||
# the files if you want and won't need to | ||
# re-build it | ||
python setup.py build develop | ||
|
||
|
||
unset INSTALL_DIR | ||
|
||
# or if you are on macOS | ||
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build develop | ||
``` | ||
|
||
### Option 2: Docker Image (Requires CUDA, Linux only) | ||
|
||
Build image with defaults (`CUDA=9.0`, `CUDNN=7`, `FORCE_CUDA=1`): | ||
|
||
nvidia-docker build -t maskrcnn-benchmark docker/ | ||
|
||
Build image with other CUDA and CUDNN versions: | ||
|
||
nvidia-docker build -t maskrcnn-benchmark --build-arg CUDA=9.2 --build-arg CUDNN=7 docker/ | ||
|
||
Build image with FORCE_CUDA disabled: | ||
|
||
nvidia-docker build -t maskrcnn-benchmark --build-arg FORCE_CUDA=0 docker/ | ||
|
||
Build and run image with built-in jupyter notebook(note that the password is used to log in jupyter notebook): | ||
|
||
nvidia-docker build -t maskrcnn-benchmark-jupyter docker/docker-jupyter/ | ||
nvidia-docker run -td -p 8888:8888 -e PASSWORD=<password> -v <host-dir>:<container-dir> maskrcnn-benchmark-jupyter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Facebook | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Oops, something went wrong.