Chad Johnson’s recent observations on Google’s Cloud Vision API led us to start thinking of ways the image recognition software could be utilized within Adobe Experience Manager (AEM). Automatic asset tagging immediately sprang to mind. This solution reduces the burden on the end user in manually identifying and tagging the assets with relevant metadata. Google’s Cloud Vision API is pretty amazing. It may not completely remove the end user’s involvement in the tagging process, but certainly eases the task. The end result is rich taxonomy structures for improved search capabilities on the DAM Assets.
AEM Implementation
Google provides an easy to use REST API for label identification (detecting individual objects on an image), landmarks detection, sentiment analysis, logo detection and amazing optical character recognition (OCR). These services can be used within any application with access to images.
Into the details …
Google requires registration with the Vision Services and establishing an authentication scheme for authentication and/or authorization. The simplest authentication scheme is an “API Key”. This scheme provides a JSON file which can be referenced in the code for authentication.
We have created an AEM service to invoke Google’s API. This service can be referenced by any component, service, or workflow process. We extended the OOTB workflow “Update DAM Asset” to include the additional process of calling this service for every asset added to the DAM.
Our process determines the type of annotation coming back from Google (label, landmark, sentiment, or logo) and creates a tag in the corresponding taxonomy (see screenshots above). The process also includes an OCR Vision call, which when made extracts the text identified on the image and populates the metafield “dc:description” on the DAM asset.
AEM “Smart Tags”
Adobe has also announced a native auto asset tagging feature called “Smart Tags” in its AEM 6.2 beta version which was received very well at the Adobe Summit—The Digital Marketing Conference 2016. Though it is not available for public yet, it would be very interesting to compare it with Google Cloud Vision API’s once available. The Google Vision / AEM integration will work in any version of AEM, not just 6.2.
Conclusion
We are very excited to see what machine learning and AI are contributing to asset repositories in terms of classification. As we keep testing, we are amazed at the great results and disappointed with few misses (It seems to always fail to recognize the Nike logo). As Chad pointed out, the results are not always accurate and for a beta release of Cloud API, we are very impressed. We would now like to see how they compare with Adobe “Smart Tagging” native feature.
Very nice.
Does the Google Cloud Vision API restricts the amount of calls made through a key?
Any batch mode supported?
Also why extend the existing DAM Workflow instead of creating a custom workflow with custom launcher.
But overall very nice!
Hi Nono,
As far as I know, Google;s Cloud Vision API does not restrict the amount of calls made through a key. Anything over a thousand inquiries a month will cost a bit. Pricing can be found here: https://cloud.google.com/vision/docs/pricing.
It does look like a batch mode is supported up to 4MB (https://cloud.google.com/vision/docs/image-best-practices#google_cloud_storage_image_files). The larger the image, the more Google will be able to accurately label the image. Since images usually run pretty big – batch processing is not realistic.
We extended the existing DAM workflow instead of creating a custom workflow for expediency sake. The process has evolved since this blog post. We now use an event listener to observe when a node of type “nt:file” is added to the DAM. We then check the size of this asset. If the size is under 4MB – we send the file to Google’s Cloud Vision API. If it is over 4MB, we send a rendition of the asset.
Thanks Shannon for your reply.
I looked at the pricing and that seems quite reasonable. Let’s see what the pricing model for Adobe Smart Tags will be.
Any chance that you can share your implementation?
Regards,
Hi Nono,
Please see our implementation here:
https://blogs.perficient.com/files/2016/05/visionapi.zip
You will need to edit the VisionApiServiceAccount.json file and insert your own project_id, private_key_id, private_key, client_email, and client_id.
Thanks,
Shannon Sumner
Hi Shannon,
Thanks for posting this great blog and code package.
I have used the code which you have shared and I created one trial account in google cloud vision.
I have changed the credential in JSON file but i am getting the below error:
Error: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Any kind of help will be appreciable 🙂
Thanks
Hi @Saurabh,
Based on the error message it looks like you’re running into a SSL Cert issue, this StackOverflow post may point you in the right direction:
https://stackoverflow.com/questions/9619030/resolving-javax-net-ssl-sslhandshakeexception-sun-security-validator-validatore