loader.py 文件源码

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

项目:mx-rfcn 作者: giorking 项目源码 文件源码
def reset(self):
        self.cur = 0
        if self.shuffle:
            if config.TRAIN.ASPECT_GROUPING:
                widths = np.array([r['width'] for r in self.roidb])
                heights = np.array([r['height'] for r in self.roidb])
                horz = (widths >= heights)
                vert = np.logical_not(horz)
                horz_inds = np.where(horz)[0]
                vert_inds = np.where(vert)[0]
                inds = np.hstack((np.random.permutation(horz_inds), np.random.permutation(vert_inds)))
                if inds.shape[0] % 2:
                    inds_ = np.reshape(inds[:-1], (-1, 2))
                    row_perm = np.random.permutation(np.arange(inds_.shape[0]))
                    inds[:-1] = np.reshape(inds_[row_perm, :], (-1, ))
                else:
                    inds = np.reshape(inds, (-1, 2))
                    row_perm = np.random.permutation(np.arange(inds.shape[0]))
                    inds = np.reshape(inds[row_perm, :], (-1, ))
                self.index = inds
            else:
                np.random.shuffle(self.index)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号