def obj_in_lane_detection()

in spark_scripts/detect_scenes.py [0:0]


def obj_in_lane_detection(row):
    if row.get('rgb_right_detections_only_clean') and row.get('post_process_lane_points_rgb_front_right_clean'):
        objects_in_lane = []
        objects = json.loads(json.loads(row['rgb_right_detections_only_clean']).get('detections_bboxes_clean', []))
        lane_points = row['post_process_lane_points_rgb_front_right_clean']
        for o in objects:
            corners_in_lane, lanes = is_object_in_lane(obj=o, lane_points=lane_points)
            o.update(
                {
                    'corners_in_lane': corners_in_lane,
                    'lanes': lanes,
                }
            )
            if corners_in_lane:
                objects_in_lane.append(o)

        row['objects_in_lane'] = objects_in_lane
    else:
        row['objects_in_lane'] = None
    return row