kaneshin / Pigeon
Licence: mit
🐦 Pigeon is a Google Cloud Vision library written in Go
Stars: ✭ 112
Labels
Projects that are alternatives of or similar to Pigeon
Secrets Store Csi Driver Provider Gcp
Google Secret Manager provider for the Secret Store CSI Driver.
Stars: ✭ 40 (-64.29%)
Mutual labels: google-cloud-platform
Awesome Gcp Certifications
Google Cloud Platform Certification resources.
Stars: ✭ 1,328 (+1085.71%)
Mutual labels: google-cloud-platform
Deno Serverless Poc
PoC Deno image for Google Cloud Run
Stars: ✭ 41 (-63.39%)
Mutual labels: google-cloud-platform
Cloudml Magic
Jupyter Notebook Magics for Google Cloud ML Engine
Stars: ✭ 58 (-48.21%)
Mutual labels: google-cloud-platform
Cloud Builders
Builder images and examples commonly used for Google Cloud Build
Stars: ✭ 968 (+764.29%)
Mutual labels: google-cloud-platform
Functions Samples
Collection of sample apps showcasing popular use cases using Cloud Functions for Firebase
Stars: ✭ 10,576 (+9342.86%)
Mutual labels: google-cloud-platform
Terraform Security Scan
Run a security scan on your terraform with the very nice https://github.com/liamg/tfsec
Stars: ✭ 64 (-42.86%)
Mutual labels: google-cloud-platform
Unity Solutions
Use Firebase tools to incorporate common features into your games!
Stars: ✭ 95 (-15.18%)
Mutual labels: google-cloud-platform
Grpc Gke Nlb Tutorial
gRPC load-balancing on GKE using Envoy
Stars: ✭ 42 (-62.5%)
Mutual labels: google-cloud-platform
Gcp Pcf Quickstart
Install Pivotal Cloud Foundry on Google Cloud Platform With One Command
Stars: ✭ 54 (-51.79%)
Mutual labels: google-cloud-platform
Gimme
Creating time bound IAM Conditions with ease and flair
Stars: ✭ 92 (-17.86%)
Mutual labels: google-cloud-platform
Cloud Functions Runtime Config
Wrapper around Google API Client to read Runtime Config variables in Cloud Functions
Stars: ✭ 40 (-64.29%)
Mutual labels: google-cloud-platform
Gke Networking Demos
This project presents a number of best practices for establishing network links between Kubernetes Engine clusters, and exposing cluster services across Google Cloud projects. You will use a set of Deployment Manager templates to create networks, subnets, vpn connections, and Kubernetes Engine clusters.
Stars: ✭ 104 (-7.14%)
Mutual labels: google-cloud-platform
Terraform Gcp Kubernetes Traefik
Little example of how to deploy a gke cluster with terraform and use traefik as ingress controller
Stars: ✭ 39 (-65.18%)
Mutual labels: google-cloud-platform
Google Cloud Eclipse
Google Cloud Platform plugin for Eclipse
Stars: ✭ 75 (-33.04%)
Mutual labels: google-cloud-platform
Yummy Phoenix Graphql
Cooking recipe sharing app built with Phoenix, React, GraphQL and Kubernetes
Stars: ✭ 112 (+0%)
Mutual labels: google-cloud-platform
Crmint
Reliable data integration & processing for advertisers
Stars: ✭ 106 (-5.36%)
Mutual labels: google-cloud-platform
My Cheat Sheets
A place to keep all my cheat sheets for the complete development of ASIC/FPGA hardware or a software app/service.
Stars: ✭ 94 (-16.07%)
Mutual labels: google-cloud-platform
Pigeon - Google Cloud Vision API on Golang
pigeon
is a service for the Google Cloud Vision API on Golang.
Prerequisite
You need to export a service account json file to GOOGLE_APPLICATION_CREDENTIALS
variable.
$ export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service_account.json
To generate the credentials file, please, refer to this documentation page
Installation
pigeon
provides the command-line tools.
$ go get github.com/kaneshin/pigeon/cmd/...
Make sure that pigeon
was installed correctly:
$ pigeon -h
Usage
pigeon
command
pigeon
is available to submit request with external image source (i.e. Google Cloud Storage image location).
# Default Detection is LabelDetection.
$ pigeon assets/lenna.jpg
$ pigeon -face gs://bucket_name/lenna.jpg
$ pigeon -label https://httpbin.org/image/jpeg
pigeon
package
import "github.com/kaneshin/pigeon"
import "github.com/kaneshin/pigeon/credentials"
func main() {
// Initialize vision service by a credentials json.
creds := credentials.NewApplicationCredentials("credentials.json")
// creds will set a pointer of credentials object using env value of
// "GOOGLE_APPLICATION_CREDENTIALS" if pass empty string to argument.
// creds := credentials.NewApplicationCredentials("")
config := pigeon.NewConfig().WithCredentials(creds)
client, err := pigeon.New(config)
if err != nil {
panic(err)
}
// To call multiple image annotation requests.
feature := pigeon.NewFeature(pigeon.LabelDetection)
batch, err := client.NewBatchAnnotateImageRequest([]string{"lenna.jpg"}, feature)
if err != nil {
panic(err)
}
// Execute the "vision.images.annotate".
res, err := client.ImagesService().Annotate(batch).Do()
if err != nil {
panic(err)
}
// Marshal annotations from responses
body, _ := json.MarshalIndent(res.Responses, "", " ")
fmt.Println(string(body))
}
pigeon.Client
The pigeon.Client
is wrapper of the vision.Service
.
// Initialize vision client by a credentials json.
creds := credentials.NewApplicationCredentials("credentials.json")
client, err := pigeon.New(creds)
if err != nil {
panic(err)
}
vision.Feature
vision.Feature
will be applied to vision.AnnotateImageRequest
.
// DetectionType returns a value of detection type.
func DetectionType(d int) string {
switch d {
case TypeUnspecified:
return "TYPE_UNSPECIFIED"
case FaceDetection:
return "FACE_DETECTION"
case LandmarkDetection:
return "LANDMARK_DETECTION"
case LogoDetection:
return "LOGO_DETECTION"
case LabelDetection:
return "LABEL_DETECTION"
case TextDetection:
return "TEXT_DETECTION"
case SafeSearchDetection:
return "SAFE_SEARCH_DETECTION"
case ImageProperties:
return "IMAGE_PROPERTIES"
}
return ""
}
// Choose detection types
features := []*vision.Feature{
pigeon.NewFeature(pigeon.FaceDetection),
pigeon.NewFeature(pigeon.LabelDetection),
pigeon.NewFeature(pigeon.ImageProperties),
}
vision.AnnotateImageRequest
vision.AnnotateImageRequest
needs to set the uri of the form "gs://bucket_name/foo.png"
or byte content of image.
- Google Cloud Storage
src := "gs://bucket_name/lenna.jpg"
req, err := pigeon.NewAnnotateImageSourceRequest(src, features...)
if err != nil {
panic(err)
}
- Base64 Encoded String
b, err := ioutil.ReadFile(filename)
if err != nil {
panic(err)
}
req, err = pigeon.NewAnnotateImageContentRequest(b, features...)
if err != nil {
panic(err)
}
Submit the request to the Google Cloud Vision API
// To call multiple image annotation requests.
batch, err := client.NewBatchAnnotateImageRequest(list, features()...)
if err != nil {
panic(err)
}
// Execute the "vision.images.annotate".
res, err := client.ImagesService().Annotate(batch).Do()
if err != nil {
panic(err)
}
Example
Pigeon
input
$ pigeon -label assets/pigeon.png
output
[
{
"labelAnnotations": [
{
"description": "bird",
"mid": "/m/015p6",
"score": 0.825656
},
{
"description": "anatidae",
"mid": "/m/01c_0l",
"score": 0.58264238
}
]
}
]
Lenna
input
$ pigeon -safe-search assets/lenna.jpg
output
[
{
"safeSearchAnnotation": {
"adult": "POSSIBLE",
"medical": "UNLIKELY",
"spoof": "VERY_UNLIKELY",
"violence": "VERY_UNLIKELY"
}
}
]
License
Author
Shintaro Kaneko [email protected]
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].