Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cost_pos = tf.multiply( y[:,0],tf.reduce_sum(tf.squared_difference(predictions,y),1))
- cost_neg = tf.multiply(tf.subtract(1.0,y[:,0]),tf.squared_difference(predictions[:,0],y[:,0]))
- cost = tf.reduce_mean(tf.add(cost_pos,cost_neg))
- def AP(y,y_hat):
- y_scores = y_hat[:,0]
- y_hat_bbox = y_hat[:,1:]
- y_bbox = y[:,1:]
- y_true = np.zeros(y_scores.shape[0])
- for i in range(y_true.shape[0]):
- y_true[i] = iou(get_corners(y_hat_bbox[i]), get_corners(y_bbox[i]), True)
- AP = average_precision_score(y_true = y_true, y_score = y_scores)
- return AP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement