wikillm

Paper · 2021-02-16 · cs.CV

Focal Inverse Distance Transform Maps for Crowd Localization

Trains a point-supervised HRNet regressor to output a Focal Inverse Distance Transform (FIDT) map, whose local maxima mark head centres. A 3x3 max-pool with a threshold at 100/255 of the peak extracts them, and an I-SSIM loss on 30x30 regions sharpens the peaks. Author-reported: best localization F-measure on NWPU-Crowd (75.5 at sigma_l) and several other crowd datasets.

Density map regressionStructural similarity (SSIM-style comparison of maps)Distance transformcrowd-localizationcrowd-countingpoint-annotationsdistance-transformloss-function

arXivPDFCodeMarkdown19 min read

AI-compiled by claude-haiku-5-5 on 2026-11-09, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.

In plain words

Counting people in a dense crowd is easier than finding where each one is. The usual trick is to train a network to paint a soft blob on each head and add up the paint. In a packed crowd the blobs run into each other, so the paint peaks no longer sit on heads.

This method paints a different picture. Each pixel gets a value that is high close to a head and falls off with distance, and the falloff is shaped so that the value drops to nearly zero in empty background. Every head is then a sharp peak with no overlap with its neighbours, so finding the heads means finding the peaks. A simple local-maximum check does that, and the number of peaks is the count.

The authors also add a loss that looks at small patches around each person, so the network learns the shape of each peak rather than only its height. They report that this gives better head locations than earlier methods, including on very dense and on empty scenes, and that it needs only point labels, not bounding boxes.

TL;DR

Train a regressor (HRNet-w48 in the release) to output a Focal Inverse Distance Transform map: each head is a local maximum, and the map has no overlap in dense regions §3.1 eq. 3. Train it with MSE plus an I-SSIM term over one 30x30 region per person §3.3 eq. 8. At test time, take the 3x3 local maxima above 100/255 of the peak, and call the image empty if the peak is below 0.10 §3.2.2 alg. 1. Author-reported: state-of-the-art localization on six crowd datasets and one vehicle dataset, using point labels only §5 tab. 1. The released training script does not include the I-SSIM term train_baseline.py.

Problem

Density-map regression (Gaussian blobs summed for the count) is blurry, and in dense crowds neighbouring blobs overlap, so the local maxima of the map no longer sit on heads §1 fig. 1. Detectors need box labels, which are costly in dense crowds §1 §2.1. Pseudo boxes built from nearest-neighbour distances do not match real head sizes well §1. Segmentation-style and binary maps need hand-set thresholds, and connected components can merge into one blob when heads are close §1 §2.1. The method assumes only point annotations per head §1 §4.2.

Method

Overview. A regressor predicts a FIDT map. Training uses MSE plus the I-SSIM loss. Testing finds local maxima with LMDS. Box sizes come from a k-nearest- neighbour rule, used only for visualisation §3 fig. 2.

Step 1: Euclidean distance transform. For a pixel (x, y), let P be the distance to its nearest annotated head. The authors define P over the set B of all head positions §3.1 eq. 1:

P(x,y) = \min_{(x',y') \in B} \sqrt{(x-x')^2 + (y-y')^2} \qquad [\text{eq. 1}]

Step 2: inverse distance (IDT). The raw distance has a very large range, so the authors take its inverse with a constant C that avoids division by zero §3.1 eq. 2. The paper calls this a special case of the iKNN map of Olmschenk et al. with K = 1 §3.1. Its response decays too fast near a head and stays too high in background §3.1 fig. 3.

I' = \frac{1}{P(x,y) + C} \qquad [\text{eq. 2}]

Step 3: focal IDT (FIDT). The exponent of the distance is made to grow with the distance, which slows the decay near the head and pushes background to near zero §3.1 eq. 3. The paper fixes alpha = 0.02, beta = 0.75 and C = 1 §3.1 §4 tab. 9.

I = \frac{1}{P(x,y)^{\,(\alpha P(x,y) + \beta)} + C} \qquad [\text{eq. 3}]

The FIDT ground truth is built from head points as follows §3.1 eq. 1 eq. 3:

Pseudocode
# FIDT ground-truth map  [§3.1] [eq. 1] [eq. 3]
# Input:  image size (H, W); head points, each (x, y)
# Output: fidt map (H, W), float in [0, 1]

