Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a readme section for training on a custom dataset #174

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions experiments/scripts/faster_rcnn_end2end.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ case $DATASET in
PT_DIR="pascal_voc"
ITERS=70000
;;
traffic)
TRAIN_IMDB="traffic_2016_train"
TEST_IMDB="traffic_2016_test"
PT_DIR="traffic"
ITERS=60000
;;
traffic_india)
TRAIN_IMDB="traffic_india_2016_trainval"
TEST_IMDB="traffic_india_2016_test"
PT_DIR="traffic_india"
ITERS=20000
;;
coco)
# This is a very long and slow training schedule
# You can probably use fewer iterations and reduce the
Expand All @@ -48,18 +60,20 @@ LOG="experiments/logs/faster_rcnn_end2end_${NET}_${EXTRA_ARGS_SLUG}.txt.`date +'
exec &> >(tee -a "$LOG")
echo Logging output to "$LOG"

time ./tools/train_net.py --gpu ${GPU_ID} \
--solver models/${PT_DIR}/${NET}/faster_rcnn_end2end/solver.prototxt \
--weights data/imagenet_models/${NET}.v2.caffemodel \
--imdb ${TRAIN_IMDB} \
--iters ${ITERS} \
--cfg experiments/cfgs/faster_rcnn_end2end.yml \
${EXTRA_ARGS}
#time ./tools/train_net.py --gpu ${GPU_ID} \
#--solver models/${PT_DIR}/${NET}/faster_rcnn_end2end/solver.prototxt \
#--weights data/imagenet_models/${NET}.v2.caffemodel \
#--imdb ${TRAIN_IMDB} \
#--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

#temp
NET_FINAL=/home/ubuntu/py-faster-rcnn/output/faster_rcnn_end2end/traffic_2016_train/zf_faster_rcnn_iter_60000.caffemodel
time ./tools/test_net.py --gpu ${GPU_ID} \
--def models/${PT_DIR}/${NET}/faster_rcnn_end2end/test.prototxt \
--net ${NET_FINAL} \
Expand Down
14 changes: 14 additions & 0 deletions lib/datasets/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@

from datasets.pascal_voc import pascal_voc
from datasets.coco import coco
from datasets.traffic import traffic
from datasets.traffic_india import traffic_india
import numpy as np

# cars-test dataset
for year in ['2016']:
for split in ['train', 'val', 'trainval', 'test']:
name = 'traffic_{}_{}'.format(year, split)
__sets[name] = (lambda split=split, year=year: traffic(split, year))

# traffic india dataset
for year in ['2016']:
for split in ['train', 'val', 'trainval', 'test']:
name = 'traffic_india_{}_{}'.format(year, split)
__sets[name] = (lambda split=split, year=year: traffic_india(split, year))

# Set up voc_<year>_<split> using selective search "fast" mode
for year in ['2007', '2012']:
for split in ['train', 'val', 'trainval', 'test']:
Expand Down
Loading