File size: 8,753 Bytes
608462a aa3c9d0 608462a aa3c9d0 608462a 1195677 0ecb9aa 1195677 0ecb9aa aa3c9d0 0ecb9aa aa3c9d0 0ecb9aa 608462a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
---
license: mit
model-index:
- name: ZIP-B
results:
- task:
type: crowd_counting
dataset:
name: ShanghaiTech A
type: shanghaitech_a
metrics:
- name: MAE
type: MAE
value: 47.81
- name: RMSE
type: RMSE
value: 75.04
- name: NAE
type: NAE
value: 0.1106
- task:
type: crowd_counting
dataset:
name: ShanghaiTech B
type: shanghaitech_b
metrics:
- name: MAE
type: MAE
value: 5.51
- name: RMSE
type: RMSE
value: 8.63
- name: NAE
type: NAE
value: 0.0408
- task:
type: crowd_counting
dataset:
name: UCF-QNRF
type: ucf_qnrf
metrics:
- name: MAE
type: MAE
value: 69.46
- name: RMSE
type: RMSE
value: 121.88
- name: NAE
type: NAE
value: 0.1018
- task:
type: crowd_counting
dataset:
name: NWPU-Crowd-Val
type: nwpu_crowd_val
metrics:
- name: MAE
type: MAE
value: 28.26
- name: RMSE
type: RMSE
value: 64.84
- name: NAE
type: NAE
value: 0.0920
- task:
type: crowd_counting
dataset:
name: NWPU-Crowd-Test
type: nwpu_crowd_test
metrics:
- name: MAE
type: MAE
value: 60.09
- name: RMSE
type: RMSE
value: 298.95
- name: NAE
type: NAE
value: 0.1044
---
# ZIP: Scalable Crowd Counting via Zero-Inflated Poisson Modeling
<!--
[](https://paperswithcode.com/sota/crowd-counting-on-shanghaitech-a?p=ebc-zip-improving-blockwise-crowd-counting)
[](https://paperswithcode.com/sota/crowd-counting-on-shanghaitech-b?p=ebc-zip-improving-blockwise-crowd-counting)
[](https://paperswithcode.com/sota/crowd-counting-on-ucf-qnrf?p=ebc-zip-improving-blockwise-crowd-counting)
[](https://paperswithcode.com/sota/crowd-counting-on-nwpu-crowd-val?p=ebc-zip-improving-blockwise-crowd-counting) -->
<a href="https://www.buymeacoffee.com/yiming.ma" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/default-orange.png" alt="Buy Me A Coffee" height="41" width="174"></a>
The official implementation of the paper [*ZIP: Scalable Crowd Counting via Zero-Inflated Poisson Modeling*](https://arxiv.org/pdf/2506.19955).
## Reults
| **Variants** | **Size (M)** | **GFLOPS (on HD)** | **SHA (MAE)** | **SHA (RMSE)** | **SHA (NAE, %)** | **SHB (MAE)** | **SHB (RMSE)** | **SHB (NAE, %)** | **QNRF (MAE)** | **QNRF (RMSE)** | **QNRF (NAE, %)** | **NWPU-Val (MAE)** | **NWPU-Val (RMSE)** | **NWPU-Val (NAE, %)** | **NWPU-Test (MAE)** | **NWPU-Test (RMSE)** | **NWPU-Test (NAE, %)** |
| ------------ | ------------ | ------------------ | ------------- | -------------- | ---------------- | ------------- | -------------- | ---------------- | -------------- | --------------- | ----------------- | ------------------ | ------------------- | --------------------- | ------------------- | -------------------- | ---------------------- |
| -P (Pico) | 0.81 | 6.46 | 71.18 | 109.60 | 16.69 | 8.23 | 12.62 | 6.98 | 96.29 | 161.82 | 14.40 | 66.94 | 223.52 | 14.97 | 79.91 | 327.17 | 21.42 |
| -N (Nano) | 3.36 | 24.73 | 58.86 | 94.63 | 14.15 | 7.74 | 12.14 | 6.33 | 86.46 | 147.64 | 12.60 | 56.27 | 292.53 | 14.06 | 75.03 | 334.54 | 17.59 |
| -T (Tiny) | 10.53 | 61.39 | 56.36 | 86.09 | 13.26 | 6.67 | 9.90 | 5.52 | 76.02 | 129.40 | 11.10 | 46.74 | 145.32 | 11.31 | 66.43 | 323.27 | 13.45 |
| -S (Small) | 33.60 | 242.43 | 55.17 | 88.99 | 11.97 | 5.83 | 9.21 | 4.58 | 73.32 | 125.09 | 10.40 | 31.66 | 77.11 | 9.61 | 62.89 | 309.02 | 12.09 |
| -B (Base) | 105.60 | 800.99 | 47.81 | 75.04 | 11.06 | 5.51 | 8.63 | 4.48 | 69.46 | 121.88 | 10.18 | 28.26 | 64.84 | 9.20 | 60.09 | 298.95 | 10.44 |
## Step 1: Install Dependencies
```bash
pip install -r requirements.txt
```
## Step 2: Download Processed Datasets
- **ShanghaiTech A**: [sha.zip](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/sha.zip)
- **ShanghaiTech B**: [shb.zip](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/shb.zip)
- **UCF-QNRF**: [qnrf.zip](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/qnrf.zip), [qnrf.z01](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/qnrf.z01)
- **NWPU-Crowd**: [nwpu.zip](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.zip), [nwpu.z01](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.z01), [nwpu.z02](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.z02), [nwpu.z03](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.z03), [nwpu.z04](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.z04), [nwpu.z05](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.z05), [nwpu.z06](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.z06), [nwpu.z07](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.z07), [nwpu.z08](https://github.com/Yiming-M/EBC-ZIP/releases/download/dataset/nwpu.z08)
To unzip splitted `.zip` files, 7-Zip is recommended. You can use the following command to install 7-Zip and unzip the dataset:
```bash
sudo apt update
sudo apt install p7zip-full
7z x dataset.zip
```
## Step 3: Run Training
Add the training code to `run.sh` and execute it:
```bash
sh run.sh
```
If you want to use the zero-inflated loss, set either `--reg_loss` or `--aux_loss` to `zipnll`. For example, you can set `--reg_loss zipnll` to use the zero-inflated loss for regression.
You can use an auxillary loss to improve the performance. For example, you might want to use the pre-defined multi-scale MAE loss by setting `--aux_loss msmae` and `--scales 1 2 4`.
The DMCount loss can also be used together with the zero-inflated loss. For example, you can set `--reg_loss zipnll --aux_loss dmcount` to use both losses.
## Step 4: Test the Model
Use `test.py` or `test.sh` to test the model. You can specify the dataset, weight path, input size, and other parameters.
To generate the predicted counts on NWPU-Crowd Test, you need to use `test_nwpu.py` instead.
To visualize the results, use the `notebooks/model.ipynb` notebook.
Trained weights are also provided:
- [**ShanghaiTech A**](https://github.com/Yiming-M/EBC-ZIP/releases/tag/weights_sha)
- [**ShanghaiTech B**](https://github.com/Yiming-M/EBC-ZIP/releases/tag/weights_shb)
- [**UCF-QNRF**](https://github.com/Yiming-M/EBC-ZIP/releases/tag/weights_qnrf)
- [**NWPU-Crowd**](https://github.com/Yiming-M/EBC-ZIP/releases/tag/weights_nwpu)
Make sure to use the processed datasets and the exact commands pre-defined in `test.sh` to reproduce the same results.
## Step 5: Visualize the Results
Use the `notebooks/model.ipynb` notebook to visualize the results. |