Skip to content

Commit

Permalink
Convert coco bounding box format to [x0,y0,x1,y1] format. (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
eddyxu authored Sep 16, 2022
1 parent 66d2c00 commit 13d9290
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/benchmarks/parse_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def _instances_to_df(self, split, instances_json):
df = pd.DataFrame(instances_json["annotations"])
df["segmentation"] = df.segmentation.apply(_convert_segmentation)
df["iscrowd"] = df.iscrowd.astype("bool")
# Convert coco dataset bounding box [x,y,width,height] to [x0,y0,x1,y1] format.
df["bbox"] = df.bbox.apply(
lambda arr: [arr[0], arr[1], arr[0] + arr[2], arr[1] + arr[3]]
)
category_df = pd.DataFrame(instances_json["categories"]).rename(
{"id": "category_id"}, axis=1
)
Expand Down

0 comments on commit 13d9290

Please sign in to comment.