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.
# 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)
curl --location --request POST "https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19" --form "image=@"
# 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)
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:
The sample JSON response is:
The response fields are:
The video recognition API is a REST API indexing videos every second. The API consists of 2 parts: 1) send video and 2) search. The indexing begins by sending the video. After sending the video, the indexed data can be viewed through the search API.
The following is a sample send video URL for indexing to begin:
API input fields are:
The sample JSON response is:
{
url: "https://s3.amazonaws.com/choochvideo/51.mp4",
status: "Success (Video is being indexed)",
predicttype: "video",
fileid: "55de9d9ce1e2469da3a420a7b4de9397"
}
The response fields are:
After the video is indexed, the indexed data can be viewed through the search API by using the File ID of the video. The following is a sample API request URL for viewing indexed data.
API input fields are:
The sample JSON response is:
The response fields are:
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.
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.
# 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)
curl --location --request POST "https://api.chooch.ai/predict/image?apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19&model_id=808" --form "image=@"
# 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)
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:
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:
# 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=88'
response = requests.post(url)
json_data = json.loads(response.content)
print(json_data)
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=88"
import requests
import json
import time
url = 'https://api.chooch.ai/predict/object_detection/?model_id=88&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)
curl --location --request POST "https://api.chooch.ai/predict/object_detection/?model_id=88&apikey=346g5717-1sd3-35h6-9104-b8h5c819dn19" --form "image=@local_file"
{
"status": "ok",
"prediction_type": "object_detection",
"predictions": [
{
"class_title": "person",
"model_id": 88,
"score": 0.74613,
"coordinates": {
"xmin": 0,
"ymin": 35,
"ymax": 297,
"xmax": 179
}
}
]
}
API input fields are:
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.
The fields are:
You can also post an image through the image field. Below are 2 separate sample posts in python.
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)
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"
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)
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=@"
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);
}
}
}
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):
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)
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);
}
}
}
{
"status_description":"success",
"post_type":"insert_person_image",
"status":41868
}
You can create a person through the Chooch API. Below is a sample Python based usage of the create_person command.
# 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)
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);
}
}
}
{
person_id: 37,
status: 37,
status_description: success,
post_type: create_person
}
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.
# 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)
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=@"
{
status: 210,
status_description: success,
post_type: insert_person_image
}