本文整理匯總了Python中model.utils.config.cfg.MAX_NUM_GT_BOXES屬性的典型用法代碼示例。如果您正苦於以下問題:Python cfg.MAX_NUM_GT_BOXES屬性的具體用法?Python cfg.MAX_NUM_GT_BOXES怎麽用?Python cfg.MAX_NUM_GT_BOXES使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類model.utils.config.cfg
的用法示例。
在下文中一共展示了cfg.MAX_NUM_GT_BOXES屬性的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
self.ratio_list_batch[left_idx:(right_idx+1)] = target_ratio
示例2: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.batch_size = batch_size
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.data_size = len(self.ratio_list)
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
self.ratio_list_batch[left_idx:(right_idx+1)] = target_ratio
示例3: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes,
training=True, normalize=None,
vis=False):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
self.vis = vis
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i * batch_size
right_idx = min((i + 1) * batch_size - 1, self.data_size - 1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1.
self.ratio_list_batch[
left_idx:(right_idx + 1)] = target_ratio.astype('float')
示例4: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
self.target_size_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
self.ratio_list_batch[left_idx:(right_idx+1)] = target_ratio
示例5: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
self.ratio_list_batch[left_idx:(right_idx+1)] = torch.tensor(target_ratio.astype(np.float64)) # trainset ratio list ,each batch is same number
示例6: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None,
shuffle=True):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
self.shuffle = shuffle
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i * batch_size
right_idx = min((i + 1) * batch_size - 1, self.data_size - 1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
self.ratio_list_batch[left_idx:(right_idx + 1)] = target_ratio
示例7: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.TRAIN.PROPOSAL_LIMIT #cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.max_image_size = cfg.TRAIN.MAX_IMAGE_SIZE
self.max_rois_size = cfg.TRAIN.MAX_ROIS_SIZE
示例8: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
# self.ratio_list_batch[left_idx:(right_idx+1)] = np.asscalar(target_ratio)
self.ratio_list_batch[left_idx:(right_idx + 1)] = target_ratio
示例9: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
target_ratio = float(target_ratio)
self.ratio_list_batch[left_idx:(right_idx+1)] = target_ratio
示例10: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None):
self._roidb = roidb
self._num_classes = num_classes
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
self.ratio_list_batch[left_idx:(right_idx+1)] = target_ratio
示例11: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, batch_size, num_classes, training=True, normalize=None,seg_return=False,path_return=False):
self._roidb = roidb
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.ratio_index = ratio_index
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
self.seg_return = seg_return
self.path_return = path_return
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
self.ratio_list_batch[left_idx:(right_idx+1)] = target_ratio
示例12: __init__
# 需要導入模塊: from model.utils.config import cfg [as 別名]
# 或者: from model.utils.config.cfg import MAX_NUM_GT_BOXES [as 別名]
def __init__(self, roidb, ratio_list, ratio_index, query, batch_size, num_classes, training=True, normalize=None, seen=True):
self._roidb = roidb
self._query = query
self._num_classes = num_classes
# we make the height of image consistent to trim_height, trim_width
self.trim_height = cfg.TRAIN.TRIM_HEIGHT
self.trim_width = cfg.TRAIN.TRIM_WIDTH
self.max_num_box = cfg.MAX_NUM_GT_BOXES
self.training = training
self.normalize = normalize
self.ratio_list = ratio_list
self.query_position = 0
if training:
self.ratio_index = ratio_index
else:
self.cat_list = ratio_index[1]
self.ratio_index = ratio_index[0]
self.batch_size = batch_size
self.data_size = len(self.ratio_list)
# given the ratio_list, we want to make the ratio same for each batch.
self.ratio_list_batch = torch.Tensor(self.data_size).zero_()
num_batch = int(np.ceil(len(ratio_index) / batch_size))
if self.training:
for i in range(num_batch):
left_idx = i*batch_size
right_idx = min((i+1)*batch_size-1, self.data_size-1)
if ratio_list[right_idx] < 1:
# for ratio < 1, we preserve the leftmost in each batch.
target_ratio = ratio_list[left_idx]
elif ratio_list[left_idx] > 1:
# for ratio > 1, we preserve the rightmost in each batch.
target_ratio = ratio_list[right_idx]
else:
# for ratio cross 1, we make it to be 1.
target_ratio = 1
self.ratio_list_batch[left_idx:(right_idx+1)] = target_ratio
self._cat_ids = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 27, 28, 31, 32, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 67, 70,
72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
82, 84, 85, 86, 87, 88, 89, 90
]
self._classes = {
ind + 1: cat_id for ind, cat_id in enumerate(self._cat_ids)
}
self._classes_inv = {
value: key for key, value in self._classes.items()
}
self.filter(seen)
self.probability()