Skip to content

Commit

Permalink
add voc rpn cls
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu Xiang committed Jun 7, 2016
1 parent 9c7efba commit 0c5eb59
Show file tree
Hide file tree
Showing 8 changed files with 1,206 additions and 20 deletions.
35 changes: 20 additions & 15 deletions NISSAN/exemplar_display_result_nissan.m
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
function exemplar_display_result_nissan

threshold_car = 0.1;
threshold_others = 0.3;
threshold_others = 0.5;
is_save = 1;
result_dir = 'test_results';
root_dir = '/capri5/NISSAN_Dataset/Images';
% image_set = '2015-10-21-16-25-12';
% image_set = '2016-01-15-15-05-24';
% image_set = '2016-02-17-16-51-05';
% image_set = '2016-02-17-16-55-12';
image_set = '2016-02-17-16-59-25';
result_dir = '/capri5/Projects/3DVP_RCNN/fast-rcnn/output/nissan';
root_dir = '/capri5/NISSAN_Dataset';
image_set = 'autonomy_log_2016-04-11-12-15-46';

if is_save
result_image_dir = sprintf('result_images/%s', image_set);
Expand All @@ -19,7 +15,7 @@
end

% read detection results
filename = sprintf('%s/%s-detections.txt', result_dir, image_set);
filename = sprintf('%s/nissan_%s/vgg16_fast_rcnn_multiscale_6k8k_kitti_iter_80000/detections.txt', result_dir, image_set);
[ids_det, cls_det, x1_det, y1_det, x2_det, y2_det, cid_det, score_det] = ...
textread(filename, '%s %s %f %f %f %f %d %f');
fprintf('load detection done\n');
Expand Down Expand Up @@ -165,6 +161,13 @@
end
end

if mod(i, 3) == 1
subplot(1, 3, 2);
elseif mod(i, 3) == 2
subplot(1, 3, 1);
else
subplot(1, 3, 3);
end
imshow(I);
hold on;
for k = 1:num
Expand All @@ -181,12 +184,14 @@
end
hold off;

if is_save
filename = fullfile(result_image_dir, sprintf('%s.png', img_idx));
% saveas(hf, filename);
hgexport(hf, filename, hgexport('factorystyle'), 'Format', 'png');
else
pause;
if mod(i, 3) == 0
if is_save
filename = fullfile(result_image_dir, sprintf('image%05d.png', i/3-1));
% saveas(hf, filename);
hgexport(hf, filename, hgexport('factorystyle'), 'Format', 'png');
else
pause;
end
end
end

Expand Down
8 changes: 4 additions & 4 deletions NISSAN/exemplar_globals.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
% directory with KITTI development kit and dataset
KITTIpaths = {'/net/skyserver10/workplace/yxiang/KITTI_Dataset', ...
'/net/acadia/workplace/yuxiang/Projects/KITTI', ...
'/home/yuxiang/Projects/KITTI_Dataset', ...
'/capri5/Projects/KITTI_Dataset', ...
'/scratch/yuxiang/Projects/KITTI_Dataset', ...
'/scail/scratch/u/yuxiang/KITTI_Dataset'};

Expand All @@ -19,7 +19,7 @@

SLMpaths = {'/net/skyserver30/workplace/local/wongun/yuxiang/SLM', ...
'/net/skyserver10/workplace/yxiang/SLM', ...
'/home/yuxiang/Projects/SLM', ...
'/capri5/Projects/SLM', ...
'/scail/scratch/u/yuxiang/SLM'};

for i = 1:numel(SLMpaths)
Expand All @@ -29,8 +29,8 @@
end
end

