Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xieenze committed Feb 18, 2021
1 parent 1cb7e94 commit 71c8a48
Show file tree
Hide file tree
Showing 54 changed files with 2,244 additions and 0 deletions.
128 changes: 128 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

openselfsup/version.py
version.py
data
.vscode
.idea

# custom
*.pkl
*.pkl.json
*.log.json
work_dirs/
pretrains

# Pytorch
*.pth

*.swp
source.sh
tensorboard.sh
.DS_Store
replace.sh
benchmarks/detection/datasets
benchmarks/detection/output
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@


## Codes

### Pretext Task Pretrain

### Transfer to COCO
Coming Soon

## Download Models
Expand Down
12 changes: 12 additions & 0 deletions benchmarks/detection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

## Transferring to Detection

We follow the evaluation setting in MoCo when trasferring to object detection.

### Instruction

1. Install [detectron2](https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md).

1. Put dataset under "benchmarks/detection/datasets" directory,
following the [directory structure](https://github.com/facebookresearch/detectron2/tree/master/datasets)
requried by detectron2.
15 changes: 15 additions & 0 deletions benchmarks/detection/configs/Base-Keypoint-RCNN-FPN.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
_BASE_: "Base-RCNN-FPN.yaml"
MODEL:
KEYPOINT_ON: True
ROI_HEADS:
NUM_CLASSES: 1
ROI_BOX_HEAD:
SMOOTH_L1_BETA: 0.5 # Keypoint AP degrades (though box AP improves) when using plain L1 loss
RPN:
# Detectron1 uses 2000 proposals per-batch, but this option is per-image in detectron2.
# 1000 proposals per-image is found to hurt box AP.
# Therefore we increase it to 1500 per-image.
POST_NMS_TOPK_TRAIN: 1500
DATASETS:
TRAIN: ("keypoints_coco_2017_train",)
TEST: ("keypoints_coco_2017_val",)
17 changes: 17 additions & 0 deletions benchmarks/detection/configs/Base-RCNN-C4-BN.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
RPN:
PRE_NMS_TOPK_TEST: 6000
POST_NMS_TOPK_TEST: 1000
ROI_HEADS:
NAME: "Res5ROIHeadsExtraNorm"
BACKBONE:
FREEZE_AT: 0
RESNETS:
NORM: "SyncBN"
TEST:
PRECISE_BN:
ENABLED: True
SOLVER:
IMS_PER_BATCH: 16
BASE_LR: 0.02
42 changes: 42 additions & 0 deletions benchmarks/detection/configs/Base-RCNN-FPN.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
MODEL:
META_ARCHITECTURE: "GeneralizedRCNN"
BACKBONE:
NAME: "build_resnet_fpn_backbone"
RESNETS:
OUT_FEATURES: ["res2", "res3", "res4", "res5"]
FPN:
IN_FEATURES: ["res2", "res3", "res4", "res5"]
ANCHOR_GENERATOR:
SIZES: [[32], [64], [128], [256], [512]] # One size for each in feature map
ASPECT_RATIOS: [[0.5, 1.0, 2.0]] # Three aspect ratios (same for all in feature maps)
RPN:
IN_FEATURES: ["p2", "p3", "p4", "p5", "p6"]
PRE_NMS_TOPK_TRAIN: 2000 # Per FPN level
PRE_NMS_TOPK_TEST: 1000 # Per FPN level
# Detectron1 uses 2000 proposals per-batch,
# (See "modeling/rpn/rpn_outputs.py" for details of this legacy issue)
# which is approximately 1000 proposals per-image since the default batch size for FPN is 2.
POST_NMS_TOPK_TRAIN: 1000
POST_NMS_TOPK_TEST: 1000
ROI_HEADS:
NAME: "StandardROIHeads"
IN_FEATURES: ["p2", "p3", "p4", "p5"]
ROI_BOX_HEAD:
NAME: "FastRCNNConvFCHead"
NUM_FC: 2
POOLER_RESOLUTION: 7
ROI_MASK_HEAD:
NAME: "MaskRCNNConvUpsampleHead"
NUM_CONV: 4
POOLER_RESOLUTION: 14
DATASETS:
TRAIN: ("coco_2017_train",)
TEST: ("coco_2017_val",)
SOLVER:
IMS_PER_BATCH: 16
BASE_LR: 0.02
STEPS: (60000, 80000)
MAX_ITER: 90000
INPUT:
MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800)
VERSION: 2
25 changes: 25 additions & 0 deletions benchmarks/detection/configs/Base-RetinaNet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
MODEL:
META_ARCHITECTURE: "RetinaNet"
BACKBONE:
NAME: "build_retinanet_resnet_fpn_backbone"
RESNETS:
OUT_FEATURES: ["res3", "res4", "res5"]
ANCHOR_GENERATOR:
SIZES: !!python/object/apply:eval ["[[x, x * 2**(1.0/3), x * 2**(2.0/3) ] for x in [32, 64, 128, 256, 512 ]]"]
FPN:
IN_FEATURES: ["res3", "res4", "res5"]
RETINANET:
IOU_THRESHOLDS: [0.4, 0.5]
IOU_LABELS: [0, -1, 1]
SMOOTH_L1_LOSS_BETA: 0.0
DATASETS:
TRAIN: ("coco_2017_train",)
TEST: ("coco_2017_val",)
SOLVER:
IMS_PER_BATCH: 16
BASE_LR: 0.01 # Note that RetinaNet uses a different default learning rate
STEPS: (60000, 80000)
MAX_ITER: 90000
INPUT:
MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800)
VERSION: 2
30 changes: 30 additions & 0 deletions benchmarks/detection/configs/Cityscapes/mask_rcnn_R_50_FPN.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
_BASE_: "../Base-RCNN-FPN.yaml"
MODEL:
WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl"
MASK_ON: True
ROI_HEADS:
NUM_CLASSES: 8
BACKBONE:
FREEZE_AT: 0
RESNETS:
DEPTH: 50
NORM: "SyncBN"
FPN:
NORM: "SyncBN"
INPUT:
MIN_SIZE_TRAIN: (800, 832, 864, 896, 928, 960, 992, 1024)
MIN_SIZE_TRAIN_SAMPLING: "choice"
MIN_SIZE_TEST: 1024
MAX_SIZE_TRAIN: 2048
MAX_SIZE_TEST: 2048
DATASETS:
TRAIN: ("cityscapes_fine_instance_seg_train",)
TEST: ("cityscapes_fine_instance_seg_val",)
SOLVER:
BASE_LR: 0.01
STEPS: (18000,)
MAX_ITER: 24000
IMS_PER_BATCH: 8
TEST:
PRECISE_BN:
ENABLED: True
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
_BASE_: "mask_rcnn_R_50_FPN.yaml"
MODEL:
PIXEL_MEAN: [123.675, 116.280, 103.530]
PIXEL_STD: [58.395, 57.120, 57.375]
WEIGHTS: "See Instructions"
RESNETS:
STRIDE_IN_1X1: False
INPUT:
FORMAT: "RGB"
6 changes: 6 additions & 0 deletions benchmarks/detection/configs/coco_R_50_C4_12k.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_BASE_: "coco_R_50_C4_2x.yaml"
SOLVER:
STEPS: (9000, 11000)
MAX_ITER: 12000


