Skip to content
Permalink
Browse files

update

  • Loading branch information...
qijiezhao committed Feb 28, 2019
1 parent dec9ba7 commit ade4f3d12979800c367bf1e46d2e316e73a87514
Showing with 40,842 additions and 0 deletions.
  1. BIN .DS_Store
  2. BIN configs/.DS_Store
  3. +161 −0 configs/CC.py
  4. BIN configs/__pycache__/CC.cpython-36.pyc
  5. BIN configs/__pycache__/default_settings.cpython-36.pyc
  6. BIN configs/__pycache__/m2det320_resnet101.cpython-36.pyc
  7. BIN configs/__pycache__/m2det320_vgg.cpython-36.pyc
  8. BIN configs/__pycache__/m2det512_vgg.cpython-36.pyc
  9. BIN configs/__pycache__/m2det704_vgg.cpython-36.pyc
  10. BIN configs/__pycache__/m2det800_vgg.cpython-36.pyc
  11. +29 −0 configs/default_settings.py
  12. +77 −0 configs/m2det320_resnet101.py
  13. +77 −0 configs/m2det320_vgg.py
  14. +77 −0 configs/m2det512_vgg.py
  15. +78 −0 configs/m2det704_vgg.py
  16. +77 −0 configs/m2det800_vgg.py
  17. BIN data/.DS_Store
  18. +5 −0 data/__init__.py
  19. BIN data/__pycache__/__init__.cpython-36.pyc
  20. BIN data/__pycache__/anchors.cpython-36.pyc
  21. BIN data/__pycache__/coco.cpython-36.pyc
  22. BIN data/__pycache__/data_augment.cpython-36.pyc
  23. BIN data/__pycache__/voc0712.cpython-36.pyc
  24. BIN data/__pycache__/voc_eval.cpython-36.pyc
  25. +45 −0 data/anchors.py
  26. +288 −0 data/coco.py
  27. +80 −0 data/coco_labels.txt
  28. +246 −0 data/data_augment.py
  29. +353 −0 data/voc0712.py
  30. +204 −0 data/voc_eval.py
  31. +122 −0 demo.py
  32. BIN imgs/COCO_train2014_000000000659.jpg
  33. BIN imgs/COCO_train2014_000000000659_m2det.jpg
  34. BIN imgs/COCO_train2014_000000000925.jpg
  35. BIN imgs/COCO_train2014_000000002389.jpg
  36. BIN imgs/COCO_train2014_000000002742.jpg
  37. BIN imgs/COCO_val2014_000000002154.jpg
  38. BIN imgs/COCO_val2014_000000005205.jpg
  39. BIN imgs/COCO_val2014_000000005617.jpg
  40. BIN imgs/COCO_val2014_000000006019.jpg
  41. BIN imgs/cmp.png
  42. BIN imgs/rank.png
  43. BIN imgs/ss2.jpg
  44. BIN imgs/ss3.jpg
  45. BIN imgs/{ → vis}/acv.png
  46. BIN imgs/vis/eval_result.png
  47. BIN imgs/{ → vis}/ffmv1.png
  48. BIN imgs/{ → vis}/ffmv2.png
  49. BIN imgs/{ → vis}/m2det.png
  50. BIN imgs/{ → vis}/mlfpn.png
  51. BIN imgs/{ → vis}/motivation.png
  52. BIN imgs/{ → vis}/sfam.png
  53. BIN imgs/{ → vis}/tums.png
  54. BIN layers/.DS_Store
  55. +2 −0 layers/__init__.py
  56. BIN layers/__pycache__/__init__.cpython-36.pyc
  57. BIN layers/__pycache__/nn_utils.cpython-36.pyc
  58. BIN layers/__pycache__/resnet.cpython-36.pyc
  59. BIN layers/__pycache__/senet.cpython-36.pyc
  60. BIN layers/functions/.DS_Store
  61. +5 −0 layers/functions/__init__.py
  62. BIN layers/functions/__pycache__/__init__.cpython-36.pyc
  63. BIN layers/functions/__pycache__/detection.cpython-36.pyc
  64. BIN layers/functions/__pycache__/prior_box.cpython-36.pyc
  65. +63 −0 layers/functions/detection.py
  66. +58 −0 layers/functions/prior_box.py
  67. BIN layers/modules/.DS_Store
  68. +3 −0 layers/modules/__init__.py
  69. BIN layers/modules/__pycache__/__init__.cpython-36.pyc
  70. BIN layers/modules/__pycache__/multibox_loss.cpython-36.pyc
  71. +115 −0 layers/modules/multibox_loss.py
  72. +187 −0 layers/nn_utils.py
  73. +208 −0 layers/resnet.py
  74. +441 −0 layers/senet.py
  75. +71 −0 logger.py
  76. +194 −0 m2det.py
  77. +8 −0 make.sh
  78. +100 −0 test.py
  79. +98 −0 train.py
  80. BIN utils/.DS_Store
  81. BIN utils/.core.py.swp
  82. 0 utils/__init__.py
  83. BIN utils/__pycache__/__init__.cpython-36.pyc
  84. BIN utils/__pycache__/box_utils.cpython-36.pyc
  85. BIN utils/__pycache__/core.cpython-36.pyc
  86. BIN utils/__pycache__/nms_wrapper.cpython-36.pyc
  87. BIN utils/__pycache__/timer.cpython-36.pyc
  88. +298 −0 utils/box_utils.py
  89. +152 −0 utils/build.py
  90. +167 −0 utils/core.py
  91. BIN utils/nms/.DS_Store
  92. 0 utils/nms/__init__.py
  93. BIN utils/nms/__pycache__/__init__.cpython-36.pyc
  94. +10,581 −0 utils/nms/cpu_nms.c
  95. +163 −0 utils/nms/cpu_nms.pyx
  96. +7,901 −0 utils/nms/gpu_nms.cpp
  97. +2 −0 utils/nms/gpu_nms.hpp
  98. +31 −0 utils/nms/gpu_nms.pyx
  99. +144 −0 utils/nms/nms_kernel.cu
  100. +38 −0 utils/nms/py_cpu_nms.py
  101. +31 −0 utils/nms_wrapper.py
  102. BIN utils/pycocotools/.DS_Store
  103. +1 −0 utils/pycocotools/__init__.py
  104. BIN utils/pycocotools/__pycache__/__init__.cpython-36.pyc
  105. BIN utils/pycocotools/__pycache__/coco.cpython-36.pyc
  106. BIN utils/pycocotools/__pycache__/cocoeval.cpython-36.pyc
  107. BIN utils/pycocotools/__pycache__/mask.cpython-36.pyc
  108. +16,163 −0 utils/pycocotools/_mask.c
  109. +308 −0 utils/pycocotools/_mask.pyx
  110. +428 −0 utils/pycocotools/coco.py
  111. +528 −0 utils/pycocotools/cocoeval.py
  112. +104 −0 utils/pycocotools/mask.py
  113. +230 −0 utils/pycocotools/maskApi.c
  114. +60 −0 utils/pycocotools/maskApi.h
  115. +40 −0 utils/timer.py
