Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
d756dce0
Commit
d756dce0
authored
Dec 19, 2018
by
pangjm
Browse files
reformat checkpoint
parent
b3238191
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
15 deletions
+11
-15
mmcv/runner/checkpoint.py
mmcv/runner/checkpoint.py
+11
-15
No files found.
mmcv/runner/checkpoint.py
View file @
d756dce0
from
importlib
import
import_module
import
pkgutil
import
os.path
as
osp
import
time
from
collections
import
OrderedDict
...
...
@@ -6,18 +8,14 @@ import mmcv
import
torch
from
torch.utils
import
model_zoo
open_mmlab_model_urls
=
{
'vgg16_caffe'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/vgg16_caffe-292e1171.pth'
,
'resnet50_caffe'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/resnet50_caffe-788b5fa3.pth'
,
'resnet101_caffe'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/resnet101_caffe-3ad79236.pth'
,
'resnext101_32x4d'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/resnext101_32x4d-a5af3160.pth'
,
'resnext101_64x4d'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/resnext101_64x4d-ee2c6f71.pth'
}
'vgg16_caffe'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/vgg16_caffe-292e1171.pth'
,
'resnet50_caffe'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/resnet50_caffe-788b5fa3.pth'
,
'resnet101_caffe'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/resnet101_caffe-3ad79236.pth'
,
'resnext101_32x4d'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/resnext101_32x4d-a5af3160.pth'
,
'resnext101_64x4d'
:
'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/pretrain/third_party/resnext101_64x4d-ee2c6f71.pth'
}
# noqa: E501
def
load_state_dict
(
module
,
state_dict
,
strict
=
False
,
logger
=
None
):
...
...
@@ -94,13 +92,11 @@ def load_checkpoint(model,
# load checkpoint from modelzoo or file or url
if
filename
.
startswith
(
'modelzoo://'
):
import
torchvision
import
pkgutil
import
inspect
model_urls
=
dict
()
for
_
,
name
,
ispkg
in
pkgutil
.
walk_packages
(
torchvision
.
models
.
__path__
):
_zoo
=
getattr
(
torchvision
.
models
,
name
)
if
inspect
.
ismodule
(
_zoo
):
if
not
ispkg
:
_zoo
=
import_module
(
'torchvision.models.{}'
.
format
(
name
))
_urls
=
getattr
(
_zoo
,
'model_urls'
)
model_urls
.
update
(
_urls
)
model_name
=
filename
[
11
:]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment