• Stars
    star
    204
  • Rank 192,063 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Code for NeurIPS 2020 paper: Distribution Matching for Crowd Counting.

DM-Count

Official Pytorch implementation of the paper Distribution Matching for Crowd Counting (NeurIPS, spotlight).

Arxiv | NeurIPS Processings

We propose to use Distribution Matching for crowd COUNTing (DM-Count). In DM-Count, we use Optimal Transport (OT) to measure the similarity between the normalized predicted density map and the normalized ground truth density map. To stabilize OT computation, we include a Total Variation loss in our model. We show that the generalization error bound of DM-Count is tighter than that of the Gaussian smoothed methods. Empirically, our method outperforms the state-of-the-art methods by a large margin on four challenging crowd counting datasets: UCF-QNRF, NWPU, ShanghaiTech, and UCF-CC50.

Prerequisites

Python 3.x

Pytorch >= 1.2

For other libraries, check requirements.txt.

Getting Started

  1. Dataset download
  • QNRF can be downloaded here

  • NWPU can be downloaded here

  • Shanghai Tech Part A and Part B can be downloaded here

  1. Data preprocess

Due to large sizes of images in QNRF and NWPU datasets, we preprocess these two datasets.

python preprocess_dataset.py --dataset <dataset name: qnrf or nwpu> --input-dataset-path <original data directory> --output-dataset-path <processed data directory> 
  1. Training
python train.py --dataset <dataset name: qnrf, sha, shb or nwpu> --data-dir <path to dataset> --device <gpu device id>
  1. Test
python test.py --model-path <path of the model to be evaluated> --data-path <directory for the dataset> --dataset <dataset name: qnrf, sha, shb or nwpu>

Pretrained models

Pretrained models on UCF-QNRF, NWPU, Shanghaitech part A and B can be found Google Drive. You could download them and put them in in pretrained_models folder.

Other resources

  • Web Demo

A web interface to can be found here.

demo

Feel free to upload a image and try out the demo on a web browser. It is developed by Ali Abdalla from Gradio. Gradio is an open source library, which helps to create interfaces to make models more accessible. Thanks Ali and Gradio!

To launch a Gradio interface, run

 python demo.py
  • Kaggle Notebook

A Kaggle Notebook is developed by Selman Ozleyen. Thanks Selman!

References

If you find this work or code useful, please cite:

@inproceedings{wang2020DMCount,
  title={Distribution Matching for Crowd Counting},
  author={Boyu Wang and Huidong Liu and Dimitris Samaras and Minh Hoai},
  booktitle={Advances in Neural Information Processing Systems},
  year={2020},
}

More Repositories

1

DewarpNet

Code for the paper "DewarpNet: Single-Image Document Unwarping With Stacked 3D and 2D Regression Networks" (ICCV '19)
Python
475
star
2

LearningToCountEverything

Python
360
star
3

doc3D-dataset

A hybrid dataset for document unwarping (Paper: https://www3.cs.stonybrook.edu/~cvl/projects/dewarpnet/storage/paper.pdf)
Shell
155
star
4

SID

Official implementation for ICCV19 "Shadow Removal via Shadow Image Decomposition"
Jupyter Notebook
96
star
5

PaperEdge

The code and the DIW dataset for "Learning From Documents in the Wild to Improve Document Unwarping" (SIGGRAPH 2022)
Python
83
star
6

Scanpath_Prediction

Predicting Goal-directed Human Attention Using Inverse Reinforcement Learning (CVPR2020)
Python
76
star
7

BodyHands

Whose Hands Are These? Hand Detection and Hand-Body Association in the Wild, CVPR 2022
Python
70
star
8

zero-shot-counting

CVPR2023 Zero-shot Counting
Python
49
star
9

ContactHands

Detecting Hands and Recognizing Physical Contact in the Wild, NeurIPS 2020.
Python
45
star
10

fsl-rsvae

Python
34
star
11

DocIIW

Repository for Intrinsic Decomposition of Document Images In-the-Wild (BMVC '20)
Python
34
star
12

EmotionNet_CVPR2020

Python
31
star
13

SAMPath

Repository for "SAM-Path: A Segment Anything Model for Semantic Segmentation in Digital Pathology" (MedAGI2023, MICCAI2023 workshop)
Python
28
star
14

local_learning_wsi

Repository for "Gigapixel Whole-Slide Images Classification using Locally Supervised Learning"
Python
27
star
15

PathLDM

Official Code for PathLDM: Text conditioned Latent Diffusion Model for Histopathology (WACV 2024)
Jupyter Notebook
27
star
16

Large-Image-Diffusion

CVPR 2024: Learned representation-guided diffusion models for large-image generation
Jupyter Notebook
25
star
17

scenes100

Python
22
star
18

HandLer

Forward Propagation, Backward Regression and Pose Association for Hand Tracking in the Wild (CVPR 2022)
Python
20
star
19

vfd-iccv21

Python
19
star
20

PromptMIL

Repository for "Prompt-MIL: Boosting Multi-Instance Learning Schemes via Task-specific Prompt Tuning" (MICCAI2023)
Python
16
star
21

SelfMedMAE

Code for ISBI 2023 paper "Self Pre-training with Masked Autoencoders for Medical Image Classification and Segmentation"
Python
16
star
22

Iso-UVField

Learning an Isometric Surface Parameterization for Texture Unwrapping (ECCV 2022)
Python
13
star
23

Emotion-Prediction

Visual Emotion Prediction (as a single-label problem) -- MS Thesis
Python
12
star
24

Gazeformer

Official codebase for "Gazeformer: Scalable, Effective and Fast Prediction of Goal-Directed Human Attention" (CVPR 2023)
Python
12
star
25

Target-absent-Human-Attention

Target-absent Human Attention (ECCV2022)
Python
11
star
26

PLM_SSL

Repository for "Precise Location Matching Improves Dense Contrastive Learning in Digital Pathology"
Python
8
star
27

LSAE

PyTorch Implementation of Lung Swapping Autoencoder
Python
7
star
28

fewshot-conditional-diffusion

Official code for "Conditional Generation from Unconditional Diffusion Models using Denoiser Representations" (BMVC 2023)
Jupyter Notebook
7
star
29

HyperMAE

Python
3
star
30

Beyond-Pixels

Beyond Pixels: Semi-Supervised Semantic Segmentation with a Multi-scale Patch-based Multi-Label Classifier (Accepted ECCV 2024)
Python
3
star
31

infinity-brush

2
star
32

EnEx

Code and datasets for BMVC 2021 paper "Exemplar-Based Early Event Prediction in Video"
Python
2
star
33

Weighting-Pseudo-Labels

2
star
34

JEAN

2
star
35

hematopoiesis-relationvae

1
star
36

TokenSparse-for-MedSeg

Code for IPMI2023 paper "Token Sparsification for Faster Medical Image Segmentation"
1
star
37

GCDR-Gaze

Repository of the paper "Diffusion-Refined VQA Annotations for Semi-Supervised Gaze Following" (ECCV 2024)
1
star