CV算法工作流,無外乎就是,從圖像數據標籤數據,到圖像數據標籤數據, 的輸入輸出過程。過程中間就是各個模型算法的學習處理,數據的處理清洗是算法效果的根基。數據清洗裏有三個重要基礎知識,numpy、pandas、matplotlib
生成numpy數組
1.1 生成0和1的數組
- np.ones(shape[, dtype, order])
- np.ones_like(a[, dtype, order, subok])
- np.zeros(shape[, dtype, order])
- np.zeros_like(a[, dtype, order, subok])
>>> zero = np.zeros([3, 4])
array([[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.],
[ 0., 0., 0., 0.]])
1.2 從現有數組生成
1.2.1 生成方式
-
np.array(object[, dtype, copy, order, subok, ndmin])
-
np.asarray(a[, dtype, order])
a = np.array([[1,2,3],[4,5,6]])
# 從現有的數組當中創建
a1 = np.array(a)
# 相當於索引的形式,並沒有真正的創建一個新的
a2 = np.asarray(a)