Skip to content

Commit

Permalink
Merge e542884 into 48374f5
Browse files Browse the repository at this point in the history
  • Loading branch information
kmaehashi committed Apr 16, 2018
2 parents 48374f5 + e542884 commit 4af405b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
10 changes: 8 additions & 2 deletions chainer/links/model/vision/googlenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def convert_caffemodel_to_npz(cls, path_caffemodel, path_npz):
_transfer_googlenet(caffemodel, chainermodel)
npz.save_npz(path_npz, chainermodel, compression=False)

def __call__(self, x, layers=['prob'], **kwargs):
def __call__(self, x, layers=None, **kwargs):
"""__call__(self, x, layers=['prob'])
Computes all the feature maps specified by ``layers``.
Expand All @@ -206,6 +206,9 @@ def __call__(self, x, layers=['prob'], **kwargs):
"""

if layers is None:
layers = ['prob']

argument.check_unexpected_kwargs(
kwargs, train='train argument is not supported anymore. '
'Use chainer.using_config')
Expand Down Expand Up @@ -238,7 +241,7 @@ def __call__(self, x, layers=['prob'], **kwargs):

return activations

def extract(self, images, layers=['pool5'], size=(224, 224), **kwargs):
def extract(self, images, layers=None, size=(224, 224), **kwargs):
"""extract(self, images, layers=['pool5'], size=(224, 224))
Extracts all the feature maps of given images.
Expand Down Expand Up @@ -273,6 +276,9 @@ def extract(self, images, layers=['pool5'], size=(224, 224), **kwargs):
"""

if layers is None:
layers = ['pool5']

argument.check_unexpected_kwargs(
kwargs, train='train argument is not supported anymore. '
'Use chainer.using_config',
Expand Down
10 changes: 8 additions & 2 deletions chainer/links/model/vision/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def convert_caffemodel_to_npz(cls, path_caffemodel, path_npz, n_layers=50):
' or 152, but {} was given.'.format(n_layers))
npz.save_npz(path_npz, chainermodel, compression=False)

def __call__(self, x, layers=['prob'], **kwargs):
def __call__(self, x, layers=None, **kwargs):
"""__call__(self, x, layers=['prob'])
Computes all the feature maps specified by ``layers``.
Expand All @@ -180,6 +180,9 @@ def __call__(self, x, layers=['prob'], **kwargs):
"""

if layers is None:
layers = ['prob']

argument.check_unexpected_kwargs(
kwargs, test='test argument is not supported anymore. '
'Use chainer.using_config')
Expand All @@ -198,7 +201,7 @@ def __call__(self, x, layers=['prob'], **kwargs):
target_layers.remove(key)
return activations

def extract(self, images, layers=['pool5'], size=(224, 224), **kwargs):
def extract(self, images, layers=None, size=(224, 224), **kwargs):
"""extract(self, images, layers=['pool5'], size=(224, 224))
Extracts all the feature maps of given images.
Expand Down Expand Up @@ -233,6 +236,9 @@ def extract(self, images, layers=['pool5'], size=(224, 224), **kwargs):
"""

if layers is None:
layers = ['pool5']

argument.check_unexpected_kwargs(
kwargs, test='test argument is not supported anymore. '
'Use chainer.using_config',
Expand Down
10 changes: 8 additions & 2 deletions chainer/links/model/vision/vgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def convert_caffemodel_to_npz(cls, path_caffemodel, path_npz):
caffemodel = CaffeFunction(path_caffemodel)
npz.save_npz(path_npz, caffemodel, compression=False)

def __call__(self, x, layers=['prob'], **kwargs):
def __call__(self, x, layers=None, **kwargs):
"""__call__(self, x, layers=['prob'])
Computes all the feature maps specified by ``layers``.
Expand All @@ -183,6 +183,9 @@ def __call__(self, x, layers=['prob'], **kwargs):
"""

if layers is None:
layers = ['prob']

argument.check_unexpected_kwargs(
kwargs, test='test argument is not supported anymore. '
'Use chainer.using_config')
Expand All @@ -201,7 +204,7 @@ def __call__(self, x, layers=['prob'], **kwargs):
target_layers.remove(key)
return activations

def extract(self, images, layers=['fc7'], size=(224, 224), **kwargs):
def extract(self, images, layers=None, size=(224, 224), **kwargs):
"""extract(self, images, layers=['fc7'], size=(224, 224))
Extracts all the feature maps of given images.
Expand Down Expand Up @@ -236,6 +239,9 @@ def extract(self, images, layers=['fc7'], size=(224, 224), **kwargs):
"""

if layers is None:
layers = ['fc7']

argument.check_unexpected_kwargs(
kwargs, test='test argument is not supported anymore. '
'Use chainer.using_config',
Expand Down

0 comments on commit 4af405b

Please sign in to comment.