You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The official codes for the ICCV2021 Oral presentation "Rethinking Counting and Localization in Crowds: A Purely Point-Based Framework"
1
+
# P2PNet (ICCV2021 Oral Presentation)
2
+
3
+
This repository contains codes for the official implementation in PyTorch of **P2PNet** as described in [Rethinking Counting and Localization in Crowds: A Purely Point-Based Framework](https://arxiv.org/abs/2107.12746).
4
+
5
+
An brief introduction of P2PNet can be found at [机器之心 (almosthuman)](https://mp.weixin.qq.com/s?__biz=MzA3MzI4MjgzMw==&mid=2650827826&idx=3&sn=edd3d66444130fb34a59d08fab618a9e&chksm=84e5a84cb392215a005a3b3424f20a9d24dc525dcd933960035bf4b6aa740191b5ecb2b7b161&mpshare=1&scene=1&srcid=1004YEOC7HC9daYRYeUio7Xn&sharer_sharetime=1633675738338&sharer_shareid=7d375dccd3b2f9eec5f8b27ee7c04883&version=3.1.16.5505&platform=win#rd).
6
+
7
+
The codes is tested with PyTorch 1.5.0. It may not run with other versions.
8
+
9
+
## Visualized demos for P2PNet
10
+
<imgsrc="vis/congested1.png"width="1000"/>
11
+
<imgsrc="vis/congested2.png"width="1000"/>
12
+
<imgsrc="vis/congested3.png"width="1000"/>
13
+
14
+
## The network
15
+
The overall architecture of the P2PNet. Built upon the VGG16, it firstly introduce an upsampling path to obtain fine-grained feature map.
16
+
Then it exploits two branches to simultaneously predict a set of point proposals and their confidence scores.
17
+
18
+
<imgsrc="vis/net.png"width="1000"/>
19
+
20
+
## Comparison with state-of-the-art methods
21
+
The P2PNet achieved state-of-the-art performance on several challenging datasets with various densities.
* Clone this repo into a directory named P2PNET_ROOT
76
+
* Organize your datasets as required
77
+
* Install Python dependencies. We use python 3.6.5 and pytorch 1.5.0
78
+
```
79
+
pip install -r requirements.txt
80
+
```
81
+
82
+
## Organize the counting dataset
83
+
We use a list file to collect all the images and their ground truth annotations in a counting dataset. When your dataset is organized as recommended in the following, the format of this list file is defined as:
84
+
```
85
+
train/scene01/img01.jpg train/scene01/img01.txt
86
+
train/scene01/img02.jpg train/scene01/img02.txt
87
+
...
88
+
train/scene02/img01.jpg train/scene02/img01.txt
89
+
```
90
+
91
+
### Dataset structures:
92
+
```
93
+
DATA_ROOT/
94
+
|->train/
95
+
| |->scene01/
96
+
| |->scene02/
97
+
| |->...
98
+
|->test/
99
+
| |->scene01/
100
+
| |->scene02/
101
+
| |->...
102
+
|->train.list
103
+
|->test.list
104
+
```
105
+
DATA_ROOT is your path containing the counting datasets.
106
+
107
+
### Annotations format
108
+
For the annotations of each image, we use a single txt file which contains one annotation per line. Note that indexing for pixel values starts at 0. The expected format of each line is:
109
+
```
110
+
x1 y1
111
+
x2 y2
112
+
...
113
+
```
114
+
115
+
## Training
116
+
117
+
The network can be trained using the `train.py` script. For training on SHTechPartA, use
- Part of codes are borrowed from the [C^3 Framework](https://github.com/gjy3035/C-3-Framework).
146
+
- We refer to [DETR](https://github.com/facebookresearch/detr) to implement our matching strategy.
147
+
148
+
149
+
## Citing P2PNet
150
+
151
+
If you find P2PNet is useful in your project, please consider citing us:
152
+
153
+
```BibTeX
154
+
@inproceedings{song2021rethinking,
155
+
title={Rethinking Counting and Localization in Crowds: A Purely Point-Based Framework},
156
+
author={Song, Qingyu and Wang, Changan and Jiang, Zhengkai and Wang, Yabiao and Tai, Ying and Wang, Chengjie and Li, Jilin and Huang, Feiyue and Wu, Yang},
157
+
journal={Proceedings of the IEEE/CVF International Conference on Computer Vision},
158
+
year={2021}
159
+
}
160
+
```
161
+
162
+
## Related works from Tencent Youtu Lab
163
+
-[AAAI2021] To Choose or to Fuse? Scale Selection for Crowd Counting. ([paper link](https://ojs.aaai.org/index.php/AAAI/article/view/16360) & [codes](https://github.com/TencentYoutuResearch/CrowdCounting-SASNet))
164
+
-[ICCV2021] Uniformity in Heterogeneity: Diving Deep into Count Interval Partition for Crowd Counting. ([paper link](https://arxiv.org/abs/2107.12619) & [codes](https://github.com/TencentYoutuResearch/CrowdCounting-UEPNet))
0 commit comments