PyTorch implementations of the paper: "DR.VIC: Decomposition and Reasoning for Video Individual Counting, CVPR, 2022"

Related tags

Deep Learning DRNet
Overview

DRNet for Video Indvidual Counting (CVPR 2022)

Introduction

This is the official PyTorch implementation of paper: DR.VIC: Decomposition and Reasoning for Video Individual Counting. Different from the single image counting methods, it counts the total number of the pedestrians in a video sequence with a person in different frames only being calculated once. DRNet decomposes this new task to estimate the initial crowd number in the first frame and integrate differential crowd numbers in a set of following image pairs (namely current frame and preceding frame). framework

Catalog

  • Testing Code (2022.3.19)
  • PyTorch pretrained models (2022.3.19)
  • Training Code
    • HT21
    • SenseCrowd

Getting started

preparatoin

  • Clone this repo in the directory (Root/DRNet):

  • Install dependencies. We use python 3.7 and pytorch >= 1.6.0 : http://pytorch.org.

    conda create -n DRNet python=3.7
    conda activate DRNet
    conda install pytorch==1.7.0 torchvision==0.8.0 cudatoolkit=10.2 -c pytorch
    cd ${DRNet}
    pip install -r requirements.txt
  • PreciseRoIPooling for extracting the feature descriptors

    Note: the PreciseRoIPooling [1] module is included in the repo, but it's likely to have some problems when running the code:

    1. If you are prompted to install ninja, the following commands will help you.
      wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
      sudo unzip ninja-linux.zip -d /usr/local/bin/
      sudo update-alternatives --install /usr/bin/ninja ninja /usr/local/bin/ninja 1 --force 
    2. If you encounter errors when compiling the PreciseRoIPooling, you can look up the original repo's issues for help.
  • Datasets

    • HT21 dataset: Download CroHD dataset from this link. Unzip HT21.zip and place HT21 into the folder (Root/dataset/).
    • SenseCrowd dataset: To be updated when it is released.
    • Download the lists of train/val/test sets at link: dataset., and place them to each dataset folder, respectively.

Training

Check some parameters in config.py before training,

  • Use __C.DATASET = 'HT21' to set the dataset (default: HT21).
  • Use __C.GPU_ID = '0' to set the GPU.
  • Use __C.MAX_EPOCH = 20 to set the number of the training epochs (default:20).
  • Use __C.EXP_PATH = os.path.join('./exp', __C.DATASET) to set the dictionary for saving the code, weights, and resume point.

Check other parameters (TRAIN_BATCH_SIZE, TRAIN_SIZE etc.) in the Root/DRNet/datasets/setting in case your GPU's memory is not support for the default setting.

  • run python train.py.

Tips: The training process takes ~10 hours on HT21 dataset with one TITAN RTX (24GB Memory).

Testing

To reproduce the performance, download the pre-trained models and then place pretrained_models folder to Root/DRNet/model/

  • for HT21:
    • Run python test_HT21.py.
  • for SenseCrowd:
    • Run python test_SENSE.py. Then the output file (*_SENSE_cnt.py) will be generated.

Performance

The results on HT21 and SenseCrowd.

  • HT21 dataset
Method CroHD11~CroHD15 MAE/MSE/MRAE(%)
Paper: VGG+FPN [2,3] 164.6/1075.5/752.8/784.5/382.3 141.1/192.3/27.4
This Repo's Reproduction: VGG+FPN [2,3] 138.4/1017.5/623.9/659.8/348.5 160.7/217.3/25.1
  • SenseCrowd dataset
Method MAE/MSE/MRAE(%) MIAE/MOAE D0~D4 (for MAE)
Paper: VGG+FPN [2,3] 12.3/24.7/12.7 1.98/2.01 4.1/8.0/23.3/50.0/77.0
This Repo's Reproduction: VGG+FPN [2,3] 11.7/24.6/11.7 1.99/1.88 3.6/6.8/22.4/42.6/85.2

Video Demo

Please visit bilibili or YouTube to watch the video demonstration. demo

