Closed zwyyy215 closed 5 years ago
I changed __C.TRAIN.PROPOSAL_METHOD = 'gt' In vgg16.yml ,I changed PROPOSAL_METHOD:gt
I don't know how to solve KeyError:'boxes', thank you
Hi @zwyyy215,
The gt
flag is a legacy from faster-RCNN.
The reason why you got a key error is, roidb of gt is composed of labels
and seg
(this).
For weakly supervised object detection, we should not use gt bounding boxes. However, if you really want to use gt boxes, you can simply change above code by using how annots.pkl
is made, maybe changing parse_rec. (this).
Thank you.
Thank you for your guidance.
When I change to selective_search,
(OICR) mickey@a208-System-Product-Name:~/OICR-pytorch$ CUDA_VISIBLE_DEVICES=0 python 3 trainval_net.py
Called with args:
Namespace(batch_size=2, checkpoint=-1, checkpoint_interval=500, class_agnostic=False , cuda=False, dataset='pascal_voc', disp_interval=50, large_scale=False, load_dir=No ne, lr=0.001, lr_decay_gamma=0.1, lr_decay_step=5, mGPUs=False, max_epochs=20, model ='oicr', net='vgg16', num_workers=4, optimizer='sgd', save_dir='output', session=1, start_epoch=1, threshold=0.01, use_tb=False, vis=False)
/home/mickey/OICR-pytorch/lib/model/utils/config.py:392: YAMLLoadWarning: calling ya ml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
yaml_cfg = edict(yaml.load(f))
Using config:
{'ANCHOR_RATIOS': [0.5, 1, 2],
'ANCHOR_SCALES': [8, 16, 32],
'CROP_RESIZE_WITH_MAX_POOL': False,
'CUDA': False,
'DATA_DIR': '/home/mickey/OICR-pytorch/data',
'DEDUP_BOXES': 0.125,
'EPS': 1e-14,
'EXP_DIR': 'vgg16',
'FEAT_STRIDE': [16],
'GPU_ID': 0,
'MATLAB': 'matlab',
'MAX_NUM_GT_BOXES': 20,
'MOBILENET': {'DEPTH_MULTIPLIER': 1.0,
'FIXED_LAYERS': 5,
'REGU_DEPTH': False,
'WEIGHT_DECAY': 4e-05},
'PIXEL_MEANS': array([[[102.9801, 115.9465, 122.7717]]]),
'POOLING_MODE': 'align',
'POOLING_SIZE': 7,
'RESNET': {'FIXED_BLOCKS': 1, 'MAX_POOL': False},
'RNG_SEED': 2,
'ROOT_DIR': '/home/mickey/OICR-pytorch',
'TEST': {'BBOX_REG': True,
'HAS_RPN': True,
'MAX_SIZE': 2000,
'MODE': 'nms',
'NMS': 0.3,
'PROPOSAL_METHOD': 'gt',
'RPN_MIN_SIZE': 16,
'RPN_NMS_THRESH': 0.7,
'RPN_POST_NMS_TOP_N': 300,
'RPN_PRE_NMS_TOP_N': 6000,
'RPN_TOP_N': 5000,
'SCALES': [480, 576, 688, 864, 1200],
'SVM': False,
'USE_FLIPPED': True},
'TRAIN': {'ASPECT_GROUPING': False,
'BATCH_SIZE': 256,
'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': True,
'BBOX_REG': True,
'BBOX_THRESH': 0.5,
'BG_THRESH_HI': 0.5,
'BG_THRESH_LO': 0.0,
'BIAS_DECAY': False,
'BN_TRAIN': False,
'DISPLAY': 10,
'DOUBLE_BIAS': True,
'FG_FRACTION': 0.25,
'FG_THRESH': 0.5,
'GAMMA': 0.1,
'HAS_RPN': True,
'IMS_PER_BATCH': 2,
'LEARNING_RATE': 0.01,
'MAX_IMAGE_SIZE': 2000,
'MAX_ROIS_SIZE': 6000,
'MAX_SIZE': 2000,
'MOMENTUM': 0.9,
'PROPOSAL_LIMIT': 2000,
'PROPOSAL_METHOD': 'selective_search',
'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': 8,
'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': [480, 576, 688, 864, 1200],
'SNAPSHOT_ITERS': 5000,
'SNAPSHOT_KEPT': 3,
'SNAPSHOT_PREFIX': 'res101_faster_rcnn',
'STEPSIZE': [40000],
'SUMMARY_INTERVAL': 180,
'TRIM_HEIGHT': 600,
'TRIM_WIDTH': 600,
'TRUNCATED': False,
'USE_ALL_GT': True,
'USE_FLIPPED': True,
'USE_GT': False,
'USE_SEG': True,
'WEIGHT_DECAY': 0.0005},
'USE_GPU_NMS': True}
WARNING: You have a CUDA device, so you should probably run with --cuda
selective_search
Loaded dataset voc_2007_trainval
for training
Set proposal method: selective_search
Appending horizontally-flipped training examples...
voc_2007_trainval gt roidb loaded from /home/mickey/OICR-pytorch/data/cache/voc_2007 _trainval_gt_roidb.pkl
Traceback (most recent call last):
File "trainval_net.py", line 231, in
I'm a beginner, I don't understand a lot. Please help me. Thank you.
Or, you can directly download by using
wget https://dl.dropboxusercontent.com/s/orrt7o6bp6ae0tc/selective_search_data.tgz
tar -xvf selective_search_data.tgz
and move selective_search_data
folder into data
Now, I added this instruction on README
Thank you for your help.
But I have new problems.I'm not sure how to modify it to make it work properly.
Thank you again.
(OICR) mickey@a208-System-Product-Name:~/OICR-pytorch$ CUDA_VISIBLE_DEVICES=0 python3 trainval_net.py
Called with args:
Namespace(batch_size=2, checkpoint=-1, checkpoint_interval=500, class_agnostic=False, cuda=False, dataset ='pascal_voc', disp_interval=50, large_scale=False, load_dir=None, lr=0.001, lr_decay_gamma=0.1, lr_decay _step=5, mGPUs=False, max_epochs=20, model='oicr', net='vgg16', num_workers=4, optimizer='sgd', save_dir= 'output', session=1, start_epoch=1, threshold=0.01, use_tb=False, vis=False)
/home/mickey/OICR-pytorch/lib/model/utils/config.py:392: YAMLLoadWarning: calling yaml.load() without Loa der=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
yaml_cfg = edict(yaml.load(f))
Using config:
{'ANCHOR_RATIOS': [0.5, 1, 2],
'ANCHOR_SCALES': [8, 16, 32],
'CROP_RESIZE_WITH_MAX_POOL': False,
'CUDA': False,
'DATA_DIR': '/home/mickey/OICR-pytorch/data',
'DEDUP_BOXES': 0.125,
'EPS': 1e-14,
'EXP_DIR': 'vgg16',
'FEAT_STRIDE': [16],
'GPU_ID': 0,
'MATLAB': 'matlab',
'MAX_NUM_GT_BOXES': 20,
'MOBILENET': {'DEPTH_MULTIPLIER': 1.0,
'FIXED_LAYERS': 5,
'REGU_DEPTH': False,
'WEIGHT_DECAY': 4e-05},
'PIXEL_MEANS': array([[[102.9801, 115.9465, 122.7717]]]),
'POOLING_MODE': 'align',
'POOLING_SIZE': 7,
'RESNET': {'FIXED_BLOCKS': 1, 'MAX_POOL': False},
'RNG_SEED': 2,
'ROOT_DIR': '/home/mickey/OICR-pytorch',
'TEST': {'BBOX_REG': True,
'HAS_RPN': True,
'MAX_SIZE': 2000,
'MODE': 'nms',
'NMS': 0.3,
'PROPOSAL_METHOD': 'gt',
'RPN_MIN_SIZE': 16,
'RPN_NMS_THRESH': 0.7,
'RPN_POST_NMS_TOP_N': 300,
'RPN_PRE_NMS_TOP_N': 6000,
'RPN_TOP_N': 5000,
'SCALES': [480, 576, 688, 864, 1200],
'SVM': False,
'USE_FLIPPED': True},
'TRAIN': {'ASPECT_GROUPING': False,
'BATCH_SIZE': 256,
'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': True,
'BBOX_REG': True,
'BBOX_THRESH': 0.5,
'BG_THRESH_HI': 0.5,
'BG_THRESH_LO': 0.0,
'BIAS_DECAY': False,
'BN_TRAIN': False,
'DISPLAY': 10,
'DOUBLE_BIAS': True,
'FG_FRACTION': 0.25,
'FG_THRESH': 0.5,
'GAMMA': 0.1,
'HAS_RPN': True,
'IMS_PER_BATCH': 2,
'LEARNING_RATE': 0.01,
'MAX_IMAGE_SIZE': 2000,
'MAX_ROIS_SIZE': 6000,
'MAX_SIZE': 2000,
'MOMENTUM': 0.9,
'PROPOSAL_LIMIT': 2000,
'PROPOSAL_METHOD': 'selective_search',
'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': 8,
'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': [480, 576, 688, 864, 1200],
'SNAPSHOT_ITERS': 5000,
'SNAPSHOT_KEPT': 3,
'SNAPSHOT_PREFIX': 'res101_faster_rcnn',
'STEPSIZE': [40000],
'SUMMARY_INTERVAL': 180,
'TRIM_HEIGHT': 600,
'TRIM_WIDTH': 600,
'TRUNCATED': False,
'USE_ALL_GT': True,
'USE_FLIPPED': True,
'USE_GT': False,
'USE_SEG': True,
'WEIGHT_DECAY': 0.0005},
'USE_GPU_NMS': True}
WARNING: You have a CUDA device, so you should probably run with --cuda
selective_search
Loaded dataset voc_2007_trainval
for training
Set proposal method: selective_search
Appending horizontally-flipped training examples...
voc_2007_trainval ss roidb loaded from /home/mickey/OICR-pytorch/data/cache/voc_2007_trainval_selective_s earch_roidb.pkl
done
Preparing training data...
done
before filtering, there are 10022 images...
after filtering, there are 10022 images...
voc_2007_trainval ss roidb loaded from /home/mickey/OICR-pytorch/data/cache/voc_2007_trainval_selective_s earch_roidb.pkl
5236 71
10022 roidb entries
output/log/log.txt file already exists
output/log/log_3.txt
output/log/progress.csv file already exists
Logging to output/log
oicr
Loading pretrained weights from data/pretrained_model/vgg16_caffe.pth
Learning rate 0.001
Traceback (most recent call last):
File "trainval_net.py", line 417, in
@zwyyy215 This seems because cuda flag is off. could you run with --cuda?
Or run
CUDA_VISIBLE_DEVICES=0 python3 trainval_net.py --dataset pascal_voc --net vgg16 \
--bs 2 --nw 6 --save_dir='results/test_single' \
--lr 0.001 --cuda --disp_interval 50 --vis \
--checkpoint_interval=500 --model='oicr' --threshold=0.1
Thank you. The program has finally run successfully. Thank you for your patient guidance.
Thank you. The program has finally run successfully. Thank you for your patient guidance.
Have you solved this problem? Can you teach me?Thankyou!
@alexshaodong Did you confront the same problem?
As you cited, the problem of this issue came from not installing voc_2007_trainval.mat
.
@alexshaodong Did you confront the same problem?
As you cited, the problem of this issue came from not installing
voc_2007_trainval.mat
.
Hello, I came across this problem: Key Error:'boxes'.I have installed voc_2007_trainval.mat. I want to ask for your help! Thank you!
Hi @zwyyy215, The
gt
flag is a legacy from faster-RCNN. The reason why you got a key error is, roidb of gt is composed oflabels
andseg
(this).For weakly supervised object detection, we should not use gt bounding boxes. However, if you really want to use gt boxes, you can simply change above code by using how
annots.pkl
is made, maybe changing parse_rec. (this).Thank you.
This is the one. I want to ask you to teach me how to modify the code.
(OICR) mickey@a208-System-Product-Name:~/OICR-pytorch$ CUDA_VISIBLE_DEVICES=0 python3 trainval_net.py Called with args: Namespace(batch_size=2, checkpoint=-1, checkpoint_interval=500, class_agnostic=False, cuda=False, dataset='pascal_voc', disp_interval=50, large_scale=False, load_dir=None, lr=0.001, lr_decay_gamma=0.1, lr_decay_step=5, mGPUs=False, max_epochs=20, model='oicr', net='vgg16', num_workers=4, optimizer='sgd', save_dir='output', session=1, start_epoch=1, threshold=0.01, use_tb=False, vis=False) /home/mickey/OICR-pytorch/lib/model/utils/config.py:392: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details. yaml_cfg = edict(yaml.load(f)) Using config: {'ANCHOR_RATIOS': [0.5, 1, 2], 'ANCHOR_SCALES': [8, 16, 32], 'CROP_RESIZE_WITH_MAX_POOL': False, 'CUDA': False, 'DATA_DIR': '/home/mickey/OICR-pytorch/data', 'DEDUP_BOXES': 0.125, 'EPS': 1e-14, 'EXP_DIR': 'vgg16', 'FEAT_STRIDE': [16], 'GPU_ID': 0, 'MATLAB': 'matlab', 'MAX_NUM_GT_BOXES': 20, 'MOBILENET': {'DEPTH_MULTIPLIER': 1.0, 'FIXED_LAYERS': 5, 'REGU_DEPTH': False, 'WEIGHT_DECAY': 4e-05}, 'PIXEL_MEANS': array([[[102.9801, 115.9465, 122.7717]]]), 'POOLING_MODE': 'align', 'POOLING_SIZE': 7, 'RESNET': {'FIXED_BLOCKS': 1, 'MAX_POOL': False}, 'RNG_SEED': 2, 'ROOT_DIR': '/home/mickey/OICR-pytorch', 'TEST': {'BBOX_REG': True, 'HAS_RPN': True, 'MAX_SIZE': 2000, 'MODE': 'nms', 'NMS': 0.3, 'PROPOSAL_METHOD': 'gt', 'RPN_MIN_SIZE': 16, 'RPN_NMS_THRESH': 0.7, 'RPN_POST_NMS_TOP_N': 300, 'RPN_PRE_NMS_TOP_N': 6000, 'RPN_TOP_N': 5000, 'SCALES': [480, 576, 688, 864, 1200], 'SVM': False, 'USE_FLIPPED': True}, 'TRAIN': {'ASPECT_GROUPING': False, 'BATCH_SIZE': 256, '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': True, 'BBOX_REG': True, 'BBOX_THRESH': 0.5, 'BG_THRESH_HI': 0.5, 'BG_THRESH_LO': 0.0, 'BIAS_DECAY': False, 'BN_TRAIN': False, 'DISPLAY': 10, 'DOUBLE_BIAS': True, 'FG_FRACTION': 0.25, 'FG_THRESH': 0.5, 'GAMMA': 0.1, 'HAS_RPN': True, 'IMS_PER_BATCH': 2, 'LEARNING_RATE': 0.01, 'MAX_IMAGE_SIZE': 2000, 'MAX_ROIS_SIZE': 6000, 'MAX_SIZE': 2000, 'MOMENTUM': 0.9, 'PROPOSAL_LIMIT': 2000, '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': 8, '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': [480, 576, 688, 864, 1200], 'SNAPSHOT_ITERS': 5000, 'SNAPSHOT_KEPT': 3, 'SNAPSHOT_PREFIX': 'res101_faster_rcnn', 'STEPSIZE': [40000], 'SUMMARY_INTERVAL': 180, 'TRIM_HEIGHT': 600, 'TRIM_WIDTH': 600, 'TRUNCATED': False, 'USE_ALL_GT': True, 'USE_FLIPPED': True, 'USE_GT': False, 'USE_SEG': True, 'WEIGHT_DECAY': 0.0005}, 'USE_GPU_NMS': True} WARNING: You have a CUDA device, so you should probably run with --cuda gt Loaded dataset
imdb, roidb, ratio_list, ratio_index = combined_roidb(args.imdb_name)
File "/home/mickey/OICR-pytorch/lib/roi_data_layer/roidb.py", line 100, in combined_roidb
roidbs = [get_roidb(s) for s in imdb_names.split('+')]
File "/home/mickey/OICR-pytorch/lib/roi_data_layer/roidb.py", line 100, in
roidbs = [get_roidb(s) for s in imdb_names.split('+')]
File "/home/mickey/OICR-pytorch/lib/roi_data_layer/roidb.py", line 97, in get_roidb
roidb = get_training_roidb(imdb)
File "/home/mickey/OICR-pytorch/lib/roi_data_layer/roidb.py", line 82, in get_training_roidb
imdb.append_flipped_images()
File "/home/mickey/OICR-pytorch/lib/datasets/imdb.py", line 117, in append_flipped_images
boxes = self.roidb[i]['boxes'].copy()
KeyError: 'boxes'
voc_2007_trainval
for training Set proposal method: gt Appending horizontally-flipped training examples... wrote gt roidb to /home/mickey/OICR-pytorch/data/cache/voc_2007_trainval_gt_roidb.pkl Traceback (most recent call last): File "trainval_net.py", line 231, in