def fidt_map(height, width, points):
    # Distance from each pixel to its nearest head  [eq. 1]
    distance = nearest_head_distance(height, width, points)
    # Focal inverse distance with C = 1; alpha = 0.02, beta = 0.75  [eq. 3]
    exponent = 0.02 * distance + 0.75
    fidt = 1 / (distance ** exponent + 1)
    return fidt

Step 4: network. The regressor is HRNet, with one convolution and two transposed convolutions added as the representation head §3.2.1. The high-resolution branch is needed because each map peak must sit on a single head centre §3.2.1. The paper says any crowd regressor could be used instead, naming CSRNet and BL §3.2.1.

Step 5: local maxima detection (LMDS). Take a 3x3 max-pool. Keep pixels equal to their pooled value (the candidate peaks M). If the largest candidate is below T_f = 0.10, the image is treated as negative and the count is 0. Otherwise keep candidates at or above T_a = 100/255 times the largest candidate. Each kept pixel is one head, and the count is the number kept §3.2.2 alg. 1 §5.4 tab. 12.

Pseudocode
# Local-Maxima-Detection-Strategy (LMDS)  [alg. 1] [§3.2.2]
# Input:  predicted FIDT map (H, W)
# Output: head coordinates (N, 2); count N = number of rows

def lmds(fidt_pred):
    # Keep only pixels equal to their 3x3 neighbourhood maximum  [alg. 1]
    pooled = max_pool2d(fidt_pred, kernel=3, stride=1, padding=1)
    candidates = fidt_pred * (pooled == fidt_pred)
    peak = max(candidates)
    # Negative image if the peak is below T_f = 0.10  [§3.2.2] [§5.4]
    if peak < 0.10:
        return empty_coordinates()
    # Adaptive threshold T_a = 100/255 * max(M)  [alg. 1] [§3.2.2]
    threshold = 100 / 255 * peak
    keep = candidates >= threshold
    return nonzero_coordinates(keep)

Step 6: I-SSIM loss. Standard SSIM eq. 5 is computed with lambda_1 = 0.0001 and lambda_2 = 0.0009 and turned into a loss as 1 minus SSIM eq. 6 §3.3. The authors argue that a global SSIM rewards background structure and creates false peaks §3.3. The I-SSIM loss applies SSIM to small regions, one per person, averaged over the N persons eq. 7 §3.3. The region size is 30x30 for all datasets §3.3 tab. 11. The total objective is MSE plus I-SSIM, with weight 1 on each eq. 8 §3.3.

SSIM(E,G) = \frac{(2\mu_E\mu_G + \lambda_1)(2\sigma_{EG} + \lambda_2)}{(\mu_E^2 + \mu_G^2 + \lambda_1)(\sigma_E^2 + \sigma_G^2 + \lambda_2)} \qquad [\text{eq. 5}]

L_S(E,G) = 1 - SSIM(E,G) \qquad [\text{eq. 6}]

L_{I\text{-}S} = \frac{1}{N} \sum_{n=1}^{N} L_S(E_n, G_n) \qquad [\text{eq. 7}]

L = L_{MSE} + L_{I\text{-}S} \qquad [\text{eq. 8}]

The training step, as the paper describes it §3.3 eq. 8:

Pseudocode
# One training step: MSE plus per-person I-SSIM  [§3.3] [eq. 8]
# Input:  images (B, 3, H, W); fidt_targets (B, H, W); points per image
# Output: scalar loss

def training_step(images, fidt_targets, points):
    # Predict a FIDT map at input resolution  [§3.2.1]
    # [code: train_baseline.py#L169-L176]
    predicted = model(images)
    # Pixel-wise MSE over the whole map; reduction not stated  [eq. 8]
    mse_term = mse(predicted, fidt_targets)
    # One 30x30 region per person; centring not stated  [§3.3] [tab. 11]
    region_losses = []
    for person in persons_in(points):
        # Local crop around the person  [§3.3]
        region_pred = crop(predicted, person, size=30)
        region_gt = crop(fidt_targets, person, size=30)
        # SSIM loss on that region, lambda_1 = 1e-4, lambda_2 = 9e-4  [eq. 5]
        region_losses.append(1 - ssim(region_pred, region_gt))
    # Average over the N persons  [eq. 7]
    ssim_term = mean(region_losses)
    return mse_term + ssim_term  # weight 1 on each term  [eq. 8]

