Crowd dispersal detection API
Check camera frames for a crowd scattering or running away.
What it detects
Flag crowd dispersal in plazas, concourses and outdoor gathering areas.
- Detection
- Several people suddenly running away from one spot or in different directions: panic, fleeing, a crowd scattering.
- Outside the definition
- Joggers or a running group exercising, someone running for a bus or car, children playing, a single runner, nobody running.
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": [
"crowd_dispersing"
],
"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
The crowd_dispersing tag returns one answer and probability. Select it with fighting and person-on-ground detection in one request.
Camera setup
Include normal foot traffic, running groups and people leaving an event in your camera tests.
Try it on your footage.
Upload an image and select “Crowd dispersing”. Run analysis.
Approved account required. Analysis uses credit. Images are retained for annotation and training.
Open the live PlaygroundBefore you integrate
The definition concerns several people suddenly scattering. A single runner, exercise group or children playing does not meet that definition.
Is this a running detector?
No. It checks for a crowd dispersing. A person jogging or running for a bus is outside the tag’s positive definition.