Accelerate your computer vision deployments by taking advantage of the Chooch computer vision API. This documentation provides insight into how to call the API, how to provide an image for analysis, and examples of the what to expect the returned predictions to look like.
model_id: The UID of the model. In this example it is 027765184-5b08-410c-97c7-c2caf3p01ad.
api_key: API key provided by Chooch. In this example, the API key is dd329728-54l0-45fc-82ad-b4ed037adxfd.
conf_thresh: Threshold for minimum confidence the model has on a detected object(box confidence score).
nms_thresh: Non-Maximum Suppression (NMS) threshold to select the best bounding box for an object and reject or “suppress” all other bounding boxes.“
Expected Results
The returned response will include a list of predictions in JSON format for easy consumption. Each prediction includes a class_title, score confidence in the detection, model_id, and coordinates of where the object is in the image.
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.
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.
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 pst 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 (Invapd 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 cpent 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 Face Recognition API
Chooch Face Recognition consists of Perception > People > Images
You can search and tag a face in the Chooch API by feeding it an image of a face. Below is a sample post of an image url.
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.
URL Post
You can also post an image through the image field. Below are 2 separate sample posts in python.
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);
});
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"
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.
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);
}
}
}
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);
}
}
}
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.
p
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);
});
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.
Support
For questions or technical support, please contact [email protected].
New Gartner Report! Discover how AI-powered vision systems can provide real-time monitoring for workplace hazards. Access your free copy →