Merge pull request #1410 from arthurcerveira/refactor/lazy-loading-for-benchmarks
Refactor the metric benchmarks to use dataset lazy loading
This commit is contained in:
1 file changed
+6
-8
@@ -391,11 +391,10 @@ class ConfusionMatrix:
|
||||
```
|
||||
"""
|
||||
predictions, targets = [], []
|
||||
for img_name, img in dataset.images.items():
|
||||
predictions_batch = callback(img)
|
||||
for _, image, annotation in dataset:
|
||||
predictions_batch = callback(image)
|
||||
predictions.append(predictions_batch)
|
||||
targets_batch = dataset.annotations[img_name]
|
||||
targets.append(targets_batch)
|
||||
targets.append(annotation)
|
||||
return cls.from_detections(
|
||||
predictions=predictions,
|
||||
targets=targets,
|
||||
@@ -604,11 +603,10 @@ class MeanAveragePrecision:
|
||||
```
|
||||
"""
|
||||
predictions, targets = [], []
|
||||
for img_name, img in dataset.images.items():
|
||||
predictions_batch = callback(img)
|
||||
for _, image, annotation in dataset:
|
||||
predictions_batch = callback(image)
|
||||
predictions.append(predictions_batch)
|
||||
targets_batch = dataset.annotations[img_name]
|
||||
targets.append(targets_batch)
|
||||
targets.append(annotation)
|
||||
return cls.from_detections(
|
||||
predictions=predictions,
|
||||
targets=targets,
|
||||
|
||||
Reference in new issue
Block a user