Step 7: box sizes (visualisation only). Each head's square size is s = min(f times the mean distance to its k nearest heads, 0.05 times the shorter image side), with k = 4 and f = 0.1 §4 eq. 4. The paper says the boxes do not affect localization §3.2.2 §5.1.

s_{(x,y)} = \min\left\{ f \cdot \frac{1}{k}\sum_{i=1}^{k} d^{\,k}_{(x,y)},\ \min(img\_w, img\_h) \cdot 0.05 \right\} \qquad [\text{eq. 4}]

Step 8: counting. The count is the number of LMDS points, and the result is 0 for negative images §3.2.2 §5.2 alg. 1.

Hyperparameters

NameValueWhereNotes
optimiserAdam§4code: torch.optim.Adam train_baseline.py
learning rate1e-4§4code default config.py; no schedule in the training script train_baseline.py
weight decay5e-4§4code default config.py
batch size16§4code default config.py
training crop256 x 256 (Part A, Part B); 512 x 512 (other datasets)§4code default is 256 config.py; the 512 setting is not shown in a script
augmentationrandom crop; horizontal flip§4flip p = 0.5 dataset.py; crop dataset.py
image resizelonger side below 2048 (NWPU-Crowd, JHU-Crowd++, UCF-QNRF)§4resizing code is not in the release; pre-resized images_2048 folders are used make_npydata.py
alpha, beta (FIDT)0.02, 0.75§3.1 §4 tab. 9matches the release generator fidt_generate_sh.py
C (FIDT)1§3.1 eq. 2matches the release generator fidt_generate_sh.py
I-SSIM constantslambda_1 = 0.0001; lambda_2 = 0.0009§3.3 eq. 5
I-SSIM region30 x 30, all datasets§3.3 tab. 11the 20 and 40 settings are in tab. 11
loss weightsMSE 1, I-SSIM 1eq. 8
LMDS max-pool3 x 3alg. 1 §3.2.2
LMDS adaptive threshold100/255 times the peakalg. 1 §3.2.2 tab. 12
LMDS negative threshold T_f0.10§3.2.2 §5.4set from NWPU validation maxima §5.4 fig. 9
box k-NNk = 4§4 eq. 4
box factor f0.1§4 eq. 4
box cap0.05 x shorter sideeq. 4
regressorHRNet-w48, ImageNet-pretrained§3.2.1paper says "HRNET"; w48 and the pretrained path are in the code seg_hrnet_w48.yaml config.py
regressor head1x1 conv, BN, ReLU, two transposed convs§3.2.1paper: "one convolution and two transposed convolution layers"; the code's layers are at seg_hrnet.py
training epochsnot statedcode default 3000 config.py
random seednot statedcode default 1 config.py
ImageNet pretrainingnot stated§3.2.1code loads ImageNet HRNet-w48 weights seg_hrnet.py

Results

Author-reported. Localization is scored by precision, recall and F-measure at distance thresholds (see §4.1). Setup: NWPU-Crowd (test set from the online benchmark), JHU-Crowd++, UCF-QNRF, ShanghaiTech Part A and Part B, UCF_CC_50, TRANCOS (vehicles). Baselines are from the NWPU benchmark, from their official code, or trained by the authors where marked §5.1 §5.3.

Table 1: NWPU-Crowd localization tab. 1. Columns: validation and test sets, each at sigma_l and sigma_s (eqs. 9 and 10), giving F, P and R in percent.

MethodLabelsVal sigma_l FVal sigma_l PVal sigma_l RVal sigma_s FVal sigma_s PVal sigma_s RTest sigma_l FTest sigma_l PTest sigma_l RTest sigma_s FTest sigma_s PTest sigma_s R
Faster RCNNBox7.396.43.86.890.03.56.795.83.56.389.43.3
TinyFacesBox59.854.366.655.350.261.756.752.961.152.649.156.6
TopoCountBox------69.169.568.760.160.559.8
VGG+GPRPoint56.361.052.246.049.942.752.555.849.642.645.340.2
RAZ_LocPoint62.569.256.954.560.549.659.866.654.351.757.647.0
Crowd-SDNetPoint------63.765.162.4---
AutoScale*Point66.870.163.860.062.957.362.067.357.454.459.150.4
GLPoint------66.080.056.2---
SCALNetPoint72.473.571.466.967.965.969.169.263.663.663.763.6
OursPoint78.982.275.973.776.770.975.579.771.770.574.466.9

