Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. cost_pos = tf.multiply( y[:,0],tf.reduce_sum(tf.squared_difference(predictions,y),1))
  2. cost_neg = tf.multiply(tf.subtract(1.0,y[:,0]),tf.squared_difference(predictions[:,0],y[:,0]))
  3. cost = tf.reduce_mean(tf.add(cost_pos,cost_neg))
  4.  
  5. def AP(y,y_hat):
  6.  
  7. y_scores = y_hat[:,0]
  8. y_hat_bbox = y_hat[:,1:]
  9. y_bbox = y[:,1:]
  10. y_true = np.zeros(y_scores.shape[0])
  11.  
  12. for i in range(y_true.shape[0]):
  13. y_true[i] = iou(get_corners(y_hat_bbox[i]), get_corners(y_bbox[i]), True)
  14.  
  15. AP = average_precision_score(y_true = y_true, y_score = y_scores)
  16. return AP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement