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:
input_0a = input[0][:,0:5] # rpn_rois as original
input_0b = input[0][:,5:6] # orientation that corresponds to the rpn_rois
#print(input[3])
rois,labels,bbox_targets,bbox_inside_weights,bbox_outside_weights, gt_orientations_new, orientations_pred_new, \
orientations_targets_new = tf.py_func(proposal_target_layer_py,[input_0a,input[1],classes, input[2], input_0b],
[tf.float32,tf.float32,tf.float32,tf.float32,tf.float32, tf.float32, tf.float32, tf.float32])
rois_wo = tf.reshape(rois,[-1,6] , name = 'rois') # does the name 'rois' matter?
rois = rois_wo[:, 0:5]
labels = tf.convert_to_tensor(tf.cast(labels,tf.int32), name = 'labels')
bbox_targets = tf.convert_to_tensor(bbox_targets, name = 'bbox_targets')
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')
gt_orientations_new = tf.reshape(gt_orientations_new, [-1,1], name = 'gt_orientations_new') # these are the rotation angles for the predicted boxes
orientations_pred_new = tf.reshape(orientations_pred_new, [-1,1], name = 'orientations_pred_new')
orientations_targets_new = tf.reshape(orientations_targets_new, [-1, 1], name='orientations_targets_new')
return rois_wo, labels, bbox_targets, bbox_inside_weights, bbox_outside_weights, gt_orientations_new, orientations_pred_new, orientations_targets_new
评论列表
文章目录