6 changes: 6 additions & 0 deletions benchmarks/detection/configs/coco_R_50_C4_12k_moco.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
_BASE_: "coco_R_50_C4_2x_moco.yaml"
SOLVER:
STEPS: (9000, 11000)
MAX_ITER: 12000


4 changes: 4 additions & 0 deletions benchmarks/detection/configs/coco_R_50_C4_1x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_BASE_: "coco_R_50_C4_2x.yaml"
SOLVER:
STEPS: (60000, 80000)
MAX_ITER: 90000
4 changes: 4 additions & 0 deletions benchmarks/detection/configs/coco_R_50_C4_1x_moco.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_BASE_: "coco_R_50_C4_2x_moco.yaml"
SOLVER:
STEPS: (60000, 80000)
MAX_ITER: 90000
13 changes: 13 additions & 0 deletions benchmarks/detection/configs/coco_R_50_C4_2x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
_BASE_: "Base-RCNN-C4-BN.yaml"
MODEL:
MASK_ON: True
WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl"
INPUT:
MIN_SIZE_TRAIN: (640, 672, 704, 736, 768, 800)
MIN_SIZE_TEST: 800
DATASETS:
TRAIN: ("coco_2017_train",)
TEST: ("coco_2017_val",)
SOLVER:
STEPS: (120000, 160000)
MAX_ITER: 180000
10 changes: 10 additions & 0 deletions benchmarks/detection/configs/coco_R_50_C4_2x_moco.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
_BASE_: "coco_R_50_C4_2x.yaml"
MODEL:
PIXEL_MEAN: [123.675, 116.280, 103.530]
PIXEL_STD: [58.395, 57.120, 57.375]
WEIGHTS: "See Instructions"
RESNETS:
STRIDE_IN_1X1: False
INPUT:
MAX_SIZE_TRAIN: 1200
FORMAT: "RGB"
4 changes: 4 additions & 0 deletions benchmarks/detection/configs/coco_R_50_FPN_12k.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_BASE_: "coco_R_50_FPN_1x.yaml"
SOLVER:
STEPS: (9000, 11000)
MAX_ITER: 12000
4 changes: 4 additions & 0 deletions benchmarks/detection/configs/coco_R_50_FPN_12k_moco.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_BASE_: "coco_R_50_FPN_1x_moco.yaml"
SOLVER:
STEPS: (9000, 11000)
MAX_ITER: 12000
17 changes: 17 additions & 0 deletions benchmarks/detection/configs/coco_R_50_FPN_1x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
_BASE_: "Base-RCNN-FPN.yaml"
MODEL:
MASK_ON: True
WEIGHTS: "detectron2://ImageNetPretrained/MSRA/R-50.pkl"
BACKBONE:
FREEZE_AT: 0
RESNETS:
DEPTH: 50
NORM: "SyncBN"
FPN:
NORM: "SyncBN"
TEST:
PRECISE_BN:
ENABLED: True
SOLVER:
STEPS: (60000, 80000)
MAX_ITER: 90000
9 changes: 9 additions & 0 deletions benchmarks/detection/configs/coco_R_50_FPN_1x_moco.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
_BASE_: "coco_R_50_FPN_1x.yaml"
MODEL:
PIXEL_MEAN: [123.675, 116.280, 103.530]
PIXEL_STD: [58.395, 57.120, 57.375]
WEIGHTS: "See Instructions"
RESNETS:
STRIDE_IN_1X1: False
INPUT:
FORMAT: "RGB"
4 changes: 4 additions & 0 deletions benchmarks/detection/configs/coco_R_50_FPN_2x.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_BASE_: "coco_R_50_FPN_1x.yaml"
SOLVER:
STEPS: (120000, 160000)
MAX_ITER: 180000
Loading

0 comments on commit 71c8a48

Please sign in to comment.