Commit 963e5100 authored by Madhav Agarwal's avatar Madhav Agarwal Committed by GitHub

Prevent filtering of empty images (#1424)

* Update data.py

* Update data.py

* Update config.py

* Update data.py

* Update data.py
parent 92aab656
...@@ -106,6 +106,8 @@ _C.DATA.CLASS_NAMES = [] # NUM_CLASS (NUM_CATEGORY+1) strings, the first is "BG ...@@ -106,6 +106,8 @@ _C.DATA.CLASS_NAMES = [] # NUM_CLASS (NUM_CATEGORY+1) strings, the first is "BG
# whether the coordinates in your registered dataset are # whether the coordinates in your registered dataset are
# absolute pixel values in range [0, W or H] or relative values in [0, 1] # absolute pixel values in range [0, W or H] or relative values in [0, 1]
_C.DATA.ABSOLUTE_COORD = True _C.DATA.ABSOLUTE_COORD = True
# Filter Negative Samples from dataset
_C.DATA.FILTER_EMPTY_ANNOTATIONS = True
# Number of data loading workers. # Number of data loading workers.
# In case of horovod training, this is the number of workers per-GPU (so you may want to use a smaller number). # In case of horovod training, this is the number of workers per-GPU (so you may want to use a smaller number).
# Set to 0 to disable parallel data loading # Set to 0 to disable parallel data loading
......
...@@ -345,7 +345,8 @@ def get_train_dataflow(): ...@@ -345,7 +345,8 @@ def get_train_dataflow():
# Filter out images that have no gt boxes, but this filter shall not be applied for testing. # Filter out images that have no gt boxes, but this filter shall not be applied for testing.
# The model does support training with empty images, but it is not useful for COCO. # The model does support training with empty images, but it is not useful for COCO.
num = len(roidbs) num = len(roidbs)
roidbs = list(filter(lambda img: len(img["boxes"][img["is_crowd"] == 0]) > 0, roidbs)) if cfg.DATA.FILTER_EMPTY_ANNOTATIONS:
roidbs = list(filter(lambda img: len(img["boxes"][img["is_crowd"] == 0]) > 0, roidbs))
logger.info( logger.info(
"Filtered {} images which contain no non-crowd groudtruth boxes. Total #images for training: {}".format( "Filtered {} images which contain no non-crowd groudtruth boxes. Total #images for training: {}".format(
num - len(roidbs), len(roidbs) num - len(roidbs), len(roidbs)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment