2019/04/24 交大 Azure AI Cognitive services 體驗課程
===
本文件網址:
http://wwjd.tw/929k891
講師聯絡方式:
david@isrock.com.tw
### Azure Cognitive Services 課程須知
#### 課前準備:
1.Microsoft Account(請務必於上課前申請)
https://account.microsoft.com/account?lang=zh-TW
2.Azure Portal Account(請務必於上課前申請,上課中申請失敗率非常高,同一個對外IP短時間內無法多次申請)
https://azure.microsoft.com/zh-tw/free/
或
https://azure.microsoft.com/zh-tw/free/students/
3.LINE Account (設計Chat Bot用,請務必於上課前申請,但我猜你一定有)
4.手機(收取簡訊驗證身分用)
5.信用卡(如果無法於上課前申請完成Azure Account則可能需要)
#### 學員上課環境:
1.Windows 10中文版
2.Visual Studio Code
https://code.visualstudio.com/
3.Visual Studio 2017/2019 Community 以上版本 (windows版)
https://visualstudio.microsoft.com/zh-hant/vs/community/
4.Postman
https://www.getpostman.com/downloads/
5.建議使用 Chrome 瀏覽器
您可以用LINE 搜尋 @jtv0835u 將其加入好友即可測試
或掃描QR Code

#### 翻譯王

您可以用LINE 搜尋 @ejn1954w 將其加入好友即可測試
或用手機點選底下連結:
https://line.me/R/ti/p/%40ejn1954w
或掃描QR Code

#### cognitive services URL: https://azure.microsoft.com/zh-tw/services/cognitive-services/computer-vision/
### Lab 20.測試與建立Computer Vision服務
1.造訪 https://azure.microsoft.com/zh-tw/services/cognitive-services/computer-vision/
2.嘗試上傳一張照片測試
3.以MS Account登入 https://azure.microsoft.com/zh-tw/try/cognitive-services 建立免費試用 或 使用 Azure Portal申請key
4.取得 endpoint 與 key 1, key 2
5.下載測試程式
https://github.com/isdaviddong/Demo-CognitiveServices
可執行範例程式:
A>
http://arock.blob.core.windows.net/blogdata201904/%E4%BA%BA%E8%87%89%E8%BE%A8%E8%AD%98.zip
B>
http://arock.blob.core.windows.net/blogdata201904/%E5%8D%B3%E6%99%82%E7%BF%BB%E8%AD%AF.zip
6.取得 Key1(8b178c6a180647e7807f4a013d26bf68), endpoint , 替換程式碼
7.endpoint 應該類似
https://westcentralus.api.cognitive.microsoft.com/vision/v1.0
:::info
Exercise
1.如何辨識圖片的內容(顯示圖說)?
:::
### Computer Vision API 文件:
https://westus.dev.cognitive.microsoft.com/docs/services/56f91f2d778daf23d8ec6739/operations/56f91f2e778daf14a499e1fa
使用postman:


使用 http post 呼叫 Computer Vision
```
POST /vision/v1.0/analyze?visualFeatures=Description HTTP/1.1
Host: southeastasia.api.cognitive.microsoft.com
Ocp-Apim-Subscription-Key: 換成自己的key
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 4ff32e01-1c53-9598-26c8-f1bd37c02ee7
{"url":"https://i.imgur.com/pBNAy1L.png"}
```
使用 http post 呼叫 Computer Vision(python)
```python=
import http.client
conn = http.client.HTTPSConnection("韓換成你的area.api.cognitive.microsoft.com")
payload = "{\"url\":\"https://i.imgur.com/pBNAy1L.png\"}"
headers = {
'ocp-apim-subscription-key': "換成自己的key",
'content-type': "application/json",
'cache-control': "no-cache",
'postman-token': "4ee26ac7-3f42-9a1e-37da-2ade0435f520"
}
conn.request("POST", "/vision/v1.0/analyze?visualFeatures=Description", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
```
### Lab 22. 使用LUIS進行自然語言識別
1.https://www.luis.ai
2.建立LUIS App
參考文章:
https://studyhost.blogspot.com/2016/08/bot-framework-4-luis.html
參考影片:
https://channel9.msdn.com/Shows/NET-Walker-5/luis-1
:::info
Exercise 目標:
建立
1.客訴行為、點餐行為 兩個intents
2.建立 餐點名稱、飲料名稱 兩個entities
```
參考語句:
我要點一份燒餅油條
麻煩你我需要一份蛋餅
給我來個大亨堡
三明治帶走
今天請幫我來一個飯糰
```
:::
memo:
只要train變成紅色都要點選並Publish
### 23.訓練LUIS
review endpoint utterrance

相關資源:
===
LINE Bot blog: http://studyhost.blogspot.com/2018/01/index-clinebot.html
LineBotSDK:https://www.nuget.org/packages/LineBotSDK
相關課程:http://www.studyhost.tw/NewCourses/LineBot
線上課程:https://www.udemy.com/line-bot/
LINE Bot實體書籍:https://www.tenlong.com.tw/products/9789865020354
更多內容,請參考電子書:https://www.pubu.com.tw/ebook/103305
最新消息:
===
您可透過Line App搜尋 『@studyhost』或 點選底下網址加入好友:
https://line.me/R/ti/p/%40dfe5542k
也可以使用Line App掃描底下QR Code加入:

各種最新消息、活動、課程、書籍更新,我們都會透過LINE@優先發送給您。如果有任何非技術性的問題,也可隨時與我們的LINE線上服務人員聯繫。
若有技術問題,可直接在講師的FB專頁中與講師聯繫。
https://www.facebook.com/DotNetWalker/