本文整理匯總了Python中model.config.cfg.POOLING_MODE屬性的典型用法代碼示例。如果您正苦於以下問題:Python cfg.POOLING_MODE屬性的具體用法?Python cfg.POOLING_MODE怎麽用?Python cfg.POOLING_MODE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類model.config.cfg
的用法示例。
在下文中一共展示了cfg.POOLING_MODE屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _predict
# 需要導入模塊: from model.config import cfg [as 別名]
# 或者: from model.config.cfg import POOLING_MODE [as 別名]
def _predict(self, net_conv):
# This is just _build_network in tf-faster-rcnn
# torch.backends.cudnn.benchmark = False
# net_conv = self._image_to_head()
'''
ROI pooling on SELECTIVE SEARCH boxes
'''
if cfg.POOLING_MODE == 'crop':
pool5 = self._crop_pool_layer(net_conv, self._boxes)
else:
pool5 = self._roi_pool_layer(net_conv, self._boxes)
if self._mode == 'TRAIN':
torch.backends.cudnn.benchmark = True # benchmark because now the input size are fixed
fc7 = self._head_to_tail(pool5)
cls_prob, bbox_prob, fuse_prob, image_prob = self._region_classification(fc7)
# for k in self._predictions.keys():
# self._score_summaries[k] = self._predictions[k]
self._score_summaries['image_prob'] = self._predictions['image_prob']
#print(id(net_conv))
return fuse_prob
# return net_conv, cls_prob, bbox_prob, fuse_prob, image_prob
開發者ID:Sunarker,項目名稱:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代碼行數:28,代碼來源:network.py
示例2: _predict
# 需要導入模塊: from model.config import cfg [as 別名]
# 或者: from model.config.cfg import POOLING_MODE [as 別名]
def _predict(self):
# This is just _build_network in tf-faster-rcnn
torch.backends.cudnn.benchmark = False
net_conv = self._image_to_head()
# build the anchors for the image
if cfg.FPN:
self._anchor_component_fpn(net_conv)
rois = self._region_proposal_fpn(net_conv)
pool5 = self._crop_pool_layer_fpn(net_conv, rois)
pool5 = pool5.view(pool5.size(0),-1)
else:
self._anchor_component(net_conv.size(2), net_conv.size(3))
rois = self._region_proposal(net_conv)
if cfg.POOLING_MODE == 'crop':
pool5 = self._crop_pool_layer(net_conv, rois)
else:
pool5 = self._roi_pool_layer(net_conv, rois)
if self._mode == 'TRAIN':
torch.backends.cudnn.benchmark = True # benchmark because now the input size are fixed
fc7 = self._head_to_tail(pool5)
cls_prob, bbox_pred = self._region_classification(fc7)
for k in self._predictions.keys():
self._score_summaries[k] = self._predictions[k]
return rois, cls_prob, bbox_pred
示例3: _build_network
# 需要導入模塊: from model.config import cfg [as 別名]
# 或者: from model.config.cfg import POOLING_MODE [as 別名]
def _build_network(self, is_training=True):
# select initializers
if cfg.TRAIN.TRUNCATED:
initializer = tf.truncated_normal_initializer(mean=0.0, stddev=0.01)
initializer_bbox = tf.truncated_normal_initializer(mean=0.0, stddev=0.001)
else:
initializer = tf.random_normal_initializer(mean=0.0, stddev=0.01)
initializer_bbox = tf.random_normal_initializer(mean=0.0, stddev=0.001)
net_conv = self._image_to_head(is_training)
with tf.variable_scope(self._scope, self._scope):
# build the anchors for the image
self._anchor_component()
# region proposal network
rois = self._region_proposal(net_conv, is_training, initializer)
# region of interest pooling
if cfg.POOLING_MODE == 'crop':
pool5 = self._crop_pool_layer(net_conv, rois, "pool5")
else:
raise NotImplementedError
fc7 = self._head_to_tail(pool5, is_training)
with tf.variable_scope(self._scope, self._scope):
# region classification
cls_prob, bbox_pred = self._region_classification(fc7, is_training,
initializer, initializer_bbox)
self._score_summaries.update(self._predictions)
return rois, cls_prob, bbox_pred