BIN +10 KB (220%) .DS_Store
Binary file not shown.
BIN +6 KB configs/.DS_Store
Binary file not shown.
@@ -0,0 +1,161 @@
import os.path as osp
import sys
from argparse import ArgumentParser
from collections import Iterable
from importlib import import_module

from addict import Dict




class ConfigDict(Dict):

def __missing__(self, name):
raise KeyError(name)

def __getattr__(self, name):
try:
value = super(ConfigDict, self).__getattr__(name)
except KeyError:
ex = AttributeError("'{}' object has no attribute '{}'".format(
self.__class__.__name__, name))
except Exception as e:
ex = e
else:
return value
raise ex


def add_args(parser, cfg, prefix=''):
for k, v in cfg.items():
if isinstance(v, str):
parser.add_argument('--' + prefix + k)
elif isinstance(v, int):
parser.add_argument('--' + prefix + k, type=int)
elif isinstance(v, float):
parser.add_argument('--' + prefix + k, type=float)
elif isinstance(v, bool):
parser.add_argument('--' + prefix + k, action='store_true')
elif isinstance(v, dict):
add_args(parser, v, k + '.')
elif isinstance(v, Iterable):
parser.add_argument('--' + prefix + k, type=type(v[0]), nargs='+')
else:
print('connot parse key {} of type {}'.format(prefix + k, type(v)))
return parser


def check_file_exist(filename, msg_tmpl='file "{}" does not exist'):
if not osp.isfile(filename):
raise FileNotFoundError(msg_tmpl.format(filename))


