Amazon Rekognition Video 技術疑難排除

亞馬遜提供的雲端服務 (AWS) Amazon Rekognition,透過深度學習技術進行電腦視覺辨識,「可識別影像和影片中的各種物體、人物、文字、場景和活動,也可以偵測任何不當的內容。」(資料來源:AWS) 以下文章列出遇到的技術問題與解決方式。

Icons made by Eucalyp from www.flaticon.com


問題1: An error occurred (InvalidS3ObjectException) when calling the DetectLabels operation: Unable to get object metadata from S3. Check object key, region and/or access permissions.

輸入開始辨識標籤指令後,遇到如以上的錯誤訊息: 

aws rekognition start-label-detection --video "S3Object={Bucket=YOUR_BUCKET_NAME,Name=YOUR_VIDEO_FILE}" \ --region us-east-1

解決方式:

(1) 請確定 Bucket=YOUR_BUCKET_NAME 中的 S3 Bucket 名稱是否正確

(2) 請確定 Name=YOUR_VIDEO_FILE 中,位於 S3 Bucket 的檔案名稱和路徑是否正確


問題2: An error occurred (ValidationException) when calling the StartLabelDetection operation: 2 validation errors detected: Value 'TopicARN' at 'notificationChannel.sNSTopicArn' failed to satisfy constraint: Member must satisfy regular expression pattern: (^arn:([a-z\d-]+):sns:.*:\w{12}:.+$); Value 'RoleARN' at 'notificationChannel.roleArn' failed to satisfy constraint: Member must satisfy regular expression pattern: arn:([a-z\d-]+):iam::\d{12}:role/?[a-zA-Z_0-9+=,.@\-_/]+

輸入開始辨識標籤指令後,遇到如以上的錯誤訊息: 

aws rekognition start-label-detection --video "S3Object={Bucket=YOUR_BUCKET_NAME,Name=YOUR_VIDEO_FILE}"  --notification-channel "SNSTopicArn=TopicARN,RoleArn=RoleARN"  --region us-east-1

解決方式:

請檢查 Amazon SNS 設定,詳見文章。如果影片數量不多且可以預估完成時間,則可考慮不啟用通知機制,刪除 --notification-channel 選項,命令將改成:

aws rekognition start-label-detection --video "S3Object={Bucket=YOUR_BUCKET_NAME,Name=YOUR_VIDEO_FILE}"   --region us-east-1

問題3: FAILED 2.8 'Unsupported codec/format

輸入取得辨識標籤結果的指令後,遇到錯誤訊息「FAILED 2.8 'Unsupported codec/format」: 

aws rekognition get-label-detection --job-id <JOB_ID> --region us-east-1

解決方式:

請確認影片檔案格式與影片編碼是否是 AWS 文件 要求的「支援 MPEG-4 (.mp4) 或 MOV 格式的 H.264 檔案」。(Windows 可以使用 VLC media player 確認 H.264 編碼)

Mac 確認影片編碼方式,可以使用內建的 QuickTime player,開啟影片檔案。點選選單的「顯示影片檢閱器」,即可查看影片編碼。



問題4: 線上分析網頁只支援一分鐘的影片


解決方式: 該網頁比較是示範用途。如果需要分析超過一分鐘的影片,請將檔案上傳到 S3 Bucket 並改用程式或 AWS CLI ,詳見 SDK 開發人員指南


參考資料


影片來源

留言