def filter_annotations(self, image_group, annotations_group, group):
    '\n        Filter annotations by removing those that are outside of the image bounds or whose width/height < 0.\n        '
    for (index, (image, annotations)) in enumerate(zip(image_group, annotations_group)):
        invalid_indices = np.where(((((((((annotations['bboxes'][:, 2] <= annotations['bboxes'][:, 0]) | (annotations['bboxes'][:, 3] <= annotations['bboxes'][:, 1])) | (annotations['bboxes'][:, 0] < 0)) | (annotations['bboxes'][:, 1] < 0)) | (annotations['bboxes'][:, 2] <= 0)) | (annotations['bboxes'][:, 3] <= 0)) | (annotations['bboxes'][:, 2] > image.shape[1])) | (annotations['bboxes'][:, 3] > image.shape[0])))[0]
        if len(invalid_indices):
            warnings.warn('Image with id {} (shape {}) contains the following invalid boxes: {}.'.format(group[index], image.shape, annotations['bboxes'][invalid_indices, :]))
            for k in annotations_group[index].keys():
                annotations_group[index][k] = np.delete(annotations[k], invalid_indices, axis=0)
        if (annotations['bboxes'].shape[0] == 0):
            warnings.warn('Image with id {} (shape {}) contains no valid boxes before transform'.format(group[index], image.shape))
    return (image_group, annotations_group)
Filter annotations by removing those that are outside of the image bounds or whose width/height < 0.
def filter_annotations(self, image_group, annotations_group, group):
    '\n        \n        '
    for (index, (image, annotations)) in enumerate(zip(image_group, annotations_group)):
        invalid_indices = np.where(((((((((annotations['bboxes'][:, 2] <= annotations['bboxes'][:, 0]) | (annotations['bboxes'][:, 3] <= annotations['bboxes'][:, 1])) | (annotations['bboxes'][:, 0] < 0)) | (annotations['bboxes'][:, 1] < 0)) | (annotations['bboxes'][:, 2] <= 0)) | (annotations['bboxes'][:, 3] <= 0)) | (annotations['bboxes'][:, 2] > image.shape[1])) | (annotations['bboxes'][:, 3] > image.shape[0])))[0]
        if len(invalid_indices):
            warnings.warn('Image with id {} (shape {}) contains the following invalid boxes: {}.'.format(group[index], image.shape, annotations['bboxes'][invalid_indices, :]))
            for k in annotations_group[index].keys():
                annotations_group[index][k] = np.delete(annotations[k], invalid_indices, axis=0)
        if (annotations['bboxes'].shape[0] == 0):
            warnings.warn('Image with id {} (shape {}) contains no valid boxes before transform'.format(group[index], image.shape))
    return (image_group, annotations_group)