• Stars
    star
    210
  • Rank 187,585 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

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

Repository Details

LSC-CNN

This repository is the pytorch implementation for the crowd counting model, LSC-CNN, proposed in the paper - Locate, Size and Count: Accurately Resolving People in Dense Crowds via Detection.

If you find this work useful in your research, please consider citing the paper:

@article{LSCCNN20,
    Author = {Sam, Deepak Babu and Peri, Skand Vishwanath and Narayanan Sundararaman, Mukuntha,  and Kamath, Amogh and Babu, R. Venkatesh},
    Title = {Locate, Size and Count: Accurately Resolving People in Dense Crowds via Detection},
    Journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
    Year = {2020}
}

Requirements

We strongly recommend to run the codes in NVidia-Docker. Install both docker and nvidia-docker (please find instructions from their respective installation pages). After the docker installations, pull pytorch docker image with the following command: docker pull nvcr.io/nvidia/pytorch:18.04-py3 and run the image using the command: nvidia-docker run --rm -ti --ipc=host nvcr.io/nvidia/pytorch:18.04-py3

Further software requirements are listed in requirements.txt.

To install them type, pip install -r requirements.txt

The code has been run and tested on Python 3.6.3, Ubuntu 14.04.5 LTS and Cuda 9.0, V9.0.176.

Please NOTE that Python 2.7 is not supported and the code would ONLY work on Python 3 versions.

Dataset Download

Download Shanghaitech dataset from here. Download UCF-QNRF dataset from here.

Place the dataset in ../dataset/ folder. (dataset and lsc-cnn folders should have the same parent directory). So the directory structure should look like the following:

-- lsc-cnn
   -- network.py
   -- main.py
   -- ....
-- dataset
   --STpart_A
     -- test_data
	    -- ground-truth
	    -- images
     -- train_data
	    -- ground-truth
	    -- images
  --UCF-QNRF
    --train_data
      -- ...
    --test_data
      -- ...

Pretrained Models

The pretrained models for testing can be downloaded from here.

For evaluating on any pretrained model, place the corresponding models from the aforementioned link to lsc-cnn folder and follow instructions in Testing section.

Usage

Clone the repository. git clone https://github.com/val-iisc/lsc-cnn.git

cd lsc-cnn

pip install -r requirements.txt

Download models folders to lsc-cnn.

Download Imagenet pretrained VGG weights from here (Download the imagenet_vgg_weights folder) and place it in the parent directory of lsc-cnn.

Preparing the Dataset

Run the following code to dump the dataset for lsc-cnn

python main.py --dataset="parta" --gpu=<gpu_number>

Warning : If the dataset is already prepared, this command would start the training!

Dataset dump size for ST_PartA is ~13 GB, for QNRF is ~150 GB, and for ST_PartB is ~35 GB, so make sure there is sufficient disk space before training/testing.

Training

  • For training lsc-cnn run:

python main.py --dataset="parta" --gpu=2 --start-epoch=0 --epochs=30

--dataset = parta / ucfqnrf / partb
--gpu = GPU number
--epochs = Number of epochs to train. [For QNRF set --epochs=50]
--patches = Number of patches to crop per image [For QNRF use --patches=30, for other crowd counting dataset default parameter --patches=100 works.]

Testing

For testing on Part-A

python main.py --dataset="parta" --gpu=2 --start-epoch=13 --epochs=13 --threshold=0.21

For testing on Part-B

python main.py --dataset="partb" --gpu=2 --start-epoch=24 --epochs=24 --threshold=0.25

For testing on QNRF

python main.py --dataset="ucfqnrf" --gpu=2 --start-epoch=46 --epochs=46 --threshold=0.20

  • All the metrics are displayed once the above code completes its run.

  • To do a threshold test, just remove the --threshold flag:

For example:

python main.py --dataset="parta" --gpu=2 --start-epoch=13 --epochs=13

Use the --mle option to compute the mean localization error. If using MLE, compile the function first:

cd utils/mle_function
./script.sh

This generates an error_function.so file in the ./lsc-cnn directory which is used by main.py for computing the MLE metric.

Test Outputs

Test outputs consist of box predictions for validation set at models/dump and that of the test set at models/dump_test.

Contact

For further queries, please mail at pvskand <at> protonmail <dot> com.

More Repositories

1

crowd-counting-scnn

This project is an implementation of the crowd counting model proposed in our CVPR 2017 paper - Switching Convolutional Neural Network(SCNN) for Crowd Counting. SCNN is an adaptation of the fully-convolutional neural network and uses an expert CNN that chooses the best crowd density CNN regressor for parts of the scene from a bag of regressors. This helps it tackle intra-scene crowd density variation and obtain SOTA results
Python
146
star
2

3d-lmnet

Repository for 3D-LMNet: Latent Embedding Matching for Accurate and Diverse 3D Point Cloud Reconstruction from a Single Image [BMVC 2018]
Python
113
star
3

deligan

This project is an implementation of the Generative Adversarial Network proposed in our CVPR 2017 paper - DeLiGAN : Generative Adversarial Networks for Diverse and Limited Data. DeLiGAN is a simple but effective modification of the GAN framework and aims to improve performance on datasets which are diverse yet small in size.
Python
111
star
4

cnn-fixations

Visualising predictions of deep neural networks
98
star
5

sketch-parse

Code, demos and data for SketchParse (a neural network for sketch segmentation). Paper:
Jupyter Notebook
80
star
6

GD-UAP

Generalized Data-free Universal Adversarial Perturbations
Python
69
star
7

