Skip to content

Deformable Parts Model#85

Open
kritsong wants to merge 27 commits into
menpo:masterfrom
kritsong:dpm
Open

Deformable Parts Model#85
kritsong wants to merge 27 commits into
menpo:masterfrom
kritsong:dpm

Conversation

@kritsong

@kritsong kritsong commented Mar 4, 2016

Copy link
Copy Markdown

This is the first version of Deformable Parts Model(DPM) moved into menpo by converting the publicly available code from matlab.

DPM represents objects using a collection of parts usually represented by rectangle boxes. Each part captures local appearance of an object normally using Histogram of Gradient(HOG) feature, and the configuration of their connections are spring-like, tree structure.

The code consist of 3 main files:

  • base.py consists of 3 classes
    • class DPM(currently name Model) is a mixture model. Similar components may share a pool of filters, but use different deformable coefficients. It provides easy way to access filters and deformable coefficients as well as some utility methods.
    • class Qp (Quadratic programming) is a dual coordinate solvers which based on data-subsampling algorithms for collecting hard examples.
    • class DPMLearner train the mixture model from the given examples by using a class Qp.
      • Initially, each part of the DPM model is initialised by averaging the filters values(HOG) from the positive examples. Then they are trained independently with Qp
      • Each part is then combined into a initial DPM model by using the average deformable coefficients computed from positive examples. The model is then again trained using Qp.
  • fitter.py contains a class DPMFitter
    • DPMFitter detect the best configurations(locations) of part based on the given model for the given image
      • A given image is first transformed into a feature pyramid.
      • Fitter iterates through each level of the feature pyramid, then through each components of the model to compute the best possible score at each position.
      • The score is computed in two steps:
        • First, by convolving the filter of each part of the model with the feature pyramid, the independent scores of each part is computed.
        • Then, each part's score is combined efficiently by using Distance transform function to compute the best possible score of each position in the image (each position in an image can have multiple configurations depending on each part location).
      • The positions with the score above a given threshold are then returned.
  • main.py
    • It is used to debug and help visualising the results.
    • It provide options to
      • Fit the pre-trained model given by the original code by converting a matlab model into DPM model.
      • Fit the pre-trained model trained in python with 93 positive examples. (original code uses 900 positive examples)

TODO:

  • Currently, the codes that originally done in C are not all moved into C
  • DPMLearner use DPMFitter as part of the training. Maybe, the functionality outside of the fitting can all be moved into DPMLearner so that DPMFitter is cleaner.
  • More comment on how Qp work.
  • Update DPMLearner so that it properly take a set of image as an input to train.
  • Add functionality to learn the configuration from the positive examples e.g. tree sturcture

@patricksnape

Copy link
Copy Markdown
Contributor

@kritsong Add me as a collaborator to your menpofit fork 😄

Comment thread conda/meta.yaml
@@ -6,6 +6,7 @@ requirements:
build:
- python
- setuptools

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numpy is required - - numpy 1.10.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants