Skip to content

hbb2obb-detect

Detects HBBs with an Ultralytics model, for images that have none. Guide: Detect HBBs.

usage: hbb2obb-detect [-h] [--version] [--hbb_dir HBB_DIR] [--model MODEL] [--imgsz IMGSZ]
                      [--conf CONF] [--iou IOU] [--classes CLASSES [CLASSES ...]]
                      [--class_map CLASS_MAP] [--max_det MAX_DET] [--device DEVICE]
                      [--model_kwargs MODEL_KWARGS] [--models_dir MODELS_DIR]
                      [--merge_with MERGE_WITH] [--merge_iou MERGE_IOU] [--extras_dir EXTRAS_DIR]
                      [--map_path MAP_PATH] [--precision PRECISION] [--normalize]
                      [--no_confidence] [--overwrite] [--save_provenance] [--no_bar]
                      img_source

Detect horizontal bounding boxes and write them as YOLO TXT, ready for hbb2obb

positional arguments:
  img_source            Path to an image or directory containing images

options:
  -h, --help            show this help message and exit
  --version, -V         show program's version number and exit
  --hbb_dir HBB_DIR, -hd HBB_DIR
                        Directory to save HBB annotations (default: img_source/../labels_hbb)
  --model MODEL, -m MODEL
                        Registered detector (default: geotrax), a local .pt file, a Hugging Face
                        file as a link or as '<user>/<repo>/<file>.pt', any other link to a .pt
                        checkpoint, or an Ultralytics model name
  --map_path MAP_PATH, -mp MAP_PATH
                        Path to a label map YAML, used to name classes in the summary
  --precision PRECISION, -p PRECISION
                        Decimal places for coordinates (default: 2)
  --normalize, -n       Write coordinates relative to [0, 1]
  --no_confidence       Do not write the confidence column
  --overwrite           Allow writing into an output directory that already holds labels
  --save_provenance     Write a PROVENANCE_hbb.txt one level above the annotations: the command
                        that reproduces them, the settings used and the SHA-256 of the detector
                        checkpoint that ran
  --no_bar, -nb         Disable tqdm progress bar display

detection options:
  --imgsz IMGSZ         Inference resolution (default: the detector's own)
  --conf CONF           Confidence threshold (default: the detector's own)
  --iou IOU             NMS IoU threshold (default: the detector's own)
  --classes CLASSES [CLASSES ...]
                        Class IDs to keep, in the detector's own numbering (default: the
                        detector's own)
  --class_map CLASS_MAP, -cm CLASS_MAP
                        Renumber the detector's classes onto yours, as 'source=target,...' (e.g.
                        '2=0,5=1,7=2' for a COCO-trained model). Boxes of a class the map does not
                        name are dropped.
  --max_det MAX_DET     Maximum detections per image
  --device DEVICE       Inference device, e.g. 'cpu', '0', 'mps'
  --model_kwargs MODEL_KWARGS, -k MODEL_KWARGS
                        Any other Ultralytics predictor arguments, passed through unchecked, as
                        'key1=value1,key2=value2'; values are Python literals where they parse as
                        one (e.g. 'agnostic_nms=True,classes=[0,2]')
  --models_dir MODELS_DIR
                        Directory checkpoints are read from and downloaded to (default:
                        $HBB2OBB_MODELS_DIR if set, else models/ in the working directory)

merging with existing annotations:
  --merge_with MERGE_WITH, -mw MERGE_WITH
                        Directory of hand-drawn HBBs to score instead of writing the detections
                        themselves. Their geometry and order are kept untouched; each box only
                        takes the confidence of the detection covering it, and a box the detector
                        missed gets 1.0.
  --merge_iou MERGE_IOU
                        Minimum IoU for a detection to score a box (default: 0.5)
  --extras_dir EXTRAS_DIR
                        Write the detections that back no hand-drawn box here, as their own HBB
                        set, so they can be reviewed with hbb2obb-view before being accepted or
                        discarded

Registered detectors: geotrax (YOLOv8s vehicle detector for high-altitude drone imagery (Geo-
trax))