Code Monkey home page Code Monkey logo

multi-stream-crowd-counting's Introduction

Multi-stream Crowd Counting

Code of "Where are the People? A Multi-Stream Convolutional Neural Network for Crowd Counting via Density Map from Complex Images" presented in IWSSIP 2019.

1. Environment

We used the following enviroment:

  • Python 3
  • PyTorch
  • OpenCV
  • Numpy
  • MatPlotLib
  • Ubuntu 16.04

You can also run the code using the docker image of ufoym/deepo.

2. Preparing data

We make available UCF-CC-50 and Shanghai Tech datasets here, download and unzip it into the root of the repo. Directories should have the following hierarchy:

ROOT_OF_REPO
    data
        ucf_cc_50
            UCF_CC_50
                images
                labels
        ShanghaiTech
            part_A
                train_data
                    images
                    ground-truth
                test_data
                    images
                    ground-truth
            part_B
                train_data
                    images
                    ground-truth
                test_data
                    images
                    ground-truth

The code was developed such that data augmentation is computed before every other step and the results are stored in the hard drive. Thus, the first time you run the code it will take quite a long time. Augmented data is stored with the following hierarchy:

ROOT_OF_REPO
    data
        ucf_cc_50
            people_thr_0_gt_mode_same
        ShanghaiTech
            part_A
                people_thr_0_gt_mode_same
            part_B
                people_thr_0_gt_mode_same

3. Training

To train using UCF-CC-50 (with all folds) and save the results log in log/multi-stream you can run:

python3 main.py -d ucf-cc-50 --train-batch 32 --save-dir log/multi-stream

In case you want to run a specific fold or part you can use flag --units, check the Makefile for more examples.

The training log is stored in log_train.txt inside the corresponding log/fold/part directory.

4. Testing

After training you can re-load the trained weights (using flag --resume) and use them for testing:

python3 main.py -d ucf-cc-50 --save-dir log/multi-stream --resume log/multi-stream/ucf-cc-50_people_thr_0_gt_mode_same --evaluate-only 

The testing log is stored in log_test.txt inside the corresponding log/fold/part directory. You can also generate the plots of the predictions using flag --save-plots, results are stored in the directory plot-results-test inside the corresponding log/fold/part directory.

5. Final Notes

If you have any question regarding the code or method don't hesitate to contact me. This project was developed using the repo of svichwa as a base.

multi-stream-crowd-counting's People

Contributors

rquispec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

fasladodo

multi-stream-crowd-counting's Issues

The errors after applying images

@RQuispeC When we launched your code the errors appeared, for example "out of range" and problems with shape. If you have some info about training model on Shanghai Tech dataset, please inform us.
P.S. We tried to train our models on Shanghai Tech dataset

The folders which are "test_den", "test_img' and "test lab" are none.

Hello, thank you for your code. When I use your code in ucf_cc_50, I find the folders which are "test_den", "test_img' and "test lab" are none in every fold. And the information of the error is that:
Traceback (most recent call last): File "main.py", line 241, in <module> main() File "main.py", line 236, in main train(train_test, out_dir_root) File "main.py", line 149, in train mae, mse = evaluate_model(save_name, data_loader_val, save_test_results=args.save_plots, plot_save_dir=osp.join(output_dir, 'plot-results-train/')) File "E:\multi-stream-crowd-counting\architecture\evaluate_model.py", line 35, in evaluate_model mae = mae/(data_loader.get_num_samples()) ZeroDivisionError: float division by zero
Looking forward to your reply!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.