本文整理汇总了Python中roi_data_layer.minibatch.get_minibatch方法的典型用法代码示例。如果您正苦于以下问题:Python minibatch.get_minibatch方法的具体用法?Python minibatch.get_minibatch怎么用?Python minibatch.get_minibatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类roi_data_layer.minibatch
的用法示例。
在下文中一共展示了minibatch.get_minibatch方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _get_next_minibatch
# 需要导入模块: from roi_data_layer import minibatch [as 别名]
# 或者: from roi_data_layer.minibatch import get_minibatch [as 别名]
def _get_next_minibatch(self):
"""Return the blobs to be used for the next minibatch.
If cfg.TRAIN.USE_PREFETCH is True, then blobs will be computed in a
separate process and made available through self._blob_queue.
"""
if cfg.TRAIN.USE_PREFETCH:
return self._blob_queue.get()
else:
db_inds = self._get_next_minibatch_inds()
minibatch_db = [self._roidb[i] for i in db_inds]
if cfg.TRAIN.USE_OHEM:
blobs = get_allrois_minibatch(minibatch_db, self._num_classes)
else:
blobs = get_minibatch(minibatch_db, self._num_classes)
return blobs
示例2: __getitem__
# 需要导入模块: from roi_data_layer import minibatch [as 别名]
# 或者: from roi_data_layer.minibatch import get_minibatch [as 别名]
def __getitem__(self, index):
# get the anchor index for current sample index
# here we set the anchor index to the last one
# sample in this group
minibatch_db = [self._roidb[index]] # [self._roidb[index_ratio]]
blobs = get_minibatch(minibatch_db, self._num_classes)
np.random.shuffle(blobs['rois'])
rois = torch.from_numpy(blobs['rois'][:self.max_rois_size])
data = torch.from_numpy(blobs['data'])
labels = torch.from_numpy(blobs['labels'])
data_height, data_width = data.size(1), data.size(2)
data = data.permute(0, 3, 1, 2).contiguous().view(3, data_height, data_width)
info = torch.Tensor([rois.size(0), data_height, data_width])
return data, rois, labels, info
示例3: _get_next_minibatch
# 需要导入模块: from roi_data_layer import minibatch [as 别名]
# 或者: from roi_data_layer.minibatch import get_minibatch [as 别名]
def _get_next_minibatch(self):
"""Return the blobs to be used for the next minibatch.
If cfg.TRAIN.USE_PREFETCH is True, then blobs will be computed in a
separate process and made available through self._blob_queue.
"""
db_inds = self._get_next_minibatch_inds()
minibatch_db = [self._roidb[i] for i in db_inds]
return get_minibatch(minibatch_db, self._num_classes)
开发者ID:Sunarker,项目名称:Collaborative-Learning-for-Weakly-Supervised-Object-Detection,代码行数:11,代码来源:layer.py
示例4: _get_next_minibatch
# 需要导入模块: from roi_data_layer import minibatch [as 别名]
# 或者: from roi_data_layer.minibatch import get_minibatch [as 别名]
def _get_next_minibatch(self):
"""Return the blobs to be used for the next minibatch.
If cfg.TRAIN.USE_PREFETCH is True, then blobs will be computed in a
separate process and made available through self._blob_queue.
"""
db_inds = self._get_next_minibatch_inds()
minibatch_db = [self._roidb[i] for i in db_inds]
return get_minibatch(minibatch_db, self._num_classes)
示例5: _get_next_minibatch
# 需要导入模块: from roi_data_layer import minibatch [as 别名]
# 或者: from roi_data_layer.minibatch import get_minibatch [as 别名]
def _get_next_minibatch(self):
"""Return the blobs to be used for the next minibatch.
If cfg.TRAIN.USE_PREFETCH is True, then blobs will be computed in a
separate process and made available through self._blob_queue.
"""
if cfg.TRAIN.USE_PREFETCH:
return self._blob_queue.get()
else:
db_inds = self._get_next_minibatch_inds()
minibatch_db = [self._roidb[i] for i in db_inds]
return get_minibatch(minibatch_db, self._num_classes)
示例6: run
# 需要导入模块: from roi_data_layer import minibatch [as 别名]
# 或者: from roi_data_layer.minibatch import get_minibatch [as 别名]
def run(self):
print 'BlobFetcher started'
while True:
db_inds = self._get_next_minibatch_inds()
minibatch_db = [self._roidb[i] for i in db_inds]
blobs = get_minibatch(minibatch_db, self._num_classes)
self._queue.put(blobs)
示例7: run
# 需要导入模块: from roi_data_layer import minibatch [as 别名]
# 或者: from roi_data_layer.minibatch import get_minibatch [as 别名]
def run(self):
print 'BlobFetcher started'
while True:
db_inds = self._get_next_minibatch_inds()
minibatch_db = [self._roidb[i] for i in db_inds]
if cfg.TRAIN.USE_OHEM:
blobs = get_allrois_minibatch(minibatch_db, self._num_classes)
else:
blobs = get_minibatch(minibatch_db, self._num_classes)
self._queue.put(blobs)
示例8: _get_next_minibatch
# 需要导入模块: from roi_data_layer import minibatch [as 别名]
# 或者: from roi_data_layer.minibatch import get_minibatch [as 别名]
def _get_next_minibatch(self, db_inds):
"""Return the blobs to be used for the next minibatch.
"""
minibatch_db = [self._roidb[i] for i in db_inds]
if cfg.TRAIN.USE_RPN_DB:
minibatch_db = self.imdb.add_rpn_rois(minibatch_db)
prepare_roidb(minibatch_db)
add_bbox_regression_targets(minibatch_db, self.bbox_means,
self.bbox_stds)
blobs = get_minibatch(minibatch_db, self._num_classes)
if blobs is not None:
blobs['db_inds'] = db_inds
return blobs