Guides

Running predictions

Load a trained model and apply it to new images or videos. The GPU subpixel peak detector recovers keypoint coordinates with sub-pixel precision.

Load a saved model

from deepposekit.models import load_model

model = load_model('/path/to/saved_model.h5')

Predict on a video

from deepposekit.io import VideoReader

reader = VideoReader('/path/to/video.mp4', batch_size=50)
predictions = model.predict(reader)

# predictions: ndarray of shape (n_frames, n_keypoints, 3)
# columns: [x, y, confidence]

Predict on an image batch

import numpy as np

batch = np.stack([img1, img2, img3])           # (3, H, W, C)
predictions = model.predict(batch, batch_size=3)

Working with the output

Each prediction row gives (x, y, confidence). Drop low-confidence detections (confidence < 0.1) when computing downstream behavioural metrics.