• Understands the content of submitted images.
• Encapsulating powerful machine learning models.
• Classifies images into thousands of categories.
• detects individual objects
• faces within images
• finds and reads printed words contained within images.
• Official Documentation
• https://cloud.google.com/vision/docs/
Cloud Vision API
Slide 12
Slide 12 text
pigeon - Cloud Vision API on Golang
Slide 13
Slide 13 text
pigeon
• A package for the Google Cloud Vision API on Golang.
• It provides command and web app.
• Repository
• https://github.com/kaneshin/pigeon
Slide 14
Slide 14 text
Getting Started
• Enabling the Google Cloud Vision API
• API Manager > Overview > Cloud Vision API
• Setting Up a Service Account
• API Manager > Credentials > Create Credentials
• Get service account credentials json file
$ export GOOGLE_APPLICATION_CREDENTIALS
=~/.credentials/service_account.json
Slide 15
Slide 15 text
Installation
• The pigeon provides the command-line tools.
• a
• Make sure that pigeon was installed correctly:
$ go get github.com/kaneshin/pigeon/tools/cmd/...
http.DefaultTransport and http.DefaultClient
are not available in App Engine. See https://
developers.google.com/appengine/docs/go/
urlfetch/overview
Slide 42
Slide 42 text
http.DefaultTransport and http.DefaultClient
are not available in App Engine. See https://
developers.google.com/appengine/docs/go/
urlfetch/overview
Slide 43
Slide 43 text
Use urlfetch.Client/Transport
Slide 44
Slide 44 text
Why urlfetch?
• Using Google's network infrastructure
• For efficiency and scaling purposes.
Slide 45
Slide 45 text
http.Client on GAE via OAuth2
httpClient := &http.Client{
Transport: &oauth2.Transport{
Source: google.AppEngineTokenSource(ctx, scope),
Base: &urlfetch.Transport{Context: ctx},
},
}
Slide 46
Slide 46 text
GAE Oriented
• Unavailable packages including Sirupsen/logrus
• PR: https://github.com/Sirupsen/logrus/pull/343
• Some packages can’t access to http.Client to send a request.
• Web Application Framework
• Double Context Problem. (Complicated)
Slide 47
Slide 47 text
GAE Oriented - http.Client Best Practice
type (
// A Config provides service configuration for service clients.
// all clients will use the {defaults.DefaultConfig} structure.
Config struct {
// The credentials object to use when signing requests.
// Defaults to application credentials file.
Credentials *credentials.Credentials
// The HTTP client to use when sending requests.
// Defaults to `http.DefaultClient`.
HTTPClient *http.Client
}
)
Slide 48
Slide 48 text
recruit.eure.jp
Slide 49
Slide 49 text
Thank you
Credit: NASA Earth Observatory/NOAA NGDC