Skip to content

[FEATURE] Add a Standalone CLI Inference Script With Bounding-Box Visualization #305

@Chiragjjjks

Description

@Chiragjjjks

Is your feature request related to a problem? Please describe.
The project currently does not provide a unified, ready-to-use inference script. Users who want to run inference on trained EfficientDet models must write custom scripts, modify internal code, or rely on notebooks.

This becomes a barrier for:

  • Beginners exploring the repo
  • Users testing trained checkpoints
  • People integrating inference into pipelines
  • Contributors reproducing results

Additionally, the repo lacks a built-in utility for drawing bounding boxes, labels, and confidence scores on images or videos, something essential for interpreting predictions.

Describe the solution you'd like
I propose adding a standalone command-line inference script, e.g., inference.py, that:

✔ Runs entirely from the terminal

Using argparse, allowing users to run inference with a single command.

✔ Accepts flexible inputs

  • Path to model checkpoint (.pth or .tar)
  • Path to a single image, directory of images, or video
  • Output directory
  • arguments:
    • --img_size
    • --conf_threshold
    • --iou_threshold

✔ Automatically performs

  • Model loading (including .tar → .pth conversion when necessary)
  • Preprocessing
  • Inference
  • Postprocessing & NMS
  • Bounding-box drawing with class labels and scores on the output media

✔ Supports multiple input types

  • Single image
  • Folder of images
  • Single video
  • COCO-style dataset (test2017 + annotations)

✔ Saves all visualized outputs

  • Images → pred_imgs/
  • Videos → pred_videos/
  • Datasets → pred_dataset/

Everything is saved in the user-defined output folder.

Describe alternatives you've considered

  • Writing custom inference scripts for every experiment
  • Testing in notebooks (not ideal for production or automation)
  • Modifying internal repo modules before every run

These approaches work but are not scalable or user-friendly, and they lack a consistent visualization pipeline.
These methods work but are not efficient, scalable, or user-friendly.

Additional context

I have already written a working implementation of this inference script, which includes:

  • CLI entry point
  • Automatic path handling
  • NMS
  • Folder/video processing
  • OpenCV visualization with bounding boxes, labels, and per-category counts
  • .tar → .pth conversion for weights
  • Unified prediction pipeline for all input types

This script could be added to the repo (e.g., in tools/ or root directory) to significantly streamline user workflow and improve accessibility.

If the maintainers approve, I can submit this as a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions