Sponsored by
Vmake Labs Video Enhancer
-Vmake Labs Video Enhancer uses AI to improve video quality, restore details, reduce blur, and upscale videos to 8K.
On-device
crowd counting
running
fully on the LiteRT
CompiledModel
GPU
delegate
(no CPU fallback).
DM-Count
(NeurIPS 2020)
regresses a person
density map
whose sum is the crowd size — it counts hundreds of
people where detector-based counting saturates.
Architecture:
VGG19 backbone + conv regression head — pure CNN.
Output:
[1, 1, 64, 64]
non-negative density map —
sum(map)
= estimated person count; normalize per frame for a heatmap overlay.
GPU conversion
DM-Count is a pure CNN (VGG19 + conv head). It converts fully GPU-compatible (
30/30 nodes
on the delegate, 1 partition
; Pixel 8a corr 0.9998–1.0 and count within 0.4% of PyTorch on
real crowd images, ~79 ms/frame) with
one exact rewrite
: the mid-graph
F.upsample_bilinear
(align_corners=True
RESIZE_BILINEAR
, banned on the delegate) is a
linear operator, re-authored as two constant-matrix multiplies — with the constant on the
RHS
(lowers to
FULLY_CONNECTED
; the delegate rejects
BATCH_MATMUL
with a constant
LHS). Desktop corr vs PyTorch is 1.000000 with an identical count.
Minimal usage
Kotlin (Android, LiteRT CompiledModel GPU)
val options = CompiledModel.Options(Accelerator.GPU)
val model = CompiledModel.create(context.assets, "dmcount.tflite", options, null)
val inBufs = model.createInputBuffers()
val outBufs = model.createOutputBuffers()
inBufs[0].writeFloat(inputNCHW) // [1,3,512,512] RGB, ImageNet-norm
model.run(inBufs, outBufs)
val density = outBufs[0].readFloat() // [64*64] density mapval count = density.sum() // estimated number of people
Python (LiteRT CompiledModel API)
import numpy as np
from ai_edge_litert.compiled_model import CompiledModel
model = CompiledModel.from_file("dmcount.tflite")
inputs = model.create_input_buffers(0)
outputs = model.create_output_buffers(0)
inputs[0].write(np.ascontiguousarray(x, np.float32)) # [1,3,512,512] RGB, ImageNet-norm
model.run_by_index(0, inputs, outputs)
n = model.get_output_buffer_requirements(0, 0)["buffer_size"] // 4
density = outputs[0].read(n, np.float32).reshape(64, 64)
count = float(density.sum())
Conversion
Converted with
litert-torch
(
build_dmcount.py
): loads the MIT DM-Count (UCF-QNRF)
weights and exports the raw density map. The UCF-QNRF checkpoint generalizes best across
scenes; the upstream repo also bundles an NWPU-Crowd variant.
License
MIT (DM-Count / cvlab-stonybrook). Trained on UCF-QNRF.
Runs of litert-community DM-Count-Crowd-LiteRT on huggingface.co
330
Total runs
0
24-hour runs
28
3-day runs
150
7-day runs
201
30-day runs
More Information About DM-Count-Crowd-LiteRT huggingface.co Model
DM-Count-Crowd-LiteRT huggingface.co is an AI model on huggingface.co that provides DM-Count-Crowd-LiteRT's model effect (), which can be used instantly with this litert-community DM-Count-Crowd-LiteRT model. huggingface.co supports a free trial of the DM-Count-Crowd-LiteRT model, and also provides paid use of the DM-Count-Crowd-LiteRT. Support call DM-Count-Crowd-LiteRT model through api, including Node.js, Python, http.
DM-Count-Crowd-LiteRT huggingface.co is an online trial and call api platform, which integrates DM-Count-Crowd-LiteRT's modeling effects, including api services, and provides a free online trial of DM-Count-Crowd-LiteRT, you can try DM-Count-Crowd-LiteRT online for free by clicking the link below.
litert-community DM-Count-Crowd-LiteRT online free url in huggingface.co:
DM-Count-Crowd-LiteRT is an open source model from GitHub that offers a free installation service, and any user can find DM-Count-Crowd-LiteRT on GitHub to install. At the same time, huggingface.co provides the effect of DM-Count-Crowd-LiteRT install, users can directly use DM-Count-Crowd-LiteRT installed effect in huggingface.co for debugging and trial. It also supports api for free installation.
DM-Count-Crowd-LiteRT install url in huggingface.co: