Documents and Videos

Computer Vision API

Now you can accelerate your computer vision deployments by taking advantage of the Chooch computer vision API. Each imaging system captures its own images or videos, and then sends them to a hosted inference engine running AI models. Using Chooch’s computer vision API, these two systems can establish a standard protocol for communication. The host machine then takes the input image or video, runs it through the model, and sends the results back to the requester within a fraction of a second.

 

General Recognition AI API

The Chooch API is organized around REST. The API recognizes objects and concepts in videos and images from our pre-trained models.

The API is compatible with livestreams and live tagging.

 

Image Recognition API

The image recognition API is a straightforward REST API conducting classification and object detection predictions on images. The image URL is passed as a field to the API and the API returns a JSON based response with relevant predictions.

LOCAL IMAGE POST

  • Python
  • jQuery
  • PHP
  • cURL
# Image Recognition with Local Image
import requests
import json
url = 'https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19'
files = {'image': open('local_image.jpg', 'rb')}
response = requests.post(url, files=files)
print(response.content)
var form = new FormData();
form.append("image", "");
var settings = {
"url": "https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
"method": "POST",
"timeout": 0,
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array('image'=> new CURLFILE('')),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
curl --location --request POST "https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19" --form "image=@local_image.jpg"

URL POST

  • Python
  • jQuery
  • PHP
  • cURL
# Image Recognition with Image Url
import requests
import json
url = 'https://api.chooch.ai/predict/image?url=https://s3.amazonaws.com/choochdashboard/base_site/ronaldo_suit.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19'
response = requests.post(url)
print(response.content)
var form = new FormData();
var settings = {
"url": "https://api.chooch.ai/predict/image?url=https://s3.amazonaws.com/choochdashboard/base_site/ronaldo_suit.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
"method": "GET",
"timeout": 0,
"headers": {
"Content-Type": "application/json"
},
"processData": false,
"mimeType": "multipart/form-data",
"contentType": false,
"data": form
};
$.ajax(settings).done(function (response) {
console.log(response);
});
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.chooch.ai/predict/image?url=https://s3.amazonaws.com/choochdashboard/base_site/ronaldo_suit.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
} ?>
curl --location --request GET "https://api.chooch.ai/predict/image?url=https://s3.amazonaws.com/choochdashboard/base_site/ronaldo_suit.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19" --header "Content-Type: application/json"

API input fields are:

  • url: URL of the image file. In this example it is https://s3.amazonaws.com/choochdashboard/base_site/ronaldo_suit.jpg
  • apikey: API key provided by Chooch. In this example it is 346g5717-1sd3-35h6-9104-b8h5c819dn19

SAMPLE OUTPUT (IMAGE)

The sample JSON response is:

