==================================================
Strongly-supervised object detector
Release 1.1

Project webpage: http://www.csc.kth.se/cvap/DPM/part_sup.html
Author: Hossein Azizpour <azizpour@kth.se>
==================================================


This package contains implementation of the strongly-supervised object 
detector [1] together with the part-level object annotation used in [1]. 
Both the training and the detection methods are included. The training 
method implements pose clustering, model-tree construction, occlusion 
handling and semi-supervised training setup as described in [1]. The code 
is based on the implementation of LSVM object detector [2] (version 4.1 [3]).
For additional information on the base code refer to code/dpmv4/README.

The package includes three subdirectories, 
1.code: all the codes are stored here.
2.data: all the annotations are stored here.
3.cache: all the models and intermediate files are (will be) stored here.

Please contact azizpour@kth.se if you have problems or need additional information.

References
==========
[1] H. Azizpour, I. Laptev. Object Detection using Strongly-Supervised
Deformable Part Based Models. European Conference on Computer Vision (ECCV) 
2012, Florence, Italy.

[2] P. Felzenszwalb, R. Girshick, D. McAllester, D. Ramanan.  Object
Detection with Discriminatively Trained Part Based Models.
To appear in the IEEE Transactions on Pattern Analysis and Machine 
Intelligence.

[3] http://people.cs.uchicago.edu/~rbg/latent/

How to Cite
===========
If you use our method or the part-level object annotation provided with this
package, please cite [1]. The corresponding BibTex entry is below:

@inproceedings{azizpour:12,
  AUTHOR     = "Azizpour, H. and Laptev, I.",
  TITLE      = "Object Detection Using Strongly-Supervised Deformable Part Models",
  BOOKTITLE  = "Proc.~ECCV",
  YEAR       = "2012",
}


Before Usage
===========
1. Unpack the code.
2. Start matlab.
3. CD to the code/dpmv4 directory and run the 'compile' script to compile the helper functions.
   (you may need to edit compile.m to use a different convolution 
    routine depending on your system)
4. make learn.cc (g++ learn.cc -O3 -o learn)
5. open code/setParams.m and change the params.vocdevkit_path path and point it to the place
where the VOC devkits are stored. You can make other changes to the parameters based on your
setup.

Available Data
===========
1. Part Annotations
	a. 6 animal classes of VOC2007: data/VOC2007
	b. 6 animal classes of VOC2010: data/VOC2010
2. Pre-trained models
	a. 6 animal classes of VOC2007: cache/${cls}_2007/model_${cls}2007_C5.mat
	b. 6 animal classes of VOC2010: cache/${cls}_2010/model_${cls}2010_C5.mat
3. Pose clusters used in [1] experiments
	a. 6 animal classes of VOC2007: cache/${cls}_2007/${cls}2007_C5_Occ1_posData.mat
	b. 6 animal classes of VOC2010: cache/${cls}_2010/${cls}2010_C5_Occ1_posData.mat

Sample Codes
===========

***** Note. Make sure you have gone through the "Before Usage" steps above *****

1. Detection demo: go to code/ and run detection_demo.m script, it will 
use the saved models in data folder and runs detection on a sample image. 
Then it visualizes the highest scoring detection and its corresponding 
mixture model. It is straight-forward to change the class, year,
or the input image.

2. Training demo: go to code/ and run mainscript.m, however, since the final model
is already in the corresponding cache folder it will run the final evaluation on 
PASCAL images. If you want to retrain using your own parameters, first move the 
pre-trained model from the corresponding cache folder, then change the necessary 
parameters in setParams.m and finaly modify the "cls" and "year" parameters in 
the first lines of mainscript.m and run it. 

3. Visualization:
	a. visualizing a model: code/gt/gt_visualizemodel.m: it gets the model and 
	the mixture number and visualizes the HOG filters and connectivities.
	b. visualizing a detection: code/gt/gt_bgf_showdet.m: it gets the model, 
	image and the detected bbox. and shows the object and parts bboxes overlaid
	on the image. 
	c. visualizing annotation: code/visualization/visualizeObject.m: it gets an 
	object instance annotation struct and visualizes it cropped from the image.
	d. there are more visualization codes in annClustering and annotations folder
	used for debugging and such, refer to the comments in the beggining of those
	files for more info.


Some Notes
===========

1. The package does not contain bounding box prediction or context rescoring 
procedure of [2] applied in the sample code, it should be straight-forward 
to use the corresponding codes from dpmv4 folder though.

2. The pose clustering and MST results are saved in the cache folder for each
class/year which corresponds to the reported results in [1]. If you remove these
files and consequently re-do the pose clustering the results might be slightly different from
those reported in [1] due to randomness of the clustering procedure.

3. For more information about individual codes, refer to the documentation inside each file.
