运行时的断言错误py-faster-rcnn

时间:2016-07-29 03:20:50

标签: python github

当我尝试运行py-faster-rcnn时跟随Github中的README.md: ./experiments/scripts/faster_rcnn_alt_opt.sh 0 VGG_CNN_M_1024 pascal_voc

它像这样停留在舞台上: 断言错误:路径不存在:/home/jiaxin/py-faster-rcnn/data/VOCdevkit2007/VOC2007/ImageSets/Main/trainval.txt

+ set -e
+ export PYTHONUNBUFFERED=True
+ PYTHONUNBUFFERED=True
+ GPU_ID=0
+ NET=VGG_CNN_M_1024
+ NET_lc=vgg_cnn_m_1024
+ DATASET=pascal_voc
+ array=($@)
+ len=3
+ EXTRA_ARGS=
+ EXTRA_ARGS_SLUG=
+ case $DATASET in
+ TRAIN_IMDB=voc_2007_trainval
+ TEST_IMDB=voc_2007_test
+ PT_DIR=pascal_voc
+ ITERS=40000
++ date +%Y-%m-%d_%H-%M-%S
+ LOG=experiments/logs/faster_rcnn_alt_opt_VGG_CNN_M_1024_.txt.2016-07-30_19-36-05
+ exec
++ tee -a experiments/logs/faster_rcnn_alt_opt_VGG_CNN_M_1024_.txt.2016-07-30_19-36-05
+ echo Logging output to experiments/logs/faster_rcnn_alt_opt_VGG_CNN_M_1024_.txt.2016-07-30_19-36-05
Logging output to experiments/logs/faster_rcnn_alt_opt_VGG_CNN_M_1024_.txt.2016-07-30_19-36-05
+ ./tools/train_faster_rcnn_alt_opt.py --gpu 0 --net_name VGG_CNN_M_1024 --weights data/imagenet_models/VGG_CNN_M_1024.v2.caffemodel --imdb voc_2007_trainval --cfg experiments/cfgs/faster_rcnn_alt_opt.yml
Called with args:
Namespace(cfg_file='experiments/cfgs/faster_rcnn_alt_opt.yml', gpu_id=0, imdb_name='voc_2007_trainval', net_name='VGG_CNN_M_1024', pretrained_model='data/imagenet_models/VGG_CNN_M_1024.v2.caffemodel', set_cfgs=None)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stage 1 RPN, init from ImageNet model
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Init model: data/imagenet_models/VGG_CNN_M_1024.v2.caffemodel
Using config:
{'DATA_DIR': '/home/jiaxin/py-faster-rcnn/data',
 'DEDUP_BOXES': 0.0625,
 'EPS': 1e-14,
 'EXP_DIR': 'faster_rcnn_alt_opt',
 'GPU_ID': 0,
 'MATLAB': 'matlab',
 'MODELS_DIR': '/home/jiaxin/py-faster-rcnn/models/pascal_voc',
 'PIXEL_MEANS': array([[[ 102.9801,  115.9465,  122.7717]]]),
 'RNG_SEED': 3,
 'ROOT_DIR': '/home/jiaxin/py-faster-rcnn',
 'TEST': {'BBOX_REG': True,
          'HAS_RPN': True,
          'MAX_SIZE': 1000,
          'NMS': 0.3,
          'PROPOSAL_METHOD': 'selective_search',
          'RPN_MIN_SIZE': 16,
          'RPN_NMS_THRESH': 0.7,
          'RPN_POST_NMS_TOP_N': 300,
          'RPN_PRE_NMS_TOP_N': 6000,
          'SCALES': [600],
          'SVM': False},
 'TRAIN': {'ASPECT_GROUPING': True,
           'BATCH_SIZE': 128,
           'BBOX_INSIDE_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
           'BBOX_NORMALIZE_MEANS': [0.0, 0.0, 0.0, 0.0],
           'BBOX_NORMALIZE_STDS': [0.1, 0.1, 0.2, 0.2],
           'BBOX_NORMALIZE_TARGETS': True,
           'BBOX_NORMALIZE_TARGETS_PRECOMPUTED': False,
           'BBOX_REG': False,
           'BBOX_THRESH': 0.5,
           'BG_THRESH_HI': 0.5,
           'BG_THRESH_LO': 0.0,
           'FG_FRACTION': 0.25,
           'FG_THRESH': 0.5,
           'HAS_RPN': True,
           'IMS_PER_BATCH': 1,
           'MAX_SIZE': 1000,
           'PROPOSAL_METHOD': 'gt',
           'RPN_BATCHSIZE': 256,
           'RPN_BBOX_INSIDE_WEIGHTS': [1.0, 1.0, 1.0, 1.0],
           'RPN_CLOBBER_POSITIVES': False,
           'RPN_FG_FRACTION': 0.5,
           'RPN_MIN_SIZE': 16,
           'RPN_NEGATIVE_OVERLAP': 0.3,
           'RPN_NMS_THRESH': 0.7,
           'RPN_POSITIVE_OVERLAP': 0.7,
           'RPN_POSITIVE_WEIGHT': -1.0,
           'RPN_POST_NMS_TOP_N': 2000,
           'RPN_PRE_NMS_TOP_N': 12000,
           'SCALES': [600],
           'SNAPSHOT_INFIX': 'stage1',
           'SNAPSHOT_ITERS': 10000,
           'USE_FLIPPED': True,
           'USE_PREFETCH': False},
 'USE_GPU_NMS': True}
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "./tools/train_faster_rcnn_alt_opt.py", line 122, in train_rpn
    roidb, imdb = get_roidb(imdb_name)
  File "./tools/train_faster_rcnn_alt_opt.py", line 61, in get_roidb
    imdb = get_imdb(imdb_name)
  File "/home/jiaxin/py-faster-rcnn/tools/../lib/datasets/factory.py", line 38, in get_imdb
    return __sets[name]()
  File "/home/jiaxin/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/jiaxin/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 38, in __init__
    self._image_index = self._load_image_set_index()
  File "/home/jiaxin/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/jiaxin/py-faster-rcnn/data/VOCdevkit2007/VOC2007/ImageSets/Main/trainval.txt

