Download processing/scripts/labelme_to_coco.py from UARK-NED3/BubbleID-Flow: direct link, hf CLI and curl.
- Browser
- Download file 935 Bytes
-
https://huggingface.co/datasets/UARK-NED3/BubbleID-Flow/resolve/main/processing/scripts/labelme_to_coco.py
- Command line
-
hf download hf://datasets/UARK-NED3/BubbleID-Flow/processing/scripts/labelme_to_coco.py
-
curl -L -o labelme_to_coco.py https://huggingface.co/datasets/UARK-NED3/BubbleID-Flow/resolve/main/processing/scripts/labelme_to_coco.py
935 Bytes
| from __future__ import annotations | |
| import argparse | |
| from bubbleid_flow.coco import labelme_to_coco | |
| from bubbleid_flow.preprocess import parse_roi | |
| def main() -> None: | |
| parser = argparse.ArgumentParser(description="Convert Labelme bubble annotations to COCO JSON.") | |
| parser.add_argument("--annotation-root", action="append", required=True) | |
| parser.add_argument("--output-dir", required=True) | |
| parser.add_argument("--holdout-every", type=int, default=5) | |
| parser.add_argument("--roi", default=None, help="Optional crop ROI formatted as x,y,width,height") | |
| args = parser.parse_args() | |
| train_json, val_json = labelme_to_coco( | |
| args.annotation_root, | |
| args.output_dir, | |
| holdout_every=args.holdout_every, | |
| roi=parse_roi(args.roi) if args.roi else None, | |
| ) | |
| print(f"Wrote {train_json}") | |
| print(f"Wrote {val_json}") | |
| if __name__ == "__main__": | |
| main() | |