SDKs
One file per language, no dependencies. Served by the API, so the client you download is the one this build was made from.
Each client is a single file with no dependencies, embedded in the service binary and served by the API itself. That is deliberate: a copy kept anywhere else can drift from the API it talks to, and an embedded one cannot.
Reading the live catalog
From https://sdk.skylarklabs.ai/v1/catalog
Using a client
Every client works the same way: load a model, then run it on an image, a
clip or a live camera. One call returns every class the model detects;
keep the ones you need by filtering on class. The model names are the ids
on the Models page.
Python
from skylark_models import Skylark
sky = Skylark("skl_...")
model = sky.models.load("CFAM-CCTV")
result = model.predict("street.jpg")
for d in result["detections"]:
print(d["class"], round(d["confidence"], 2), d["bbox"], d.get("plate", ""))
people = [d for d in result["detections"] if d["class"] == "person"]
clip = model.predict_video("clip.mp4")
live = model.stream("rtsp://192.168.1.20/stream1", fps=2)Node
import { Skylark } from './skylark.mjs'
const sky = new Skylark(process.env.SKYLARK_API_KEY)
const model = sky.model('CFAM-CCTV')
const result = await model.predict('street.jpg')
const people = result.detections.filter((d) => d.class === 'person')
const clip = await model.predictVideo('clip.mp4')TypeScript and the browser
import { Skylark } from './skylark' // or https://sdk.skylarklabs.ai/v1/sdk/browser, as a module
const sky = new Skylark(apiKey)
const result = await sky.model('CFAM-Aerial').predict(file)sky.models() (Python: sky.models.list()) lists every model with its
classes, what it adds and its prices. An unknown model raises an error whose
code is unknown_model, and whose message names the valid ones.
curl
curl -X POST https://sdk.skylarklabs.ai/v1/infer/image \
-H "Authorization: Bearer $SKYLARK_API_KEY" \
-F "model=CFAM-CCTV" -F "file=@street.jpg"Upgrading from 1.x
Clients before 2.0 named a solution id (detect(file, "cctv_outdoor_person_detection")
and a solution form field). The API now takes a model instead, and
refuses solution; a refused call's message names the model to use. One call
returns every class the model detects, so to get what a 1.x solution gave
you, run its model and read the part of the result it was about:
| 1.x solution id | model | Read from the result |
|---|---|---|
cctv_outdoor_crowd_detection | CFAM-CCTV | crowd |
cctv_outdoor_fire_smoke_detection | CFAM-CCTV | detections of fire, smoke |
cctv_outdoor_helmet_detection | CFAM-CCTV | flags.hasBikeHelmet on riders |
cctv_outdoor_anpr_detection | CFAM-CCTV | number_plate detections and their plate |
cctv_outdoor_person_detection | CFAM-CCTV | detections of person |
cctv_outdoor_ppe_detection | CFAM-CCTV | flags.hasVest / flags.hasHelmet on person |
cctv_outdoor_vehicle_detection | CFAM-CCTV | detections of two_wheeler, three_wheeler, four_wheeler |
cctv_outdoor_weapon_detection | CFAM-CCTV | detections of weapon |
drone_person_crowd | CFAM-Aerial | crowd |
drone_fire_smoke_detection | CFAM-Aerial | detections of the *_fire and *_smoke classes |
drone_person_detection | CFAM-Aerial | detections of person, partial_human |
drone_ppe_detection | CFAM-Aerial | flags.hasVest / flags.hasHelmet on people |
drone_vehicle_crowd | CFAM-Aerial | congestion |
drone_vehicle_detection | CFAM-Aerial | detections of its vehicle classes |
thermal_uas_detection | CFAM-Aerial-Thermal | detections of Drone |
fod_detection | CFAM-FOD | detections of Big, Medium, Small |
cctv_outdoor_uas_detection | CFAM-UAS | detections of Quadcopter, Payload, Bird |
What else changed:
- Results are the model's raw output — see Raw output.
Expect more detections than 1.x returned: every class, including
lower-confidence boxes; filter on
classandconfidenceif you want fewer. - Every image costs one frame. 1.x charged fixed-camera models four.
- Results carry
modelinstead ofsolution, pluscountsper class and the model'scrowd/congestionblocks.