2018年11月22日星期四

tf faster rcnn 训练自己的数据集


1 按照https://github.com/endernewton/tf-faster-rcnn中介绍步骤安装项目。

2 用自己的数据集替换VOC2007数据集文件夹。

3 修改lib/datasets/pascal_voc.py中

self._classes = ('__background__',  # always index 0       "defect0","defect1","defect2","defect3","defect4","defect5","defect6","defect7","defect8","defect9")####################
 
4 lib/datasets/factory.py和experiments/scripts/train_faster_rcnn, experiments/scripts/test_faster_rcnn中,因为自己数据集名称和VOC2007一致,暂不用修改。

5 开始训练

./experiments/scripts/train_faster_rcnn.sh 0 pascal_voc res101
注意每次训练前删除output和data/cache文件夹。

训练时其它可能需要修改的参数:
1)修改迭代次数:experiments/scripts/train_faster_rcnn.sh文件中修改迭代次数
experiments/scripts/test_faster_rcnn.sh中也相应修改
2) 学习率设置:tf-faster-rcnn/lib/model/config.py文件中设置



6 tools/demo.py修改种类数
net.create_architecture("TEST", 11,#####################21


可能出现的错误:
1)InvalidArgumentError (see above for traceback): Nan in summary histogram for: 


it's because in the file 'pascal_voc.py', the function '_load_pascal_annotation' has an operation of make pixel indexes 0-based,the code is :
x1 = float(bbox.find('xmin').text) - 1
y1 = float(bbox.find('ymin').text) - 1
x2 = float(bbox.find('xmax').text) - 1
y2 = float(bbox.find('ymax').text) - 1
删除-1

2)assert(cfg.TRAIN.BATCH_SIZE % num_images == 0), 
ZeroDivisionError: integer division or modulo by zero

test.txt不能为空







1 条评论:

  1. This is the ultimate steel razor - Titanium White Octane
    This is the ultimate steel titanium drill bit set razor samsung watch 3 titanium - Titanium White Octane, a titanium frames chrome finished razor. The lightweight chrome harbor freight titanium welder finished razor is very similar to titanium grinder other

    回复删除

Failed to find TIFF library

ImportError: Failed to find TIFF library. Make sure that libtiff is installed and its location is listed in PATH|LD_LIBRARY_PATH|.. 解决方法: ...