我该怎么办?我在构建符号链接之前检查了trainval.txt文件,它存在。我不知道在构建符号链接后发生了什么,我不能再打开这个文件了。

我改变了我的命令: ./experiments/scripts/faster_rcnn_alt_opt.sh 0 VGG_CNN_M_1024 pascal_voc - 设置EXP_DIR foobar RNG_SEED 42 TRAIN.SCALES“[400,500,600,700]”

再次遇到另一个AssertionError:

  • set -e
  • export PYTHONUNBUFFERED = True
  • PYTHONUNBUFFERED =真
  • GPU_ID = 0
  • NET = VGG_CNN_M_1024
  • NET_lc = vgg_cnn_m_1024
  • DATASET = pascal_voc
  • 阵列=($ @)
  • LEN = 13
  • EXTRA_ARGS =' - 设置EXP_DIR foobar RNG_SEED 42 TRAIN.SCALES [400,500,600,700]'
  • EXTRA_ARGS_SLUG = ' - set_EXP_DIR_foobar_RNG_SEED_42_TRAIN.SCALES_ [400,_500,_600,_700]'
  • 案例$ DATASET
  • TRAIN_IMDB = voc_2007_trainval
  • TEST_IMDB = voc_2007_test
  • PT_DIR = pascal_voc
  • ITERS = 40000 ++ date +%Y-%m-%d_%H-%M-%S
  • LOG = '实验/日志/ faster_rcnn_alt_opt_VGG_CNN_M_1024 _-- set_EXP_DIR_foobar_RNG_SEED_42_TRAIN.SCALES_ [400,_500,_600,_700] .txt.2016-07-30_19-41-43'
  • EXEC ++ tee -a'experimental / logs / faster_rcnn_alt_opt_VGG_CNN_M_1024 _-- set_EXP_DIR_foobar_RNG_SEED_42_TRAIN.SCALES_ [400,_500,_600,_700] .txt.2016-07-30_19-41-43'
  • echo记录输出到'experiments / logs / faster_rcnn_alt_opt_VGG_CNN_M_1024 _-- set_EXP_DIR_foobar_RNG_SEED_42_TRAIN.SCALES_ [400,_500,_600,_700] .txt.2016-07-30_19-41-43' 将输出记录到实验/日志/ faster_rcnn_alt_opt_VGG_CNN_M_1024 _-- set_EXP_DIR_foobar_RNG_SEED_42_TRAIN.SCALES_ [400,_500,_600,_700] .txt.2016-07-30_19-41-43
  • ./ tools / train_faster_rcnn_alt_opt.py --gpu 0 --net_name VGG_CNN_M_1024 --weights data / imagenet_models / VGG_CNN_M_1024.v2.caffemodel --imdb voc_2007_trainval --cfg experiments / cfgs / faster_rcnn_alt_opt.yml --set EXP_DIR foobar RNG_SEED 42 TRAIN.SCALES'[400,'500,600,'700]' 用args调用: 命名空间(cfg_file ='experiments / cfgs / faster_rcnn_alt_opt.yml',gpu_id = 0,imdb_name ='voc_2007_trainval',net_name ='VGG_CNN_M_1024',pretrained_model ='data / imagenet_models / VGG_CNN_M_1024.v2.caffemodel',set_cfgs = ['EXP_DIR' ,'foobar','RNG_SEED','42','TRAIN.SCALES','[400,','500,','600,','700]']) Traceback(最近一次调用最后一次): 文件“./tools/train_faster_rcnn_alt_opt.py”,第212行,in cfg_from_list(args.set_cfgs) 在cfg_from_list中输入文件“/home/jiaxin/py-faster-rcnn/tools/../lib/fast_rcnn/config.py”,第268行 断言len(cfg_list)%2 == 0 的AssertionError

我该怎么办?请帮我!

3 个答案:

答案 0 :(得分:0)

我刚用Google搜索了第二个错误的解决方案。积分来自@faschinj https://github.com/rbgirshick/py-faster-rcnn/issues/132

确保逗号后面没有空格,否则它们会被解析为单独的参数,如TRAIN.SCALES“[400,500,600,700]”

答案 1 :(得分:0)

我认为这是符号链接的错误。我的解决方案是首先删除文件夹'data'中的符号链接'VOCdevkit2007'。然后将文件夹'VOCdevkit'复制到'data'文件夹中,并将其重命名为'VOCdevkit2007'。

答案 2 :(得分:0)

在创建符号链接时,使用

ln -s ./VOCdevkit ./VOCdevkit2007

代替

ln -s $VOCdevkit VOCdevkit2007

因为作者可能创建了变量$VOCdevkit,而我们没有创建。然后ln命令将VOCdevkit2007链接到自身:

'./VOCdevkit2007' -> 'VOCdevkit2007'