溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

使用Azure Function + Cognitive Services 實現圖片自動化審核

發布時間:2020-07-03 07:27:45 來源:網絡 閱讀:3546 作者:wuyvzhang 欄目:云計算



假定我們正在運行某個應用程序,此應用程序需要用戶在應用程序中提交大量圖片文件,那么對于系統管理員來說手動審核這些圖片是很消耗時間的,并且對于圖片的審核也許并不是即時的。為了解決這一問題,這篇文章將向大家演示如何使用Azure Function和Cognitive Services來對上傳到應用程序的圖片進行自動化審核。

再正式開始今天的實驗之前我們先帶大家了解一下本次實驗所有到的一些Azure功能:

l Azure Function:Azure Functions是一種無服務器計算服務,使您可以按需運行代碼,而無需顯式配置或管理基礎結構。使用Azure Functions運行腳本或代碼片段以響應各種事件

l Cognitive Services:Azure Cognitive Services是API,SDK和服務,可幫助開發人員構建智能應用程序,而無需直接的AI或數據科學技能或知識。Azure認知服務擴展了微軟不斷發展的機器學習API產品組合,使開發人員能夠輕松添加認知功能 - 例如情感和視頻檢測; 面部,語言和視覺識別; 和語言和語言理解 - 進入他們的應用程序

l Content Moderator:Azure Content Moderator API是一種認知服務,可檢查文本,圖像和視頻內容,查找可能具有***性,風險或其他不良內容的材料。找到此類材料后,該服務會對內容應用適當的標簽(標記)。然后,您的應用可以處理已標記的內容,以符合法規或維護用戶的預期環境。

l Azure Blob Storage:Azure Blob存儲是Microsoft針對云的對象存儲解決方案。Blob存儲優化用于存儲大量非結構化數據。非結構化數據是不遵循特定數據模型或定義的數據,例如文本或二進制數據。

下面是我們今天實驗的基本拓撲:

使用Azure Function + Cognitive Services 實現圖片自動化審核

創建Content Moderator

點擊“新建”—“Content Moderator”—“創建”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

輸入相關信息,點擊創建:

使用Azure Function + Cognitive Services 實現圖片自動化審核

創建完成,如下圖所示,我們點擊“Show access keys并將此值記錄下來”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

使用Azure Function + Cognitive Services 實現圖片自動化審核

創建Function App和Storage

創建Function App

點擊“新建”—“計算”—“Function App”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

輸入如下參數,點擊創建:

使用Azure Function + Cognitive Services 實現圖片自動化審核

創建成功,如下圖所示:

使用Azure Function + Cognitive Services 實現圖片自動化審核

點擊“新建Function”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

在此選擇“自定義Function”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

選擇“Blob trigger”—“C#”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

修改名稱和路徑,點擊創建:

使用Azure Function + Cognitive Services 實現圖片自動化審核

創建成功,如下圖所示:

使用Azure Function + Cognitive Services 實現圖片自動化審核

點擊“集成”—“+新建輸出”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

選擇“Azure Blob存儲”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

將路徑修改為“Container1/{name}”,點擊保存:

使用Azure Function + Cognitive Services 實現圖片自動化審核

配置Storage

創建container1和container2,如下圖所示:

使用Azure Function + Cognitive Services 實現圖片自動化審核

配置Function + Cognitive Services實現圖片自動審核:

打開我們之前創建的Function,點擊“ImageAnalysis”:

使用Azure Function + Cognitive Services 實現圖片自動化審核

將之前創建Content Moderator時所保存的Key替換到如下位置:

使用Azure Function + Cognitive Services 實現圖片自動化審核

點擊保存:

使用Azure Function + Cognitive Services 實現圖片自動化審核

測試功能

測試“無效“圖片:

上傳“無效“圖片到Container1,如下圖所示:

使用Azure Function + Cognitive Services 實現圖片自動化審核

使用Azure Function + Cognitive Services 實現圖片自動化審核

圖片上傳完成,我們可以看到如下Log:

使用Azure Function + Cognitive Services 實現圖片自動化審核

上傳“有效“圖片

上傳“有效“圖片到Container1:

使用Azure Function + Cognitive Services 實現圖片自動化審核

使用Azure Function + Cognitive Services 實現圖片自動化審核

上傳成功可以看到如下Log:

使用Azure Function + Cognitive Services 實現圖片自動化審核

同時我們的圖片會被添加水印并存儲再Container2:

使用Azure Function + Cognitive Services 實現圖片自動化審核

添加水印的圖片如下圖所示:

使用Azure Function + Cognitive Services 實現圖片自動化審核

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女