As a start it is a good practise to create a project folder and create a virtual environment.
Create the environment like this:
python3 -m virtualenv your-virtual-env
activate it with:
Follow this guide to get started and try the vision API using the command line. https://cloud.google.com/vision/docs/quickstart-cli
Use this python script to get a request json you can send to the Vision API.
You can use the script like this:
python image2request_json.py path/to/your/img
Make the request:
curl -X POST \ -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \ -H "Content-Type: application/json; charset=utf-8" \ https://vision.googleapis.com/v1/images:annotate -d @your-request.json > your-response.json
The Quickstart guide for using the client libraries can be found here:
Use this python script to directly request the data via python and get a reduced json, that only includes recognized labels/objects and the scores they have.
python vision_request.py path/to/your/img
Robert, July 16th, 2020