# CS231N (2017) Lec 01 課程筆記
###### tags: `CV`
🔷 CS231N: A course for Computer Vision
📌 What is Computer Vision ?
Computer Vision (電腦視覺):
The studies of Visual Data (視覺資料的研究)
---------------------
// 有趣的統計資料: 平均每一秒鐘,約有 5 小時長度的影片
// 被上傳到 Youtube (來自世界各地)
// Google - Youtube 部門的任務:
// (a) Watch >> (b) Understand >> (c) Annotate
// 但影片總數實在太多了!沒有那麼多資料標記人員
// => 電腦視覺的演算法可以派上用場
Related subjects to Computer Vision:
光學, 視覺科學, 機器學習 (ML), 自然語言處理 (NLP),
神經科學, 認知科學
Related courses to Computer Vision:
CS231a: focus on "3D Reconstruction", "Matching"
and "Robotic Vision"
🔷 電腦視覺的歷史
📌 1. 5 億年前 (5.43 億年前) --- 冰河時期
地球動物種類稀少 (幾種),萬物孤寂
📌 2. 1 千萬年前 --- 大爆炸理論
動物種類數量急遽增加 (成千上萬種,生物學家稱為 "大爆炸 The Big Bang")
澳洲的動物學家 Andrew Parker 找到一顆 5.4 億年前的化石
=> 第一批 "發展出眼睛的動物"
=> 推測之後的動物為了避免被捕食,存活下來的幾乎都有眼睛
📌 3. 智慧生物,如: 人類,都有發達的眼睛
腦皮層中,50 % 的神經元 (神經細胞) 都涉及 "視覺處理"
眼睛 近乎可謂是最大的 感知系統 (sensory system)
讓人類得以: 工作、移動、四處走走看看、交流、娛樂等
📌 4. 具有視覺的機械裝置: 數位相機 的歷史
Trace Back to 1600s --- 文藝復興時期
🌟 Pin Hole Camera 針孔相機
小孔可以聚光,聚光後可以成像,類似最早發展視覺的動物的眼睛
📌 5. 1950s-1960s --- Hubel & Wiesel: Discuss the "Animal Visual Processing" (動物視覺處理)
基於理論: 電生理學 (electro-physiology)
探討以下主題: "視覺處理機制" 是如何運作的?
---
Their works:
在貓腦後面插上電極貼片
>> 測量腦皮層 (cortex) 中的視覺區域 (V1 region)
>> 看看是甚麼 "刺激(物) stimulis" 觸發 神經元 的運作
i.e. Visual cortex 中的哪些部分讓貓感到 excited (興奮)
>> 實驗結果:
有些 簡單細胞 會在 定向邊緣 (oriented edges) 附近
規律地 (in certain direction) 遊走
---
In summary, animals' eyes can capture these things in real world:
▫️simple structure 簡單結構
▫️oriented edges 方向邊緣
Also, animal visual processing mechanism is:
▫️visual information pass by "visual pathway (視覺路徑)" 🌟
=> 是一條涵蓋 複雜性 的路 (分布於大腦的各部分), 讓動物可是別複雜的影像
📌 6. 1963, Block World
(積木世界: 以積木的方式重建真實世界的物體) --- 電腦視覺第一篇博士論文
- Edges 邊緣 (Differentiated picture 微分影像)
- Feature Points 特徵點
- 把數位影像微分: 得到邊緣線條 >> 抓取特徵點 >> 物體重建 (Object Reconstruction)
📌 7. 1966, The Summer Vision Project --- MIT 論文
- 發表了一系列電腦視覺 (vision) 的願景 (visions)
- 至今 (2017) 有數以千計的電腦視覺研究者,
仍在解決一些當年提出的基本視覺任務 & 問題討論
- 但得以讓 電腦視覺 蓬勃地發展,成為 AI 領域中最重要且快速發展的一環
📌 8. 1970s, VISION --- David Marr 的知名書籍著作
About:
- What he thought THE VISION is
- 以 CV 進行 "物件識別 (辨識)" 任務的概念構思
i.e. 現代 "3D 建模" 的基本假設
▫️目標: 得到一個 "3D model",是一個整體的完整 3D 表示
▫️假設的運算流程
(It's a very "ideal" thought process,
helps student to understand how Computer Vision works "intuitively" in the 1st step)
-----------------------------------------------
0. Input Image
1. Primal Sketch (原始草圖)
=> i.e. Edge Image
=> edges (邊緣) & curves (曲線)
----------------------
i.e. 邊緣線條
analog: 畫家作圖打的 "線稿"、"素描畫"
include: "edges" (邊緣), "bars" (線條), "ends" (末端), "virtual lines" (虛擬線)
"curves" (曲線), "boundaries" (邊界) 🌟
// 與 歷史 part (5) --- 神經科學家 得出的結果不謀而合:
// "edges" 不就是神經科學家當初研究動物視覺可捕捉的 "simple structures"
2. 2.5-D Sketch
include: "surface" (物體表面), "depth info." (深度資訊), "layers" (層次),
"discontinuities of the visual scene" (視覺場景的不連續性) 🌟
3. 3-D model
definition (by David Marr):
3-D model hierarchically organized
in terms of surface and volumetric primitives.
(🌟 3D 模型 會根據 表面 和 體積基元,階層式地組織起來)
📌 9. 1973 & 1979
Stanford University & SRI International (國際史丹福研究所)
兩群學者的研究 --- 圖形結構 及 廣義圓柱體
---------------------------------------------------
🌟 基本假設:
所有物體都是由 簡單的幾何基元 (simple geometric primitives) 構成
// All these ways (methods) are to reduce the complexity
// of a complex structure of the real-world object.
➡️ Pictorial Structure (圖形結構)
Fischler & Elschlager, 1973
i.e. Circles
=> Use the
(a) circles, and
(b) elastic distance between two circles (圓圈間的彈性距離)
to represent (表示) & recognize (辨識) the object
➡️ Generalized Cylinder (廣義圓柱體)
Brooks & Binford, 1979
i.e. Cylinder
📌 10. 1987, David Lowe 的研究 --- 提取「影像邊緣輪廓」,以刮鬍刀為例
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fei-Fei, Lee:
" The problem was:
上述的這些研究和開發,
多數尚停留在玩具範例 (toy examples) 或者 幾個範例 (few examples) 階段。
要能「提供可在現實世界運作」的東西 (影像處理工具) 在當年代是比較棘手的問題 "
之後, 有些電腦視覺研究者思考能否
"退而求其次 --- 先不做困難的影像辨識 (recognition),
只專注於研究如何做: 影像分割 (segmentation)"
於是 電腦視覺史 有了以下的進展:
↓↓↓
~~~~~~~~~~~~~~~~~~~~~~~~~~~
📌 11. 1997, Jitendra Malik 老師 & 其柏克萊大學的學生 Malik 的開創性研究:
"Normalized Cut: Using a graphy theory algo. for the image segmentation problem"
(使用圖論中的演算法,解決影像分割問題)
example fig: 影像中的僧侶,經圖論演算法,可分割為一坨像素點的集合
=> 即使不能辨識,但可以成功地 "提取多個影像區域" >> 再手工選取目標影像區域 (集合)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Fei-Fei, Lee:
" 1999 - 2000s
許多 機器學習 領域的研究成果
被各國的研究者導入 電腦視覺
像是: (a) SVM: Support Vector Machine
(b) Boosting
(c) Graphical Models:
including 1st wave of NN (Neural Networks)
值得一提的是:
下列 (12) 重要研究 ↓↓↓
~~~~~~~~~~~~~~~~~~~~~~~~~~~
📌 12. 2001, Viola & Jones
Paul Viola & Michael Jones 的突破性研究:
「使用 AdaBoost 演算法 做 人臉即時偵測」
(Real-Time Face Recognition Using AdaBoost Algorithm) "
"Face Recognition"
// "臉" 無疑是人類重要的有興趣區域, so, of course it's useful !
=> 1. 即時人臉檢測
2. 近距離人臉檢測
📌 13. 2006, Fujifilm (日本富士軟片)
=> 繼 (12), 日本富士軟片在五年時間內發表了一篇
在數位相機中的 "即時人臉檢測器"
(Real-Time Face Sensor in Digital Camera)
// 從 科學研究 到 商業實際應用,速度之快 (短短五年) 令人驚奇!
~~~~~~~~~~~~~~~~~~~~~~~~~~~
2000 ~ 2010: Feature-based Object Recognition
↓↓↓
~~~~~~~~~~~~~~~~~~~~~~~~~~~
📌 14. 1999, SIFT (尺度不便特徵轉換, Scale-Invariant Feature Transform)
➡️ 針對 Object
➡️ 核心要素: Feature
➡️ Goal / Target: Object matching: To "match" the entire object.
物件匹配: 匹配整個物件
➡️ Example: 不同視角 (spot sight) 的相機捕捉到的 2 張影像,
目標物件為影像中的 "停車標誌" (STOP sight)
➡️ Difficulties: (a) camera angles 相機角度
(b) occlusion 遮擋
(c) intrinsic variation of the object itself 物件本身的內部變異 (變化)
➡️ Inspiration (啟發):
(a) 有些特徵往往會保持「診斷性」(diagnostic)
及對應改變 (changes) 的「不變性」(in-variant)
(b) 之後的「物件辨識」(Object Recognition) 方法 > 流程:
Step 1. 始於: 識別關鍵「特徵」 (Identify the critical features)
🔘 特徵點檢測 (Feature Point Dection)
Step 2. 再將特徵「匹配」到相似影像
🔘 特徵對應 (Feature Matching)
(c) 啟發 > (2) 提出的方法,
當時被認為比
「針對整個物件的模式匹配(pattern matching in the entire object)」
更容易且可行
📌 15. 2006, Spatial Pyramid Matching (空間金字塔匹配)
➡️ 針對 Holistic Scene (整體場景)
➡️ Idea:
抽取 "特徵" >> 作為 "區別" 不同場景,如: Lanscape, Kicthen, High-way 的線索
➡️ 演算法概要:
對場景影像 (scene image) 的不同部分
縮放成不同的解析度,稱為子影像
>> 用 "特徵描述子 (feature descritor)" 將多張子影像合併起來
>> 支援向量機 (Suppoer Vector Machine algorithm)
📌 16. 探討如何以 "更逼真的特徵" (而並非只是 簡單結構) 組成 "人體"
↑ 方法的 核心要素 ↑ ROI
>> 進一步 辨識人體區域 的相關研究 (related works)
➡️ (a) HOG: 梯度直方圖 (Histogram of Gradient)
➡️ (b) Deformable Part Model
📌 17. 資料品質
從 60s, 70s, 80s 到 2000 年代的前十年
明顯改變的是: 隨著 數位相機、網際網路、多媒體技術 的工藝提升
影像(視覺資料)的也品質越來越好了
---
資料集的資料量
從原本可能 整個資料集 數千張
變成每個種類 (category) 皆有數千張,甚至數萬張
📌 18. PASCAL Visual Object Challange (20 object categories)
2006 - 2012, Everingham et al.
➡️ 任務: 這是個「物件辨識」的挑戰
➡️ 資料集: 有提供 benchmark dataset (基準資料集)
➡️ 評估指標: 以 mAP (Mean Average Precision) 做為評估指標
➡️ 效能: 2007 - 2012, Measuring the performance on detecting objects
=> mAP 穩健成長了約 2.66 倍
📌 19. A Big Problem: Over-fitting (過度擬合:過度配適)
// => 機器學習 領域的瓶頸
// Basically rooted in Machine Learning
// No matter what kind of ML model:
// e.g. Graphical model, SVM, Ada-Boost
The reason:
visual data is very complex
>> lead to: (a) 高維度的輸入 high-dimensional inputs
(b) 大量參數 a lot of parameters
>> and, if we don't have enough "training data"
Overfitting happens very fast
📌 20. 2009, Image Net Dataset
➡️ 提出者: Deng, Dong, Sacher Li & Fei-Fei
➡️ 目的: 為了解決 電腦視覺史 (19) 遇到的重要問題 --- ML 的 Over-fitting
➡️ 時代: 和 歷史 (18) 大約同期,史丹福和普林斯頓的研究者開始此資料集的製備
➡️ 描述: 22K categories and 14M images (2.2 萬個物件類別,1400 萬張影像)
➡️ 概述:
1. 專案辛苦地執行了約 3 年時間
2. 從 Internet 上,總計下載了數十億 (billions) 張影像
以字典 (dictionary) 型態儲存
被組織成成千上萬個 物件類別 (object classes)
3. 資料標註: Amazon Mechanical Turk Platform
// Sort, Clean, Label (Annotate)
➡️ 基準 (benchmark): // 是比較困難的一點
🔘 The Image Classification Challenge
▫️ 1000 object classes
▫️ 1431167 images (143 萬張影像)
🔘 目的: 測試影像分類的 (物件辨識) 結果
🔘 評估方法
▫️ Success: 輸出的前五個 (機率前五高) 物件類別中,
包含正確的物件類別
▫️ Failure: 輸出的前五個 (機率前五高) 物件類別中,
不包含正確的物件類別
🔘 實驗結果
▫️ 以 Image Net Dataset 為基準資料集 (benchmark dataset)
的核心挑戰: The Image Classification Challenge
於 2010 - 2015 年間,
分類 "錯誤率 (error rate)" 穩健下降:
從 28.2 % ➡️ 3.57 %
2015 年 分類模型 冠軍得主的 分類錯誤率 "3.57 %"
甚至小於人類的 分類錯誤率 "5.1 %"
// 2015 冠軍似乎是個史丹福電腦科學系的博士生
// 花費幾周時間進行這項挑戰, 並開發了卓越的模型
▫️ 2012 年, AlexNet 相當值得一提
相較於 2011 的冠軍模型 (fig.12),
其分類錯誤率大幅下降了 9.4 % !!!
// 之後幾年, 每年的錯誤率下降百分比多落在 3 ~ 5 %
➡️ 特別的是, 這是此挑戰歷屆冠軍模型中
第一個以 "卷積神經網路(CNN, Convolutional) 模型 (model)"
作為 核心架構 的模型
~~~~~~~~~~~~~~~~~~~~~~~~~~~
有鑑於 AlexNet 的卓越表現
(AlexNet: ImageNet 資料集的挑戰中, 得到冠軍的第一個 CNN model)
本課程核心議題, 圍繞在 CNN models, 通俗的講法: Deep Learning models
↓↓↓
~~~~~~~~~~~~~~~~~~~~~~~~~~~
🔷 Computer Vision History: Summary
📌 Object Recognition: The Setup
(1) 用來 "看圖" 的演算法 (Algorithm to looks at images)
(2) 有限集合的種類 (Fixed sets of categories)
// Fei-Fei 的博士生總結:
// 儘管 "基於 CNN 的物件辨識" 需要的 設置 直覺上看來有點 restrictive (限制性)
// 需要一些 artificial setup (人工設定)
// 但我們認為:
// 這類方法的應用,具有良好的廣泛性 (可廣泛用於學術界和工商業界)
// e.g. 食物辨識, 藝術品辨識
📌 Computer Vision: The Tasks
🔘 Object recognition
➡️ Classify the "entire" image
e.g. Cat, Dog, Car, Human, etc.
> ref: CV 史 (20): 2009, Image Net Dataset
🔘 Object detection
➡️ Classify the "specific" image
e.g. Draw the "b-box" (bounding boxes)
// 包圍框 (bounding boxes)
// 主要用於: 描述「物件」在影像中的「位置」資訊
🔘 Action classification
🔘 Image Captioning
➡️ 輸入: 影像
輸出: "自然語言的句子 (natural language sentances)"
用於「描述影像」
🔷 Convolutional Neural Network (CNN) have become a import tool
for Object Recognition
// CNN model: 有時簡稱 "conv-nets"
📌 ImageNet (Dataset 的分類競賽) 歷屆優勝模型介紹:
🔘 2010: NEC-UIUC
➡️ "hierarchical" !!!
仍然保留傳統影像處理的特性
如: 邊緣偵測, 不變性
➡️ contains multiple layers
➡️ abstract of the algo.
計算: 一些特徵 (包含: HOG (梯度直方圖) and LBP)
>> 計算: local invariance (局部不變性)
>> Pooling + SPM
>> Linear SVM
🔘 2012: SuperVision
➡️ "The breakthough year" !!!
➡️ 機器學習研究者 Jeff Hinton
在多倫多的研究小組
與他的博士生 Alex Krizhevsky 和 Ilya Sutskever
建立一個: 7 層 CNN model
🔘 2014: (1) GoogLeNet (2) VGG
➡️ (1) GoogLeNet
Google 開發的 CNN model
➡️ (2) VGG
牛津大學 開發的 19 層 CNN model
🔘 2015: MSRA
➡️ ResNet (Residual Network)
微軟亞洲研究院 開發的 152 層 CNN model
// Fei-Fei 博士生: "後續研究表明, 若提高層數到 200 層會更好,
// 但是當 GPU memory (顯卡內存) 不足可能會發生 error:
// Run out out GPU memory"
📌 Who is the first CNN (卷積神經網路) model ?
儘管 2012 年 Hinton 團隊的 AlexNet 在 ImageNet 分類競賽上
因為首次採用 CNN 並贏得冠軍而成名
但是, 「第一個」CNN model 其實源自於 1998 年 Yann LeCun 團隊
目標是: 辨識手寫數字 (應用於: 支票金額自動輸入) 的模型
📌 Why CNN-like model traced back to 1998
become so popular in recent years ?
Reasons:
➡️ (1) CPU 計算能力明顯提升: 電晶體數量的大幅增加 (=> 摩爾定律)
➡️ (2) GPU (圖形處理單元) 的出現: 可以高度平行化 (parallelizable)
// 只有有內存足夠大的多張顯卡,
// 即便只是根據上述那些 classical approaches & classical algo.
// 經常也能執行的很好
➡️ (3) Data: Supervised Learning models (監督式學習的模型)
需要大量「帶有標籤」(labeled) 的影像
00s 比起 90s, 「可用資料」(available data) 明顯增加不少
e.g. 知名資料集: (a) PASCAL in 2006 - 2012
(b) ImageNet in 2009
📌 用一句白話總結 Computer Vision
Trying to build machines that can see like people.
試著做「視覺功能近似於人類」的機器
example: (a) 語意分割 semantic segmentation
(b) 感知分組 perceptual grouping
example: 3D 建模, AR, VR 可能都還有許多未解問題可以研究
example: "Visual Genome", 一個影像語意資料集,
目標是輸出: 結合 局部包圍框物件 及 整張影像 的自然語句
> paper:
> Image Retrieval Using Scene Graphs (CVPR 2015)
> citation: 876
application: 醫療、藝術、機器人
補充-1: 2015 - 2016 同一門課的講師 => Andrej Karpathy
補充-2: DEEP LEARNING (2017 的課, 第一本有關深度學習的經典讀物)
有趣的應用 - eg1: Image Captioning (using RNN)
// 輸出對影像的描述性語句
有趣的應用 - eg2: DeepDream, NeuralStyle, etc.
// 自動產生具迷幻效果的藝術影像 (fig.20 > 左圖)
// 畢卡索或梵谷的作品風格轉換 (fig.20 > 右圖)