Skip to content
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

更新 #1

Merged
merged 34 commits into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1127bdd
Renames the `transforms` attribute of COCODataset (#744)
qizhuli May 2, 2019
16b8b09
change torch.IntTensor to torch.LongTensor for storing large tensor n…
caiqi May 20, 2019
38d08ca
modify senario where dataset has no mask provided (#814)
CoinCheung May 24, 2019
95521b6
some protection code in bounding box operations (#811)
lsrock1 May 24, 2019
5eca57b
Windows10 installation fixes ver2 (#741)
Idolized22 May 24, 2019
7a9b185
Multi-scale testing (#804)
fallingdust May 24, 2019
cd63feb
support empty BinaryMaskList initialization (#780)
botcs May 24, 2019
2ff23c4
Update defaults.py (#774)
zhangliliang May 24, 2019
3d2e2b3
keep the resize function the same in test time the same with training…
hcx1231 May 24, 2019
44fb065
Add requests for compatibility with the demo notebook (#655)
AnnaAraslanova May 24, 2019
c58550c
minor fix: incorrect assert string message formatting (#631)
May 24, 2019
cd35ff0
Update predictor.py (#820)
aperkes May 24, 2019
d7e3c65
enable inference on cpu (#821)
techkang May 25, 2019
4c6cd1a
add vertical flip (#818)
hcx1231 May 28, 2019
d269847
WorkAround for `ValueError: No ground-truth boxes available for one o…
obendidi May 29, 2019
7338be2
Save full configuration in output dir (#835)
May 31, 2019
d802413
fix cv2 compatibility between versions 3 and 4; ignore vscode; minor …
wangg12 Jun 3, 2019
614e427
Save labels in output directory (#842)
Jun 3, 2019
9e25cd5
Add mixed precision training instruction (#837)
khoa-ho Jun 3, 2019
2c025d9
Shapes dataset demo (#849)
karanchahal Jun 3, 2019
b5b0a0a
out0 to out in backbone/resnet (#858)
lsrock1 Jun 4, 2019
c8eff2c
Add RLE size check for SegmentationMask (#859)
botcs Jun 4, 2019
378845c
Fix typo for shapes_dataset_demo.ipynb (#885)
keineahnung2345 Jun 12, 2019
5b20697
Update build.py (#878)
SkeletonOne Jun 12, 2019
7ee52a4
allow test for any checkpoint (#874)
wangg12 Jun 12, 2019
d173a85
update dockerfile according to the new INSTALL.md (#883)
keineahnung2345 Jun 12, 2019
5a431ef
allow test for checkpoint from cfg.MODEL.WEIGHT (#894)
Johnqczhang Jun 14, 2019
eea7b82
Fix typo in bounding_box.py (#902)
keineahnung2345 Jun 17, 2019
6dfb4db
print pretty evaluation results (#900)
Johnqczhang Jun 17, 2019
8783a31
Fix typo: percentace -> percentage (#914)
keineahnung2345 Jun 19, 2019
73ed879
Fix minor typo in rpn.py (#921)
keineahnung2345 Jun 23, 2019
5018ca2
Fix typos in ROIAlign_cpu.cpp (#923)
keineahnung2345 Jun 24, 2019
55796a0
Panoptic Segmentation (#928)
karanchahal Jun 25, 2019
24c8c90
Pruning Demo added (#964)
karanchahal Jul 12, 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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ dist/
# Pycharm editor settings
.idea

# vscode editor settings
.vscode

# MacOS
.DS_Store

# project dirs
/datasets
/models
Expand Down
51 changes: 51 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,58 @@ unset INSTALL_DIR
# or if you are on macOS
# MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build develop
```
#### Windows 10
```bash
open a cmd and change to desired installation directory
from now on will be refered as INSTALL_DIR
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
## Important : check the cuda version installed on your computer by running the command in the cmd :
nvcc -- version
conda install -c pytorch pytorch-nightly torchvision cudatoolkit=9.0

git clone https://github.com/cocodataset/cocoapi.git

#To prevent installation error do the following after commiting cocooapi :
#using file explorer naviagate to cocoapi\PythonAPI\setup.py and change line 14 from:
#extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
#to
#extra_compile_args={'gcc': ['/Qstd=c99']},
#Based on https://github.com/cocodataset/cocoapi/issues/51

cd cocoapi/PythonAPI
python setup.py build_ext install

# navigate back to INSTALL_DIR
cd ..
cd ..
# install apex

git clone https://github.com/NVIDIA/apex.git
cd apex
python setup.py install --cuda_ext --cpp_ext
# navigate back to INSTALL_DIR
cd ..
# install PyTorch Detection

git clone https://github.com/Idolized22/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
```
### Option 2: Docker Image (Requires CUDA, Linux only)

Build image with defaults (`CUDA=9.0`, `CUDNN=7`, `FORCE_CUDA=1`):
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ creating detection and segmentation models using PyTorch 1.0.
- **Very fast**: up to **2x** faster than [Detectron](https://github.com/facebookresearch/Detectron) and **30%** faster than [mmdetection](https://github.com/open-mmlab/mmdetection) during training. See [MODEL_ZOO.md](MODEL_ZOO.md) for more details.
- **Memory efficient:** uses roughly 500MB less GPU memory than mmdetection during training
- **Multi-GPU training and inference**
- **Mixed precision training:** trains faster with less GPU memory on [NVIDIA tensor cores](https://developer.nvidia.com/tensor-cores).
- **Batched inference:** can perform inference using multiple images per batch per GPU
- **CPU support for inference:** runs on CPU in inference time. See our [webcam demo](demo) for an example
- Provides pre-trained models for almost all reference Mask R-CNN and Faster R-CNN configurations with 1x schedule.
Expand Down Expand Up @@ -152,6 +153,15 @@ python -m torch.distributed.launch --nproc_per_node=$NGPUS /path_to_maskrcnn_ben
```
Note we should set `MODEL.RPN.FPN_POST_NMS_TOP_N_TRAIN` follow the rule in Single-GPU training.

### Mixed precision training
We currently use [APEX](https://github.com/NVIDIA/apex) to add [Automatic Mixed Precision](https://developer.nvidia.com/automatic-mixed-precision) support. To enable, just do Single-GPU or Multi-GPU training and set `DTYPE "float16"`.

```bash
export NGPUS=8
python -m torch.distributed.launch --nproc_per_node=$NGPUS /path_to_maskrcnn_benchmark/tools/train_net.py --config-file "path/to/config/file.yaml" MODEL.RPN.FPN_POST_NMS_TOP_N_TRAIN images_per_gpu x 1000 DTYPE "float16"
```
If you want more verbose logging, set `AMP_VERBOSE True`. See [Mixed Precision Training guide](https://docs.nvidia.com/deeplearning/sdk/mixed-precision-training/index.html) for more details.

## Evaluation
You can test your model directly on single or multiple gpus. Here is an example for Mask R-CNN R-50 FPN with the 1x schedule on 8 GPUS:
```bash
Expand Down
48 changes: 48 additions & 0 deletions configs/test_time_aug/e2e_mask_rcnn_R_50_FPN_1x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
WEIGHT: "catalog://ImageNetPretrained/MSRA/R-50"
BACKBONE:
CONV_BODY: "R-50-FPN"
RESNETS:
BACKBONE_OUT_CHANNELS: 256
RPN:
USE_FPN: True
ANCHOR_STRIDE: (4, 8, 16, 32, 64)
PRE_NMS_TOP_N_TRAIN: 2000
PRE_NMS_TOP_N_TEST: 1000
POST_NMS_TOP_N_TEST: 1000
FPN_POST_NMS_TOP_N_TEST: 1000
ROI_HEADS:
USE_FPN: True
ROI_BOX_HEAD:
POOLER_RESOLUTION: 7
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
POOLER_SAMPLING_RATIO: 2
FEATURE_EXTRACTOR: "FPN2MLPFeatureExtractor"
PREDICTOR: "FPNPredictor"
ROI_MASK_HEAD:
POOLER_SCALES: (0.25, 0.125, 0.0625, 0.03125)
FEATURE_EXTRACTOR: "MaskRCNNFPNFeatureExtractor"
PREDICTOR: "MaskRCNNC4Predictor"
POOLER_RESOLUTION: 14
POOLER_SAMPLING_RATIO: 2
RESOLUTION: 28
SHARE_BOX_FEATURE_EXTRACTOR: False
MASK_ON: True
DATASETS:
TRAIN: ("coco_2014_train", "coco_2014_valminusminival")
TEST: ("coco_2014_minival",)
DATALOADER:
SIZE_DIVISIBILITY: 32
SOLVER:
BASE_LR: 0.02
WEIGHT_DECAY: 0.0001
STEPS: (60000, 80000)
MAX_ITER: 90000
TEST:
BBOX_AUG:
ENABLED: True
H_FLIP: True
SCALES: (400, 500, 600, 700, 900, 1000, 1100, 1200)
MAX_SIZE: 2000
SCALE_H_FLIP: True
Loading