Plugin Base Classes¶
MindSight defines four plugin base classes. Every plugin must subclass exactly one of these and implement the required methods.
GazePlugin¶
Base class for gaze estimation backends.
Properties¶
| Property | Type | Description |
|---|---|---|
name |
str |
Unique identifier for the backend (e.g., "gazelle"). |
mode |
str |
Processing mode: "face" (per-crop) or "frame" (whole-frame). |
is_fallback |
bool |
If True, this backend is used when the preferred one fails. |
Methods¶
Estimate gaze from a single face crop. Returns(pitch, yaw) in radians. Only called when mode == "face".
def estimate_frame(
self,
frame: np.ndarray,
bboxes: List[Tuple[int, int, int, int]],
) -> List[Tuple[float, float]]:
(pitch, yaw) tuples, one per bbox. Only called when mode == "frame".
Optional. Run a full custom pipeline. Receives the same keyword arguments as the main pipeline loop. Return value is backend-specific.
Register backend-specific CLI arguments on the given parser.
Construct an instance from parsed CLI arguments.
ObjectDetectionPlugin¶
Base class for object detection backends.
Properties¶
| Property | Type | Description |
|---|---|---|
name |
str |
Unique identifier for the detection backend. |
Methods¶
def detect(
self,
frame: np.ndarray,
detection_frame: np.ndarray,
all_dets: Any,
det_cfg: dict,
) -> Any:
detection_frame may be a resized or preprocessed copy of frame. all_dets carries forward detections from a previous stage (e.g., the built-in YOLOE pass). det_cfg contains detection parameters from the pipeline config. Returns updated detections in the same format as all_dets.
Register detection-specific CLI arguments.
Construct an instance from parsed CLI arguments.
PhenomenaPlugin¶
Base class for phenomena tracker plugins.
Properties¶
| Property | Type | Description |
|---|---|---|
name |
str |
Unique identifier for the tracker (e.g., "joint_attention"). |
dashboard_panel |
Optional[str] |
Name of the dashboard section, or None to skip dashboard rendering. |
Methods¶
Called once per frame. Receives keyword arguments includingframe_idx, person_gazes, detections, and other pipeline state. Returns a dict of computed metrics for this frame.
Draw annotations onto the video frame. Called after
update(). Returns the modified frame.
def dashboard_section(
self,
panel: np.ndarray,
y: int,
line_h: int,
pid_map: Dict[int, str],
) -> int:
panel is the image buffer, y is the starting vertical offset, line_h is the line height in pixels, and pid_map maps track IDs to participant labels. Returns the new y position after drawing.
Return structured data for the GUI dashboard.
pid_map maps track IDs to participant labels.
Return a list of dicts suitable for CSV output. Each dict is one row.
Return a human-readable summary string printed to the console at the end of a run.
Return time-series data for charting (e.g., per-frame metric values).
Return the most recent scalar metric value (used by live dashboard widgets).
Return a dict of the most recent metric values (multi-metric trackers).
Return a PyQt6 widget for the GUI dashboard, or
None for the default rendering.
Update the custom dashboard widget with new data from
dashboard_data().
Register tracker-specific CLI arguments.
Construct an instance from parsed CLI arguments.
DataCollectionPlugin¶
Base class for data collection and output plugins.
Properties¶
| Property | Type | Description |
|---|---|---|
name |
str |
Unique identifier for the data collector. |
Methods¶
Called once per processed frame. Receives keyword arguments includingframe_idx, frame, person_gazes, detections, and phenomena results. Use this to accumulate per-frame data.
Called once after the pipeline finishes processing all frames. Receives summary keyword arguments including
total_frames, output_dir, and pid_map. Use this to flush buffers, close files, or write final outputs.
Generate charts or visualizations and save them to
output_dir. Called after on_run_complete().
Register output-specific CLI arguments.
Construct an instance from parsed CLI arguments.