{
  "status": "ok",
  "url": "https://s3.amazonaws.com/choochdashboard/base_site/ronaldo_suit.jpg",
  "predictions": [
    {
      "class_title": "Cristiano Ronaldo",
      "order": "1"
    },
    {
      "class_title": "tom ford style",
      "order": "2"
    },
    {
      "class_title": "double-breasted suit, fashion",
      "order": "3"
    },
    {
      "class_title": "man",
      "order": "6"
    },
    {
      "class_title": "suit",
      "order": "7"
    },
    {
      "class_title": "cartoon, sterling archer",
      "order": "8"
    },
    {
      "class_title": "icon",
      "order": "9"
    },
    {
      "class_title": "man's clothing",
      "order": "10"
    },
    {
      "class_title": "face",
      "order": "11"
    },
    {
      "class_title": "male",
      "order": "12"
    },
    {
      "class_title": "young man",
      "order": "13"
    },
    {
      "class_title": "actor, doer",
      "order": "14"
    },
    {
      "class_title": "tie",
      "order": "15"
    },
    {
      "class_title": "striped tie",
      "order": "16"
    },
    {
      "class_title": "windsor tie",
      "order": "17"
    },
    {
      "class_title": "four-in-hand tie",
      "order": "18"
    },
    {
      "class_title": "cravat",
      "order": "19"
    }
  ],
  "texts": {
    "status": "limited to 15 results",
    "predictions": [
      
    ],
    "summary": [
      
    ]
  },
  "objects": {
    "predictions": [
      {
        "sub_predictions": [
          {
            "class_title": "tom ford style",
            "order": 1
          },
          {
            "class_title": "double breasted suit",
            "order": 2
          },
          {
            "class_title": "brown tie",
            "order": 3
          },
          {
            "class_title": "double-breasted suit, fashion",
            "order": 4
          }
        ],
        "object_title": "man",
        "coordinates": "0,749,64,982"
      },
      {
        "sub_predictions": [
          {
            "class_title": "cartoon, sterling archer",
            "order": 1
          },
          {
            "class_title": "tom ford style",
            "order": 2
          },
          {
            "class_title": "sterling archer",
            "order": 3
          },
          {
            "class_title": "double breasted suit",
            "order": 4
          },
          {
            "class_title": "brown tie",
            "order": 5
          },
          {
            "class_title": "double-breasted suit, fashion",
            "order": 6
          },
          {
            "class_title": "icon",
            "order": 7
          },
          {
            "class_title": "man's clothing",
            "order": 8
          }
        ],
        "object_title": "suit",
        "coordinates": "25,712,305,995"
      },
      {
        "sub_predictions": [
          {
            "class_title": "male",
            "order": 1
          },
          {
            "class_title": "young man",
            "order": 2
          },
          {
            "class_title": "actor, doer",
            "order": 3
          }
        ],
        "object_title": "face",
        "coordinates": "225,504,75,464"
      },
      {
        "sub_predictions": [
          {
            "class_title": "striped tie",
            "order": 1
          },
          {
            "class_title": "windsor tie",
            "order": 2
          },
          {
            "class_title": "four-in-hand tie",
            "order": 3
          },
          {
            "class_title": "cravat",
            "order": 4
          }
        ],
        "object_title": "tie",
        "coordinates": "320,436,523,875"
      }
    ],
    "summary": [
      {
        "count": "1",
        "object_title": "tie"
      },
      {
        "count": "1",
        "object_title": "face"
      },
      {
        "count": "1",
        "object_title": "suit"
      },
      {
        "count": "1",
        "object_title": "man"
      }
    ]
  },
  "faces": {
    "face_count": 1,
    "predictions": [
      {
        "face_name": "Cristiano Ronaldo",
        "coordinates": "248,506,192,450"
      }
    ]
  },
  "predicttype": "dense",
  "fileid": "c2f02758f0dd4b8ab703e26f4d70d7c7"
}  

The response fields are:

  • url: URL of the image file posted
  • status: Status of the API request. When successful the status is “ok”. For error messages see last section.
  • predictions: Predictions made on the image. Predictions are provided as a list and have class_title and order fields.class_title is the name of the class predicted, and order is the order of relevancy of the particular class.
  • sub_predictions: Predictions made under dense classification. The image or frame is segmented into parts and classified based on the segments.
  • text_value: Text predictions.
  • face_name: Facial recognition name predictions.
  • face_count: Sum of faces.
  • coordinates: Coordinates of the object based on pixels. The format for the coordinates is X1, X2, Y1, Y2.
  • count: The number of times an object or concept appears in an image or a frame.
  • fileid: Unique File ID created for the image. The File ID is to identify the image for future references.
    In this example it is ec7995bb557d4416ab97b819917fc18c

