Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tud/fudan #3

Open
wants to merge 31 commits into
base: python3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
b922dfb
Update .gitignore
patatedouze Feb 7, 2023
812d130
Merge pull request #2 from cupnootle/chi/update_gitignore
patatedouze Feb 9, 2023
015cd29
Update README.md
phpin57 Feb 14, 2023
f5fde1b
Reformatting
patatedouze Feb 15, 2023
a34f951
Merge pull request #5 from cupnootle/chi/first_cleaning_pass
patatedouze Feb 15, 2023
8026fc4
Update train.py
patatedouze Feb 16, 2023
220f0e1
Modifications for colab support
patatedouze Feb 16, 2023
df43f89
Update train.py
patatedouze Feb 16, 2023
64852a1
Merge pull request #6 from cupnootle/chi/improvements_1
patatedouze Feb 16, 2023
c040241
Updates to loading_data.py and train dynamic imports
patatedouze Feb 17, 2023
87f2162
Merge pull request #7 from cupnootle/chi/bugfixes_1
patatedouze Feb 17, 2023
8256e28
Changed relative imports
patatedouze Feb 17, 2023
c1f6dd5
Merge pull request #8 from cupnootle/chi/bugfixes_2
patatedouze Feb 17, 2023
cd45467
Reformatting
patatedouze Feb 18, 2023
ac1399d
Merge pull request #9 from cupnootle/chi/cleaning_pass2
patatedouze Feb 18, 2023
3825762
Bugfixes
patatedouze Feb 18, 2023
a6b464e
Merge pull request #10 from cupnootle/chi/bugfixes_3
patatedouze Feb 18, 2023
9e6438f
Adding support for cfg_data parameter pass
patatedouze Feb 21, 2023
397361c
Merge pull request #11 from cupnootle/chi/bugfixes_4
patatedouze Feb 21, 2023
60eed19
adding 5 files
raeell Feb 21, 2023
c031bfe
Added missing corrections from bugfixes_4
patatedouze Feb 21, 2023
049a77c
Merge pull request #12 from cupnootle/chi/bugfixes_5
patatedouze Feb 21, 2023
990af05
Create bay_loss.py
raeell Feb 21, 2023
4b1ab77
Update bay_loss.py
phpin57 Feb 27, 2023
9afaeee
ras
phpin57 Mar 3, 2023
478bb8a
bayesian
phpin57 Mar 3, 2023
b8705c9
Merge branch 'python3.x' into origin/ph/test
patatedouze Mar 3, 2023
d0c5985
Update README.md
patatedouze Mar 3, 2023
967387c
Merge pull request #3 from cupnootle/origin/ph/test
patatedouze Mar 3, 2023
2dfd2a3
Adapted existing dataloaders to FUDAN-UCC dataset
patatedouze Mar 7, 2023
5ca9370
Merge branch 'python3.x' into tud/FUDAN
patatedouze Mar 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ venv.bak/
*.pyc
exp/
backup_exp/

# MacOS
.DS_Store
91 changes: 91 additions & 0 deletions README_bay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Bayesian-Crowd-Counting (ICCV 2019 oral)
[Arxiv](https://arxiv.org/abs/1908.03684) | [CVF](http://openaccess.thecvf.com/content_ICCV_2019/papers/Ma_Bayesian_Loss_for_Crowd_Count_Estimation_With_Point_Supervision_ICCV_2019_paper.pdf)
### Official Implement of ICCV 2019 oral paper "Bayesian Loss for Crowd Count Estimation with Point Supervision"

## Visualization
### Bayesian

![](imgs/bayesian.png)

### Bayesian+

![](imgs/bayesian+.png)

### Density

![](imgs/density.png)

## Citation
If you use this code for your research, please cite our paper:

```
@inproceedings{ma2019bayesian,
title={Bayesian loss for crowd count estimation with point supervision},
author={Ma, Zhiheng and Wei, Xing and Hong, Xiaopeng and Gong, Yihong},
booktitle={Proceedings of the IEEE International Conference on Computer Vision},
pages={6142--6151},
year={2019}
}
```

## Code

### Install dependencies

torch >= 1.0 torchvision opencv numpy scipy, all the dependencies can be easily installed by pip or conda

This code was tested with python 3.6

### Train and Test

1、 Dowload Dataset UCF-QNRF [Link](https://www.crcv.ucf.edu/data/ucf-qnrf/)

2、 Pre-Process Data (resize image and split train/validation)

```
python preprocess_dataset.py --origin_dir <directory of original data> --data_dir <directory of processed data>
```

3、 Train model (validate on single GTX Titan X)

```
python train.py --data_dir <directory of processed data> --save_dir <directory of log and model>
```

4、 Test Model
```
python test.py --data_dir <directory of processed data> --save_dir <directory of log and model>
```
The result is slightly influenced by the random seed, but fixing the random seed (have to set cuda_benchmark to False) will make training time extrodinary long, so sometimes you can get a slightly worse result than the reported result, but most of time you can get a better result than the reported one. If you find this code is useful, please give us a star and cite our paper, have fun.

5、 Training on ShanghaiTech Dataset

Change dataloader to crowd_sh.py

For shanghaitech a, you should set learning rate to 1e-6, and bg_ratio to 0.1

### Pretrain Weight
#### UCF-QNRF

Baidu Yun [Link](https://pan.baidu.com/s/1Evxxu1skHni3Iv3VxdcZvA) extract code: x9wc

Google Drive [Link](https://drive.google.com/file/d/1i22E7_zigkSm7nBnqMaEv00MD3CPhIDk/view?usp=sharing)

#### ShanghaiTech A

Baidu Yun [Link](https://pan.baidu.com/s/1GlaxGzFI8qFCHbqu56qSRw) extract code: tx0m

Goodle Drive [Link](https://drive.google.com/file/d/13bEdshBY-brUvLSwTCOqDlK5QKcZIAAH/view?usp=sharing)

#### ShanghaiTech B

Baidu Yun [Link](https://pan.baidu.com/s/1YYg-a-sdhBAHZRJzZOU-6Q) extract code: a15u

Goodle Drive [Link](https://drive.google.com/file/d/1woK-bI_JyeY9wZL2pXsWgPzQqhD8Qy0u/view?usp=sharing)

### License

GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <http://fsf.org/>

Loading