Sending image data to Google Cloud for training machine learning models
Configuring a Separate Cloud Pub/Sub Topic
- Setting up your Pub/Sub topic and subscription
Log into GCP Console.
- Go to the Pub-Sub of the Google Cloud Console.
Follow the prompt to enable the API.
Click Create a topic. Publishing applications send messages to topics. Let say use 'camera-data' as the Name.
By default, the console will also create a default subscription with the name: camera-data-sub. Keep the ‘Add a default subscription’ enabled Click ‘Create topic’ to create the topic and default subscription
Creating service account credentials
- In the Cloud Console, go to the Service Account.
- Select your project.
- Click Create Service Account.
- In the Service account name field, enter a name: pubsub-publisher. The Cloud Console fills in the Service account ID field based on this name.
- Click Create and continue.
- The service account needs publishing permissions. Use the Select a role dropdown to add the Pub/Sub Publisher role.
- Tip: Use the string pub to filter for Pub/Sub roles.
- Click Add another role and add Pub/Sub Subscriber.
- Click Done to finish creating the service account.
- Do not close your browser window. You will use it in the next step.
- Download a JSON key for the service account you just created. The client library uses the key to access the Pub/Sub API.
- In the Cloud Console, click the email address for the service account that you created.
- Click Keys.
- Click Add key, then click Create new key.
- Click Create. A JSON key file is downloaded to your computer.
- Rename the key file to credentials.json (OPTIONAL)
Install pip requirements from
pip3 install -Ir requirements-gcp.txt --user --no-cache-dir
Note
You may see errors on installing pip requirements on some platforms which required pip upgrade. Use pip3 install --upgrade pip
- Load JSON key for service account in certificate store.
via curl command
$ curl -sF "cert=@credentials.json" -F "overwrite=1" http://localhost:8081/fledge/certificate
Note
where credentials.json is the service account file
via GUI
Go to Certificate Store -> Import -> Choose certificate -> Import