From 7a782b1ac3153dc413444143ec9a4e7ea0c22448 Mon Sep 17 00:00:00 2001 From: kirilllzaitsev Date: Thu, 20 Jul 2023 15:59:50 +0200 Subject: [PATCH] cleanup test_detection --- test/metrics/test_detection.py | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/test/metrics/test_detection.py b/test/metrics/test_detection.py index fc530217..31ba20de 100644 --- a/test/metrics/test_detection.py +++ b/test/metrics/test_detection.py @@ -25,13 +25,6 @@ PREDICTIONS = np.array( ], dtype=np.float32, ) -CERTAIN_PREDICTIONS = np.concatenate( - [ - PREDICTIONS[:, :4], - np.ones((len(PREDICTIONS), 1)), - ], - axis=1, -) TARGET_TENSORS = [ np.array( @@ -56,7 +49,7 @@ DETECTIONS = Detections( ) CERTAIN_DETECTIONS = Detections( xyxy=PREDICTIONS[:, :4], - confidence=np.ones_like(PREDICTIONS[:, 4]), + confidence=np.ones(len(PREDICTIONS)), class_id=PREDICTIONS[:, 5].astype(int), ) @@ -73,10 +66,14 @@ DETECTION_TENSORS = [ ] CERTAIN_DETECTION_TENSORS = [ np.concatenate( - [det.xyxy, np.expand_dims(det.class_id, 1)], + [ + det.xyxy, + np.expand_dims(det.class_id, 1), + np.ones((len(det), 1)), + ], axis=1, ) - for det in [CERTAIN_DETECTIONS] + for det in [DETECTIONS] ] IDEAL_MATCHES = np.stack(