Code Monkey home page Code Monkey logo

waldboost's Introduction

WaldBoost detector

Object detection with WaldBoost detector for Python/Numpy. The detection algortithm is similar to Aggregated Channel Features detector by Piotr Dollar. The training algortithm is different - WaldBoost instead of Constant Soft Cascade.

The package supports

  • Custom channel features - any channel type, shrinking, smoothing
  • Decision tree weak classifiers
  • FPGA-friendly training and inference pipeline

The purpose of this package is to provide reference implementation of detector training and inference of images for Python. It is not meant to be fast. We however did our best to speed up things using Numba while keeping the code as simple as possible.

Acknowledgment Development of this software was funded by TACR project and V3C Center of Competence (TE01020415) and ECSEL FitOptiVis (No 783162).

Installation

Necessary requirements include:

  • numpy
  • numba
  • scipy
  • scikit-image
  • scikit-learn
  • opencv-python
  • protobuf
  • bbx >= 0.0.5

The package can be installed through pip

pip install waldboost-*.tgz

Quick start

Following example show basic pipeline for training the detector.

  1. Include the package and other required packages (e.g. dataset generators etc.)
import waldboost as wb
# ...
  1. Setup training parameters. Define how image channels are calculated and detector window size. For detailed info see wb.channels.channel_pyramid.
channel_opts = dict(shrink=2, n_per_oct=8, smooth=1, channels=wb.channels.grad_hist)
shape = (12,12,4)
  1. Initialize new model, sample pool (source of training data), and learner (training algorithm and state).
model = wb.Model(shape, channel_opts)
pool = wb.Pool(shape, min_tp=1000, min_fp=1000)
learner = wb.Learner(alpha=0.2, max_depth=2))
  1. Run the training. Each iteration updates training set from images produced by user-specified generator, and adds new stage to the model.
for stage in range(len(model),T):
    pool.update(M, training_images)
    X0,H0 = P.gather_samples(0)
    X1,H1 = P.gather_samples(1)
    learner.fit_stage(model, X0, H0, X1, H1)
  1. Finally model can be used for detection on new images, and saved to file.
model.save("detector.pb")
image,*_ = next(training_images)
boxes = model.detect(image)
  1. Function wb.load_model can load the model form file.
model = wb.Model.load("detector.pb")

waldboost's People

Contributors

romanjuranek avatar

Stargazers

 avatar

Forkers

cbhxdyx

waldboost's Issues

Improve data format from generator

So far it is expected that training data generator produces tuples with image and BoxList and potentialy other data. This can be replaced with dict with explicit keys ("image", "ground_truth") which will be more readable.

Replace TF Api boxes

The code now depends on a huge non-standard package only because of BoxList class for representation of bounding boxes and non-maxima suppression. This can be replaced with something else

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.