* as printed in the source. Baseline rows for Crowd-SDNet and GL are reported as published; the source gives no validation figures for them tab. 1.

Table 2: UCF-QNRF localization (average over thresholds 1 to 100 pixels) tab. 2.

MethodAv. precisionAv. recallF-measure
MCNN59.93%63.50%61.66%
CL75.80%59.75%66.82%
LCFCN77.89%52.40%62.65%
Method in Ribera et al. 201975.46%49.87%60.05%
LSC-CNN74.62%73.50%74.06%
GL78.20%74.80%76.30%
TopoCount81.77%78.96%80.34%
Ours84.49%80.10%82.23%

Table 3: JHU-Crowd++ localization tab. 3.

Methodsigma=4 Psigma=4 Rsigma=4 Fsigma=8 Psigma=8 Rsigma=8 F
TopoCount31.5%28.8%30.1%63.6%58.3%60.8%
Ours38.9%38.7%38.8%62.5%62.4%62.4%

Table 4: ShanghaiTech Part A and Part B localization tab. 4.

MethodA sigma=4 PA sigma=4 RA sigma=4 FA sigma=8 PA sigma=8 RA sigma=8 FB sigma=4 PB sigma=4 RB sigma=4 FB sigma=8 PB sigma=8 RB sigma=8 F
LCFCN43.3%26.0%32.5%75.1%45.1%56.3%------
Method in Ribera et al. 201934.9%20.7%25.9%67.7%44.8%53.9%------
LSC-CNN33.4%31.9%32.6%63.9%61.0%62.4%29.7%29.2%29.5%57.5%56.7%57.0%
TopoCount41.7%40.6%41.1%74.6%72.7%73.6%63.4%63.1%63.2%82.3%81.8%82.0%
Ours59.1%58.2%58.6%78.2%77.0%77.6%64.9%64.5%64.7%83.9%83.2%83.5%

Table 5: UCF_CC_50 localization tab. 5. Rows marked with a dagger were trained by the authors tab. 5.

Methodsigma=4 Psigma=4 Rsigma=4 Fsigma=8 Psigma=8 Rsigma=8 F
LSC-CNN (dagger)37.7%39.5%38.6%57.8%61.1%59.4%
AutoScale (dagger)37.8%40.5%39.1%59.0%62.3%60.6%
TopoCount (dagger)39.5%42.0%40.7%62.5%66.9%64.6%
Ours46.5%49.0%47.7%67.0%70.6%68.7%

Table 6: NWPU-Crowd counting tab. 6. The S0 to S4 columns are MAE by scene level (0; (0,100]; (100,500]; (500,5000]; >5000). Position output: the method returns coordinates.

MethodPositionVal MAEVal MSETest MAETest MSETest avg MAES0/S1/S2/S3/S4 MAE
C3F-VGGno105.79504.39127.0439.6666.9140.9/26.5/58.0/307.1/2801.8
CSRNetno104.89433.48121.3387.8522.7176.0/35.8/59.8/285.8/2055.8
CANno93.58489.90106.3386.5612.282.6/14.7/46.6/269.7/2647.0
SCARno81.57397.92110.0495.3718.3122.9/16.7/46.0/241.7/3164.3
BLno93.64470.38105.4454.2750.566.5/8.7/41.2/249.9/3386.4
SFCNno95.46608.32105.7424.1712.754.2/14.8/44.4/249.6/3200.5
KDMGno--100.5415.5632.777.3/10.3/38.5/259.4/2777.9
NoisyCCno--96.9534.2608.1218.7/10.7/35.2/203.2/2572.8
DM-Countno70.5357.688.4388.6498.0146.6/7.6/31.2/228.7/2075.8
RAZ_locyes128.7665.4151.4634.61166.060.6/17.1/48.3/364.7/5339.0
AutoScaleyes97.3571.2123.9515.5871.042.3/18.8/46.1/301.7/3947.0
TopoCountyes--107.8438.5--
SCALNetyes64.4251.186.8339.9429.592.0/11.2/41.1/227.7/1775.3
Oursyes51.4107.686.0312.5390.621.6/13.7/55.6/217.1/1645.4

Table 7: counting on JHU-Crowd++, UCF-QNRF, ShanghaiTech A and B, UCF_CC_50 tab. 7. Each cell is MAE / MSE.

