-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CLI tools for converting yolo to mscoco
- Loading branch information
Showing
2 changed files
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2022, yolort team. All rights reserved. | ||
|
||
import argparse | ||
|
||
from yolort.utils.yolo2coco import YOLO2COCO | ||
|
||
|
||
def get_parser(): | ||
parser = argparse.ArgumentParser("Datasets converter from yolo to coco", add_help=True) | ||
|
||
parser.add_argument("--data_source", default="./coco128", help="Dataset root path") | ||
parser.add_argument("--class_names", default="./coco.name", help="Path of the label names") | ||
parser.add_argument("--split", default="train", choices=["train", "val"], help="Dataset split part") | ||
parser.add_argument("--year", default=2017, type=int, help="Year of the dataset") | ||
|
||
return parser | ||
|
||
|
||
def cli_main(): | ||
parser = get_parser() | ||
args = parser.parse_args() | ||
print(f"Command Line Args: {args}") | ||
|
||
converter = YOLO2COCO(args.data_source, args.class_names, split=args.split, year=args.year) | ||
converter.generate() | ||
|
||
|
||
if __name__ == "__main__": | ||
cli_main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters