Google Vision - Batch Image Annotation, map result to request images - google-cloud-platform

I'm using Google Vision to detect text in images (on my backend written in kotlin).
I want to do a batch request with multiple images from a web url but the problem I'm facing is how to know what results maps to what image in the request?
Can I rely on Google to return the result in the same order as I put them into the batch request?
Currently I do not get any information in the response that I can use to figure out to what image the annotated text belongs to. And it's important that the text can be mapped to the correct image.
If you need more information please let me know and I'll provide it to you.

The responses are in the same order as they are in the request.

Related

AWS Rekognition Service: Improve facial recognition accuracy

I'm finding the right way to use AWS Rekognition service.
My problem is How to verify a person image on multi collections, I'm reading Build Your Own Face Recognition Service Using Amazon Rekognition | AWS Machine Learning Blog from Amazon but cannot find the implementation document for it. My point is Face verification title.
Update 1:
My target is: Using AWS Rekognition to get person's info by their face.
My problem is: How to make AWS Rekognition improves its accuracy when recognizing a face.
What I tried:
Upload multi captured portraits of a person with same ExternalImageID but I'm not sure it works or not.
Finding a way to create Collection for each person, then upload person's portraits to their Collection but I don't how to search a face through multiple Collections.
I'm trying use S3 for storage people's images then using Lambda function to do something that I've not got yet.
Update 2:
What is your input material: Input materials are some people's portrait photo with ExternalImageID is their name (eg: my portrait photo will have ExternalImageID is "Long").
What are you trying to do: I'm trying to get ExternalImageID when I send a portrait photo of a registered person. (eg: with my other portrait photo, AWS has to response ExternalImageID is "Long").
Do you have it working, but it is not recognizing some people? Yes, it's work but sometimes it cannot recognize exactly people.
Please tell us your use-case / scenario and what you are trying to accomplish:
Create an AWS Rekognition collection with sample name (eg facetest).
Register some people with their name is ExternalImageID.
Submit an image to AWS Rekognition API to get ExternalImageID - his name.
Okay, so basically you have it working but it doesn't always recognise the person. I'll assume it does not even list the person in the response, even with a low percentage.
I would recommend adding multiple images of the same person to the Face Collection, specifying the same ExternalImageId for each image. (Use one Face Collection with all people in it, including multiple images of the same person.)
Please note that "If you provide the same image, specify the same collection, and use the same external ID in the IndexFaces operation, Amazon Rekognition doesn't save duplicate face metadata." However, adding different images with the same ExternalImageId should be fine.

Resize Google Cloud images via request URL?

I need a CDN of images where I can resize the image from URL parameter. So for instance if I wanted a 400px wide version I would use www.cdn.com/image-400 and if I wanted a 200px version it would be www.cdn.com/image-200
From looking at this blog post it seems Google Cloud can do this:
https://medium.com/google-cloud/uploading-resizing-and-serving-images-with-google-cloud-platform-ca9631a2c556
Im having trouble understanding the article however and i wonder if its out of date. One of links to Google's documentation says you should use instead use Google Cloud Storage https://cloud.google.com/appengine/docs/standard/python/blobstore/
I came across these 2 SO questions but they seem to give opposite answers:
Get resized images from Google cloud storage
Resize image in Google Cloud Storage
Can Google Cloud resize images based on the url? If so, then how can you do this? I have a bucket set up in Google Cloud Storage, can you use images from a bucket like this?
First of all yes, it is possible, but as the first SO answer you shared it is not directly implemented and as you noticed the process it is not as straightforward as adding =sxx to an URL of a bucket.
Therefore writing https://storage.googleapis.com/bucketname/file.jpg=sxx does NOT work.
In order to create a URL capable to support this features you have to make use of Images API for Java, in particular the getServingUrl() method (there is also the GO or Python version of it) that will generate a new URL with the very same shape of the URL contained in the article you shared.
Once you retrieved the URL making use of the API you will be able to get the resized images, quoting directly from the official documentation you will be able to add:
=sxx where xx is an integer from 0–2560 representing the length, in pixels, of the image's longest side. For example, adding =s32 resizes the image so its longest dimension is 32 pixels.
=sxx-c where xx is an integer fro
m 0–2560 representing the cropped image size in pixels, and -c tells the system to crop the image.

