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_P2,rois_P3,rois_P4,rois_P5,rois_P6,labels,bbox_targets,bbox_inside_weights,bbox_outside_weights,rois \
= 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,tf.float32,tf.float32,tf.float32,tf.float32,tf.float32])
# rois_Px <- (1 x H x W x A(x), 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
rois_P2 = tf.reshape(rois_P2, [-1, 5], name='rois_P2') # goes to roi_pooling
rois_P3 = tf.reshape(rois_P3, [-1, 5], name='rois_P3') # goes to roi_pooling
rois_P4 = tf.reshape(rois_P4, [-1, 5], name='rois_P4') # goes to roi_pooling
rois_P5 = tf.reshape(rois_P5, [-1, 5], name='rois_P5') # goes to roi_pooling
rois_P6 = tf.reshape(rois_P6, [-1, 5], name='rois_P6') # 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_P2, rois_P3, rois_P4, rois_P5, rois_P6, labels, bbox_targets, bbox_inside_weights, bbox_outside_weights, rois
评论列表
文章目录