Analyze Image

analyzeImage.predict(data, [params])
Make calls to many APIs in parallel.

Arguments

data – image or list of images – required – images to be analyzed
apis – list – required – the list of APIs to run in parallel
[api_key] – String – optional – your indico API key
[cloud] – String – optional – your private cloud subdomain

Output

A dictionary where each key maps to the specified models’ results. If used on a single input (not recommemnded as using multiple APIs quickly uses up your allotted calls!) you’ll get the default response, otherwise a list of the default.

# single image output
{
    'image_features': [
        0.0, 
        1.84086012840271, 
        ...
    ],
    'fer': {
        'happy': 0.00004324968926091062,
        'sad': 0.007702528578033991,
        'angry': 0.0002575132225946431,
        'fear': 0.2071775132225946431,
        'surprise': 0.008160047807935744,
        'neutral': 0.00015069427192724994
    }
}

# batch output
{
    'image_features': [
        [0.0, 1.84086012840271, ...],
        [0.0, 1.84086012840271, ...]
    ]
    'fer': [
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }, 
        {
            'happy': 0.00004324968926091062,
            'sad': 0.007702528578033991,
            'angry': 0.0002575132225946431,
            'fear': 0.2071775132225946431,
            'surprise': 0.008160047807935744,
            'neutral': 0.00015069427192724994
        }
    ]
}

Example

import io.indico.Indico;
import io.indico.api.image.FacialEmotion;
import io.indico.api.BatchIndicoResult;

Map params = new HashMap()
ArrayList apiList = new ArrayList;
apiList.add("image_features");
apiList.add("fer");
params.put("apis", apiList);

// single example
Indico indico = new Indico("YOUR_API_KEY");
IndicoResult single = indico.analyzeImage.predict(
    "<IMAGE>",
    params
);
Map> result = single.getAnalyzeImage();
System.out.println(result);

// batch example
String[] batchExample = {
    <IMAGE>, 
    <IMAGE>
};
BatchIndicoResult batch = indico.analyzeImage.predict(batchExample,
    params
);
Map>> result = batch.getAnalyzeImage();
System.out.println(result);