MethodPositionJHUQNRFPart APart BUCF_CC_50
CSRNetno85.9 / 309.2-68.2 / 115.010.6 / 16.0266.1 / 397.5
SFCNno77.5 / 297.6102.0 / 171.464.8 / 107.57.6 / 13.0214.2 / 318.2
L2SMno-104.7 / 173.664.2 / 98.47.2 / 11.1188.4 / 315.3
CG-DRCNno82.3 / 328.0112.2 / 176.364.0 / 98.48.5 / 14.4-
MUD-iKNNno-104.0 / 172.068.0 / 117.713.4 / 21.4237.7 / 305.7
DSSI-Netno133.5 / 416.599.1 / 159.260.6 / 96.06.9 / 10.3216.9 / 302.4
MBTTBFno81.8 / 299.197.5 / 165.260.2 / 94.18.0 / 15.5233.1 / 300.9
BLno75.0 / 299.988.7 / 154.862.8 / 101.87.7 / 12.7229.3 / 308.2
RPNetno--61.2 / 96.98.1 / 11.6-
ASNetno-91.6 / 159.757.8 / 90.1-174.8 / 251.6
AMSNetno-101.8 / 163.256.7 / 93.46.7 / 10.2208.6 / 296.3
LibraNetno-88.1 / 143.755.9 / 97.17.3 / 11.3181.2 / 262.2
KDMGno69.7 / 268.399.5 / 173.063.8 / 99.27.8 / 12.7-
NoisyCCno67.7 / 258.585.8 / 150.661.9 / 99.67.4 / 11.3-
DM-Countno-85.6 / 148.359.7 / 95.77.4 / 11.8211.0 / 291.5
RAZ_loc+yes-118.0 / 198.071.6 / 120.19.9 / 15.6-
PSDDNyes--65.9 / 112.39.1 / 14.2359.4 / 514.8
LSC-CNNyes112.7 / 454.4120.5 / 218.266.4 / 117.08.1 / 12.7225.6 / 302.7
Crowd-SDNetyes--65.1 / 104.47.8 / 12.6-
AutoScaleyes85.6 / 356.1104.4 / 174.265.8 / 112.18.6 / 13.9210.5 / 287.4
TopoCountyes60.9 / 267.489.0 / 159.061.2 / 104.67.8 / 13.7184.1 / 258.3
Oursyes66.6 / 253.689.0 / 153.557.0 / 103.46.9 / 11.8171.4 / 233.1

Table 8: TRANCOS vehicle counting, GAME(L) tab. 8. Lower is better. Dagger rows were trained by the authors.

MethodGAME(0)GAME(1)GAME(2)GAME(3)
PSDDN4.795.436.688.40
LSC-CNN4.605.406.908.30
AutoScale2.884.976.649.73
Crowd-SDNet (dagger)3.825.277.7210.11
TopoCount (dagger)3.424.766.518.55
Ours2.253.915.668.36

Table 9: alpha and beta on ShanghaiTech Part A, localization at sigma=8 tab. 9. The IDT row is alpha = 0, beta = 1.

MethodalphabetaP (%)R (%)F (%)MAEMSE
IDT0.001.0075.674.675.161.8109.6
FIDT0.010.6576.676.076.360.5107.4
FIDT0.020.7578.277.077.657.0103.4
FIDT0.030.8577.076.876.958.3106.6

Table 10: I-SSIM ablation, Part A, sigma=8 tab. 10.

LossP (%)R (%)F (%)MAEMSE
L273.576.374.962.1108.8
L2 + SSIM76.876.676.759.3106.5
L2 + I-SSIM (ours)78.277.077.657.0103.4

Table 11: I-SSIM region size, Part A, sigma=8 tab. 11.

Region sizeP (%)R (%)F (%)MAEMSE
20 x 2078.076.477.258.1104.4
30 x 3078.277.077.657.0103.4
40 x 4077.476.476.958.6105.9

Table 12: threshold T_a ablation tab. 12. The dataset is not stated in the caption.

ThresholdAdaptiveMAEMSE
50/255no95.6169.9
70/255no92.1167.0
90/255no80.6152.3
100/255no115.3206.4
110/255no122.6233.5
90/255 x max(M)yes60.4105.3
100/255 x max(M)yes57.0103.4
110/255 x max(M)yes58.1107.1

Table 13: NWPU-Crowd test, negative (S0) and extremely dense (S4) scenes tab. 13.

