Daniel Vieira
Daniel Vieira

Reputation: 471

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

I have trained a model using google cloud AutoML Vision API, however when I specifically try to obtain the model performance metrics via the Python package I keep getting a 403 response:

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).

I am using the python code as layed out in the documentation and also not having any unauthorised ops with the other operations (Create Dataset, Train Model), so really struggling to understand why is this the case. Here is the code:

# 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_)

Thanks for your help

Upvotes: 0

Views: 208

Answers (1)

Daniel Vieira
Daniel Vieira

Reputation: 471

After a few tests I found the problem. When calling out the model details you need to use model_id and not model_name, whereas in the previous API calls in the documentation the model_name was the identifier to use.

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

This fixed the issue.

Upvotes: 3

Related Questions