Fight detection API
Detect physical fights in surveillance camera images through one API.
What it detects
Check entrances, parking areas and public spaces for people punching, grappling or shoving.
- Detection
- Punching, grappling, shoving, or someone being hit.
- Outside the definition
- No physical fight. Hugging, play, arguing without contact.
Send a camera image.
Set KIRKWOOD_API_KEY on your server. Save a frame as frame.jpg.
import base64
import json
import os
import urllib.request
with open("frame.jpg", "rb") as frame:
image = base64.b64encode(frame.read()).decode()
body = json.loads('''{
"images": [
"<BASE64_JPEG>"
],
"tags": [
"people_fighting"
],
"detections": {
"return_boxes": true
}
}''')
body["images"] = [image]
request = urllib.request.Request(
"https://app.kirkwood.ai/v1/analyze",
data=json.dumps(body).encode(),
headers={
"Authorization": "Bearer " + os.environ["KIRKWOOD_API_KEY"],
"Content-Type": "application/json",
},
method="POST",
)
with urllib.request.urlopen(request, timeout=120) as response:
print(json.dumps(json.load(response), indent=2))Read the result
Read tags.people_fighting for the answer and probability. Request bounding boxes to locate detected people in the image.
Camera setup
Test contact sports, friendly embraces and crowded walkways as well as fights. Keep the people large enough in the image to see their actions.
Try it on your footage.
Upload an image and select “People fighting”. Run analysis.
Approved account required. Analysis uses credit. Images are retained for annotation and training.
Open the live PlaygroundBefore you integrate
The tag concerns physical contact. An argument without contact is outside its positive definition.
Does an argument count as a fight?
No. The catalog definition covers punching, grappling, shoving or someone being hit. Hugging and play are outside that definition.
API pricing
Billed per image analyzed. Contact us for your rate.
Request pricing