Giter Club home page Giter Club logo

object_detection_ensemble's Introduction

Object Detection Ensemble

Algorithm

Reference to the main idea: https://github.com/ahrnbom/ensemble-objdet
The idea is used for ensembling the boxes that have same image_id and category_id.

Reproducing

The test has been conducted using COCO 2017 val dataset and Detectron2.
In order to reproduce what I've got during the test, you can follow the below.

1. Prepare conda environment

  1. Prepare Ubuntu 20.04 in WSL(Windows Subsystem for Linux) 2.
    The environment has been tested without using GPU due to WSL limitation.
    The environment has been tested using GPU thanks to 21H2 update for Windows 10 Pro.

  2. Run the command line below to install the packages except for Detectron2.

$ conda env create -f environment_wsl.yml
  1. Activate the environment.
$ conda activate torch
  1. Install Detectron2.
$ git clone https://github.com/facebookresearch/detectron2.git
$ cd detectron2 && git checkout v0.6 && cd ..
$ python -m pip install -e detectron2

When having any installation issue with Detectron2 please followed the instruction here.

2. Prepare COCO 2017 val dataset

$ wget http://images.cocodataset.org/zips/val2017.zip
$ wget http://images.cocodataset.org/annotations/annotations_trainval2017.zip
$ mkdir -p datasets/coco
$ unzip val2017.zip -d datasets/coco
$ unzip annotations_trainval2017.zip -d datasets/coco 

3. Emit estimation results of coco_2017_val for object detection models

$ python evaluate_pretrained_model.py
$ ls -A1 datasets/coco
coco_instances_results_faster_rcnn_R_50_DC5_1x.json
coco_instances_results_faster_rcnn_R_50_FPN_1x.json
coco_instances_results_faster_rcnn_R_50_FPN_3x.json

4. Create an ensemble and evaluate the output

$ python evaluate_ensemble.py
Loaded output/coco_instances_results_faster_rcnn_R_50_DC5_1x.json
Loaded output/coco_instances_results_faster_rcnn_R_50_FPN_1x.json
Loaded output/coco_instances_results_faster_rcnn_R_50_FPN_3x.json
Saved the ensemble result to output/ensemble_results.json
Preparing for evaluating the ensemble
Loading and preparing results...
DONE (t=0.23s)
creating index...
index created!
Running per image evaluation...
Evaluate annotation type *bbox*
COCOeval_opt.evaluate() finished in 8.24 seconds.
Accumulating evaluation results...
COCOeval_opt.accumulate() finished in 0.87 seconds.
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.386
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.572
...

5. Try other models

Edit path for the models in config.py and repeat step 3 and 4.

model box AP (at IoU=0.50:0.95, area=all) model box AP (at IoU=0.50:0.95, area=all) model box AP (at IoU=0.50:0.95, area=all)
faster_rcnn_R_50_C4_1x 33.05873724953157 faster_rcnn_R_50_C4_1x 33.05873724953157 faster_rcnn_R_50_DC5_1x 35.02630019513202
faster_rcnn_R_50_DC5_1x 35.02630019513202 faster_rcnn_R_50_C4_3x 35.92233833824599 faster_rcnn_R_50_FPN_1x 34.35279506894608
faster_rcnn_R_50_FPN_1x 34.35279506894608 faster_rcnn_R_101_C4_3x 38.51233125665915 faster_rcnn_R_50_FPN_3x 36.66724655820816
Ensemble 36.988241172963086 Ensemble 39.57683208823928 Ensemble 38.61288520614146

object_detection_ensemble's People

Contributors

sungwonida avatar

Stargazers

Nick Giakoumoglou avatar Roman avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.