def proposal_target_layer(self, input, classes, name):
if isinstance(input[0], tuple):
input[0] = input[0][0]
with tf.variable_scope(name) as scope:
# inputs: 'rpn_rois','gt_boxes', 'gt_ishard', 'dontcare_areas'
rois,labels,bbox_targets,bbox_inside_weights,bbox_outside_weights \
= tf.py_func(proposal_target_layer_py,
[input[0],input[1],input[2],input[3],classes],
[tf.float32,tf.float32,tf.float32,tf.float32,tf.float32])
# rois <- (1 x H x W x A, 5) e.g. [0, x1, y1, x2, y2]
# rois = tf.convert_to_tensor(rois, name='rois')
rois = tf.reshape(rois, [-1, 5], name='rois') # goes to roi_pooling
labels = tf.convert_to_tensor(tf.cast(labels,tf.int32), name = 'labels') # goes to FRCNN loss
bbox_targets = tf.convert_to_tensor(bbox_targets, name = 'bbox_targets') # goes to FRCNN loss
bbox_inside_weights = tf.convert_to_tensor(bbox_inside_weights, name = 'bbox_inside_weights')
bbox_outside_weights = tf.convert_to_tensor(bbox_outside_weights, name = 'bbox_outside_weights')
self.layers['rois'] = rois
return rois, labels, bbox_targets, bbox_inside_weights, bbox_outside_weights
评论列表
文章目录