MethodS0 MAES0 MSES4 MAES4 MSE
KDMG77.3303.02777.93521.8
DM-Count146.7736.12075.82895.2
NoisyCC218.71415.62572.53414.9
SCALNet92.0479.31775.32676.4
Ours21.6129.31645.42288.2

Table 14: other regressors with FIDT maps, NWPU-Crowd validation tab. 14. Density-map columns count by integration; FIDT columns count by localization. The FIDT runs use only the L2 loss §5.4.

RegressorDensity MAEDensity MSEFIDT MAEFIDT MSEFIDT P (%)FIDT R (%)FIDT F (%)
CSRNet104.9433.5100.6464.368.866.267.5
CSRNet + FPN95.5450.870.6369.773.969.871.8
BL93.6470.489.7446.669.968.969.4
BL + FPN85.4412.965.7259.277.870.073.7

Table 15: complexity tab. 15. MACs at 768 x 1024, RTX 3090 §5.5.

MethodMACs (G)Inference speedF-measure (NWPU test)
LSC-CNN1244.32.6 FPS-
AutoScale1074.65.7 FPS62.0%
Crowd-SDNet-0.8 FPS63.7%
GL324.620.3 FPS66.0%
TopoCount797.29.4 FPS69.1%
Ours426.77.1 FPS75.5%

Qualitative results. Figures show FIDT versus density-map predictions in dense scenes fig. 6, box visualisations against LSC-CNN fig. 4 and fig. 5, and the maximum response per image used to pick T_f fig. 9.

Paper vs code

Official repository: github.com/dk-liang/FIDTM, owned by the first author (Dingkang Liang), commit e9308bdd2292e0308b2e02a9c8fc21ec5530cd9e (git rev-parse HEAD on a depth-1 clone). It is MIT-licensed. The paper's abstract gives this link. Only what is needed for the card is read; no code is quoted.

Discrepancies found:

  • I-SSIM loss is not in the release. The training script uses only MSE with size_average=False train_baseline.py and sums it in the loss train_baseline.py. The paper's objective eq. 8 adds I-SSIM, which is not implemented anywhere in the repository (no ssim string in the Python or Markdown files). The reported ablation tab. 10 cannot be checked from the code.
  • MSE reduction. The paper writes MSE with no reduction. The code sums over pixels and images train_baseline.py. Loss magnitudes, and so the Adam-normalised step size relative to the weight decay, depend on this choice.
  • UCF-QNRF pooling in the training script. The training-time LMDS applies a 3x3 average pool to the prediction before max-pooling on UCF-QNRF train_baseline.py. The test script has that line commented out test.py. Algorithm 1 has no average pool alg. 1.
  • Negative check. The code compares the global maximum of the map with T_f train_baseline.py train_baseline.py. The paper uses the maximum of the candidates M §3.2.2. The global maximum is always a candidate, so the two agree (inferred from the code).
  • Adaptive threshold. The code uses 100/255 times the global maximum train_baseline.py, which matches the paper alg. 1.
  • Box size. The paper's square size is min(f times the mean of k = 4 neighbour distances, 0.05 times the shorter side) eq. 4 §4. The code sums three neighbour distances and multiplies by 0.1 test.py test.py. The k-d tree query with k = 4 returns the point itself first, so the three terms are its three nearest other heads (inferred). The code then caps the value at 0.05 times the shorter side test.py, which matches. The drawn rectangle goes from the point minus sigma to the point plus sigma test.py, so its side is 2 sigma. The paper does not say whether s is a side or a half-side.
  • Single-point images. The code uses a different size for an image with one head: the average image side over 4 test.py. The paper does not mention this.
  • FIDT ground truth. The generator matches eq. 3 with C = 1 and alpha, beta as in the paper fidt_generate_sh.py. It also zeroes values below 1e-2 fidt_generate_sh.py, which the paper does not mention. It moves head coordinates of 0 to 1 fidt_generate_sh.py.
  • Hyperparameters that match. Adam with lr 1e-4, weight decay 5e-4 and batch 16 config.py. The crop default is 256 config.py; the paper's 512 crop for the other datasets is not in any script shown.
  • Regressor. HRNet-w48 with an ImageNet checkpoint config.py and a 1x1 convolution, then two transposed convolutions seg_hrnet.py. The output has no final activation seg_hrnet.py. The paper does not state the output activation.
  • Training-time filter. Training images whose shorter side is under 256 are dropped train_baseline.py. The paper does not mention this.
  • Training length and selection. The default is 3000 epochs config.py. Validation runs every 10 epochs from epoch 200 train_baseline.py. The best checkpoint is chosen by MAE on the test list train_baseline.py train_baseline.py. The paper does not describe selection.
  • Evaluation files. The repository ships predicted coordinates and ground-truth scripts under local_eval/ [README], and the NWPU sigmas come from box annotations in the benchmark eval.py. The fixed sigma of 4 and 8 for the other datasets is in gt_generate.py.
  • TRANCOS. The repository has FIDT generators for ShanghaiTech, JHU, UCF-QNRF and NWPU only [README]. The vehicle results cannot be reproduced from the release, and the paper does not say how its vehicle model was trained §5.3.

