Image Recognition in Ruby

Competitive Landscape

Use Cases

Getting Started

gcloud auth list
Credentialed accounts:
- <myaccount>@<mydomain>.com (active)
gcloud config list project
project = <PROJECT_ID>
gcloud services enable

4. Create a service account

export GOOGLE_APPLICATION_CREDENTIALS="/Users/AndyXcode/Downloads/Mod-3-Blogpost-fff77bdf1b10.json"t
export GOOGLE_CLOUD_PROJECT="/Users/AndyXcode/Downloads/Mod-3-Blogpost-fff77bdf1b10.json"

5. Install the Cloud Vision Gem

gem install google-cloud-vision -v 0.27.0

6. Download the sample ruby repository

git clone
cd ruby-docs-samples
git checkout "a902f30dd449ce82469cc315610c8a3d4888ff5a"
cd vision

7. Start IRB

irb --noecho

8. Sample an Image

require "google/cloud/vision"vision =
**select an image**
image = vision.image "images/otter_crossing.jpg"

9. Explore API

10. Perform image analysis

image.landmarks.each do |landmark|
puts landmark.descriptionlandmark.locations.each do |location|
puts "#{location.latitude}, #{location.longitude}"
image = vision.image "images/imagine.png" => [#<Google::Cloud::Vision::Annotation::Entity mid: "/m/013397", locale: "", description: "Strawberry Fields (memorial)", score: 0.416331022977829, confidence: 0.0, topicality: 0.0, bounds: 4, locations: 1, properties: {}>]
Strawberry Fields (memorial)40.775744, -73.975281
puts image.text
IMAG NE=> nil
Take screenshot of student in the class and run an emotion detection



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store