References

  1. Acquisition of Localization Confidence for Accurate Object Detection, ECCV, 2018.
  2. Very Deep Convolutional Networks for Large-scale Image Recognition, arXiv, 2014.
  3. Feature Pyramid Networks for Object Detection, CVPR, 2017.

Citation

If you find this project is useful for your research, please cite:

@article{han2022drvic,
  title={DR.VIC: Decomposition and Reasoning for Video Individual Counting},
  author={Han, Tao, Bai Lei, Gao, Junyu, Qi Wang, and Ouyang  Wanli},
  booktitle={CVPR},
  year={2022}
}

Acknowledgement

The released PyTorch training script borrows some codes from the C^3 Framework and SuperGlue repositories. If you think this repo is helpful for your research, please consider cite them.

You might also like...
PyTorch implementations of neural network models for keyword spotting
PyTorch implementations of neural network models for keyword spotting

Honk: CNNs for Keyword Spotting Honk is a PyTorch reimplementation of Google's TensorFlow convolutional neural networks for keyword spotting, which ac

Implementations of polygamma, lgamma, and beta functions for PyTorch

lgamma Implementations of polygamma, lgamma, and beta functions for PyTorch. It's very hacky, but that's usually ok for research use. To build, run: .

ilpyt: imitation learning library with modular, baseline implementations in Pytorch
ilpyt: imitation learning library with modular, baseline implementations in Pytorch

ilpyt The imitation learning toolbox (ilpyt) contains modular implementations of common deep imitation learning algorithms in PyTorch, with unified in

A lightweight library to compare different PyTorch implementations of the same network architecture.
A lightweight library to compare different PyTorch implementations of the same network architecture.

TorchBug is a lightweight library designed to compare two PyTorch implementations of the same network architecture. It allows you to count, and compar

Independent and minimal implementations of some reinforcement learning algorithms using PyTorch (including PPO, A3C, A2C, ...).

PyTorch RL Minimal Implementations There are implementations of some reinforcement learning algorithms, whose characteristics are as follow: Less pack

Pytorch Implementations of large number  classical backbone CNNs, data enhancement, torch loss, attention, visualization and  some common algorithms.
Pytorch Implementations of large number classical backbone CNNs, data enhancement, torch loss, attention, visualization and some common algorithms.

Torch-template-for-deep-learning Pytorch implementations of some **classical backbone CNNs, data enhancement, torch loss, attention, visualization and

Siamese-nn-semantic-text-similarity - A repository containing comprehensive Neural Networks based PyTorch implementations for the semantic text similarity task
PyTorch implementations of the beta divergence loss.

Beta Divergence Loss - PyTorch Implementation This repository contains code for a PyTorch implementation of the beta divergence loss. Dependencies Thi

Machine Learning From Scratch. Bare bones NumPy implementations of machine learning models and algorithms with a focus on accessibility. Aims to cover everything from linear regression to deep learning.
Machine Learning From Scratch. Bare bones NumPy implementations of machine learning models and algorithms with a focus on accessibility. Aims to cover everything from linear regression to deep learning.

Machine Learning From Scratch About Python implementations of some of the fundamental Machine Learning models and algorithms from scratch. The purpose

