Skip to content

Commit 5d4e1fb

Browse files
committed
Minor changes to evaluation script
1 parent b4c0566 commit 5d4e1fb

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

eval.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ def evaluate(
139139
classes=None,
140140
colors=None
141141
):
142+
metric = MeanAveragePrecision(class_metrics=args['verbose'])
142143
n_threads = torch.get_num_threads()
143144
# FIXME remove this and make paste_masks_in_image run on the GPU
144145
torch.set_num_threads(1)
@@ -172,13 +173,11 @@ def evaluate(
172173
preds.append(preds_dict)
173174
target.append(true_dict)
174175
#####################################
175-
176176
outputs = [{k: v.to(cpu_device) for k, v in t.items()} for t in outputs]
177177

178178
# gather the stats from all processes
179179
metric_logger.synchronize_between_processes()
180180
torch.set_num_threads(n_threads)
181-
metric = MeanAveragePrecision(class_metrics=args['verbose'])
182181
metric.update(preds, target)
183182
metric_summary = metric.compute()
184183
return metric_summary

utils/validate.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,18 @@
7878
# Model configurations
7979
IMAGE_WIDTH = args['img_size']
8080
IMAGE_HEIGHT = args['img_size']
81-
8281
valid_dataset = create_valid_dataset(
83-
VALID_DIR_IMAGES, VALID_DIR_LABELS,
84-
IMAGE_WIDTH, IMAGE_HEIGHT, CLASSES
85-
)
82+
VALID_DIR_IMAGES,
83+
VALID_DIR_LABELS,
84+
args['img_size'],
85+
CLASSES,
86+
square_training=True
87+
)
8688
valid_loader = create_valid_loader(valid_dataset, BATCH_SIZE, NUM_WORKERS)
8789

8890
coco_evaluator, stats = evaluate(
8991
model,
9092
valid_loader,
9193
device=DEVICE,
92-
classes=CLASSES,
93-
)
94+
# classes=CLASSES,
95+
)

0 commit comments

Comments
 (0)