Javadoc link

Google make exemplary software.  Much of it the publish as open source.  (Thank You Google).  
Some of it, they make impressive services.  This service allows our robots to interact with those services. 

They include Vision, Speech, Translate, & Cloud Machine Learning.

In order to start you need a Google account, and I believe you can start stepping through the necessary forms here.  At some point it will be necssary to get an OAuth json file.  MyRobotLab's GoogleCloud needs to know where this file is.

To create a json OAuth file - you must first sign into google and create a service account.  This link has all the gory details.  At some point eventually you should create a service account and generate a key for that service account.

 

Service Account

 

Create Key

 

JSON file

 

[[service/GoogleCloud.py]]

faces.jpg

Found 20 faces
Writing to file faces.jpg.out.jpg
Labels for image faces.jpg:
person (score: 0.966)
facial expression (score: 0.906)
painting (score: 0.756)
profession (score: 0.743)
portrait (score: 0.699)
emotion (score: 0.680)
moustache (score: 0.512)
 
 
Labels for image kitchen.jpg:
kitchen (score: 0.983)
home (score: 0.951)
cabinetry (score: 0.911)
room (score: 0.911)
residential area (score: 0.879)
estate (score: 0.878)
property (score: 0.823)
dining room (score: 0.806)
real estate (score: 0.706)
flooring (score: 0.695)
wood flooring (score: 0.693)
hardwood (score: 0.684)
interior design (score: 0.559)
floor plan (score: 0.522)
 
Labels for image plumbing.jpg:
trigger (score: 0.857)
exhaust system (score: 0.517)
 
 
Labels for image ship.jpg:
vehicle (score: 0.949)
ship (score: 0.912)
ship of the line (score: 0.875)
ocean liner (score: 0.813)
warship (score: 0.779)
sailing ship (score: 0.778)
frigate (score: 0.776)
full rigged ship (score: 0.731)
naval ship (score: 0.725)
barque (score: 0.715)
mode of transport (score: 0.705)
watercraft (score: 0.657)
clipper (score: 0.646)
tall ship (score: 0.556)
caravel (score: 0.548)

c.m.service.GoogleCloudService - 9022 total ms

Above is the results of using the new GoogleCloud  Service.

References :

FIXME:

  • Standard publishing methods
  • WebGui interface
  • Example with Webcam

 

Example code (from branch develop):
#########################################
# GoogleCloud.py
# description: google api client service
# categories: [google, vision, cloud]
# possibly more info @: http://myrobotlab.org/service/GoogleCloud
#########################################
# start the service
googlecloud = runtime.start("googlecloud","GoogleCloud")
 
# connect to the google cloud back end with the vision api
# this authorization api json file needs to be created 
if googlecloud.connect("../API Project-c90c3d12e7d3.json"):
 
  faces = googlecloud.detectFaces("faces.jpg")
  print("Found ", faces.size(), " faces")
  print("Writing to file ", "facesOutput.jpg")
  googlecloud.writeWithFaces("faces.jpg", "facesOutput.jpg", faces)
 
  print(googlecloud.getLabels("kitchen.jpg"))
  print(googlecloud.getLabels("plumbing.jpg"))
  print(googlecloud.getLabels("ship.jpg"))
  print(googlecloud.getLabels("greenball.jpg"))
Example configuration (from branch develop):
!!org.myrobotlab.service.config.ServiceConfig
listeners: null
peers: null
type: GoogleCloud