def pick_vehicles(img, rclasses, rscores, rbboxes): bboxes = [] sizes = [] for i, rclass in enumerate(rclasses): if rclass == 7 and rscores[i] > 0.5: bbox = VehicleDetector.rbbox2bbox(img, rbboxes[i]) bboxes.append(rbboxes[i]) pt0_, pt1_, pt2_, pt3_, w, h, center, pt_left, pt_right, angle_degree = analyzeBBox( bbox) sizes.append(w * h) return bboxes
def pick_one_vehicle(img, rclasses, rscores, rbboxes): size = 0 selected = None for i, rclass in enumerate(rclasses): if rclass == 7 and rscores[i] > 0.5: bbox = VehicleDetector.rbbox2bbox(img, rbboxes[i]) pt0_, pt1_, pt2_, pt3_, w, h, center, pt_left, pt_right, angle_degree = analyzeBBox( bbox) if w * h > size: selected = bbox size = w * h return selected