Skip to content

Commit

Permalink
feat(back): Replace category ID and name by single category field
Browse files Browse the repository at this point in the history
  • Loading branch information
cpvannier committed Jan 22, 2024
1 parent 14e558b commit d0b9569
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
3 changes: 1 addition & 2 deletions pixano_inference/pytorch/deeplabv3.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ def preannotate(
"mask": CompressedRLE.from_mask(
unmold_mask(mask)
).to_dict(),
"category_id": int(label),
"category_name": voc_names(label),
"category": voc_names(label),
}
for label, mask in zip(labels, masks)
]
Expand Down
3 changes: 1 addition & 2 deletions pixano_inference/pytorch/maskrcnnv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ def preannotate(
"mask": CompressedRLE.from_mask(
unmold_mask(output["masks"][i])
).to_dict(),
"category_id": int(output["labels"][i]),
"category_name": coco_names_91(output["labels"][i]),
"category": coco_names_91(output["labels"][i]),
}
for i in range(len(output["scores"]))
if output["scores"][i] > threshold
Expand Down
5 changes: 1 addition & 4 deletions pixano_inference/pytorch/yolov5.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,7 @@ def preannotate(
)
.normalize(h, w)
.to_dict(),
"category_id": coco_ids_80to91(pred[5] + 1),
"category_name": coco_names_91(
coco_ids_80to91(pred[5] + 1)
),
"category": coco_names_91(coco_ids_80to91(pred[5] + 1)),
}
for pred in img_output
if pred[4] > threshold
Expand Down
3 changes: 1 addition & 2 deletions pixano_inference/tensorflow/efficientdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ def preannotate(
],
confidence=float(output["detection_scores"][0][i]),
).to_dict(),
"category_id": int(output["detection_classes"][0][i]),
"category_name": coco_names_91(
"category": coco_names_91(
output["detection_classes"][0][i]
),
}
Expand Down
3 changes: 1 addition & 2 deletions pixano_inference/tensorflow/fasterrcnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def preannotate(
],
confidence=float(output["detection_scores"][0][i]),
).to_dict(),
"category_id": int(output["detection_classes"][0][i]),
"category_name": coco_names_91(
"category": coco_names_91(
output["detection_classes"][0][i]
),
}
Expand Down

0 comments on commit d0b9569

Please sign in to comment.