using_videodir.py 文件源码

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

项目:deepstacks 作者: guoxuesong 项目源码 文件源码
def read(self,training=False,validation=False):
        pos=int(self.currpos)
        ret,image=self.video.read()
        count=0
        while True:
            if ret:
                self.currpos+=1
                update=False
            else:
                self.currpos=0
                update=True
            if update:
                self.video.set(cv.CV_CAP_PROP_POS_FRAMES,self.currpos)
            if ret and (validation and is_validation_frame(pos) or training and is_training_frame(pos) or not training and not validation):
                return ret,image,pos
            else:
                pos=int(self.currpos)
                ret,image=self.video.read()
                count+=1
                if count>=1000:
                    print 'read retry timeout'
                    os._exit(-1)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号