Coder Social home page Coder Social logo

jasonsalem2002 / crowdcounting Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 6.26 MB

Efficient PyTorch implementation of CSRNet for crowd counting, optimized for Mac M1/M2/M3 GPUs and Nvidia GPUs. Includes dataset preparation, training pipeline, and visualization. Next goal: integrating IIM for enhanced accuracy. Developed with streamlined architecture for ease of use

Python 93.45% Jupyter Notebook 6.55%

crowdcounting's Introduction

Crowd Counting with Simplified CSRNet Implementation

Overview

This repository presents a concise and efficient PyTorch implementation of the CSRNet architecture for crowd counting, optimized for compatibility with Mac M1/M2/M3 GPUs and Nvidia GPUs. It includes comprehensive code for dataset preparation, model training, and visualization, suitable for both research and practical applications.

Results

Result

Next Goal

Next goal is to test and implement the integration of CSRNet and IIM, aiming for enhanced crowd counting accuracy through improved image preprocessing. IIM Repository: taohan10200/IIM

Key Features:

CSRNet Architecture: Leverages dilated convolutions for precise density estimation.

GPU Acceleration: Employs PyTorch with MPS for efficient training on Mac M1/M2/M3 GPUs, and cuda for Nvidia GPUs.

Streamlined Implementation: Focused on core model and training pipeline for clarity.

Dataset Handling: Prepares the ShanghaiTech dataset, including density map generation.

Memory Optimization: Addresses GPU memory limitations during density map creation.

Prerequisites:

  • Python 3.6 or later
  • PyTorch 1.4 or later
  • torchvision
  • h5py
  • scipy
  • matplotlib
  • Pillow (PIL Fork)
  • Pytorch should be downloaded with cuda to work properly if on windows

Usage Guide

  1. Acquire Dataset:

    Download the ShanghaiTech dataset from here and extract it into ShanghaiTech within this repository.

  2. Generate Density Maps:

    Execute makedataset.py to efficiently create density maps, optimizing memory usage.

  3. Explore Data Visually:

    Run densityChecker.py to visualize an image-density map pair for understanding.

  4. Train the CSRNet Model:

    Initiate model training with train.py, maximizing performance on Mac M1/M2/M3 GPUs.

Model Architecture

  • Employs initial 23 layers of pre-trained VGG16 for feature extraction.
  • Backend: Incorporates 6 convolutional layers with ReLU activations for density map generation.

Additional Information

  • dataset.py defines a custom dataset class for seamless data loading and preprocessing.
  • model.py encapsulates the SimplifiedCSRNet model architecture.

References

crowdcounting's People

Contributors

jasonsalem2002 avatar

Watchers

 avatar

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.