Last active
May 8, 2017 01:32
-
-
Save jinyu121/c44ff3b9368c3b4f1b8f3de4880d7eab to your computer and use it in GitHub Desktop.
RCNN自动化脚本
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 删除 Cache | |
rm -Rf ./cachedir/* | |
# 删除 selective_search_data | |
rm -Rf ./data/selective_search_data/* | |
# 删除网络模型 finetune_voc_2007_trainval_iter_70k | |
rm -Rf data/caffe_nets/finetune_voc_2007_trainval_iter_70k | |
# 删除 备份网络配置和训练快照 | |
rm -Rf ./external/caffe/examples/pascal-finetuning/* | |
# 并将一份空的模型文件复制进去 | |
# 所以请修改 `finetuning/voc_2007_prototxt/` 目录下的配置 | |
cp ./finetuning/voc_2007_prototxt/*.prototxt ./external/caffe/examples/pascal-finetuning | |
# 删除 提取出的特征 | |
rm -Rf ./feat_cache/* | |
# 删除数据集信息 | |
rm -Rf ./imdb/cache/* | |
# 恢复几个README文件 | |
git checkout cachedir/README.md | |
git checkout feat_cache/README.md | |
git checkout imdb/cache/README.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 启动 | |
startup | |
% 测试 Caffe 工作是否正常 | |
key = caffe('get_init_key') | |
% Selective Search | |
selective_search_boxes_generator('train'); | |
selective_search_boxes_generator('val'); | |
selective_search_boxes_generator('trainval'); | |
selective_search_boxes_generator('test'); | |
% 制作 Window File | |
imdb_trainval = imdb_from_voc('datasets/VOCdevkit2007', 'trainval', '2007'); | |
imdb_test = imdb_from_voc('datasets/VOCdevkit2007', 'test', '2007'); | |
rcnn_make_window_file(imdb_trainval, 'external/caffe/examples/pascal-finetuning'); | |
rcnn_make_window_file(imdb_test, 'external/caffe/examples/pascal-finetuning'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 进入对应目录 | |
cd ./external/caffe/examples/pascal-finetuning | |
#开始训练 | |
GLOG_logtostderr=1 ../../build/tools/finetune_net.bin pascal_finetune_solver.prototxt ../../../../data/caffe_nets/ilsvrc_2012_train_iter_310k 2>&1 | tee log.txt | |
# 删除之前的模型文件并使用刚刚训练出来的模型 | |
rm ../../../../data/caffe_nets/finetune_voc_2007_trainval_iter_70k | |
cp ./pascal_finetune_train_iter_最大迭代次数 ../../../../data/caffe_nets/finetune_voc_2007_trainval_iter_70k | |
# 回到当前目录 | |
cd ../../../../ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 启动 | |
startup | |
% 提取特征 | |
rcnn_exp_cache_features('train'); | |
rcnn_exp_cache_features('val'); | |
rcnn_exp_cache_features('test_1'); | |
rcnn_exp_cache_features('test_2'); | |
% 训练和测试 | |
test_results = rcnn_exp_train_and_test() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
haoyu_extension="BAK" | |
haoyu_backupdir=backup-$haoyu_extension | |
# 创建备份目录 | |
mkdir $haoyu_backupdir | |
# 备份 Cache | |
cp ./cachedir ./$haoyu_backupdir/cachedir | |
# 备份 selective_search_data | |
mkdir -p ./$haoyu_backupdir/data | |
cp ./data/selective_search_data ./$haoyu_backupdir/data/selective_search_data | |
# 备份网络模型 finetune_voc_2007_trainval_iter_70k | |
mkdir -p ./$haoyu_backupdir/data/caffe_nets | |
cp data/caffe_nets/finetune_voc_2007_trainval_iter_70k ./$haoyu_backupdir/data/caffe_nets/finetune_voc_2007_trainval_iter_70k | |
# 备份网络配置和训练快照 | |
mkdir -p ./$haoyu_backupdir/external/caffe/examples | |
cp ./external/caffe/examples/pascal-finetuning ./$haoyu_backupdir/external/caffe/examples/pascal-finetuning | |
# 备份提取出的特征 | |
cp ./feat_cache ./$haoyu_backupdir/feat_cache | |
# 备份数据集信息 | |
mkdir ./$haoyu_backupdir/imdb | |
cp ./imdb/cache ./$haoyu_backupdir/imdb/cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 清理遗留文件 | |
. ./haoyu_1_cleanup.sh | |
# Selective Search | |
cat ./haoyu_2_ss.m | matlab | |
# 使用 Caffe 训练 | |
. ./haoyu_3_caffe.sh | |
# 训练 SVM 并测试 | |
cat ./haoyu_4_train.m | matlab | |
# 备份结果 | |
. ./haoyu_5_backup.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment