簡體   English   中英

盡管已分配了正確的服務帳戶,但使用Google AutoML vision Python API仍獲得403響應

[英]getting a 403 response with Google AutoML vision Python API despite having assigned right Service Account

我已經使用Google Cloud AutoML Vision API訓練了一個模型,但是當我專門嘗試通過Python包獲取模型性能指標時,我一直收到403響應:

PermissionDenied: 403 Permission 'automl.modelEvaluations.list' denied on resource 'projects/MY_BUCKET_ID/locations/us-central1/models/MY_MODEL_ID' (or it may not exist).

我使用的是文檔中列出的python代碼,並且其他操作(創建數據集,訓練模型)也沒有未經授權的操作,因此我很難理解這種情況。 這是代碼:

# Get the full path of the model.
model_full_id = client.model_path(project_id, compute_region, model_id)
print(model_full_id)

# List all the model evaluations in the model by applying filter.
response = client.list_model_evaluations(model_full_id, filter_)

謝謝你的幫助

經過幾次測試,我發現了問題。 調出模型詳細信息時,您需要使用model_id而不是model_name,而在文檔中先前的API調用中,model_name是要使用的標識符。

model_full_id = client.model_path(project_id, compute_region, model_id)

這解決了問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM