tinesight.client#
Classes
|
Client for invoking the Tinesight API from a device. |
- class tinesight.client.TinesightClient(x509_key_path: Path | str, x509_cert_path: Path | str)#
Client for invoking the Tinesight API from a device.
To use this class, a device must be registered with a signed certificate using the TinesightRegistrar.
- Examples:
>>> result = TinesightClient(my_key_path, my_cert_path).detect(my_image_bytes) >>> print(result.json()) >>> [{'class': 'deer', 'probability': 0.98, 'bbox': [0, 0, 100, 100]}]
- detect(image: str | Path | bytes) Response#
Invokes the object detection model for the specified image
Returns a list of detections, each containing a class label, probability, and bounding box coordinates [x1, y1, x2, y2].
- Args:
image: Can be a file path (str or Path) or raw image bytes
- Returns:
requests.Response containing detection results
- Examples:
>>> result = TinesightClient(key, cert).detect("photo.jpg") >>> print(result.json()) >>> [{'class': 'deer', 'probability': 0.95, 'bbox': [100, 200, 300, 400]}]
- detect_motion_stream(video_source: str | int = 0, probability_threshold: float = 0.55, window_name: str = 'Tinesight Motion Detection', motion_threshold: int = 25, min_motion_area: int = 500, cooldown_seconds: float = 20.0, display: bool = False, dry_run: bool = False, max_frames: int | None = None, max_invocations: int | None = None) None#
Detect objects in one frame when motion is detected.
This is the preferred trail-camera mode: frames are watched locally, and the API is invoked only after enough motion is detected and the cooldown has elapsed.