From edba78c742f4e46851f0eaa5e4958a38b5429f4f Mon Sep 17 00:00:00 2001 From: Paul Tunison Date: Wed, 18 Dec 2024 12:50:46 -0500 Subject: [PATCH] Fix how tcn test considers total num classes automatically Some detection inputs have "missing" categories due to their being skipped during detection inference. This creates a discrepancy between quantity of listed categories vs category IDs that can be listed. Instead consider the max category ID + 1, on the assumption that category IDs start at 0, which is a strong assumption due to considering category IDs as the index of prediction outputs to which that category applies. --- tcn_hpl/data/tcn_dataset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcn_hpl/data/tcn_dataset.py b/tcn_hpl/data/tcn_dataset.py index 2d0dd9b90..68f8a6d5b 100644 --- a/tcn_hpl/data/tcn_dataset.py +++ b/tcn_hpl/data/tcn_dataset.py @@ -521,7 +521,7 @@ def test_dataset_for_input( # TODO: Some method of configuring which vectorizer to use. from tcn_hpl.data.vectorize.locs_and_confs import LocsAndConfs - num_object_classes = len(dets_coco.cats) + num_object_classes = max(dets_coco.cats) + 1 vectorize = LocsAndConfs( top_k=1, num_classes=num_object_classes,