#NEWLINE# def evaluate_recall( self , candidate_boxes , ar_thresh = 0.5 ) : #NEWLINE# #INDENT# gt_overlaps = np . zeros ( 0 ) #NEWLINE# for i in xrange ( self . num_images ) : #NEWLINE# #INDENT# gt_inds = np . where ( ( self . roidb [ i ] [ 'gt_classes' ] > 0 ) ) [ 0 ] #NEWLINE# gt_boxes = self . roidb [ i ] [ 'boxes' ] [ gt_inds , : ] #NEWLINE# boxes = candidate_boxes [ i ] #NEWLINE# if ( boxes . shape [ 0 ] == 0 ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# overlaps = bbox_overlaps ( boxes . astype ( np . float ) , gt_boxes . astype ( np . float ) ) #NEWLINE# _gt_overlaps = np . zeros ( _gt_overlaps . shape [ 0 ] ) #NEWLINE# for j in xrange ( gt_boxes . shape [ 0 ] ) : #NEWLINE# #INDENT# argmax_overlaps = overlaps . argmax ( axis = 0 ) #NEWLINE# max_overlaps = overlaps . max ( axis = 0 ) #NEWLINE# gt_ind = max_overlaps . argmax ( ) #NEWLINE# gt_ovr = max_overlaps . max ( ) #NEWLINE# assert ( gt_ovr >= 0 ) #NEWLINE# box_ind = argmax_overlaps [ gt_ind ] #NEWLINE# _gt_overlaps [ j ] = overlaps [ ( box_ind , gt_ind ) ] #NEWLINE# assert ( _gt_overlaps [ j ] == gt_ovr ) #NEWLINE# overlaps [ box_ind , : ] = ( - 1 ) #NEWLINE# overlaps [ : , gt_ind ] = ( - 1 ) #NEWLINE# #UNINDENT# gt_overlaps = np . hstack ( ( gt_overlaps , _gt_overlaps ) ) #NEWLINE# #UNINDENT# num_pos = gt_overlaps . size #NEWLINE# gt_overlaps = np . sort ( gt_overlaps ) #NEWLINE# step = 0.001 #NEWLINE# thresholds = np . minimum ( np . arange ( 0.5 , ( 1.0 + step ) , step ) , 1.0 ) #NEWLINE# recalls = np . zeros_like ( thresholds ) #NEWLINE# for ( i , t ) in enumerate ( thresholds ) : #NEWLINE# #INDENT# recalls [ i ] = ( ( gt_overlaps >= t ) . sum ( ) / float ( num_pos ) ) #NEWLINE# #UNINDENT# ar = ( 2 * np . trapz ( recalls , thresholds ) ) #NEWLINE# return ( ar , gt_overlaps , recalls , thresholds )