Google Earth: is a dynamic parametrized KML possible?

I made a large KML file ca. 23 MBytes long. Google Earth renders it very long period of time, lags and occupies 1GB RAM and more. On slower computers it may also not to render some areas.
So the idea is to use a parametrized GET request to the server returning kml data only for a region with specified boundaries.
Can GoogleEarth initiate and use such requests?
What you're asking can be done with a NetworkLink. If you dynamically generate the KML from a servlet, web-service, script, etc. then you can instruct Google Earth to send the bounding box for its view from which you can generate the KML to return. This approach requires hosting a custom "service" on an application server/web server that can generate KML in response to requests sent by Google Earth.
In your root-level NetworkLink you need to define refreshMode=onChange to refesh when view is changed along with the URL to the servlet. Recommended to set viewRefreshMode=onStop with a viewRefreshTime element so the data is only fetched 1 second after the user stops zooming/moving around otherwise the data is continually refreshed. Also the viewFormat is needed to instruct Google Earth to return the bounding box of the view. In this example, the BBOX parameter is added to the HTTP parameters sent to the servlet in an HTTP GET request.
<Link>
<href>servlet-url</href>
<refreshMode>onChange</refreshMode>
<viewRefreshMode>onStop</viewRefreshMode>
<viewRefreshTime>1</viewRefreshTime>
<viewFormat>BBOX=[bboxWest],[bboxSouth],[bboxEast],[bboxNorth]</viewFormat>
</Link>
If your data spans a large area then you could break up the data into separate KML files then specify Region-based NetworkLinks in parent KML file. This approach would allow you to generate the data once as static KML files and only serve up what data is "active" based on the user's view.
Related Tutorial:
https://developers.google.com/kml/documentation/regions#regionbasednl
Reference:
https://developers.google.com/kml/documentation/kmlreference#networklink
https://developers.google.com/kml/documentation/kmlreference#region
https://developers.google.com/kml/documentation/kmlreference#viewformat
Yes, this isn't a problem at all. You add the source URL of you KML in Google Earth as a URL with parameters and then load it as several separate sources. With that approach though you are only 'dynamically' providing the criteria at the time you add the KML to GE, and from then on it looks like any other static KML file you would have loaded.
EDIT I see now (logging into GE) that it actually calls these network links as described by #JasonM1 (under Add->NetworkLink)

Upload Photos using Silverlight - Ria Services

i'm trying to find a good exemple on uploading and downloading images using solely Silverlgith + Ria Services, i tried to find some but i failed, please any help would be appreciated.
thank you all in advance
I just found some useful walk trough here and make sure to read follow-up that improves the save process and used image
We did it by saving the images on disk (not in a DB) - like this:
Upload image:
Write a Domain Service with an operation like void UploadJPGImage(string uniqueName, byte[] jpgBytes). This needs to be marked with the attribute for ClientAccess. The (server-side) implementation saves the image on the disk.
for the uniqueName, we generate a GUID client-side
Download image:
HTTP Handler - write an HTTP handler for downloading the image using a URL containing the unique name parameter passed by the client when uploading the image
Or, one could write a Domain Service operation, like byte[] DownloadJPGImage(string uniqueName)

How do I track images embedded in HTML?

I'd like to track the views/impressions of images on web pages, but still allow the images to be embedded in HTML, like in the "img src="http://mysite.com/upload/myimage.jpg"/" element.
I know in Windows I can write a handler for ".jpg" so the URL will actually trigger a handling function instead of loading the images from disk. Is it possible to do that in python/django on Ubuntu server? Can web browser still cache the jpg files if it is not a straight file path?
It looks to me that this is how google picasaweb handles the image file name. I'd like to get some ideas on how to implement that.
Thanks!
-Yi
If you want images to not be cached, just append a timestamp to them. This example is in PHP, but you get the idea:
<img src=<?php echo '"../images/myimage.gif?'.time().'"'; /* Append time so image is not cached */ ?>
Then you can analyze your logs to track views, etc.