Comments
  • ModuleNotFoundError: No module named 'torch.fx'

    ModuleNotFoundError: No module named 'torch.fx'

    hi

    I ran the code "train.py" on my server and got this error. I searched and found that it was added in PyTorch 1.8.0, so I upgraded PyTorch. However, I got another error that 「ModuleNotFoundError: No module named 'torch.ao'」

    Would you please tell me how to fix the problem?

    
    (DRNet2) shoto@istlab-System-Product-Name:~/DRNet$ sudo python train.py
    ['/mnt/shoto/DRNet', '/mnt/shoto/anaconda3/envs/DRNet2/lib/python37.zip', '/mnt/shoto/anaconda3/envs/DRNet2/lib/python3.7', '/mnt/shoto/anaconda3/envs/DRNet2/lib/python3.7/lib-dynload', '/mnt/shoto/.local/lib/python3.7/site-packages', '/mnt/shoto/anaconda3/envs/DRNet2/lib/python3.7/site-packages']
    /mnt/shoto/.local/lib/python3.7/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
      warn(f"Failed to load image Python extension: {e}")
    Traceback (most recent call last):
      File "train.py", line 6, in <module>
        import datasets
      File "/mnt/shoto/DRNet/datasets/__init__.py", line 7, in <module>
        import misc.transforms as own_transforms
      File "/mnt/shoto/DRNet/misc/transforms.py", line 10, in <module>
        from torchvision.transforms import functional as TrF
      File "/mnt/shoto/.local/lib/python3.7/site-packages/torchvision/__init__.py", line 7, in <module>
        from torchvision import models
      File "/mnt/shoto/.local/lib/python3.7/site-packages/torchvision/models/__init__.py", line 2, in <module>
        from .convnext import *
      File "/mnt/shoto/.local/lib/python3.7/site-packages/torchvision/models/convnext.py", line 9, in <module>
        from ..ops.misc import ConvNormActivation
      File "/mnt/shoto/.local/lib/python3.7/site-packages/torchvision/ops/__init__.py", line 18, in <module>
        from .poolers import MultiScaleRoIAlign
      File "/mnt/shoto/.local/lib/python3.7/site-packages/torchvision/ops/poolers.py", line 7, in <module>
        import torch.fx
    ModuleNotFoundError: No module named 'torch.fx'
    opened by Mori062 0
Owner
tao han
tao han
PyTorch implementations for our SIGGRAPH 2021 paper: Editable Free-viewpoint Video Using a Layered Neural Representation.

st-nerf We provide PyTorch implementations for our paper: Editable Free-viewpoint Video Using a Layered Neural Representation SIGGRAPH 2021 Jiakai Zha

Diplodocus 258 Jan 2, 2023
StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.

StudioGAN is a Pytorch library providing implementations of representative Generative Adversarial Networks (GANs) for conditional/unconditional image generation.

null 3k Jan 8, 2023
Pytorch Lightning 1.2k Jan 6, 2023
PyTorch version of Stable Baselines, reliable implementations of reinforcement learning algorithms.

PyTorch version of Stable Baselines, reliable implementations of reinforcement learning algorithms.

DLR-RM 4.7k Jan 1, 2023
PyTorch implementations of Top-N recommendation, collaborative filtering recommenders.

PyTorch implementations of Top-N recommendation, collaborative filtering recommenders.

Yoonki Jeong 129 Dec 22, 2022
PyTorch implementations of deep reinforcement learning algorithms and environments

Deep Reinforcement Learning Algorithms with PyTorch This repository contains PyTorch implementations of deep reinforcement learning algorithms and env

Petros Christodoulou 4.7k Jan 4, 2023
Annotated, understandable, and visually interpretable PyTorch implementations of: VAE, BIRVAE, NSGAN, MMGAN, WGAN, WGANGP, LSGAN, DRAGAN, BEGAN, RaGAN, InfoGAN, fGAN, FisherGAN

Overview PyTorch 0.4.1 | Python 3.6.5 Annotated implementations with comparative introductions for minimax, non-saturating, wasserstein, wasserstein g

Shayne O'Brien 471 Dec 16, 2022
PyTorch implementations of algorithms for density estimation

pytorch-flows A PyTorch implementations of Masked Autoregressive Flow and some other invertible transformations from Glow: Generative Flow with Invert

Ilya Kostrikov 546 Dec 5, 2022
PyTorch implementations of Generative Adversarial Networks.

This repository has gone stale as I unfortunately do not have the time to maintain it anymore. If you would like to continue the development of it as

Erik Linder-Norén 13.4k Jan 8, 2023
Pytorch implementations of popular off-policy multi-agent reinforcement learning algorithms, including QMix, VDN, MADDPG, and MATD3.

Off-Policy Multi-Agent Reinforcement Learning (MARL) Algorithms This repository contains implementations of various off-policy multi-agent reinforceme

null 183 Dec 28, 2022