Dovelet is both a Go wrapper library for the Google Cloud Vision API and a tool to make queries using such wrapper.
The original Pigeon tool and library used a deprecated Google Cloud Vision API. One reason could be that, at the time of writing, its last commit was on Oct 14 2020, which means that the API may have become deprecated somewhere after the last commit. This fork attempts to stay up to date and to pursue a similar purpose. Apart from the usage of deprecated APIs, I think that the original Pigeon codebase was unnecessarily complex. This fork has been renamed to distinguish it from the original.
You need to create a shell variable named GOOGLE_APPLICATION_CREDENTIALS which holds the path of your Service Account private key (replace /path/to/service_account.json). The key type must be JSON.
GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
export GOOGLE_APPLICATION_CREDENTIALSTo generate the credentials file refer to "Authentication with service accounts" and "Create a service account key".
The dovelet executable binary is a command-line tool to interface with the Google Cloud Vision API.
go install github.com/EdoardoLaGreca/dovelet/cmd/dovelet@latestgit clone https://github.com/EdoardoLaGreca/dovelet
cd dovelet
go install ./cmd/dovelet # or: go build ./cmd/doveletUse the dovelet command to make requests. The syntax is as follows.
dovelet -text [ -lang l1,l2,... ] files ...
dovelet -doc [ -lang l1,l2,... ] files ...
dovelet -face files ...
dovelet -image-properties files ...
dovelet -label files ...
dovelet -landmark files ...
dovelet -logo files ...
dovelet -safe-search files ...Where:
l1,l2,...are language hints for better accuracy (see "languageHintscode" in Supported languages)files ...is one or more files to use in the request
You can find more details using dovelet -h.
The dovelet package contains types and functions for simple Cloud Vision queries.
go get https://github.com/EdoardoLaGreca/doveletRefer to cmd/dovelet/main.go for an example.
input:
dovelet -label assets/pigeon.pngoutput:
[
{
"label_annotations": [
{
"mid": "/m/015p6",
"description": "Bird",
"score": 0.96299416,
"topicality": 0.96299416
},
{
"mid": "/m/01c09k",
"description": "Stock dove",
"score": 0.8821084,
"topicality": 0.8821084
},
{
"mid": "/m/01c4rd",
"description": "Beak",
"score": 0.87776655,
"topicality": 0.87776655
},
{
"mid": "/m/036k5h",
"description": "Grey",
"score": 0.8444576,
"topicality": 0.8444576
},
{
"mid": "/m/01c08f",
"description": "Rock dove",
"score": 0.83560807,
"topicality": 0.83560807
},
{
"mid": "/m/01k0mv",
"description": "Road surface",
"score": 0.8078585,
"topicality": 0.8078585
},
{
"mid": "/m/0dfgf",
"description": "Feather",
"score": 0.8044634,
"topicality": 0.8044634
},
{
"mid": "/m/083s2",
"description": "Wing",
"score": 0.74377084,
"topicality": 0.74377084
},
{
"mid": "/m/07sx2n",
"description": "Natural material",
"score": 0.6731261,
"topicality": 0.6731261
},
{
"mid": "/m/0hr8",
"description": "Asphalt",
"score": 0.6372245,
"topicality": 0.6372245
}
]
}
]input:
dovelet -safe-search assets/lenna.jpgoutput:
[
{
"safe_search_annotation": {
"adult": 2,
"spoof": 1,
"medical": 2,
"violence": 1,
"racy": 4
}
}
]- Author of the original software: Shintaro Kaneko

