The Object Detection API provides fast and accurate image object recognition using advanced neural networks developed by machine learning experts.
HTTP POST
Given an input image, return a list of detected objects labels, confidence percentages and bounding boxes. Objects with confidence less than 0.3 (30%) are filtered out.
image
(required) - input image file. Must be either JPEG or PNG format and smaller than 2000 by 2000.
X-Api-Key
(required) - API Key associated with your account.
Live Demo!
https://api.api-ninjas.com/v1/objectdetection
import requests
api_url = 'https://api.api-ninjas.com/v1/objectdetection'
image_file_descriptor = open('YOUR_IMAGE.jpeg', 'rb')
files = {'image': image_file_descriptor}
r = requests.post(api_url, files=files)
print(r.json())
var formData = new FormData();
formData.append('image', $('#YOUR_IMAGE_FILE')[0].files[0]);
$.ajax({
method: 'POST',
url: 'https://api.api-ninjas.com/v1/objectdetection',
data: formData,
enctype: 'multipart/form-data',
processData: false,
contentType: false,
success: function(result) {
console.log(result);
},
error: function ajaxError(jqXHR, textStatus, errorThrown) {
alert(jqXHR.responseText);
}
});