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

I have spent 2 weeks to deploy the environment without success. Could you please pay for help to solve the problem? My email is [email protected] #93

Open
wants to merge 188 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
9e3dcd0
refactor ops: unify cuda ops api (#2277)
xvjiarui Mar 21, 2020
ad7115a
Scale Factor Fix (#2039)
ZwwWayne Mar 21, 2020
eeff0be
add new config sample and check scripts (#2216)
xvjiarui Mar 23, 2020
465473e
delete work_dir in all configs (#2315)
xvjiarui Mar 24, 2020
a3e6144
Add norm eval in configs (#2319)
xvjiarui Mar 26, 2020
ceb8082
Add unit tests for image loading (#2329)
hellock Mar 26, 2020
82b794d
refactor resnet, add deep_stem and avg_down opt (#2252)
xvjiarui Mar 28, 2020
79241e1
Merge branch 'master' into v2.0
hellock Mar 30, 2020
4ad7b27
remove from result dict and fix unit tests (#2352)
hellock Mar 30, 2020
c29a789
Encapsulate the second stage into RoI heads (#1999)
ZwwWayne Mar 31, 2020
1cccda2
Refactor gcnet/emperical into plugin (#2345)
xvjiarui Apr 1, 2020
5134d44
Refactor (test_config): rename function names in test_config (#2373)
ZwwWayne Apr 1, 2020
b2e8ac0
Refactor (iou_assigner): set low quality match as an option (#2375)
ZwwWayne Apr 2, 2020
2bb37ac
L1 loss (#2376)
ZwwWayne Apr 2, 2020
9ab68c7
Merge branch 'master' into v2.0
hellock Apr 2, 2020
d65e232
Support polygon mask training (#2353)
yhcao6 Apr 3, 2020
8549d10
add unit tests for fp16 decorators (#2381)
hellock Apr 3, 2020
da09e7e
Support CPU mode for inference (#2385)
xvjiarui Apr 4, 2020
5db9b2e
Rename BitMap to Bitmap, perfect unit test. (#2391)
yhcao6 Apr 6, 2020
7ed8d51
Change V2.0 coors (#2380)
ZwwWayne Apr 6, 2020
70eedbd
Refactor category orders in heads (#2374)
ZwwWayne Apr 8, 2020
2082430
Add optimizer constructor (#2397)
hellock Apr 8, 2020
3ed272a
Add sampler and assigner registry (#2419)
xvjiarui Apr 10, 2020
af6e1f8
V2.0 speedup rpn (#2420)
yhcao6 Apr 10, 2020
3174d69
Add train_cfg/test_cfg in AnchorHead (#2422)
xvjiarui Apr 11, 2020
55d3b8c
Add pafpn (#2392)
yhcao6 Apr 11, 2020
913e099
Support empty tensor input for some models. (#2280)
yhcao6 Apr 11, 2020
e33ecfe
Rename imgs_per_gpu to samples_per_gpu (#2404)
ZwwWayne Apr 11, 2020
990412e
Refactor (training cfgs): change default training settings for better…
ZwwWayne Apr 11, 2020
1e5e271
Support for custom classes (#2408)
igonro Apr 11, 2020
25ede58
Add ability to specify device ids for non-distributed training (#2400)
melikovk Apr 11, 2020
fbdb488
Support to train subsets of coco dataset (#2340)
ZwwWayne Apr 12, 2020
c64a80d
Refactor (tools): use '-' rather than '_' for command option (#2433)
ZwwWayne Apr 12, 2020
4ece0d8
Support custom classes (#2443)
daavoo Apr 14, 2020
a1c3aa4
Merge non dist and dist train (#2440)
daavoo Apr 14, 2020
bff88bd
Merge branch 'master' into v2.0
hellock Apr 14, 2020
55e1a90
Fix bug of necessary arguments with '-' (#2453)
ZwwWayne Apr 14, 2020
a76bd6f
Refactor (assigner): add iou_calculator (#2405)
ZwwWayne Apr 14, 2020
79014df
Merge target into head (#2429)
xvjiarui Apr 16, 2020
4c80abb
fixed local_rank (#2470)
xvjiarui Apr 17, 2020
76b3f02
Remove duplicate unmap function (#2471)
xvjiarui Apr 17, 2020
127a5d2
V2.0 classwise (#2459)
ZwwWayne Apr 17, 2020
a244af7
Add BBox Coder (#2480)
xvjiarui Apr 19, 2020
c1ef12d
Remove datasets.loader and add datasets.samplers (#2482)
hellock Apr 20, 2020
a8cbd92
Add bypass_duplicate option in optimizer constructor (#2488)
xvjiarui Apr 20, 2020
1be4e2e
Check if max_num > 0 before slicing in nms (#2486)
Apr 20, 2020
81ef07b
fix dpool no instance (#2490)
yhcao6 Apr 20, 2020
2452761
add reminder for PhotoMetricDistortion (#2492)
yhcao6 Apr 20, 2020
d1b4f87
Unify regression loss (#2156)
xvjiarui Apr 21, 2020
ebbb7e9
fixed ga_head typo and add test cases (#2494)
xvjiarui Apr 21, 2020
e176b6b
fixed init/refine (#2498)
xvjiarui Apr 21, 2020
a6236b7
Refactor Anchor Generator (#2474)
ZwwWayne Apr 22, 2020
46ef592
Merge master to v2.0
ZwwWayne Apr 22, 2020
8d9d1d4
Merge pull request #2501 from ZwwWayne/v2.0_merge_master
hellock Apr 22, 2020
6259a34
use mmcv.cnn.bias_init_with_prob (#2502)
hellock Apr 22, 2020
08f4b64
remove legacy import statements (#2503)
hellock Apr 22, 2020
ac4c061
Make 'lr' optional parameter (#2509)
Mxbonn Apr 23, 2020
4cfc0a9
Use mmcv Registry (#2511)
xvjiarui Apr 23, 2020
cd4e716
add dilation to conv_offset (#2507)
vanpersie32 Apr 24, 2020
2e802ce
Add documentation (#2432)
ZwwWayne Apr 24, 2020
e5921ca
Fix pytorch1.5 compile error (#2524)
yhcao6 Apr 24, 2020
d8c1f68
Change to use F-string (#2531)
ZwwWayne Apr 25, 2020
d522281
Add Scripts for Regression benchmark (#2516)
ZwwWayne Apr 25, 2020
23edb95
Fix f-string bugs and ga_rpn_head bug (#2543)
ZwwWayne Apr 26, 2020
e53dfff
Fix bugs in mask structure (#2540)
ZwwWayne Apr 26, 2020
c40cafb
consummating xml_style.py (#2457)
yuzhj Apr 26, 2020
415970e
more consistent assigner (#2536)
Johnson-Wang Apr 27, 2020
937d57e
Add doc for config (#2538)
xvjiarui Apr 28, 2020
be15b0c
rm bboxes[:,:4] (#2550)
ZwwWayne Apr 28, 2020
8d7c832
Use torch.bool rather than torch.uint8 after deprecate pytorch < 1.3 …
ZwwWayne Apr 28, 2020
d63c840
fix unmap (#2560)
yhcao6 Apr 29, 2020
7dbee18
enable self-defined OptimizerHook (#2500)
z-bingo Apr 29, 2020
e8117f0
Add option to save the result images of running tools/test (#2414)
daavoo Apr 29, 2020
4a59d1f
Fix fstring in print_map_summary (#2564)
Mxbonn Apr 29, 2020
717cbd3
Fix iou loss shape (#2552)
xvjiarui Apr 29, 2020
e07b344
Add scripts to convert v1.x models to v2.0 (#2529)
ZwwWayne Apr 29, 2020
0cf8a42
Merge branch 'master' of github.com:open-mmlab/mmdetection into v2.0
ZwwWayne Apr 30, 2020
1c353b4
Merge pull request #2568 from ZwwWayne/v2.0
hellock Apr 30, 2020
fdc0c6d
change register_module to func (#2569)
xvjiarui Apr 30, 2020
c55e53b
Momentum updater hook (#2571)
daavoo Apr 30, 2020
1ebc2f3
Implement FSAF on V2.0 (#2521)
Johnson-Wang May 1, 2020
2bed0f5
Add tutorials for V2.0 (#2435)
ZwwWayne May 1, 2020
672fd5d
Fix ATSS warning on dist.ReduceOp (#2576)
ZwwWayne May 1, 2020
482fcfa
Add configs and benchmarks. (#2446)
yhcao6 May 1, 2020
6080d9a
typo fix for docs and add requirements (#2577)
hellock May 1, 2020
e74155b
fixed cityscapes eval (#2578)
xvjiarui May 1, 2020
da1cf65
Add fsaf into regression benchmark (#2581)
ZwwWayne May 2, 2020
b051fff
update cityscapes model/log link (#2585)
xvjiarui May 2, 2020
5a0e55a
Migrate to mmcv.cnn.bricks (#2572)
xvjiarui May 2, 2020
37c7313
unset use_torchvison when aligned=True (#2592)
xvjiarui May 3, 2020
95e753e
install ninjia in ci (#2588)
yhcao6 May 3, 2020
03e1325
Fix loss_bbox in fovea_head.py when num_pos=0 (#2548)
anurag1paul May 3, 2020
5a0e2ed
Update v2.0 docs (#2590)
hellock May 3, 2020
d215aa2
fix torch.nonzero usage in pytorch 1.5 (#2602)
yhcao6 May 4, 2020
f2f744a
fixed webcam demo (#2596)
xvjiarui May 4, 2020
7ee9b8e
add a demo to inference a single image (#2605)
hellock May 4, 2020
bb67350
Enrich V2.0 dataset tutorial (#2595)
ZwwWayne May 4, 2020
b9a81b0
Add gradient clip back in cfgs (#2608)
ZwwWayne May 4, 2020
8a9bc1c
migrate to mmcv get_logger and print_log (#2609)
xvjiarui May 4, 2020
af7da7b
Added FSAFHead Test and supported FSAFHead when there is zero-gt (#2603)
Johnson-Wang May 4, 2020
1553e18
Fix config files (#2591)
xvjiarui May 4, 2020
2d035d0
Add score threshold (#2601)
igonro May 5, 2020
4f4c04f
Move shared_heads, mask_heads, bbox_heads under roi_heads (#2616)
xvjiarui May 5, 2020
0f33c08
release the last version of v1.x (#2617)
hellock May 5, 2020
09a5f71
Merge master
ZwwWayne May 5, 2020
8f5774d
Merge pull request #2618 from ZwwWayne/v2.0
hellock May 5, 2020
0cf70c2
Add API documentation (#2610)
hellock May 5, 2020
40d5381
Add v2.0 changelog (#2599)
hellock May 5, 2020
94233d4
Fix the docs (#2621)
hellock May 5, 2020
b62ed85
Add compare table (#2620)
yhcao6 May 6, 2020
48bc4ef
Update dockerfile (#2623)
hellock May 6, 2020
99c879d
Add print_config tool (#2624)
xvjiarui May 6, 2020
3b53fe1
Add python path in scripts (#2625)
ZwwWayne May 6, 2020
b5fd4fd
Rename anchor_heads to dense_heads (#2628)
xvjiarui May 6, 2020
88d042a
Merge pull request #2619 from open-mmlab/v2.0
hellock May 6, 2020
5035022
typo in model zoo (#2630)
hiyyg May 6, 2020
c77ccbb
fix docstring styles (#2634)
hellock May 6, 2020
6603790
1. fixed the small bug that model_zoo url is inaccessible (#2641)
Johnson-Wang May 7, 2020
2d8bfea
spelling miss (#2647)
tinunkai May 8, 2020
2d844a8
Fix validate default (#2651)
ZwwWayne May 8, 2020
0fab4b4
Allow different x and y strides in anchor heads. (#2629)
Mxbonn May 9, 2020
6236b70
Close multiprocessing Pool (#2671)
Mxbonn May 10, 2020
f6db3a1
fix a warning in pytorch 1.5 (#2673)
hellock May 10, 2020
bce9682
add iou models (#2666)
xvjiarui May 10, 2020
3c021b1
Add colab demo for inference
hellock May 10, 2020
93de55a
fix bug. use f-string format (#2681)
bailiqun May 11, 2020
514a644
Make FSAF loss more robust to no gt (#2680)
Johnson-Wang May 11, 2020
ba58dda
compute pure inference time instead (#2657)
yhcao6 May 12, 2020
c802b17
Avoided the possibility that a patch with 0 area is cropped. (#2704)
Johnson-Wang May 13, 2020
f64acfa
Add warnings about imgs_per_gpu (#2700)
ZwwWayne May 13, 2020
43759df
Add benchmark gathering scripts (#2676)
ZwwWayne May 13, 2020
e55b288
Add a mask rcnn example for config (#2645)
ZwwWayne May 13, 2020
0162204
Support class agnostic nms (#2553)
Mxbonn May 13, 2020
b0d845f
added missing cython to docker file (#2713)
aboettcher May 14, 2020
72de487
Command usage of Image and Webcam demo were wrong. (#2718)
deepaksinghcv May 14, 2020
d0f71b2
Typo in command usage for cityscapes conversion (#2719)
deepaksinghcv May 14, 2020
502c551
adds note to remove build folder when rebuilding (#2714)
grayson-hilliard May 15, 2020
a9622c6
Add links in docs (#2735)
ZwwWayne May 18, 2020
2064492
Change to mmcv-nightly (#2742)
xvjiarui May 18, 2020
347618a
Fix bug in nms cpu implementation (#2754)
Mxbonn May 19, 2020
b20d699
Extension link (#2736)
ZwwWayne May 19, 2020
ea4ffff
Fix mask show (#2763)
yhcao6 May 19, 2020
18daa4a
Reformat project links (#2767)
ZwwWayne May 19, 2020
a9bedfb
Fix typos (#2768)
kinredon May 19, 2020
3b908f5
fixed dcn (#2775)
xvjiarui May 20, 2020
227d338
add config dump in training (#2779)
xvjiarui May 20, 2020
9be3eb0
Update inf speed (#2730)
yhcao6 May 20, 2020
f745a64
add ClassBalancedDataset (#2721)
xvjiarui May 21, 2020
6730084
add res2net backbone (#2237)
gasvn May 21, 2020
0367dd9
fix bug for coco person subset (#2793)
xinghaochen May 22, 2020
dab4ac1
Support RegNetX models (#2710)
ZwwWayne May 23, 2020
93b666d
Update model performance (#2762)
ZwwWayne May 23, 2020
e4972de
Add ori_filename to img_metas and use it in test show-dir (#2612)
daavoo May 23, 2020
60ddf55
Support Img fields during transform (#2800)
ZwwWayne May 23, 2020
f9e273b
Use mmcv.FileClient to support different storage backends (#2712)
hellock May 24, 2020
e903b5c
Code Release: Prime Sample Attention in Object Detection (CVPR 2020) …
yhcao6 May 24, 2020
50ffa24
Add upsample_cfg support in FPN (#2787)
Johnson-Wang May 24, 2020
754ec97
Implement NASFCOS (#2682)
Chrisfsj2051 May 24, 2020
9f8c002
Fix gcc requirement (#2806)
yhcao6 May 24, 2020
145a2d5
add 'img' as default for back compatibility (#2809)
ZwwWayne May 25, 2020
c298a0a
fix the jupyter notebook demo (#2814)
hellock May 26, 2020
ba5d942
fix typo (#2819)
loveunk May 26, 2020
20dec4b
fix ssd map typo (#2821)
yhcao6 May 26, 2020
6549b30
Fix type error with albumentation (#2788)
mmeendez8 May 26, 2020
24a43d5
fix async test (#2820)
yhcao6 May 27, 2020
f0ec12d
fix show bug (#2824)
yhcao6 May 27, 2020
b9daf23
Fix configs (#2828)
ZwwWayne May 27, 2020
d9c8f14
Update model_zoo url (#2832)
xvjiarui May 28, 2020
51bbe2d
added sleep(2) in test.py (#2847)
Johnson-Wang May 30, 2020
29f3617
fixed nms build warning (#2846)
liaopeiyuan May 30, 2020
55a4023
Fix bug in test time aug (#2858)
ZwwWayne May 31, 2020
61dfc43
Fix typo (#2859)
mdv3101 Jun 1, 2020
5af7711
Add procedure to remove compiled shared objects (#2860)
TonyLianLong Jun 1, 2020
b6b80a0
update some models (#2866)
yhcao6 Jun 1, 2020
58c55a9
fix fcos readme typo (#2869)
yhcao6 Jun 1, 2020
de7917d
Add cls weight in CrossEntropyLoss (#2797)
ZwwWayne Jun 1, 2020
1c3f6ee
Add more models (#2876)
ZwwWayne Jun 2, 2020
fb9efc2
fix a typo in comment of apis/train (#2877)
ZhiyuanChen Jun 2, 2020
a59f274
Update model links (#2879)
ZwwWayne Jun 2, 2020
e180ed1
support c10::half in CARAFE (#2890)
myownskyW7 Jun 4, 2020
cc4b2d4
Update project links (#2895)
ZwwWayne Jun 4, 2020
e05e858
Update README.md (#2902)
liaopeiyuan Jun 4, 2020
206107e
Fixed bugs in transform.py (#2810)
Johnson-Wang Jun 5, 2020
8fc0542
add lvis support (#2088)
xvjiarui Jun 5, 2020
a84eb7c
Fix base_channels of regnet (#2917)
ZwwWayne Jun 6, 2020
ffeb3af
add dcn offset doc (#2918)
xvjiarui Jun 6, 2020
7788eee
init for detectors based on mmdet-v2
joe-siyuan-qiao Jun 6, 2020
e32f6d5
Fix typos in README.md
joe-siyuan-qiao Jun 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
121 changes: 121 additions & 0 deletions .dev_scripts/benchmark_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import argparse
import os
import os.path as osp

import mmcv


def parse_args():
parser = argparse.ArgumentParser(description='Filter configs to train')
parser.add_argument(
'--basic-arch',
action='store_true',
help='to train models in basic arch')
parser.add_argument(
'--datasets', action='store_true', help='to train models in dataset')
parser.add_argument(
'--data-pipeline',
action='store_true',
help='to train models related to data pipeline, e.g. augmentations')
parser.add_argument(
'--nn-module',
action='store_true',
help='to train models related to neural network modules')

args = parser.parse_args()
return args


basic_arch_root = [
'cascade_rcnn', 'double_heads', 'fcos', 'foveabox', 'free_anchor',
'grid_rcnn', 'guided_anchoring', 'htc', 'libra_rcnn', 'atss', 'mask_rcnn',
'ms_rcnn', 'nas_fpn', 'reppoints', 'retinanet', 'ssd', 'gn', 'ghm', 'fsaf'
]

datasets_root = ['wider_face', 'pascal_voc', 'cityscapes', 'mask_rcnn']

data_pipeline_root = [
'albu_example', 'instaboost', 'ssd', 'mask_rcnn', 'nas_fpn'
]

nn_module_root = [
'carafe', 'dcn', 'empirical_attention', 'gcnet', 'gn+ws', 'hrnet', 'pafpn',
'nas_fpn'
]

benchmark_pool = [
'configs/cityscapes/mask_rcnn_r50_fpn_1x_cityscapes.py',
'configs/htc/htc_r50_fpn_1x_coco.py',
'ghm/retinanet_ghm_r50_fpn_1x_coco.py',
'configs/carafe/mask_rcnn_r50_fpn_carafe_1x_coco.py',
'configs/grid_rcnn/grid_rcnn_r50_fpn_gn-head_2x_coco.py',
'configs/albu_example/mask_rcnn_r50_fpn_albu_1x_coco.py',
'configs/rpn/rpn_r50_fpn_1x_coco.py',
'configs/dcn/mask_rcnn_r50_fpn_mdconv_c3-c5_1x_coco.py',
'configs/dcn/faster_rcnn_r50_fpn_dpool_1x_coco.py',
'configs/dcn/faster_rcnn_r50_fpn_mdpool_1x_coco.py',
'configs/dcn/mask_rcnn_r50_fpn_dconv_c3-c5_1x_coco.py',
'configs/libra_rcnn/libra_faster_rcnn_r50_fpn_1x_coco.py',
'configs/double_heads/dh_faster_rcnn_r50_fpn_1x_coco.py',
'configs/instaboost/mask_rcnn_r50_fpn_instaboost_4x_coco.py',
'configs/retinanet/retinanet_r50_caffe_fpn_1x_coco.py',
'configs/ssd/ssd300_coco.py',
'configs/faster_rcnn/faster_rcnn_r50_fpn_ohem_1x_coco.py',
'configs/faster_rcnn/faster_rcnn_r50_caffe_fpn_1x_coco.py',
'configs/empirical_attention/faster_rcnn_r50_fpn_attention_1111_dcn_1x_coco.py', # noqa
'configs/reppoints/reppoints_moment_r50_fpn_gn-neck+head_1x_coco.py',
'configs/guided_anchoring/ga_faster_r50_caffe_fpn_1x_coco.py',
'configs/free_anchor/retinanet_free_anchor_r50_fpn_1x_coco.py',
'configs/fsaf/fsaf_r50_fpn_1x_coco.py',
'configs/scratch/mask_rcnn_r50_fpn_gn-all_scratch_6x_coco.py',
'configs/pafpn/faster_rcnn_r50_pafpn_1x_coco.py',
'configs/fp16/retinanet_r50_fpn_fp16_1x_coco.py',
'configs/fp16/mask_rcnn_r50_fpn_fp16_1x_coco.py',
'configs/cascade_rcnn/cascade_mask_rcnn_r50_fpn_1x_coco.py',
'configs/gcnet/mask_rcnn_r50_fpn_r4_gcb_c3-c5_1x_coco.py',
'configs/wider_face/ssd300_wider_face.py',
'configs/gn/mask_rcnn_r50_fpn_gn-all_2x_coco.py',
'configs/fcos/fcos_center_r50_caffe_fpn_gn-head_4x4_1x_coco.py',
'configs/atss/atss_r50_fpn_1x_coco.py',
'configs/hrnet/mask_rcnn_hrnetv2p_w18_1x_coco.py',
'configs/ms_rcnn/ms_rcnn_r50_caffe_fpn_1x_coco.py',
'configs/foveabox/fovea_align_r50_fpn_gn-head_4x4_2x_coco.py',
'configs/pascal_voc/faster_rcnn_r50_fpn_1x_voc0712.py',
'configs/pascal_voc/ssd300_voc0712.py',
'configs/nas_fpn/retinanet_r50_nasfpn_crop640_50e_coco.py',
'configs/mask_rcnn/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_coco.py',
'configs/gn+ws/mask_rcnn_r50_fpn_gn_ws-all_2x_coco.py'
]


def main():
args = parse_args()

benchmark_type = []
if args.basic_arch:
benchmark_type += basic_arch_root
if args.datasets:
benchmark_type += datasets_root
if args.data_pipeline:
benchmark_type += data_pipeline_root
if args.nn_module:
benchmark_type += nn_module_root

config_dpath = 'configs/'
benchmark_configs = []
for cfg_root in benchmark_type:
cfg_dir = osp.join(config_dpath, cfg_root)
configs = os.scandir(cfg_dir)
for cfg in configs:
config_path = osp.join(cfg_dir, cfg.name)
if (config_path in benchmark_pool
and config_path not in benchmark_configs):
benchmark_configs.append(config_path)

print(f'Totally found {len(benchmark_configs)} configs to benchmark')
config_dicts = dict(models=benchmark_configs)
mmcv.dump(config_dicts, 'regression_test_configs.json')


if __name__ == '__main__':
main()
170 changes: 170 additions & 0 deletions .dev_scripts/gather_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
import argparse
import glob
import json
import os.path as osp
import shutil
import subprocess

import mmcv
import torch

# build schedule look-up table to automatically find the final model
SCHEDULES_LUT = {
'1x': 12,
'2x': 24,
'20e': 20,
'3x': 36,
'4x': 48,
'24e': 24,
'6x': 73
}
RESULTS_LUT = ['bbox_mAP', 'segm_mAP']


def process_checkpoint(in_file, out_file):
checkpoint = torch.load(in_file, map_location='cpu')
# remove optimizer for smaller file size
if 'optimizer' in checkpoint:
del checkpoint['optimizer']
# if it is necessary to remove some sensitive data in checkpoint['meta'],
# add the code here.
torch.save(checkpoint, out_file)
sha = subprocess.check_output(['sha256sum', out_file]).decode()
final_file = out_file.rstrip('.pth') + '-{}.pth'.format(sha[:8])
subprocess.Popen(['mv', out_file, final_file])
return final_file


def get_final_epoch(config):
if config.find('grid_rcnn') != -1 and config.find('2x') != -1:
# grid_rcnn 2x trains 25 epochs
return 25

for schedule_name, epoch_num in SCHEDULES_LUT.items():
if config.find(schedule_name) != -1:
return epoch_num


def get_final_results(log_json_path, epoch):
result_dict = dict()
with open(log_json_path, 'r') as f:
for line in f.readlines():
log_line = json.loads(line)
if 'mode' not in log_line.keys():
continue

if log_line['mode'] == 'train' and log_line['epoch'] == epoch:
result_dict['memory'] = log_line['memory']

if log_line['mode'] == 'val' and log_line['epoch'] == epoch:
result_dict.update({
key: log_line[key]
for key in RESULTS_LUT if key in log_line
})
return result_dict


def parse_args():
parser = argparse.ArgumentParser(description='Gather benchmarked models')
parser.add_argument(
'root',
type=str,
help='root path of benchmarked models to be gathered')
parser.add_argument(
'out', type=str, help='output path of gathered models to be stored')

args = parser.parse_args()
return args


def main():
args = parse_args()
models_root = args.root
models_out = args.out
mmcv.mkdir_or_exist(models_out)

# find all models in the root directory to be gathered
raw_configs = list(mmcv.scandir('./configs', '.py', recursive=True))

# filter configs that is not trained in the experiments dir
used_configs = []
for raw_config in raw_configs:
if osp.exists(osp.join(models_root, raw_config)):
used_configs.append(raw_config)
print(f'Find {len(used_configs)} models to be gathered')

# find final_ckpt and log file for trained each config
# and parse the best performance
model_infos = []
for used_config in used_configs:
exp_dir = osp.join(models_root, used_config)
# check whether the exps is finished
final_epoch = get_final_epoch(used_config)
final_model = 'epoch_{}.pth'.format(final_epoch)
model_path = osp.join(exp_dir, final_model)

# skip if the model is still training
if not osp.exists(model_path):
continue

# get logs
log_json_path = glob.glob(osp.join(exp_dir, '*.log.json'))[0]
log_txt_path = glob.glob(osp.join(exp_dir, '*.log'))[0]
model_performance = get_final_results(log_json_path, final_epoch)

if model_performance is None:
continue

model_time = osp.split(log_txt_path)[-1].split('.')[0]
model_infos.append(
dict(
config=used_config,
results=model_performance,
epochs=final_epoch,
model_time=model_time,
log_json_path=osp.split(log_json_path)[-1]))

# publish model for each checkpoint
publish_model_infos = []
for model in model_infos:
model_publish_dir = osp.join(models_out, model['config'].rstrip('.py'))
mmcv.mkdir_or_exist(model_publish_dir)

model_name = osp.split(model['config'])[-1].split('.')[0]

model_name += '_' + model['model_time']
publish_model_path = osp.join(model_publish_dir, model_name)
trained_model_path = osp.join(models_root, model['config'],
'epoch_{}.pth'.format(model['epochs']))

# convert model
final_model_path = process_checkpoint(trained_model_path,
publish_model_path)

# copy log
shutil.copy(
osp.join(models_root, model['config'], model['log_json_path']),
osp.join(model_publish_dir, f'{model_name}.log.json'))
shutil.copy(
osp.join(models_root, model['config'],
model['log_json_path'].rstrip('.json')),
osp.join(model_publish_dir, f'{model_name}.log'))

# copy config to guarantee reproducibility
config_path = model['config']
config_path = osp.join(
'configs',
config_path) if 'configs' not in config_path else config_path
target_cconfig_path = osp.split(config_path)[-1]
shutil.copy(config_path,
osp.join(model_publish_dir, target_cconfig_path))

model['model_path'] = final_model_path
publish_model_infos.append(model)

models = dict(models=publish_model_infos)
mmcv.dump(models, osp.join(models_out, 'model_info.json'))


if __name__ == '__main__':
main()
3 changes: 3 additions & 0 deletions .dev_scripts/linter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
yapf -r -i --style .style.yapf mmdet/ configs/ tests/ tools/
isort -rc mmdet/ configs/ tests/ tools/
flake8 .
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ venv.bak/
.mypy_cache/

mmdet/version.py
data
./data/
.vscode
.idea
.DS_Store

# custom
*.pkl
Expand All @@ -116,3 +117,5 @@ work_dirs/

# Pytorch
*.pth
*.py~
*.sh~
2 changes: 1 addition & 1 deletion .isort.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ line_length = 79
multi_line_output = 0
known_standard_library = setuptools
known_first_party = mmdet
known_third_party = asynctest,cityscapesscripts,cv2,matplotlib,mmcv,numpy,onnx,pycocotools,robustness_eval,roi_align,roi_pool,seaborn,six,terminaltables,torch,torchvision
known_third_party = PIL,asynctest,cityscapesscripts,cv2,matplotlib,mmcv,numpy,onnx,pycocotools,pytest,robustness_eval,roi_align,roi_pool,seaborn,six,terminaltables,torch,torchvision
no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://gitlab.com/pycqa/flake8.git
rev: 3.7.9
rev: 3.8.0
hooks:
- id: flake8
- repo: https://github.com/asottile/seed-isort-config
Expand All @@ -10,7 +10,7 @@ repos:
- repo: https://github.com/timothycrosley/isort
rev: 4.3.21
hooks:
- id: isort
- id: isort
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.29.0
hooks:
Expand All @@ -23,5 +23,6 @@ repos:
- id: end-of-file-fixer
- id: requirements-txt-fixer
- id: double-quote-string-fixer
- id: check-merge-conflict
- id: fix-encoding-pragma
args: ["--remove"]
7 changes: 7 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2

python:
version: 3.7
install:
- requirements: requirements/docs.txt
- requirements: requirements/readthedocs.txt
Loading