號稱超簡單的機器學習工具 Cloud AutoML 終於在這次的 Google Cloud Next 大會正式亮相拉,我一大早收到 Email 通知說 Beta 版本已經可以試用,整個超級興奮的!想當初看到 Alpha 釋出體驗的消息,到現在已經等待超過半年了呀,究竟這個 AutoML 是不是如傳聞所說那麼容易上手,就來讓我們看看 GCP 專門家帶來的第一手消息吧!

資料準備
首先我們用 Google Search 來收集這兩種狗狗的圖片作為訓練資料,這邊可以利用 google-images-download 這個 tool 批次下載圖片。
如下圖,將下載的圖片分別整理至三個角色各自的資料夾中 (Akita: 秋田犬;Shiba: 柴犬)。

Cloud AutoML Vision 有兩種上傳訓練圖片的方式,這邊我們使用 Cloud Storage 匯入。
首先,將收集好的訓練圖片上傳至 Cloud Storage (alpha 有限定要在 PROJECT_ID-vcm 這個 bucket 裡面,假如你的 project ID 是 test-123 那麼就要上傳到 test-123-vcm 這個 bucket)。
如下圖:

接著要建立一個 CSV 檔案描述訓練圖片 URL 和其所對應的 labels,CSV 內容節錄部分如下:
gs://<project_ID>-vcm/ShibaAkita/Akita/98.jpg,Akita
gs://<project_ID>-vcm/ShibaAkita/Akita/99.jpg,Akita
gs://<project_ID>-vcm/ShibaAkita/Shiba/1.jpg,Shiba
gs://<project_ID>-vcm/ShibaAkita/Shiba/10.jpg,Shiba
然後將該 CSV 也上傳到 Cloud Storage 中,如下:

創建 Dataset
1. 在 Cloud AutoML Vision 的 console 中,點選 「NEW DATASET」。

2. 填入 Dataset 名稱,指定好 CSV 的 Cloud Storage URL,點選 「Create Dataset」(訓練資料如果很多的話,需要稍等片刻等待資料匯入完成)

3. 匯入完成後,可以在 「IMAGES」tab 可以看到匯入圖片的縮圖

模型訓練與評估
1. 在「TRAIN」tab 點選 「TRAIN NEW MODEL」按鈕

2. 選擇 Training budget (理論上 compute hour 愈多,訓練出來的 model 準確率越高),然後按下 「START TRAINING」按鈕 (這通常需要一些時間)

3. 沒錯,你完全不需要具備 machine learning 的背景知識,就可以訓練出一個 machine learning model。訓練完成後,可以在「EVALUATE」tab 看到訓練的結果,包括 Precision、Recall、Confusion matrix 等指標 (參照 lee 文)

利用模型預測
到這邊我們已經完成了這個狗狗辨識器啦!切到「PREDICT」tab 上傳一張你想要辨識的圖片,這個辨識器就會告訴你這是秋田還是柴犬,並且有一個信心分數 (0 ~ 1)。

頁面下方也會給出 prediction API 的使用範例。你不需要擔心這個 API 是 host 在哪邊也不需要擔心 scaling 的問題,Cloud AutoML 會幫你代管這個 API 服務。

持續迭代優化模型準確率
你也許會問,有什麼方式可以提升 model 的準確率呢?在 Cloud AutoML 當中,因為 training 和 evaluation 是由 Cloud AutoML 自動處理,因此我們只能藉由提升訓練資料的品質,來提升模型的準確率。
切換至 「IMAGES」tab,我們發現在 Shiba 的訓練資料當中,其實有些圖片並不是 Shiba,因此我們可以將這些錯誤的訓練資料刪除,提升訓練資料的品質,如下圖。

整理完各類別的訓練資料之後,我們再重新訓練一個新的 model,準確率果然有顯著的提升。
Cloud AutoML 獨家搶先體驗
結合 AI 大眾化的趨勢,Google Cloud 首席合作夥伴:GCP專門家架設了「Cloud AutoML 獨家體驗專區」,讓所有人都能即刻感受 Cloud AutoML 的威力。

若想客製化擁有自己的 Cloud AutoML 模型,GCP專門家提供以下教學文章與應用案例:
- [手把手教學] 快速啟用 Cloud AutoML Vision:Google 最新機器學習產品!
- 如何應用 Cloud AutoML Vision 辨識屈中恆、宋少卿、鈕承澤!
- Google 三大機器學習產品比較
擁有專屬自己的機器學習模型
想立即擁有自己的客製化機器學習模型嗎?想訓練模型卻不知從何下手嗎?立刻與 GCP專門家聯繫吧!
瀏覽更多 Cloud AutoML 相關文章與 Google Cloud 產品應用,詳見 GCP專門家技術部落格,最新知識均在此與您分享。