predict_frames.py 文件源码

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

项目:commercials_project 作者: BryceLuna 项目源码 文件源码
def read_video(self):

        vid = cv2.VideoCapture(self.video_path)

        if vid.isOpened():

            frame_count = int(vid.get(cv2.cv.CV_CAP_PROP_FRAME_COUNT))
            self.predictions = np.zeros((frame_count,100,100,3))#need to know frame size
            for count in xrange(frame_count):
                ret,frame = vid.read() #probably don't want to get every frame
                processed_frame = self.process_frame(frame)
                self.predictions[count] = processed_frame
            vid.release()
        else:
            print 'unable to open file: {}'.format(file_str)


    #maybe should separate this algo, or somehow automatically detect what the model accepts
    #should probably convert to float32, divide by 255.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号