overall_box[overall_box < 0] = 0 overall_score = np.concatenate((dscores, tscores), axis=0) # Get key frame RE-ID from tracklet template_features = tracklet.get_features() # print(template_features.shape) # print(frame.shape, overall_box) after_reid_score, reid_features = reid_rescore(reid_module, frame, template_features, overall_box, overall_score) # print(after_reid_score) best_idx = np.argmax(after_reid_score) best_bbox = overall_box[best_idx] best_score = after_reid_score[best_idx] running_stats.push(best_score) # Score better than one sigma, treat as key frame if best_score >= running_stats.mean() + running_stats.standard_deviation(): tracklet.push_frame(frame[best_bbox[1]:best_bbox[3], best_bbox[0]:best_bbox[2], :], np.squeeze(reid_features[best_idx])) # print(count, best_score) # print(overall_box) # if confidence is low than LOST_THRESHOLD, flag_lost = True cv2.circle(frame, (int(tracker.tracker.center_pos[0]), int(tracker.tracker.center_pos[1])), 4, (0, 0, 255), -1) if best_score < LOST_THRESHOLD: flag_lost = True lost_frame_count += 1 else: flag_lost = False lost_frame_cout = 0
# Get key frame RE-ID from tracklet template_features = tracklet.get_features() # print(template_features.shape) # print(frame.shape, overall_box) after_reid_score, reid_features = reid_rescore( reid_module, frame, template_features, overall_box, overall_score) # print(after_reid_score) best_idx = np.argmax(after_reid_score) best_bbox = overall_box[best_idx] best_score = after_reid_score[best_idx] running_stats.push(best_score) # Score better than one sigma, treat as key frame if best_score >= running_stats.mean( ) + running_stats.standard_deviation(): tracklet.push_frame( frame[best_bbox[1]:best_bbox[3], best_bbox[0]:best_bbox[2], :], np.squeeze(reid_features[best_idx])) # print(count, best_score) # print(overall_box) # if confidence is low than LOST_THRESHOLD, flag_lost = True cv2.circle(frame, (int(tracker.tracker.center_pos[0]), int(tracker.tracker.center_pos[1])), 4, (0, 0, 255), -1) if best_score < LOST_THRESHOLD: flag_lost = True lost_frame_count += 1
overall_box[overall_box < 0] = 0 overall_score = np.concatenate((dscores, tscores), axis=0) # Get key frame RE-ID from tracklet template_features = tracklet.get_features() # print(template_features.shape) # print(frame.shape, overall_box) after_reid_score, reid_features = reid_rescore(reid_module, frame, template_features, overall_box, overall_score) # print(after_reid_score) best_idx = np.argmax(after_reid_score) best_bbox = overall_box[best_idx] best_score = after_reid_score[best_idx] running_stats.push(best_score) # Score better than one sigma, treat as key frame if best_score >= running_stats.mean() + running_stats.standard_deviation(): tracklet.push_frame(frame[best_bbox[1]:best_bbox[3], best_bbox[0]:best_bbox[2], :], np.squeeze(reid_features[best_idx])) # print(count, best_score) # print(overall_box) # if confidence is low than LOST_THRESHOLD, flag_lost = True cv2.circle(frame, (int(tracker.tracker.center_pos[0]), int(tracker.tracker.center_pos[1])), 4, (0, 0, 255), -1) if count > 30 and best_score < running_stats.mean() - running_stats.standard_deviation(): flag_lost = True lost_frame_count += 1 else: flag_lost = False lost_frame_cout = 0