一、基本步驟
這里是使用動畫片貓和老鼠進行計算,基本流程如下:
1、導入并讀取視頻,從中提取幀,并將其另存為圖像
2、標記一些圖像以訓練模型(別擔心,我已經為你做好了)
3、根據訓練數據構建我們的模型
4、對剩余圖像進行預測
5、計算湯姆和杰瑞的屏幕時間
二、基礎環境
安裝以下庫,Numpy、Pandas、Matplotlib、Keras、Skimage、OpenCV。
import cv2 # for capturing videos
import math # for mathematical operations
import matplotlib.pyplot as plt # for plotting the images
%matplotlib inline
import pandas as pd
from keras.preprocessing import image # for preprocessing the images
import numpy as np # for mathematical operations
from keras.utils import np_utils
from skimage.transform import resize # for resizing images