class Config(object):
"""A facility for config and config files.
It supports common file formats as configs: python/json/yaml. The interface
is the same as a dict object and also allows access config values as
attributes.
Example:
>>> cfg = Config(dict(a=1, b=dict(b1=[0, 1])))
>>> cfg.a
1
>>> cfg.b
{'b1': [0, 1]}
>>> cfg.b.b1
[0, 1]
>>> cfg = Config.fromfile('tests/data/config/a.py')
>>> cfg.filename
"/home/kchen/projects/mmcv/tests/data/config/a.py"
>>> cfg.item4
'test'
>>> cfg
"Config [path: /home/kchen/projects/mmcv/tests/data/config/a.py]: "
"{'item1': [1, 2], 'item2': {'a': 0}, 'item3': True, 'item4': 'test'}"
"""

@staticmethod
def fromfile(filename):
filename = osp.abspath(osp.expanduser(filename))
check_file_exist(filename)
if filename.endswith('.py'):
module_name = osp.basename(filename)[:-3]
if '.' in module_name:
raise ValueError('Dots are not allowed in config file path.')
config_dir = osp.dirname(filename)
sys.path.insert(0, config_dir)
mod = import_module(module_name)
sys.path.pop(0)
cfg_dict = {
name: value
for name, value in mod.__dict__.items()
if not name.startswith('__')
}
elif filename.endswith(('.yaml', '.json')):
import mmcv
cfg_dict = mmcv.load(filename)
else:
raise IOError('Only py/yaml/json type are supported now!')
return Config(cfg_dict, filename=filename)

@staticmethod
def auto_argparser(description=None):
"""Generate argparser from config file automatically (experimental)
"""
partial_parser = ArgumentParser(description=description)
partial_parser.add_argument('config', help='config file path')
cfg_file = partial_parser.parse_known_args()[0].config
cfg = Config.from_file(cfg_file)
parser = ArgumentParser(description=description)
parser.add_argument('config', help='config file path')
add_args(parser, cfg)
return parser, cfg

def __init__(self, cfg_dict=None, filename=None):
if cfg_dict is None:
cfg_dict = dict()
elif not isinstance(cfg_dict, dict):
raise TypeError('cfg_dict must be a dict, but got {}'.format(
type(cfg_dict)))

super(Config, self).__setattr__('_cfg_dict', ConfigDict(cfg_dict))
super(Config, self).__setattr__('_filename', filename)
if filename:
with open(filename, 'r') as f:
super(Config, self).__setattr__('_text', f.read())
else:
super(Config, self).__setattr__('_text', '')

@property
def filename(self):
return self._filename

@property
def text(self):
return self._text

def __repr__(self):
return 'Config (path: {}): {}'.format(self.filename,
self._cfg_dict.__repr__())

def __len__(self):
return len(self._cfg_dict)

def __getattr__(self, name):
return getattr(self._cfg_dict, name)

def __getitem__(self, name):
return self._cfg_dict.__getitem__(name)

def __setattr__(self, name, value):
if isinstance(value, dict):
value = ConfigDict(value)
self._cfg_dict.__setattr__(name, value)

def __setitem__(self, name, value):
if isinstance(value, dict):
value = ConfigDict(value)
self._cfg_dict.__setitem__(name, value)

def __iter__(self):
return iter(self._cfg_dict)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,29 @@
# Only m2det_configs are supported
# For debug when configuring m2det.py file
# you can modify them in m2det_config in ./configs/m2detxxx.py

m2det_configs = dict(
vgg16 = dict(
backbone = 'vgg16',
net_family = 'vgg',
base_out = [22,34], # [22,34] for vgg, [2,4] or [3,4] for res families
planes = 256,
num_levels = 8,
num_scales = 6,
sfam = True,
smooth = True,
num_classes = 81,
),
resnet50 = dict(
backbone = 'resnet50',
net_family = 'res',
base_out = [2,4], # [22,34] for vgg, [2,4] or [3,4] for res families
planes = 256,
num_levels = 8,
num_scales = 6,
sfam = True,
smooth = True,
num_classes = 81,
)
)

