Skip to content

saisrivatsan/selective-search

Repository files navigation

Object Recognition using Selective Search (Python Implementation) + R-CNNs

Created by Sai Srivatsa Ravindranath

Introduction

Selective Search is an object proposal algorithm which combines the strength of both exhaustive search and segmentation. We provide a python implementation of selective search. We also integrate it with fast-rcnn, which uses these proposals for object detection.

Contents

  1. Installation
  2. Demo

Installation

  1. Python Packages : numpy, scikit-image, scipy, scikit-learn, matplotlib

    pip install <package-name>
  2. Clone the selective search repository

git clone https://github.com/saisrivatsan/selective-search.git
  1. Install fast-rcnn. (see: fast-rcnn installation instructions) and download pre-computed Fast R-CNN detectors.

Demo

Open ipython and run the following commands

# Demo: Object Recognition with Selective Search and RCNN
# Append fast-rcnn directories to python path
import sys
sys.path.append('fast-rcnn/tools/')
import recognition
image_name = '000846'
# Select custom parameters for the demo
# Select colorspaces
color_space_list = ['HSV','LAB']
# Select thresholds for segmentation
ks = [50,100]
# Use default similarity features i.e C+T+S+F ans T+S+F 
# Default cpu_mode = True, Disable it if you have GPUs
# Default Net = 'vgg16'. Refer fast-rcnn module for other model
# Display selected image
import matplotlib.pyplot as plt
%matplotlib inline
plt.imshow(plt.imread('Data/img/' + image_name + '.jpg'))

png

# Call demo, Run with only image_name as parameter for fast mode ssearch
recognition.demo(image_name,color_space_list=color_space_list,ks=ks)
. . . . . . . . 
Computed 1445 proposals


Loaded network /home/sai/Documents/Projects/selective_search/fast-rcnn/data/fast_rcnn_models/vgg16_fast_rcnn_iter_40000.caffemodel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demo for 000846.jpg
Detection took 33.032s for 1445 object proposals
All aeroplane detections with p(aeroplane | box) >= 0.8
All bicycle detections with p(bicycle | box) >= 0.8
All bird detections with p(bird | box) >= 0.8
All boat detections with p(boat | box) >= 0.8
All bottle detections with p(bottle | box) >= 0.8
All bus detections with p(bus | box) >= 0.8
All car detections with p(car | box) >= 0.8
All cat detections with p(cat | box) >= 0.8
All chair detections with p(chair | box) >= 0.8
All cow detections with p(cow | box) >= 0.8
All diningtable detections with p(diningtable | box) >= 0.8
All dog detections with p(dog | box) >= 0.8
All horse detections with p(horse | box) >= 0.8
All motorbike detections with p(motorbike | box) >= 0.8
All person detections with p(person | box) >= 0.8
All pottedplant detections with p(pottedplant | box) >= 0.8
All sheep detections with p(sheep | box) >= 0.8
All sofa detections with p(sofa | box) >= 0.8
All train detections with p(train | box) >= 0.8
All tvmonitor detections with p(tvmonitor | box) >= 0.8

png

About

selective-search for object recognition

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages