76b060f625e037d479a2eb25462a3b3f70af5bb7,chainercv/links/model/faster_rcnn/faster_rcnn_vgg.py,FasterRCNNVGG16,__init__,#FasterRCNNVGG16#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#Any#,87
Before Change
loc_initialW=None, score_initialW=None,
proposal_creator_params={}
):
if n_fg_class is None:
if pretrained_model not in self._models:
raise ValueError(
"The n_fg_class needs to be supplied as an argument")
n_fg_class = self._models[pretrained_model]["n_fg_class"]
if loc_initialW is None:
loc_initialW = chainer.initializers.Normal(0.001)
if score_initialW is None:
score_initialW = chainer.initializers.Normal(0.01)
if rpn_initialW is None:
rpn_initialW = chainer.initializers.Normal(0.01)
if vgg_initialW is None and pretrained_model:
vgg_initialW = chainer.initializers.constant.Zero()
extractor = VGG16(initialW=vgg_initialW)
extractor.pick = "conv5_3"
// Delete all layers after conv5_3.
extractor.remove_unused()
rpn = RegionProposalNetwork(
512, 512,
ratios=ratios,
anchor_scales=anchor_scales,
feat_stride=self.feat_stride,
initialW=rpn_initialW,
proposal_creator_params=proposal_creator_params,
)
head = VGG16RoIHead(
n_fg_class + 1,
roi_size=7, spatial_scale=1. / self.feat_stride,
vgg_initialW=vgg_initialW,
loc_initialW=loc_initialW,
score_initialW=score_initialW
)
super(FasterRCNNVGG16, self).__init__(
extractor,
rpn,
head,
mean=np.array([122.7717, 115.9465, 102.9801],
dtype=np.float32)[:, None, None],
min_size=min_size,
max_size=max_size
)
if pretrained_model in self._models:
path = download_model(self._models[pretrained_model]["url"])
chainer.serializers.load_npz(path, self)
elif pretrained_model == "imagenet":
self._copy_imagenet_pretrained_vgg16()
elif pretrained_model:
chainer.serializers.load_npz(pretrained_model, self)
def _copy_imagenet_pretrained_vgg16(self):
pretrained_model = VGG16(pretrained_model="imagenet")
self.extractor.conv1_1.copyparams(pretrained_model.conv1_1)
self.extractor.conv1_2.copyparams(pretrained_model.conv1_2)
After Change
loc_initialW=None, score_initialW=None,
proposal_creator_params={}
):
n_fg_class, path = prepare_link_initialization(
n_fg_class, pretrained_model, self._models, True)
if loc_initialW is None:
loc_initialW = chainer.initializers.Normal(0.001)
if score_initialW is None:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 20
Instances
Project Name: chainer/chainercv
Commit Name: 76b060f625e037d479a2eb25462a3b3f70af5bb7
Time: 2018-05-01
Author: yuyuniitani@gmail.com
File Name: chainercv/links/model/faster_rcnn/faster_rcnn_vgg.py
Class Name: FasterRCNNVGG16
Method Name: __init__
Project Name: chainer/chainercv
Commit Name: 76b060f625e037d479a2eb25462a3b3f70af5bb7
Time: 2018-05-01
Author: yuyuniitani@gmail.com
File Name: chainercv/links/model/vgg/vgg16.py
Class Name: VGG16
Method Name: __init__
Project Name: chainer/chainercv
Commit Name: 76b060f625e037d479a2eb25462a3b3f70af5bb7
Time: 2018-05-01
Author: yuyuniitani@gmail.com
File Name: chainercv/experimental/links/model/fcis/fcis_resnet101.py
Class Name: FCISResNet101
Method Name: __init__