Weighing Counts: Sequential Crowd Counting by Reinforcement Learning

Overview

LibraNet

weighing_counts

This repository includes the official implementation of LibraNet for crowd counting, presented in our paper:

Weighing Counts: Sequential Crowd Counting by Reinforcement Learning

Proc. European Conference on Computer Vision (ECCV), 2020

Liang Liu1,†, Hao Lu2,†, Hongwei Zou1, Haipeng Xiong1, Zhiguo Cao1, Chunhua Shen1

1Huazhong University of Science and Technology

2The University of Adelaide, Australia

equal contribution

Model Structure

Installation

The code has been tested on Python 3.7.6 and PyTorch 1.4.0. Please follow the official instructions to configure your environment. See other required packages in requirements.txt.

Data Structure

$./data/
├──── Train
├──── Test

Training

$./backbone.pth.tar

Train LibraNet on SHT Part_A Dataset

python train.py

Inference

Pre-trained Model on SHT Part_A dataset

  • Download the model from: [BaiduYun (68.3 MB) (code: 20um) or OneDrive (70 MB)](https://1drv.ms/u/s!AkNf_IPSDakh8XBVTepnGq2J_YjN?e=lJCCUw)
  • The result of this model is: mae=55.5, mse=93.9. However, if the pythorch version is less than 1.4.0 (1.3.1 for example), the result might be: mae=56.3 , mse=95.2. Now I try to find the reason.
  • Move the model into the folder, and the path structure should like this:
$./trained_model/
├──── LibraNet_SHT_A.pth.tar

Evaluation

python Test_SHT_A.py

Citation

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

@article{liu2020WeighingCounts,
  title={Weighing Counts: Sequential Crowd Counting by Reinforcement Learning},
  author={Liu, Liang and Lu, Hao and Zou, Hongwei and Xiong, Haipeng and Cao, Zhiguo and Chun, Huashen},
  journal={Proc. Eur. Conf. Computer Vision},
  year={2020}
}

Update

2020-9-24

  1. Fix a bug in train_test.py line 32
  • Error:
for image_index in range(0, 1):
  • Correct:
for image_index in range(0, train_number):
  1. Add LICENSE.md

Permission

The code are only for non-commercial purposes. Copyrights reserved.

Contact: Liang Liu ([email protected]) Hao Lu ([email protected])

Comments
  • About cross-dataset evaluation

    About cross-dataset evaluation

    Hi, Thanks for your great work. For the cross-dataset evaluation, did you use the same model trained on the source domain for cross-dataset evaluation?

    opened by jimmy-dq 2
  • Code?

    Code?

    Is there an ETA on when the code will be coming @poppinace? Using RL for this is awesome, and I'm keen to have a look under the hood. For what it's worth, an open license would be great too.

    opened by kodonnell 1
  • train dataset

    train dataset

    Hi, can you explain more on the ground truth file (.csv in your preprocessed training dataset)? From my understanding, you divide the whole image into 32*32 patches and corresponding count value. So each element in the csv file represents its patch count and its patch relative location. Am I correct? For example: I use $ cat 9.csv and it shows: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 1,5,14,20,23,16,5,1,10,1,12,23,32,36,40,42 37,37,40,42,39,39,44,44,40,42,39,45,45,47,42,44 26,29,20,20,19,23,23,27,22,22,29,27,32,32,30,30

    opened by 1170801121 1
  • what is the start_ind_random and the end_mask_random?

    what is the start_ind_random and the end_mask_random?

    if recycle_ind < parameters['ACTION_NUMBER'] - 1: start_mask_random = ( (count_rem + net.A[recycle_ind] >= 0) & (start_ind_random == -1) ) start_ind_random[start_mask_random] = recycle_ind

                    **end_mask_random** = ( count_rem + net.A[recycle_ind] < parameters['Interval_N'] )
                    **end_ind_random**[end_mask_random] = recycle_ind                
                    
                maskselect_end = (sort[recycle_ind]==parameters['ACTION_NUMBER']-1)
                action_sort = sort[recycle_ind]
                
                A_sort = np.squeeze(net.A_mat[action_sort])
                
                _ind_max = (( (count_rem + A_sort < parameters['Interval_N']) & (count_rem + A_sort >= 0) | maskselect_end) & (mask_max_find==0) ) & (mask_last==0)
                action_max[_ind_max] = action_max[_ind_max] + sort[recycle_ind] [_ind_max] #?
                mask_max_find = mask_max_find + ( (count_rem + A_sort < parameters['Interval_N']) & (count_rem + A_sort >= 0) | maskselect_end ).astype(np.int8)
    

    action_random = (start_ind_random + (end_ind_random + 2 - start_ind_random ) * np.random.rand(h, w)).astype(np.int8)

    Why don't we generate action_random at random, but start_ ind_ Random and end_ ind_ random?

    opened by Song-gusu 0
  • The train dataset

    The train dataset

    I notice that your train dataset is not the standard Shanghaitech part-A dataset. You do some data augmentation. Could you share some details about augmentation and what the CSV files mean? Thanks!

    opened by zimingzhong 1
Owner
Hao Lu
I am currently an Associate Professor with Huazhong University of Science and Technology, China.
Hao Lu
Variational Attention: Propagating Domain-Specific Knowledge for Multi-Domain Learning in Crowd Counting (ICCV, 2021)

DKPNet ICCV 2021 Variational Attention: Propagating Domain-Specific Knowledge for Multi-Domain Learning in Crowd Counting Baseline of DKPNet is availa

null 19 Oct 14, 2022
DCSL - Generalizable Crowd Counting via Diverse Context Style Learning

DCSL Generalizable Crowd Counting via Diverse Context Style Learning Requirement

null 3 Jun 13, 2022
LWCC: A LightWeight Crowd Counting library for Python that includes several pretrained state-of-the-art models.

LWCC: A LightWeight Crowd Counting library for Python LWCC is a lightweight crowd counting framework for Python. It wraps four state-of-the-art models

Matija Teršek 39 Dec 28, 2022
Rohit Ingole 2 Mar 24, 2022
PyTorch implementations of the paper: "Learning Independent Instance Maps for Crowd Localization"

IIM - Crowd Localization This repo is the official implementation of paper: Learning Independent Instance Maps for Crowd Localization. The code is dev

tao han 91 Nov 10, 2022
Conservative Q Learning for Offline Reinforcement Reinforcement Learning in JAX

CQL-JAX This repository implements Conservative Q Learning for Offline Reinforcement Reinforcement Learning in JAX (FLAX). Implementation is built on

Karush Suri 8 Nov 7, 2022
Reinforcement-learning - Repository of the class assignment questions for the course on reinforcement learning

DSE 314/614: Reinforcement Learning This repository containing reinforcement lea

Manav Mishra 4 Apr 15, 2022
Jetson Nano-based smart camera system that measures crowd face mask usage in real-time.

MaskCam MaskCam is a prototype reference design for a Jetson Nano-based smart camera system that measures crowd face mask usage in real-time, with all

BDTI 212 Dec 29, 2022
PED: DETR for Crowd Pedestrian Detection

PED: DETR for Crowd Pedestrian Detection Code for PED: DETR For (Crowd) Pedestrian Detection Paper PED: DETR for Crowd Pedestrian Detection Installati

null 36 Sep 13, 2022
A solution to ensure Crowd Management with Contactless and Safe systems.

CovidTrack A Solution to ensure Crowd Management with Contactless and Safe systems. ML Model Mask Detection Social Distancing Detection Analytics Page

Om Khare 1 Nov 10, 2021
Official PyTorch implementation of the paper: Improving Graph Neural Network Expressivity via Subgraph Isomorphism Counting.

Improving Graph Neural Network Expressivity via Subgraph Isomorphism Counting Official PyTorch implementation of the paper: Improving Graph Neural Net

Giorgos Bouritsas 58 Dec 31, 2022
Vehicles Counting using YOLOv4 + DeepSORT + Flask + Ngrok

A project for counting vehicles using YOLOv4 + DeepSORT + Flask + Ngrok

Duong Tran Thanh 37 Dec 16, 2022
Real time Human Detection Counting

In this python project, we are going to build the Human Detection and Counting System through Webcam or you can give your own video or images. This is a deep learning project on computer vision, which will help you to master the concepts and make you an expert in the field of Data Science. Let’s build an exciting project.

Mir Nawaz Ahmad 2 Jun 17, 2022
A model that attempts to learn and benefit from data collected on card counting.

A model that attempts to learn and benefit from data collected on card counting. A decision tree like model is built to win more often than loose and increase the bet of the player appropriately to come out winning as much money as possible.

null 1 Dec 17, 2021
Various operations like path tracking, counting, etc by using yolov5

Object-tracing-with-YOLOv5 Various operations like path tracking, counting, etc by using yolov5

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

DRNet for Video Indvidual Counting (CVPR 2022) Introduction This is the official PyTorch implementation of paper: DR.VIC: Decomposition and Reasoning

tao han 35 Nov 22, 2022
Learning from History: Modeling Temporal Knowledge Graphs with Sequential Copy-Generation Networks

CyGNet This repository reproduces the AAAI'21 paper “Learning from History: Modeling Temporal Knowledge Graphs with Sequential Copy-Generation Network

CunchaoZ 89 Jan 3, 2023
Moving Object Segmentation in 3D LiDAR Data: A Learning-based Approach Exploiting Sequential Data

LiDAR-MOS: Moving Object Segmentation in 3D LiDAR Data This repo contains the code for our paper: Moving Object Segmentation in 3D LiDAR Data: A Learn

Photogrammetry & Robotics Bonn 394 Dec 29, 2022
DTCN SMP Challenge - Sequential prediction learning framework and algorithm

DTCN This is the implementation of our paper "Sequential Prediction of Social Me

Bobby 2 Jan 24, 2022