Faster-RCNN訓練自己的樣本

Faster-RCNN訓練自己的樣本






I0929 23:25:56.106283  9598 net.cpp:228] conv1 does not need backward computation.
I0929 23:25:56.106286  9598 net.cpp:270] This network produces output bbox_pred
I0929 23:25:56.106287  9598 net.cpp:270] This network produces output cls_prob
I0929 23:25:56.106299  9598 net.cpp:283] Network initialization done.
I0929 23:25:56.171612  9598 net.cpp:816] Ignoring source layer data
I0929 23:25:56.201792  9598 net.cpp:816] Ignoring source layer loss_cls
I0929 23:25:56.201802  9598 net.cpp:816] Ignoring source layer loss_bbox
I0929 23:25:56.202102  9598 net.cpp:816] Ignoring source layer silence_rpn_cls_score
I0929 23:25:56.202107  9598 net.cpp:816] Ignoring source layer silence_rpn_bbox_pred
Traceback (most recent call last):
  File "./tools/test_net.py", line 85, in <module>
    imdb = get_imdb(args.imdb_name)
  File "/home/icalc/py-faster-rcnn/tools/../lib/datasets/factory.py", line 38, in get_imdb
    return __sets[name]()
  File "/home/icalc/py-faster-rcnn/tools/../lib/datasets/factory.py", line 20, in <lambda>
    __sets[name] = (lambda split=split, year=year: pascal_voc(split, year))
  File "/home/icalc/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 38, in __init__
    self._image_index = self._load_image_set_index()
  File "/home/icalc/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 82, in _load_image_set_index
    'Path does not exist: {}'.format(image_set_file)
AssertionError: Path does not exist: /home/icalc/py-faster-rcnn/data/VOCdevkit2007/VOC2007/ImageSets/Main/test.txt

解決:

ImageSets

Main文件需要trainval.txt和test.txt兩個文件

train

val 

test

Reading annotation for 3901/4952
Reading annotation for 4001/4952
Reading annotation for 4101/4952
Reading annotation for 4201/4952
Reading annotation for 4301/4952
Reading annotation for 4401/4952
Reading annotation for 4501/4952
Reading annotation for 4601/4952
Reading annotation for 4701/4952
Reading annotation for 4801/4952
Reading annotation for 4901/4952
Saving cached annotations to /home/icalc/py-faster-rcnn/data/VOCdevkit2007/annotations_cache/annots.pkl
AP for aeroplane = 0.6114
AP for bicycle = 0.6873
AP for bird = 0.5735
AP for boat = 0.4505
AP for bottle = 0.3223
AP for bus = 0.6750
AP for car = 0.7491
AP for cat = 0.7020
AP for chair = 0.3622
AP for cow = 0.6265
AP for diningtable = 0.5938
AP for dog = 0.6640
AP for horse = 0.7727
AP for motorbike = 0.6801
AP for person = 0.6518
AP for pottedplant = 0.3408
AP for sheep = 0.5669
AP for sofa = 0.5379
AP for train = 0.6842
AP for tvmonitor = 0.6016
Mean AP = 0.5927
~~~~~~~~
Results:
0.611
0.687
0.574
0.450
0.322
0.675
0.749
0.702
0.362
0.626
0.594
0.664
0.773
0.680
0.652
0.341
0.567
0.538
0.684
0.602
0.593
~~~~~~~~

--------------------------------------------------------------
Results computed with the **unofficial** Python eval code.
Results should be very close to the official MATLAB eval code.
Recompute with `./tools/reval.py --matlab ...` for your paper.
-- Thanks, The Management
--------------------------------------------------------------

real	2m36.431s
user	2m30.988s
sys	0m18.472s

#!/bin/bash
# Usage:
# ./experiments/scripts/faster_rcnn_alt_opt.sh GPU NET DATASET [options args to {train,test}_net.py]
# DATASET is only pascal_voc for now
#
# Example:
# ./experiments/scripts/faster_rcnn_alt_opt.sh 0 VGG_CNN_M_1024 pascal_voc \
#   --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,,}
DATASET=$3

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

case $DATASET in
  pascal_voc)
    TRAIN_IMDB="voc_2007_trainval"
    TEST_IMDB="voc_2007_test"
    PT_DIR="pascal_voc"
    ITERS=40000
    ;;
  coco)
    echo "Not implemented: use experiments/scripts/faster_rcnn_end2end.sh for coco"
    exit
    ;;
  *)
    echo "No dataset given"
    exit
    ;;
esac

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

time ./tools/train_faster_rcnn_alt_opt.py --gpu ${GPU_ID} \
  --net_name ${NET} \
  --weights data/imagenet_models/${NET}.v2.caffemodel \
  --imdb ${TRAIN_IMDB} \
  --cfg experiments/cfgs/faster_rcnn_alt_opt.yml \
  ${EXTRA_ARGS}

set +x
NET_FINAL=`grep "Final model:" ${LOG} | awk '{print $3}'`
set -x

time ./tools/test_net.py --gpu ${GPU_ID} \
  --def models/${PT_DIR}/${NET}/faster_rcnn_alt_opt/faster_rcnn_test.pt \
  --net ${NET_FINAL} \
  --imdb ${TEST_IMDB} \
  --cfg experiments/cfgs/faster_rcnn_alt_opt.yml \
  ${EXTRA_ARGS}



發佈了252 篇原創文章 · 獲贊 132 · 訪問量 72萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章