Skip to content

CLI pm_evaluate detection crashes with AttributeError when --out_fname is used #563

Description

@Harshavardhan-Raju

File: perceptionmetrics/cli/evaluate.py
Line: 197

Description

TorchImageDetectionModel.eval() returns a dict with keys metrics_df
and metrics_factory. The CLI calls .to_csv() directly on this dict,
which raises AttributeError every time detection evaluation is run with
--out_fname.

Bug

results = model.eval(...)
results.to_csv(out_fname)  # results is a dict for detection models

Fix

if isinstance(results, dict):
    results = results["metrics_df"]
results.to_csv(out_fname)

Steps to Reproduce

  1. Set up a COCO dataset and a torchscript detection model
  2. Run evaluation with --out_fname:
    pm_evaluate detection image --model_format torch --model model.pt
    --dataset_format coco --dataset_dir /path/to/coco --out_fname results.csv
  3. Evaluation completes but crashes before saving with:
    AttributeError: 'dict' object has no attribute 'to_csv'

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions