Going to re:Invent every year and meeting new people, seeing what they do with the cloud, and learning about new technologies is always a pleasure.

This year the emerging technologies that interested me the most were Alexa (spoiler alert: it will be my next blog topic!) and Machine Learning. One of the applications of Machine Learning is image recognition and AWS has released a packaged service for this called Amazon Rekognition.

Earlier last year we released Nuxeo Vision, a plugin that uses the Google Cloud Vision API for image detection services, such as image safe search, labeling common objects within an image, image text detection and extraction, and more. So, as an enhancement I decided to add the Rekognition service to Nuxeo Vision to give you an option to choose the service you want to use: Amazon Rekognition or Google Cloud Vision. This integration will be released in the next couple of days and until then let’s take a quick look at the configuration and the result.

Rekognition Provider

After a small refactoring of nuxeo-vision, I extracted a provider interface in order to add an Amazon Provider for adding Rekognition:

public interface VisionProvider { List <visionresponse>execute(List <blob>blobs, List <visionfeature>features, i nt maxResults) throws IOException, GeneralSecurityException, IllegalStateException; }

Amazon Rekognition can perform face detection and tagging, just like Google Vision can perform tagging, OCR, and image analysis. For now, we will only use the tagging feature of Rekognition in Nuxeo Vision. Here’s what our Amazon Provider looks like:

public class AmazonProvider implements VisionProvider { ... @Override public List <visionresponse>execute(List <blob>blobs, List <visionfeature>features, int maxResults) throws IOException, GeneralSecurityException, IllegalStateException { ArrayList <visionresponse>result = new ArrayList<>(); for (Blob blob : blobs) { result.add(new AmazonRekognitionResponse(client.detectLabels(new DetectLabelsRequest().withImage( new com.amazonaws.services.rekognition.model.Image() .withBytes(ByteBuffer.wrap(blob.getByteArray()))) .withMaxLabels(maxResults).withMinConfidence(0.9f)))); } return result; } }

The Configuration

Once our code is added and installed on our Nuxeo server we need to configure it by adding those variables to our nuxeo.conf file.

org.nuxeo.vision.provider=amazon org.nuxeo.vision.amazon.access_key=AKIA...UA org.nuxeo.vision.amazon.secret_key=F0..../e

That’s all there is to it!

The Result

Now whenever we add a picture to our Nuxeo server we will see tags added to it automatically from Amazon Rekognition:

Image tags added by Amazon Rekognition

Read more about Nuxeo on AWS in this whitepaper.