Code for Fast Bird Part Localization (FGVC 2015)
Jupyter Notebook Python
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.


Code for Fast Bird Part Localization part of the following paper:

Fast Bird Part Localization for Fine-Grained Categorization
Yaser Souri, Shohreh Kasaei
The Third Workshop on Fine-Grained Visual Categorization (FGVC3) in conjunction with CVPR 2015

The code for classification part is very simple and not included in this repository.


  1. Python 2.7. This might not work with Python 3.
  2. A recent installation of caffe with its python wrapper. (I have installed this version of caffe.)
  3. OpenCV 2.4 with its Python wrapper.
  4. All other python requirements are mentioned in requirements.txt

Getting Started

For testing or training you need the pretrained CaffeNet network. You can download it from this url. After downloading it, make sure you change the src/ file and change the CAFFE_NET_PRETRAINED variable accordingly.

Training a new head detector

This can be done using the CUB dataset. First download the CUB-200-2011 dataset from here and extract it. Then change src/ file and set the CUB_FOLDER_PATH varialble accordingly.

Then run the following command:


This will create a head detector for you in the models directory. To run this script you will night large amount of RAM (~30GB).

Changing part_name variable in file to body instead of head will create a detector for body.


For localization you can run something like this.

import sys
from fast_bird_part_localization import settings
import caffe
from fast_bird_part_localization import detector

fbp = detector('/path/to/project/models/head_model.mdl')

img ='/path/to/bird.jpg')
head, head_prob = fbp.detect(img)
fbp.draw(img, head, head_prob)

This is the result you get:


You can also take a look at the notebook example

Work in Progress

I'm in progress of cleaning up my original code and putting it here. So please wait a little while.


  • Extracting code from notebook about postprocessing.
  • Extracting code from notebook about visualization.
  • Adding description on how to use the pretrined model.
  • Adding description on how to train a new model from CUB.
  • Adding description on how to train a new model from own data.
  • Adding code for PCP evaluation.
  • Adding bounding box regression for better PCP.