The repository for the Structure from Category (SfC) method presented on 3DV 2016
Lua Matlab Objective-C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Structure from Category: A Generic and Prior-less Approach

This repository contains necessary code for the structure from category method (SfC) presented at 3DV 2016.



We use Torch 7 ( for our implementation with these additional packages:

  • mattorch: we use .mat file for saving input 2D projection matrix and estimated 3D structure.
  • cutorch: we utilize GPU to accelerate matrix manipulation.
  • MAGMA: we utilize CUDA implementation of gels.


MATLAB (tested on R2016b)


Our current release has been tested on Ubuntu 16.04 LTS.

Cloning the repository

git clone

Download PASCAL3D+ (optional)

A series of annotated 2D chairs is included in this repository, which is stored in data/chair_pascal.mat. As a result, PASCAL3D+ dataset is not required in terms of running the demo. However, if you want see the images where these 2D annotations come from and compare the estimated 3D structures against them, you have to download PASCAL3D+ and pass the path to the function visualize.m.


Running demo

The implementation of Alternating Direction Method of Multipliers (ADMMs) is included in the file structure_from_category.lua.

To run the demo, open torch and simply run

th> dofile('demo.lua')

The result should be saved under the folder data/results/.


We used MATLAB to visualize the 3D skeleton. After obtaining the estimated 3D structure, simply add the folder visualization to MATLAB's path and run visualize.m for 3D plot.

The function visualize.m takes one required input, the object category (e.g. 'chair'), and two options.

Options include

  • frames: a subset/order of frames to visualize;
  • pascal_dir: the path to Pascal3D+ dataset. If this option is empty, the 2D images will be prohibited to show.

For details and examples, run in MATLAB:

>> help visualize


  title={Structure from Category: A Generic and Prior-less Approach},
  author={Kong, Chen and Zhu, Rui and Kiani, Hamed and Lucey, Simon},
  booktitle={3D Vision (3DV), 2016 Fourth International Conference on},

For any questions, please contact Chen Kong (