pascal_voc.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:mxnet-ssd 作者: zhreshold 项目源码 文件源码
def _filter_image_with_no_gt(self):
        """
        filter images that have no ground-truth labels.
        use case: when you wish to work only on a subset of pascal classes, you have 2 options:
            1. use only the sub-dataset that contains the subset of classes
            2. use all images, and images with no ground-truth will count as true-negative images
        :return:
        self object with filtered information
        """

        # filter images that do not have any of the specified classes
        self.labels = [f[np.logical_and(f[:, 0] >= 0, f[:, 0] <= self.num_classes-1), :] for f in self.labels]
        # find indices of images with ground-truth labels
        gt_indices = [idx for idx, f in enumerate(self.labels) if not f.size == 0]

        self.labels = [self.labels[idx] for idx in gt_indices]
        self.image_set_index = [self.image_set_index[idx] for idx in gt_indices]
        old_num_images = self.num_images
        self.num_images = len(self.labels)

        print ('filtering images with no gt-labels. can abort filtering using *true_negative* flag')
        print ('... remaining {0}/{1} images.  '.format(self.num_images, old_num_images))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号