layer.py 文件源码

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

项目:QScode 作者: PierreHao 项目源码 文件源码
def _get_next_minibatch(self):
        """For txt mode, read image in training process"""
        if params._use_prefetch:
            return self._blob_queue.get()
        db_inds = self._get_next_minibatch_inds()
        datum = []
        #dataset = data.Dataset()
        data = []
        def addIm(img):
            im = cv2.imread(img)
            im = dataset.pad(im)
            im = im - params._mean
            # change (h,w,c) to (c,h,w)
            im = np.rollaxis(im,2) 
            data.append(im)
        for i in db_inds:
            for idx in xrange(3):
                 try:
                    addIm(self._db[i][idx])   
                 except:
                    print "error with read line: ",self._db[i]
        data = np.array(data)
        datum.append(data.copy())
        blobs = {name: datum[i] for name,i in self._name_to_top_map.iteritems()}
        return blobs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号