@@ -0,0 +1,77 @@
model = dict(
type = 'm2det',
input_size = 320,
init_net = True,
pretrained = 'None', # res series, directly load the pretrained weights when defining them
m2det_config = dict(
backbone = 'resnet101',
net_family = 'res', # vgg includes ['vgg16','vgg19'], res includes ['resnetxxx','resnextxxx']
base_out = [2,4], # [22,34] for vgg, [2,4] or [3,4] for res families
planes = 256,
num_levels = 8,
num_scales = 6,
sfam = False,
smooth = True,
num_classes = 81,
),
rgb_means = (104, 117, 123),
p = 0.6,
anchor_config = dict(
step_pattern = [8, 16, 32, 64, 107, 320],
size_pattern = [0.08, 0.15, 0.33, 0.51, 0.69, 0.87, 1.05],
),
save_eposhs = 10,
weights_save = 'weights/'
)

train_cfg = dict(
cuda = True,
warmup = 5,
per_batch_size = 12,
lr = [0.004, 0.002, 0.0004, 0.00004, 0.000004],
gamma = 0.1,
end_lr = 1e-6,
step_lr = dict(
COCO = [90, 110, 130, 150, 160],
VOC = [100, 150, 200, 250, 300], # unsolve
),
print_epochs = 10,
num_workers= 8,
)

test_cfg = dict(
cuda = True,
topk = 0,
iou = 0.45,
soft_nms = True,
score_threshold = 0.1,
keep_per_class = 50,
save_folder = 'eval'
)

loss = dict(overlap_thresh = 0.5,
prior_for_matching = True,
bkg_label = 0,
neg_mining = True,
neg_pos = 3,
neg_overlap = 0.5,
encode_target = False)

optimizer = dict(type='SGD', momentum=0.9, weight_decay=0.0005)

dataset = dict(
VOC = dict(
train_sets = [('2007', 'trainval'), ('2012', 'trainval')],
eval_sets = [('2007', 'test')],
),
COCO = dict(
train_sets = [('2014', 'train'), ('2014', 'valminusminival')],
eval_sets = [('2014', 'minival')],
test_sets = [('2015', 'test-dev')],
)
)

import os
home = os.path.expanduser("~")
VOCroot = os.path.join(home,"data/VOCdevkit/")
COCOroot = os.path.join(home,"data/coco/")
@@ -0,0 +1,77 @@
model = dict(
type = 'm2det',
input_size = 320,
init_net = True,
pretrained = 'weights/vgg16_reducedfc.pth',
m2det_config = dict(
backbone = 'vgg16',
net_family = 'vgg', # vgg includes ['vgg16','vgg19'], res includes ['resnetxxx','resnextxxx']
base_out = [22,34], # [22,34] for vgg, [2,4] or [3,4] for res families
planes = 256,
num_levels = 8,
num_scales = 6,
sfam = False,
smooth = True,
num_classes = 81,
),
rgb_means = (104, 117, 123),
p = 0.6,
anchor_config = dict(
step_pattern = [8, 16, 32, 64, 107, 320],
size_pattern = [0.08, 0.15, 0.33, 0.51, 0.69, 0.87, 1.05],
),
save_eposhs = 10,
weights_save = 'weights/'
)

train_cfg = dict(
cuda = True,
warmup = 5,
per_batch_size = 16,
lr = [0.004, 0.002, 0.0004, 0.00004, 0.000004],
gamma = 0.1,
end_lr = 1e-6,
step_lr = dict(
COCO = [90, 110, 130, 150, 160],
VOC = [100, 150, 200, 250, 300], # unsolve
),
print_epochs = 10,
num_workers= 8,
)

test_cfg = dict(
cuda = True,
topk = 0,
iou = 0.45,
soft_nms = True,
score_threshold = 0.1,
keep_per_class = 50,
save_folder = 'eval'
)

loss = dict(overlap_thresh = 0.5,
prior_for_matching = True,
bkg_label = 0,
neg_mining = True,
neg_pos = 3,
neg_overlap = 0.5,
encode_target = False)

optimizer = dict(type='SGD', momentum=0.9, weight_decay=0.0005)

dataset = dict(
VOC = dict(
train_sets = [('2007', 'trainval'), ('2012', 'trainval')],
eval_sets = [('2007', 'test')],
),
COCO = dict(
train_sets = [('2014', 'train'), ('2014', 'valminusminival')],
eval_sets = [('2014', 'minival')],
test_sets = [('2015', 'test-dev')],
)
)

import os
home = os.path.expanduser("~")
VOCroot = os.path.join(home,"data/VOCdevkit/")
COCOroot = os.path.join(home,"data/coco/")
Oops, something went wrong.

0 comments on commit ade4f3d

Please sign in to comment.
You can’t perform that action at this time.