This practical lab introduces the participants to the affordances of Google Cloud Vision API in research and Memespector-GUI. Memespector-GUI is a tool with a graphical user interface (GUI) which helps researchers use Google Vision API.
- Introduction to Google Vision API
- Signing up for Google Cloud
- Obtaining a credential file
- Downloading Memespector-GUI
- Opening Memespector-GUI for the first time
- Using Memespector-GUI
Google Vision API extract information from images using pre-trained artificial intelligence models. It detects faces, emotions, text and explicit content, and suggests labels and similar images on the web. See here for a full list of features. The easiest way to try out Google Vision API is to use Google’s drag-and-drop demo.
Just drop an image file from your computer into the designated area to see what Google Vision API can tell you about the image.
The drag-and-drop demo is good enough if you only have a few images at hand to process. In research, you may need to process hundreds or even thousands of images. When you need to analyse images in batch, you should sign up for Google Cloud and use a suitable API client.
If you have signed up for Google Cloud already, please jump to Obtaining a credential key file.
Log on to Google Cloud Platform using your Gmail account. Click Activate
on the top right corner or TRY FOR FREE
in the centre.
Choose your country and check the box to agree to the service terms. Click CONTINUE
.
Complete the form with your name, address and details of your payment card.
You must provide Google with a valid debit / credit card. Otherwise, you will not be able to use Google Vision API. From my experience, Google will check if your card is valid but will not charge on your card when you sign up.
Click START MY FREE TRIAL
when you are done.
After signing up for Google Cloud, you need to create a project, enable Vision API and create a service account before you can use Google Vision API.
Click Select a project
on the top. Then Click NEW PROJECT
.
Give a name to the project. Click CREATE
.
Click the sandwich menu button on the top left. Navigate to API & Services
-> Library
.
Click Cloud Vision API
If you are unable to find Cloud Vision API
for some reason, please type vision
into the search box. You should be able to see it now. Click Cloud Vision API
.
Click Enable
Click the sandwich menu button on the top left. Navigate to IAM & Admin
-> Service Accounts
.
Click CREATE SERVICE ACCOUNT
.
Give a name to the account. It is usually a name for your computer as service accounts are usually issued to computers. Click CREATE
.
Click Select a role
Navigate to Basic
-> Owner
.
Click CONTINUE
.
Leave these fields blank. Click DONE
.
Under Actions
on the right-hand side, click the sandwich button on the row of the service account you created just now. Click Create key
.
Select JSON
for Key type
. Click CREATE
.
Your browser should automatically download a .json file or ask you to save a .json file. This is the Google Cloud credential file
that Memespector-GUI will need. Please move the credential file to a safe location after downloading.
Visit here to download Memesecptor-GUI. Under Assets
, choose the zip file that corresponds to the operating system on your computer.
For Windows, please choose the win64 version by default. Choose the win32 version if the win64 version does not work or you are sure that your Windows is 32-bit which is usually found on older computers.
When you open Memespector-GUI for the first time on Windows or Mac, the operating system may decline to run Memespector-GUI because of tightened security measures. You have to take some extra steps to ask Windows or Mac to allow Memespector-GUI to run on your computer.
Usually, you will only need to take these extra steps once. Next time, Memespector-GUI should run without further hindrance.
After extracting the zip file, you will see the file Memespector-GUI.exe
with an eye's icon. (Note: The file extension .exe may be hidden depending on the settings.) Double click on it to open Memespector-GUI.
If you see a window telling you not to run the app, click More info
.
You will see that a new button will appear at the bottom. Click Run anyway
. Then, Memespector-GUI should open in a few seconds.
Safari may have extracted the zip file automatically for you after downloading it. Open the Memespector-GUI-macOS
folder and click Memespector-GUI
inside.
If you see a window asking that are you sure you want to open Memespector-GUI, click Open
. Then, Memespector-GUI should open in a few seconds.
However, in some cases, you may not see the window above but instead encounter another window without an Open button. In this case, see the additional steps as follows.
In case you see a window telling you that Memespector-GUI cannot be opened, click Ok
.
Open System Preferences on your Mac. Click Security & Privacy
.
Navigate to the General
tab. You should be able to see "Memespector-GUI" was blocked from use because it is not from an identified developer
at the bottom of the tab. Click Open Anyway
to the right of that message.
Click Open
.
Note: The graphical user interfaces of Memespsector-GUI are nearly identical across the Windows, Mac and Linux versions. For illustrative purpose, the screenshots of the Windows version are used in this document. The following steps also apply to the Mac and Linux versions of Memespector-GUI.
Click Browse
to the right of the field for Google Cloud credential file
.
Select the .json file you downloaded at the end of creating a service account.
Check the features that you want Google Vision API to detect in the images.
- Safety - adult, violent and racist elements
- Face - emotional expressions of faces
- Label - generalised labels defined by Google
- Web - web entities (inferred descriptions from similar images on the web), similar images, full/partial matching images, visually similar images and web pages with matching images
- Text - the text recognised
- Landmark - well-known or prominent sites
- Logo - logos of popular products
Click files on this computer
. Select the image files. Click Open
. The locations of the image files will be added to the Image locations
box.
If you want to add all images inside a folder with many sub-folders which also contain images, click a folder on this computer
. Select the folder. The locations of all image files inside the folder and its sub-folders will be added to the Image locations
box.
Copy and paste the URLs of the images into the Image locations
box. Put one URL per line.
Memespector generates two output files. The JSON file stores the structured data values in full generated by Google Vision API. The CSV file contains a version of the data transformed into a tabular format which may be easily opened using general software tools.
Click Browser
to the right of each field to change the name and location of an output file.
Click Invoke Google Cloud Vision API
after you have selected your Google Cloud credential file
, added image files or URLs to the Image locations
box and/or edited the output filenames.
Memespector-GUI will show the progress of sending the images to the Google Vision API.
Once all images are processed, a message about the completion will be shown. Open the output files to see the results.