Pitfalls

  • One loss term is absent from the release. The I-SSIM term, its region size and its region-centring rule are only in the paper, so a model trained with the released script is MSE-only. Its results may differ from tab. 1 and tab. 10.
  • Region centring is not stated. For I-SSIM, the paper defines one 30x30 region per person §3.3 but does not say whether it is centred on the ground- truth head, on the prediction, or on a peak. A reimplementation has to choose.
  • The negative threshold depends on output scale. T_f = 0.10 is set from the maxima of predicted maps on the NWPU validation set §5.4 fig. 9. A model trained with a different loss reduction or on a different scale needs its own threshold.
  • Adaptive threshold ablation has no dataset. The T_a table tab. 12 gives no dataset in the caption. The text says the fixed thresholds lose to the adaptive one §5.4.
  • FIDT depends on pixel distances. Eq. 1 and eq. 3 use distances in pixels, so a different resize changes the map. The paper resizes the three large datasets to a longer side below 2048 §4, and the release uses pre-resized folders make_npydata.py. The paper does not discuss how alpha and beta interact with resizing (the dependence is inferred from the formulas).
  • Ties in the 3x3 maximum. Algorithm 1 keeps every pixel equal to its window maximum. A flat plateau of equal values can therefore produce several peaks for one head. The paper does not discuss ties (inferred from the algorithm).
  • Label types differ across the comparison. TopoCount is trained with boxes on NWPU, while this method uses points only §5.1. The NWPU localization numbers come from the online benchmark, not from a local run §5.1.
  • Inference cost. The method is slower than the real-time GL method, and the paper says it wants to move to real-time later §5.5. At 768 x 1024, it runs at 7.1 FPS on an RTX 3090 with 426.7 GMACs tab. 15.
  • Small mismatches in the paper's tables. DM-Count's S0 MAE is 146.6 in tab. 6 but 146.7 in tab. 13. NoisyCC's S4 MAE is 2572.8 in tab. 6 and 2572.5 in tab. 13. The text gives the 27.4 MSE margin over SCALNet, which matches tab. 6.
  • Citation key. The row labelled TopoCount in tab. 15 cites the DM-Count reference key §5.5 tab. 15. Treat the row as TopoCount, following its name and the other tables.
  • Not stated. Training epochs, learning-rate schedule, ImageNet initialisation for the paper's own training, random seed, and the vehicle training protocol.
  • Paper figures are described only. No figure is reproduced here. Read fig. 3 for the IDT and FIDT decay curves and fig. 9 for the peak-value distribution behind T_f.

Lineage

  • Builds on: the iKNN map of Olmschenk et al. (IDT is its K = 1 case, not used for localization in that work) §3.1; the Euclidean distance transform §2.3.
  • Loss ideas from: SSIM for density maps (Cao et al., DSSI-Net) §2.2 §3.3.
  • Regressor: HRNet (Wang et al.) §3.2.1; the paper also tests CSRNet and BL §5.4 tab. 14.
  • Compared against: TopoCount (Abousamra et al.), LSC-CNN (Sam et al.), AutoScale (Xu et al.), SCALNet, GL, Crowd-SDNet, RAZ_loc, PSDDN, VGG+GPR, TinyFaces and Faster R-CNN tab. 1. None of these have cards yet.
  • Superseded by: not stated.

Source and license

Adapted from “Focal Inverse Distance Transform Maps for Crowd Localization” by Dingkang Liang, Wei Xu, Yingying Zhu, Yu Zhou (arXiv:2102.07925), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/dk-liang/FIDTM at commit e9308bdd2292 (MIT). Any quoted code is shown under that license.