in training/dataset/vos_segment_loader.py [0:0]
def get_valid_obj_frames_ids(self, num_frames_min=None):
# For each object, find all the frames with a valid (not None) mask
num_objects = len(self.frame_annots[0])
# The result dict associates each obj_id with the id of its valid frames
res = {obj_id: [] for obj_id in range(num_objects)}
for annot_idx, annot in enumerate(self.frame_annots):
for obj_id in range(num_objects):
if annot[obj_id] is not None:
res[obj_id].append(int(annot_idx * self.ann_every))
if num_frames_min is not None:
# Remove masklets that have less than num_frames_min valid masks
for obj_id, valid_frames in list(res.items()):
if len(valid_frames) < num_frames_min:
res.pop(obj_id)
return res