Skip to content

Comments

feat(eyeTracking): improve batch_predict visualization payload (heatmap + points)#48

Open
harsshks wants to merge 1 commit intoruxailab:mainfrom
harsshks:fix/visualization-improvements
Open

feat(eyeTracking): improve batch_predict visualization payload (heatmap + points)#48
harsshks wants to merge 1 commit intoruxailab:mainfrom
harsshks:fix/visualization-improvements

Conversation

@harsshks
Copy link

Summary

This PR improves the /api/session/batch_predict response to support richer eye-tracking visualizations (heatmaps and prediction/scanpath points) while preserving backward compatibility.

What changed

  • Introduced a lightweight heatmap generator (app/services/heatmap.py) that:
    • builds a 2D gaze density map from prediction points
    • applies optional Gaussian smoothing
    • normalizes values to the 0–1 range for frontend rendering
  • Restructured predict_new_data_simple to return a unified, self-descriptive payload containing:
    • per-prediction data (x, y, x_norm, y_norm, timestamp, confidence)
    • screen dimensions
    • a heatmap placeholder
  • Updated batch_predict route to attach heatmap data safely (wrapped in error handling so predictions still return if heatmap generation fails)

Resulting response shape

{
  "screen": { "width": W, "height": H },
  "predictions": [
    { "x": 678.6, "y": 383.7, "x_norm": 0.49, "y_norm": 0.50, "timestamp": 123456, "confidence": 0.87 }
  ],
  "normalized": true,
  "heatmap": [[...]]
}

Adds unified response structure with normalized gaze points and optional heatmap generation while preserving backward compatibility. Closes ruxailab#47.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant