Skip to content

Commit

Permalink
[Fix] Memory leaking in panpotic segmentation evaluation (#7538)
Browse files Browse the repository at this point in the history
  • Loading branch information
chhluo authored Mar 26, 2022
1 parent 5eb4608 commit a80e3c8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
12 changes: 6 additions & 6 deletions configs/mask2former/mask2former_r50_lsj_8x2_50e_coco.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,16 +238,16 @@
dict(type='TextLoggerHook', by_epoch=False),
dict(type='TensorboardLoggerHook', by_epoch=False)
])
interval = 200000
interval = 5000
workflow = [('train', interval)]
checkpoint_config = dict(
by_epoch=False, interval=interval, save_last=True, max_keep_ckpts=3)

# Before 365001th iteration, we do evaluation every 200000 iterations.
# Before 365001th iteration, we do evaluation every 5000 iterations.
# After 365000th iteration, we do evaluation every 368750 iterations,
# which means do evaluation at the end of training.
# In all, we do evaluation at the 200000th iteration and the
# last iteratoin.
# which means that we do evaluation at the end of training.
dynamic_intervals = [(max_iters // interval * interval + 1, max_iters)]
evaluation = dict(
interval=interval, dynamic_intervals=dynamic_intervals, metric='PQ')
interval=interval,
dynamic_intervals=dynamic_intervals,
metric=['PQ', 'bbox', 'segm'])
7 changes: 7 additions & 0 deletions mmdet/datasets/api_wrappers/panoptic_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,14 @@ def pq_compute_multi_core(matched_annotations_list,
(proc_id, annotation_set, gt_folder,
pred_folder, categories, file_client))
processes.append(p)

# Close the process pool, otherwise it will lead to memory
# leaking problems.
workers.close()
workers.join()

pq_stat = PQStat()
for p in processes:
pq_stat += p.get()

return pq_stat

0 comments on commit a80e3c8

Please sign in to comment.