GENERAL STATUS MESSAGES

  • ok
  • Error (Wrong Parameters)
  • Error (Invalid API Key)
  • Error (You Have Reached Your Trial API Call Limit)
  • Error (No File)

    FTP DROP FUNCTION

    The FTP drop function was developed on top of the Chooch API for image and video professionals who want to tag their images and videos autonomously. For every client a personal FTP host is issued together with the API.

    • FTP Host: ftp://52.207.237.100
    • API Key: 6werc42-1675-6553-8105

    The FTP drop sends the image to the API. The API predicts the image and places the results in the keywords field of the IPTC metadata file. Once the metadata has been successfully placed into the keywords fields of the IPTC file, it is sent to the destination directed by the user.

    Custom Image Recognition API

    LOCAL IMAGE POST

    • Python
    • jQuery
    • PHP
    • cURL
    # Image Recognition with Local Image
    import requests
    import json
    url = 'https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808'
    files = {'image': open('local_image.jpg', 'rb')}
    response = requests.post(url, files=files)
    print(response.content)
    var form = new FormData();
    form.append("image", "");
    var settings = {
    "url": "https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808",
    "method": "POST",
    "timeout": 0,
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
    };
    $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => array('image'=> new CURLFILE('')),
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl --location --request POST "https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808" --form "image=@local_image.jpg"
    

    URL POST

    • Python
    • jQuery
    • PHP
    • cURL
    # Image Recognition with Image Url
    import requests
    import json
    url = 'https://api.chooch.ai/predict/image?url=https://chooch-share.s3.amazonaws.com/cat.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808'
    response = requests.post(url)
    print(response.content)
    var form = new FormData();
    var settings = {
    "url": "https://api.chooch.ai/predict/image?url=https://chooch-share.s3.amazonaws.com/cat.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808",
    "method": "GET",
    "timeout": 0,
    "headers": {
    "Content-Type": "application/json"
    },
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
    };
    $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/image?url=https://chooch-share.s3.amazonaws.com/cat.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    CURLOPT_HTTPHEADER => array(
    "Content-Type: application/json"
    ),
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl --location --request GET "https://api.chooch.ai/predict/image?url=https://chooch-share.s3.amazonaws.com/cat.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808"  --header "Content-Type: application/json"

    API input fields are:

    • model_id: The id of the model you trained.In this example it is 808
    • url:  URL of the image file. In this example it is https://chooch-share.s3.amazonaws.com/cat.jpg
    • apikey: API key provided by Chooch. In this example it is 346g5717-1sd3-35h6-9104-b8h5c819dn19

    SAMPLE OUTPUT (IMAGE)

    The sample JSON response is:

    {
        "status": "ok",
        "model_id": "808",
        "url": "https://chooch-share.s3.amazonaws.com/cat.jpg",
        "predictions": [
            {
            "class_title": "cat",
            "order": 1
            }
        ],
        "prediction_type": "image"
        }

    The response fields are:

    • status: Status of the API request.
    • model_id: The id of the model you trained.In this example it is 808
    • url:  URL of the image file posted. In this example it is https://chooch-share.s3.amazonaws.com/cat.jpg
    • predictions: Predictions made on the image. Predictions are provided as a list and have class_title and order fields.class_title is the name of the class predicted, and order is the order of relevancy of the particular class.
    • predict_type: Predict type is image.

    Custom Object Detection API

    URL POST

    • Python
    • jQuery
    • PHP
    • cURL
    # Object Detection with Image Url
    import requests
    import json
    url = 'https://api.chooch.ai/predict/object_detection/?url=https://choochdashboard.s3.amazonaws.com/truck.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19c&model_id=777'
    response = requests.post(url)
    json_data = json.loads(response.content)
    print(json_data)
    var settings = {
    "url": "https://api.chooch.ai/predict/object_detection/?url=https://choochdashboard.s3.amazonaws.com/truck.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19c&model_id=777",
    "method": "GET",
    "timeout": 0,
    };
    $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/object_detection/?url=https://choochdashboard.s3.amazonaws.com/truck.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19c&model_id=777",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "GET",
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl --location --request GET "https://api.chooch.ai/predict/object_detection/?url=https://choochdashboard.s3.amazonaws.com/truck.jpg&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19c&model_id=777"

    LOCAL IMAGE POST

    • Python
    • jQuery
    • PHP
    • cURL
    import requests
    import json
    import time
    url = 'https://api.chooch.ai/predict/object_detection/?model_id=777&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19'
    files = {'image': open('local_image.jpg', 'rb')}
    response = requests.post(url, files=files)
    json_data = json.loads(response.content)
    print(json_data)
    var form = new FormData();
    form.append("image", "local_file");
    var settings = {
    "url": "https://api.chooch.ai/predict/object_detection/?model_id=777&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
    "method": "POST",
    "timeout": 0,
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
    }; $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/object_detection/?model_id=777&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => array('image'=> new CURLFILE('local_file')),
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl --location --request POST "https://api.chooch.ai/predict/object_detection/?model_id=777&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19" --form "image=@local_image.jpg"

    SAMPLE RESPONSE:

        {
            "status": "ok",
            "prediction_type": "object_detection",
            "predictions": [
                {
                    "class_title": "person",
                    "model_id": 777,
                    "score": 0.74613,
                    "coordinates": {
                        "xmin": 0,
                        "ymin": 35,
                        "ymax": 297,
                        "xmax": 179
                    }
                }
            ]
        }

    API input fields are:

    • model_id: The id of the model you trained.In this example it is 777
    • coordinates: Coordinates of the object based on pixels. The format for the coordinates is xmin, ymin ,xmax, ymax

    Custom Facial Recognition API

    Chooch Face Recognition consists of Perception > People > Images

    You can search and tag a face in the Chooch API by feeding the Chooch API a Face Image. Below is a sample post of an image url.

    SAMPLE OUTPUT (IMAGE)

    The fields are:

    • url: This is the image url of the face to be searched.
      In this example it is https://choochdashboard.s3.amazonaws.com/base_site/1461123713-esq050116cover001s.jpg
    • person_id_filter: This field is a filter that is optional to pass. The default -1 which means don’t filter by person. If a valid person_id is passed, Chooch will search only in that given person’s data.
      In this example it is -1
    • model_id: This is the id of the perception that the search will be made on. This field is required.
      In this example it is 14

    You can also post an image through the image field. Below are 2 separate sample posts in python.

    URL POST

    • Python
    • jQuery
    • PHP
    • cURL
    import requests
    import json
    import time
    url = 'https://api.chooch.ai/predict/face?url=https://choochdashboard.s3.amazonaws.com/base_site/1461123713-esq050116cover001s.jpg&person_id_filter=-1&model_id=14&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19'
    response = requests.post(url)
    json_data = json.loads(response.content)
    print(json_data)
    var form = new FormData();
    var settings = {
    "url": "https://api.chooch.ai/predict/face?url=https://choochdashboard.s3.amazonaws.com/base_site/1461123713-esq050116cover001s.jpg&person_id_filter=-1&model_id=14&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
    "method": "POST",
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
    };
    $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/face?url=https://choochdashboard.s3.amazonaws.com/base_site/1461123713-esq050116cover001s.jpg&person_id_filter=-1&model_id=14&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl --location --request POST "https://api.chooch.ai/predict/face?url=https://choochdashboard.s3.amazonaws.com/base_site/1461123713-esq050116cover001s.jpg&person_id_filter=-1&model_id=14&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19"

    LOCAL IMAGE POST

    • Python
    • jQuery
    • PHP
    • cURL
    • Java
    • C#
    import requests
    import json
    import time
    url = 'https://api.chooch.ai/predict/face?person_id_filter=-1&model_id=5&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19'
    files = {'image': open('local_image.jpg', 'rb')}
    response = requests.post(url, files=files)
    json_data = json.loads(response.content)
    print(json_data)
    var form = new FormData();
    form.append("image", "");
    var settings = {
    "url": "https://api.chooch.ai/predict/face?person_id_filter=-1&model_id=14&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
    "method": "POST",
    "timeout": 0,
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
    };
    $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/face?person_id_filter=-1&model_id=14&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => array('image'=> new CURLFILE('')),
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl --location --request POST "https://api.chooch.ai/predict/face?person_id_filter=-1&model_id=14&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19" --form "image=@local_image.jpg"
    import java.io.File;
    import kong.unirest.HttpResponse;
    import kong.unirest.JsonNode;
    import kong.unirest.Unirest;

    public class Test {
    public static void main(String[] args) {
        HttpResponse<JsonNode> response = Unirest.post("https://api.chooch.ai/predict/face?person_id_filter=-1&model_id=5&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19").field("image", new File("/home/ashwmadhu/Desktop/12.jpg")).asJson();
        System.out.println(response.getBody());
        }
    }
    using System;
    using RestSharp;
    namespace TestProject {     class Program     {         static void Main(string[] args)         {             var client = new RestClient("https://api.chooch.ai/predict/face?person_id_filter=-1&model_id=5&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19");             var request = new RestRequest(Method.POST); var path = "/home/ashwmadhu/Desktop/12.jpg";             request.AddFile("image", path);             IRestResponse response = client.Execute(request);             Console.WriteLine(response.Content);         }     } }

    JSON RESPONSE

    The example JSON response is here below. In this example, the similarity is 0.80. The face_recog_hit is True when there is a match and False when there is no match.

    {
        status: "ok",
        person_id_filter: -1,
        faces_detected: [
            {
                person_name: "George Clooney",
                similarity: 0.8,
                coordinates: "1402,1657,158,506",
                image_url: "https://s3.amazonaws.com/choochdashboard/media/face_models/14/George_Clooney/220px-George_Clooney_2016_(1).jpg",
                person_id: 22,
                key_id: null
            }
        ],
        face_recog_hit: true,
        face_count: 1,
        post_type: "face_search",
        faces: [
            {
                person_name: "George Clooney",
                similarity: 0.8,
                face_live: null,
                coordinates: "1402,1657,158,506",
                person_id: 22,
                key_id: null,
                face_live_status_description: null
            }
        ],
        similar_faces: [
            {
                person_name: "George Clooney",
                similarity: 0.8,
                coordinates: "1402,1657,158,506",
                image_url: "https://s3.amazonaws.com/choochdashboard/media/face_models/14/George_Clooney/220px-George_Clooney_2016_(1).jpg",
                person_id: 22,
                key_id: null,
                order: 1
            },
            {
                person_name: "4566",
                similarity: 0.8,
                coordinates: "1402,1657,158,506",
                image_url: "https://s3.amazonaws.com/choochdashboard/media/face_models/api/-1/79db335f-46e8-4e35-b15e-5174a5bc7d22.jpg",
                person_id: 131,
                key_id: "4566",
                order: 2
            },
            {
                person_name: "5677",
                similarity: 0.08,
                coordinates: "1402,1657,158,506",
                image_url: "https://s3.amazonaws.com/choochdashboard/media/face_models/api/None/9f7eff07-6313-461b-b326-1a1949138244.jpg",
                person_id: 130,
                key_id: "5677",
                order: 3
            },
            {
                person_name: "Hakan Gultekin",
                similarity: 0.07,
                coordinates: "1402,1657,158,506",
                image_url: "https://s3.amazonaws.com/choochdashboard/media/face_models/14/Hakan_Gultekin/37592577_10155843376073845_3443616404685717504_n.jpg",
                person_id: 117,
                key_id: null,
                order: 4
            }
        ]
    }

    This API function allows the user to add a face image with a unique id (it can be a unique person name, or a unique id assigned to a person):

    • Python
    • jQuery
    • PHP
    • cURL
    • Java
    • C#
    import requests
    import json
    import time
    url = 'https://api.chooch.ai/predict/face?&key_id=3245&model_id=7&command=insert_person_image_key_id&apikey=46g5717-1sd3-35h6-9104-b8h5c819dn19'
    files = {'image': open('/home/ashwmadhu/Desktop/12.jpg', 'rb')}
    response = requests.post(url, files=files)
    json_data = json.loads(response.content)
    print(json_data)
    var form = new FormData();
    form.append("image", "");
    var settings = {
    "url": "https://api.chooch.ai/predict/face?&key_id=3245&model_id=7&command=insert_person_image_key_id&apikey=46g5717-1sd3-35h6-9104-b8h5c819dn19",
    "method": "POST",
    "timeout": 0,
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
    };
    $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/face?&key_id=3245&model_id=7&command=insert_person_image_key_id&apikey=46g5717-1sd3-35h6-9104-b8h5c819dn19",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => array('image'=> new CURLFILE('')),
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl -X POST 'https://api.chooch.ai/predict/face?key_id=3245&model_id=7&command=insert_person_image_key_id&apikey=46g5717-1sd3-35h6-9104-b8h5c819dn19' -F image=@/home/ashwmadhu/Desktop/12.jpg
    import java.io.File;
    import kong.unirest.HttpResponse;
    import kong.unirest.JsonNode;
    import kong.unirest.Unirest;
    public class Test { public static void main(String[] args) {     HttpResponse<JsonNode> response = Unirest.post("https://api.chooch.ai/predict/face?&key_id=3245&model_id=7&command=insert_person_image_key_id&apikey=46g5717-1sd3-35h6-9104-b8h5c819dn19").field("image", new File("/home/ashwmadhu/Desktop/12.jpg")).asJson();     System.out.println(response.getBody());     } }
    using System;
    using RestSharp;
    namespace TestProject {     class Program     {         static void Main(string[] args)         {         var client = new RestClient("https://api.chooch.ai/predict/face?&key_id=3245&model_id=7&command=insert_person_image_key_id&apikey=46g5717-1sd3-35h6-9104-b8h5c819dn19");         var request = new RestRequest(Method.POST);         var path = "/home/ashwmadhu/Desktop/12.jpg"; request.AddFile("image", path);         IRestResponse response = client.Execute(request);         Console.WriteLine(response.Content);         }     } }

    JSON RESPONSE

    {
      "status_description":"success",
      "post_type":"insert_person_image",
      "status":41868
    }

    CREATE PERSON API COMMAND

    You can create a person through the Chooch API. Below is a sample Python based usage of the create_person command.

    • Python
    • jQuery
    • PHP
    • cURL
    • Java
    • C#
    # Create Person Python Code
    import requests
    import json
    url = 'https://api.chooch.ai/predict/face?person_name=Tom Bill&model_id=5&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=create_person'
    response = requests.post(url)
    json_data = json.loads(response.content)
    print(json_data)
    var form = new FormData();
    var settings = {
    "url": "https://api.chooch.ai/predict/face?person_name=Tom Bill&model_id=5&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=create_person",
    "method": "POST",
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
    };
    $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/face?person_name=Tom%20Bill&model_id=5&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=create_person",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl --location --request POST "https://api.chooch.ai/predict/face?person_name=Tom%20Bill&model_id=5&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=create_person"
    import java.io.File;
    import kong.unirest.HttpResponse;
    import kong.unirest.JsonNode;
    import kong.unirest.Unirest;
    public class Test { public static void main(String[] args) {     HttpResponse<JsonNode> response = Unirest.post("https://api.chooch.ai/predict/face?person_name=Tom&model_id=5&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=create_person").asJson();     System.out.println(response.getBody());     } }
    using System;
    using RestSharp;
    namespace TestProject {     class Program     {         static void Main(string[] args)         {         var client = new RestClient("https://api.chooch.ai/predict/face?person_name=Tom%20Bill&model_id=5&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=create_person");         var request = new RestRequest(Method.POST);         IRestResponse response = client.Execute(request);         Console.WriteLine(response.Content);         }     } }

    JSON RESPONSE

    {
        person_id: 37,
        status: 37,
        status_description: success,
        post_type: create_person
    }

    RETURN STATUS VALUES:

    • status > 0 : success, and the return value is the person_id.
    • status = 0 : error has occurred.
    • status = -1 : invalid model id.
    • status = -2 : invalid person name.

    INSERT PERSON IMAGE API COMMAND

    A face image can be added to an existing person using the person_id. Below is a sample Python based usage of the insert_person_image command.

    • Python
    • jQuery
    • PHP
    • cURL
    # Add face image to person with person_id_filter (person_id) Python Code
    import requests
    import json
    url = 'https://api.chooch.ai/predict/face?person_id_filter=37&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=insert_person_image'
    files = {'image': open('your_image.jpg', 'rb')}
    response = requests.post(url, files=files)
    json_data = json.loads(response.content)
    print(json_data)
    var form = new FormData();
    form.append("image", "");
    var settings = {
    "url": "https://api.chooch.ai/predict/face?person_id_filter=37&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=insert_person_image",
    "method": "POST",
    "processData": false,
    "mimeType": "multipart/form-data",
    "contentType": false,
    "data": form
    };
    $.ajax(settings).done(function (response) {
    console.log(response);
    });
    <?php
    $curl = curl_init();
    curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api.chooch.ai/predict/face?person_id_filter=37&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=insert_person_image",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => false,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    URLOPT_POSTFIELDS => array('image'=> new CURLFILE('')),
    ));
    $response = curl_exec($curl);
    $err = curl_error($curl);
    curl_close($curl);
    if ($err) {
    echo "cURL Error #:" . $err;
    } else {
    echo $response;
    } ?>
    curl --location --request POST "https://api.chooch.ai/predict/face?person_id_filter=37&apikey=cx065e5d-51wc87-9df6-163e-8b65a78k51e3&command=insert_person_image" --form "image=@"

    JSON RESPONSE

    {
        status: 210,  
        status_description: success, 
        post_type: insert_person_image
    }

    RETURN STATUS VALUES:

    • status > 0 : success, and the return value is the image id
    • status = 0 : error has occurred.
    • status = -1 : no face detected.
    • status = -2 : invalid person id.

    Computer Vision API

    Thank you for evaluating the Chooch AI computer vision API.

    Learn  more about Chooch AI.

    Computer Vision Resources

     

     

    ×

    Oops, something went wrong.
    Please try back later.

    Click here Tap here to upload Upload your image
    and Chooch will recognize it.
    Supported formats are .jpg .jpeg .png

    ×