PASCAL3Dpaths = {'/home/yuxiang/Projects/PASCAL3D+_release1.1', ...
'/home/yuxiang/Projects/Pose_Dataset/PASCAL3D+_release1.1', ...
PASCAL3Dpaths = {'/capri5/Projects/PASCAL3D+_release1.1', ...
'/capri5/Projects/Pose_Dataset/PASCAL3D+_release1.1', ...
'/scratch/yuxiang/Projects/PASCAL3D+_release1.1', ...
'/scail/scratch/u/yuxiang/PASCAL3D+_release1.1'};

Expand Down
26 changes: 26 additions & 0 deletions fast-rcnn/experiments/cfgs/pascal_rpn_cls_vgg16.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
EXP_DIR: pascal2007
IS_RPN: True
NET_NAME: 'VGG16'
SUBCLS_NAME: 'subcategory_exemplars'
TRAIN:
SCALES_BASE: !!python/tuple [0.25, 2.0]
NUM_PER_OCTAVE: 19
ASPECTS: !!python/tuple [3.0, 2.0, 1.5, 1.0, 0.75, 0.5, 0.25, 0.125]
IMS_PER_BATCH: 1
BATCH_SIZE: 128
FG_FRACTION: 0.5
FG_THRESH: !!python/tuple [0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7]
BG_THRESH_HI: !!python/tuple [0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7]
BG_THRESH_LO: !!python/tuple [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
BBOX_THRESH: !!python/tuple [0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7, 0.7]
SNAPSHOT_INFIX: pascal2007
BBOX_REG: True
SNAPSHOT_ITERS: 10000
TEST:
SCALES_BASE: !!python/tuple [0.25, 2.0]
NUM_PER_OCTAVE: 19
ASPECTS: !!python/tuple [3.0, 2.0, 1.5, 1.0, 0.75, 0.5, 0.25, 0.125]
NMS: 0.5
ROI_THRESHOLD: 0.005
ROI_NUM: 2000
BBOX_REG: True
30 changes: 30 additions & 0 deletions fast-rcnn/experiments/scripts/pascal2007_vgg16_rpn_cls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -x
set -e

export PYTHONUNBUFFERED="True"

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

#time ./tools/train_net.py --gpu $1 \
# --solver models/VGG16/pascal2007/solver_rpn_cls.prototxt \
# --weights data/imagenet_models/VGG16.v2.caffemodel \
# --imdb voc_2007_trainval \
# --cfg experiments/cfgs/pascal_rpn_cls_vgg16.yml \
# --iters 40000

time ./tools/test_net.py --gpu $1 \
--def models/VGG16/pascal2007/test_rpn_cls.prototxt \
--net output/pascal2007/voc_2007_trainval/vgg16_fast_rcnn_rpn_cls_pascal2007_iter_10000.caffemodel \
--imdb voc_2007_test \
--cfg experiments/cfgs/pascal_rpn_cls_vgg16.yml

time ./tools/test_net.py --gpu $1 \
--def models/VGG16/pascal2007/test_rpn_cls.prototxt \
--net output/pascal2007/voc_2007_trainval/vgg16_fast_rcnn_rpn_cls_pascal2007_iter_40000.caffemodel \
--imdb voc_2007_trainval \
--cfg experiments/cfgs/pascal_rpn_cls_vgg16.yml

2 changes: 1 addition & 1 deletion fast-rcnn/lib/fast_rcnn/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ def test_net(net, imdb):
.astype(np.float32, copy=False)
count = count + len(cls_scores)

if 0:
if 1:
keep = nms(all_boxes[j][i], cfg.TEST.NMS)
vis_detections(im, imdb.classes[j], all_boxes[j][i][keep, :])
_t['misc'].toc()
Expand Down
15 changes: 15 additions & 0 deletions fast-rcnn/models/VGG16/pascal2007/solver_rpn_cls.prototxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
train_net: "models/VGG16/pascal2007/train_rpn_cls.prototxt"
base_lr: 0.001
lr_policy: "step"
gamma: 0.1
stepsize: 30000
display: 20
average_loss: 100
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_fast_rcnn_rpn_cls"
#debug_info: true
Loading

0 comments on commit 0c5eb59

Please sign in to comment.