Skip to content

Commit

Permalink
Script, solvers, and model definitions for end-to-end training of Fas…
Browse files Browse the repository at this point in the history
…ter R-CNN detectors
  • Loading branch information
rbgirshick committed Dec 7, 2015
1 parent 81ee227 commit f740544
Show file tree
Hide file tree
Showing 10 changed files with 3,184 additions and 0 deletions.
48 changes: 48 additions & 0 deletions experiments/scripts/faster_rcnn_end2end.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# Usage:
# ./experiments/scripts/default_faster_rcnn.sh GPU NET [--set ...]
# Example:
# ./experiments/scripts/default_faster_rcnn.sh 0 ZF \
# --set EXP_DIR foobar RNG_SEED 42 TRAIN.SCALES "[400,500,600,700]"

set -x
set -e

export PYTHONUNBUFFERED="True"

GPU_ID=$1
NET=$2
NET_lc=${NET,,}
ITERS=70000
DATASET_TRAIN=voc_2007_trainval
DATASET_TEST=voc_2007_test

array=( $@ )
len=${#array[@]}
EXTRA_ARGS=${array[@]:2:$len}
EXTRA_ARGS_SLUG=${EXTRA_ARGS// /_}

LOG="experiments/logs/faster_rcnn_${NET}_${EXTRA_ARGS_SLUG}.txt.`date +'%Y-%m-%d_%H-%M-%S'`"
exec &> >(tee -a "$LOG")
echo Logging output to "$LOG"

NET_INIT=data/imagenet_models/${NET}.v2.caffemodel

time ./tools/train_net.py --gpu ${GPU_ID} \
--solver models/${NET}/faster_rcnn_end2end/solver.prototxt \
--weights ${NET_INIT} \
--imdb ${DATASET_TRAIN} \
--iters ${ITERS} \
--cfg experiments/cfgs/faster_rcnn_end2end.yml \
${EXTRA_ARGS}

set +x
NET_FINAL=`grep -B 1 "done solving" ${LOG} | grep "Wrote snapshot" | awk '{print $4}'`
set -x

time ./tools/test_net.py --gpu ${GPU_ID} \
--def models/${NET}/faster_rcnn_end2end/test.prototxt \
--net ${NET_FINAL} \
--imdb ${DATASET_TEST} \
--cfg experiments/cfgs/faster_rcnn_end2end.yml \
${EXTRA_ARGS}
16 changes: 16 additions & 0 deletions models/VGG16/faster_rcnn_end2end/solver.prototxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
train_net: "models/VGG16/faster_rcnn_end2end/train.prototxt"
base_lr: 0.001
lr_policy: "step"
gamma: 0.1
stepsize: 50000
display: 20
average_loss: 100
# iter_size: 1
momentum: 0.9
weight_decay: 0.0005
# We disable standard caffe solver snapshotting and implement our own snapshot
# function
snapshot: 0
# We still use the snapshot prefix, though
snapshot_prefix: "vgg16_faster_rcnn"
iter_size: 2
Loading

0 comments on commit f740544

Please sign in to comment.