hbb2obb-convert¶
Converts annotations between YOLO, DOTA, Pascal VOC, COCO and LabelMe. Guide: Convert between formats.
usage: hbb2obb-convert [-h] [--version]
[--to {yolo,dota,voc,coco,labelme} [{yolo,dota,voc,coco,labelme} ...]]
[--from {yolo,dota,voc,coco,labelme}] [--out_dir OUT_DIR]
[--map_path MAP_PATH] [--images IMAGES] [--img_width IMG_WIDTH]
[--img_height IMG_HEIGHT] [--kind {auto,hbb,obb}] [--normalize]
[--precision PRECISION] [--dota_ext DOTA_EXT]
[--difficult_from {dota,voc,confidence}] [--confidence_dir DIR]
[--difficult_below DIFFICULT_BELOW] [--voc_database VOC_DATABASE]
[--coco_name COCO_NAME] [--coco_from FILE] [--coco_info FILE] [--verify]
[--no_bar]
source
Convert bounding box annotations between YOLO, DOTA, Pascal VOC, COCO and LabelMe
positional arguments:
source Directory of annotation files, or the .json file itself for COCO
options:
-h, --help show this help message and exit
--version, -V show program's version number and exit
--to {yolo,dota,voc,coco,labelme} [{yolo,dota,voc,coco,labelme} ...], -t {yolo,dota,voc,coco,labelme} [{yolo,dota,voc,coco,labelme} ...]
Output format(s); several can be written in one pass
--from {yolo,dota,voc,coco,labelme}, -f {yolo,dota,voc,coco,labelme}
Input format (default: detected from the files)
--out_dir OUT_DIR, -o OUT_DIR
Directory to write the converted annotations (default: source directory)
--map_path MAP_PATH, -mp MAP_PATH
Path to a label map YAML mapping class IDs to names
--images IMAGES, -i IMAGES
Image directory, read for the frame dimensions the formats need
--img_width IMG_WIDTH, -iw IMG_WIDTH
Frame width, if there is no image directory
--img_height IMG_HEIGHT, -ih IMG_HEIGHT
Frame height, if there is no image directory
--kind {auto,hbb,obb}, -k {auto,hbb,obb}
Write horizontal or oriented boxes (default: auto, oriented if any box is
rotated)
--normalize, -n Write YOLO coordinates relative to [0, 1]
--precision PRECISION, -p PRECISION
Decimal places for YOLO output (default: 10 normalized, 2 absolute)
--dota_ext DOTA_EXT Extension for DOTA files (default: .dota; use .txt for a standalone
labelTxt directory)
--difficult_from {dota,voc,confidence}
Take the per-box 'difficult' flag from this format in the source
directory. Only DOTA and Pascal VOC can carry it, so writing either one
from YOLO or COCO resets it to 0 unless this is given. 'confidence'
instead derives it from the per-box conversion score, flagging everything
below --difficult_below; the scores come from the source labels if they
carry a trailing column, otherwise from --confidence_dir.
--confidence_dir DIR Side-car directory of per-box confidence scores, as written by 'hbb2obb
--confidence_dir'. Read only by --difficult_from confidence; the scores
stay out of the written labels.
--difficult_below DIFFICULT_BELOW
With --difficult_from confidence, flag every box scoring below this
(default: 0.5). A box that fell back to its source HBB scores 0.0 and is
therefore always flagged
--voc_database VOC_DATABASE
Value of the <database> field in Pascal VOC output
--coco_name COCO_NAME
File name for COCO output (default: coco_annotations_<kind>.json). Use it
to match a labels_<name> directory, which is how --verify pairs the two.
--coco_from FILE Take the image and annotation ids, and the 'licenses' and 'supercategory'
fields, from this existing COCO file instead of numbering from 1. Use it
when the boxes are derived one for one from that file, so the two can
still be joined by id. The match is by frame name and row order and is
checked before anything is written. 'info' is not carried over, since it
describes the record being written: see --coco_info.
--coco_info FILE JSON file holding the COCO 'info' object for the written record, e.g. its
description, version, contributor and DOI. Written verbatim; omitted,
'info' stays empty.
--verify Check that every format found under the source encodes the same boxes, and
write nothing
--no_bar, -nb Disable tqdm progress bar display