Faster-RCNN训练自己的样本

来源:互联网 发布:红帆oa软件 编辑:程序博客网 时间:2024/06/07 22:02

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_predI0929 23:25:56.106287  9598 net.cpp:270] This network produces output cls_probI0929 23:25:56.106299  9598 net.cpp:283] Network initialization done.I0929 23:25:56.171612  9598 net.cpp:816] Ignoring source layer dataI0929 23:25:56.201792  9598 net.cpp:816] Ignoring source layer loss_clsI0929 23:25:56.201802  9598 net.cpp:816] Ignoring source layer loss_bboxI0929 23:25:56.202102  9598 net.cpp:816] Ignoring source layer silence_rpn_cls_scoreI0929 23:25:56.202107  9598 net.cpp:816] Ignoring source layer silence_rpn_bbox_predTraceback (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/4952Reading annotation for 4001/4952Reading annotation for 4101/4952Reading annotation for 4201/4952Reading annotation for 4301/4952Reading annotation for 4401/4952Reading annotation for 4501/4952Reading annotation for 4601/4952Reading annotation for 4701/4952Reading annotation for 4801/4952Reading annotation for 4901/4952Saving cached annotations to /home/icalc/py-faster-rcnn/data/VOCdevkit2007/annotations_cache/annots.pklAP for aeroplane = 0.6114AP for bicycle = 0.6873AP for bird = 0.5735AP for boat = 0.4505AP for bottle = 0.3223AP for bus = 0.6750AP for car = 0.7491AP for cat = 0.7020AP for chair = 0.3622AP for cow = 0.6265AP for diningtable = 0.5938AP for dog = 0.6640AP for horse = 0.7727AP for motorbike = 0.6801AP for person = 0.6518AP for pottedplant = 0.3408AP for sheep = 0.5669AP for sofa = 0.5379AP for train = 0.6842AP for tvmonitor = 0.6016Mean AP = 0.5927~~~~~~~~Results:0.6110.6870.5740.4500.3220.6750.7490.7020.3620.6260.5940.6640.7730.6800.6520.3410.5670.5380.6840.6020.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--------------------------------------------------------------real2m36.431suser2m30.988ssys0m18.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 -xset -eexport PYTHONUNBUFFERED="True"GPU_ID=$1NET=$2NET_lc=${NET,,}DATASET=$3array=( $@ )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    ;;esacLOG="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 +xNET_FINAL=`grep "Final model:" ${LOG} | awk '{print $3}'`set -xtime ./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}