Skip to content

Commit

Permalink
allow CCLabelSource to read scores if available (#1988)
Browse files Browse the repository at this point in the history
Co-authored-by: Adeel Hassan <ahassan@element84.com>
  • Loading branch information
AdeelH and AdeelH committed Nov 8, 2023
1 parent 903fbd9 commit e882bfe
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@ def read_labels(labels_df: gpd.GeoDataFrame,
if bbox is not None:
boxes = [b for b in boxes if b.intersects(bbox)]
class_ids = labels_df['class_id'].astype(int)
if 'scores' in labels_df.columns:
scores = labels_df['scores']
else:
scores = [None] * len(class_ids)
cells_to_class_id = {
cell: (class_id, None)
for cell, class_id in zip(boxes, class_ids)
cell: (class_id, class_scores)
for cell, class_id, class_scores in zip(boxes, class_ids, scores)
}
labels = ChipClassificationLabels(cells_to_class_id)
return labels
Expand Down

0 comments on commit e882bfe

Please sign in to comment.