SDAT

[ICML 2022]Source code for "A Closer Look at Smoothness in Domain Adversarial Training",
Python
68
star
8

fast-feature-fool

Data independent universal adversarial perturbations
Python
61
star
9

densepcr

Repository for 'Dense 3D Point Cloud Reconstruction Using a Deep Pyramid Network' [WACV 2019]
Python
52
star
10

expresso

expresso
Python
44
star
11

NoisyTwins

[CVPR 2023] Source code for NoisyTwins: Class-consistent and Diverse Image Generation Through StyleGANs
Python
34
star
12

DeiT-LT

[CVPR 2024] Code for our Paper "DeiT-LT: Distillation Strikes Back for Vision Transformer training on Long-Tailed Datasets"
Python
33
star
13

pose_estimation

Code for our work on pose-estimation using template 3D models.
Jupyter Notebook
32
star
14

nag

[CVPR 2018] Tensorflow implementation of NAG : Network for Adversary Generation
Python
32
star
15

ss_human_mesh

Code repository for the paper: Appearance Consensus Driven Self-Supervised Human Mesh Recovery
Python
31
star
16

css-ccnn

Implementation for "Completely Self-Supervised Crowd Counting via Distribution Matching" (http://arxiv.org/abs/2009.06420)
Python
29
star
17

Hard-Label-Model-Stealing

Python
26
star
18

3d-psrnet

Repository for 3D-PSRNet: Part Segmented 3D Point Cloud Reconstruction [ECCVW 2018]
Python
24
star
19

GAMA-GAT

Guided Adversarial Attack for Evaluating and Enhancing Adversarial Defenses, NeurIPS Spotlight 2020
Python
24
star
20

Saddle-LongTail

[NeurIPS 2022] Source code for our paper "Escaping Saddle Points for Effective Generalization on Class-Imbalanced Data"
Python
22
star
21

BPFC

Towards Achieving Adversarial Robustness by Enforcing Feature Consistency Across Bit Planes
Python
22
star
22

capnet

Code release for "CAPNet: Continuous Approximation Projection For 3D Point Cloud Reconstruction Using 2D Supervision", (AAAI-19)
Python
21
star
23

StickerDA

[ECCV22] Concurrent Subsidiary Supervision for Unsupervised Source-Free Domain Adaptation
Python
18
star
24

VL2V-ADiP

[CVPR 2024] Leveraging Vision-Language Models for Improving Domain Generalization in Image Classification
Python
18
star
25

USFDA

Universal Source-Free Domain Adaptation (CVPR 2020)
17
star
26

NuAT

Towards Efficient and Effective Adversarial Training, NeurIPS 2021
Python
16
star
27

gSRGAN

[ECCV2022] Source Code for "Improving GANs for Long-Tailed Data through Group Spectral Regularization"
Python
16
star
28

DAJAT

Official Code for Efficient and Effective Augmentation Strategy for Adversarial Training (NeurIPS-2022)
Python
15
star
29

s3vaada

Submodular Subset Selection for Active Domain Adaptation (ICCV 2021)
Python
15
star
30

sketch-object-recognition

C++
15
star
31

RMLVQA

Python
12
star
32

class-balancing-gan

Class Balancing GAN with a Classifier In The Loop (UAI 2021)
Python
12
star
33

InheriTune

Code Release for the CVPR 2020 (oral) paper, "Towards Inheritable Models for Open-set Domain Adaptation".
11
star
34

DART

[CVPR-2023] Official Code for DART: Diversify-Aggregate-Repeat Training Improves Generalization of Neural Networks
Python
10
star
35

SFDA-Seg

Generalize then Adapt: Source-free Domain Adaptation for Semantic Segmentation (ICCV 2021)
9
star
36

MixupDA

[ICML22] Balancing Discriminability and Transferability for Source-Free Domain Adaptation
Python
9
star
37

OAAT

Official Code for Scaling Adversarial Training to Large Perturbation Bounds (ECCV-2022)
Python
9
star
38

sketchguess

Repository for code, models and datasets for the paper Game of Sketches: Deep Recurrent Models of Pictionary-style Word Guessing accepted at 36th AAAI Conference on Artificial Intelligence (AAAI-18), New Orleans, USA
Python
9
star
39

FLSS

Official code for the paper - Boosting Adversarial Robustness using Feature Level Stochastic Smoothing
Python
7
star
40

CostSensitiveSelfTraining

[NeurIPS 2022] This repository contains the code for our work CSST: Cost Sensitive Self Training for Optimizing Non-Decomposable Objectives
Python
7
star
41

AAA

Python
6
star
42

SelMix

[ICLR 2024] [Spotlight]Code for our paper SelMix: Selective Mixup FineTuning
Python
4
star
43

EffSSL

Towards Efficient and Effective Self-Supervised Learning of Visual Representations
Python
4
star
44

sketch-object-part-analysis

Code and data related to analysis of object sketches at a semantic part-level
3
star
45

HSR

Code for Hierarchical Semantic Regularization of Latent Spaces in StyleGANs (ECCV 2022)
Python
3
star
46

DLCV

Webpage for DS265: Deep Learning in Computer Vision Course
CSS
2
star
47

gat

Repository for the Gray-box Adversarial Training project presented at ECCV 2018.
Python
2
star
48

swiden

Jupyter Notebook
2
star
49

DSiT-SFDA

[ICCV23] Domain-Specificity Inducing Transformers for Source-Free Domain Adaptation
1
star
50

SAT-Rx

Regularizers for Single-step Adversarial training
Python
1
star