GithubHelp home page GithubHelp logo

links-ads / starlight-crowd-counting-inference Goto Github PK

View Code? Open in Web Editor NEW
0.0 4.0 0.0 4.73 MB

This repository performs crowd counting inference using a pre-trained ONNX model. Input an image to estimate head localization in crowded scenes.

Python 100.00%
crowdcounting

starlight-crowd-counting-inference's Introduction

Crowd Counting Inference

Input and output example of crowded inference This repository contains code for performing crowd counting inference using a pre-trained model. The code allows you to input an image and obtain estimated head localization points in crowded scenes. The inference is based on a trained ONNX model that has been optimized for crowd counting tasks.

How to Run

  1. Clone the repository to your local machine:
git clone https://github.com/your-username/crowd-counting-inference.git
cd crowd-counting-inference
  1. Install the required dependencies. It's recommended to use a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
pip install -r requirements.txt
  1. Import the library and run the inference:
from crowd_counting_inference import CrowdCountingModel
# ... other imports

# Specify the path to your YAML file
CONFIG_FILE = "path/to/config"

if __name__ == "__main__":
    # Load config
    with open(CONFIG_FILE, "r") as yaml_file:
        config = yaml.safe_load(yaml_file)

    # Load the sample image
    img = ...

    # Create and run the model
    runtime = CrowdCountingModel(
        model_path=config["model_path"],
        providers=config["providers"],
        head_threshold=config["head_threshold"],
        patch_size=config["patch_size"],
        batch_size=config["batch_size"],
    )
    pred_points = runtime.inference(np.array(img))

Every ONNX file is associated to a model configuration (a .yaml file). Model weights have not been uploaded to the repository due to the large size, if you wish to run the code please reach to fabio.montello[at]linksfoundation.com.

starlight-crowd-counting-inference's People

Contributors

fabiomontello avatar

Watchers

 avatar  avatar  avatar  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.