
Density-based crowd counter: reads each Image and emits a head-density DensityMap, a per-class probability DensityMap, and a UInt64 total. Use where occlusion or distance defeats per-head bounding-box detection.
A camera or file stream is counted per frame and the integer total is published as JSON as a live occupancy signal for alarms or dashboards.
The density map is forwarded to peak detection to recover discrete per-head coordinates instead of a single scalar count.
model must contain exactly one `.pth` checkpoint; zero or more than one aborts startup with a count mismatch.UInt64 total is the rounded sum of the head-density map, taken from the full-resolution map so it stays exact relative to the model, but it is integer-quantised regression rather than a verified per-head enumeration.DensityMap outputs are emitted at the resized inference resolution (the value of model_width by model_height), not the original frame size; the count is computed before that resize so it is unaffected. Set both to 0 to run and emit at native source resolution.model therefore determine preprocessing implicitly.device value beginning with `cuda` silently falls back to CPU with a warning when CUDA is unavailable; CPU inference is impractical for live video.device are fixed at startup, but model_width and model_height are re-read each frame, so the inference resolution can be retuned live without a redeploy.Automated release