infer_cells(cells: List[Box], labels_df: geopandas.GeoDataFrame, ioa_thresh: float, use_intersection_over_cell: bool, pick_min_class_id: bool, background_class_id: int) ChipClassificationLabels[source]#

Infer ChipClassificationLabels grid from GeoJSON containing polygons.

Given GeoJSON with polygons associated with class_ids, infer a grid of cells and class_ids that best captures the contents of each cell.

For each cell, the problem is to infer the class_id that best captures the content of the cell. This is non-trivial since there can be multiple polygons of differing classes overlapping with the cell. Any polygons that sufficiently overlaps with the cell are in the running for setting the class_id. If there are none in the running, the cell is either considered null or background.

  • ioa_thresh (float) – (float) the minimum IOA of a polygon and cell for that polygon to be a candidate for setting the class_id

  • use_intersection_over_cell (bool) – (bool) If true, then use the area of the cell as the denominator in the IOA. Otherwise, use the area of the polygon.

  • background_class_id (int) – (None or int) If not None, class_id to use as the background class; ie. the one that is used when a window contains no boxes.

  • pick_min_class_id (bool) – If true, the class_id for a cell is the minimum class_id of the boxes in that cell. Otherwise, pick the class_id of the box covering the greatest area.

  • cells (List[Box]) –

  • labels_df (geopandas.GeoDataFrame) –



Return type