TypeError: Cannot handle this data type Command exited with non-zero status 1
zhongnanning opened this issue · 6 comments
- set -e
- export PYTHONUNBUFFERED=True
- PYTHONUNBUFFERED=True
- GPU_ID=0
- DATASET=pascal_voc
- NET=vgg16
- array=($@)
- len=3
- EXTRA_ARGS=
- EXTRA_ARGS_SLUG=
- case ${DATASET} in
- TRAIN_IMDB=voc_2007_trainval
- TEST_IMDB=voc_2007_test
- STEPSIZE='[50000]'
- ITERS=70000
- ANCHORS='[8,16,32]'
- RATIOS='[0.5,1,2]'
++ date +%Y-%m-%d_%H-%M-%S - LOG=experiments/logs/vgg16_voc_2007_trainval__vgg16.txt.2018-11-08_21-33-49
- exec
++ tee -a experiments/logs/vgg16_voc_2007_trainval__vgg16.txt.2018-11-08_21-33-49 - echo Logging output to experiments/logs/vgg16_voc_2007_trainval__vgg16.txt.2018-11-08_21-33-49
Logging output to experiments/logs/vgg16_voc_2007_trainval__vgg16.txt.2018-11-08_21-33-49 - set +x
- '[' '!' -f output/vgg16/voc_2007_trainval/default/vgg16_faster_rcnn_iter_70000.pth.index ']'
- [[ ! -z '' ]]
- CUDA_VISIBLE_DEVICES=0
- time python ./tools/trainval_net.py --weight data/imagenet_weights/vgg16.pth --imdb voc_2007_trainval --imdbval voc_2007_test --iters 70000 --cfg experiments/cfgs/vgg16.yml --net vgg16 --set ANCHOR_SCALES '[8,16,32]' ANCHOR_RATIOS '[0.5,1,2]' TRAIN.STEPSIZE '[50000]'
Called with args:
Namespace(cfg_file='experiments/cfgs/vgg16.yml', imdb_name='voc_2007_trainval', imdbval_name='voc_2007_test', max_iters=70000, net='vgg16', set_cfgs=['ANCHOR_SCALES', '[8,16,32]', 'ANCHOR_RATIOS', '[0.5,1,2]', 'TRAIN.STEPSIZE', '[50000]'], tag=None, weight='data/imagenet_weights/vgg16.pth')
Using config:
{'ANCHOR_RATIOS': [0.5, 1, 2],
'ANCHOR_SCALES': [8, 16, 32],
'DATA_DIR': '/home/zhong/pytorch-faster-rcnn/data',
'EXP_DIR': 'vgg16',
'MATLAB': 'matlab',
'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': 'crop',
'POOLING_SIZE': 7,
'RESNET': {'FIXED_BLOCKS': 1, 'MAX_POOL': False},
'RNG_SEED': 3,
'ROOT_DIR': '/home/zhong/pytorch-faster-rcnn',
'RPN_CHANNELS': 512,
'TEST': {'BBOX_REG': True,
'HAS_RPN': True,
'MAX_SIZE': 1000,
'MODE': 'nms',
'NMS': 0.3,
'PROPOSAL_METHOD': 'gt',
'RPN_NMS_THRESH': 0.7,
'RPN_POST_NMS_TOP_N': 300,
'RPN_PRE_NMS_TOP_N': 6000,
'RPN_TOP_N': 5000,
'SCALES': [600],
'SVM': False},
'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,
'DISPLAY': 20,
'DOUBLE_BIAS': True,
'FG_FRACTION': 0.25,
'FG_THRESH': 0.5,
'GAMMA': 0.1,
'HAS_RPN': True,
'IMS_PER_BATCH': 1,
'LEARNING_RATE': 0.001,
'MAX_SIZE': 1000,
'MOMENTUM': 0.9,
'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_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_ITERS': 5000,
'SNAPSHOT_KEPT': 3,
'SNAPSHOT_PREFIX': 'vgg16_faster_rcnn',
'STEPSIZE': [50000],
'SUMMARY_INTERVAL': 180,
'TRUNCATED': False,
'USE_ALL_GT': True,
'USE_FLIPPED': True,
'USE_GT': False,
'WEIGHT_DECAY': 0.0001},
'USE_GPU_NMS': True}
Loaded datasetvoc_2007_trainval
for training
Set proposal method: gt
Appending horizontally-flipped training examples...
voc_2007_trainval gt roidb loaded from /home/zhong/pytorch-faster-rcnn/data/cache/voc_2007_trainval_gt_roidb.pkl
done
Preparing training data...
done
42 roidb entries
Output will be saved to/home/zhong/pytorch-faster-rcnn/output/vgg16/voc_2007_trainval/default
TensorFlow summaries will be saved to/home/zhong/pytorch-faster-rcnn/tensorboard/vgg16/voc_2007_trainval/default
Loaded datasetvoc_2007_test
for training
Set proposal method: gt
Preparing training data...
voc_2007_test gt roidb loaded from /home/zhong/pytorch-faster-rcnn/data/cache/voc_2007_test_gt_roidb.pkl
done
10 validation roidb entries
Filtered 0 roidb entries: 42 -> 42
Filtered 0 roidb entries: 10 -> 10
Solving...
Loading initial model weights from data/imagenet_weights/vgg16.pth
Loaded.
Traceback (most recent call last):
File "/home/zhong/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2428, in fromarray
mode, rawmode = _fromarray_typemap[typekey]
KeyError: ((1, 1, 333), '|u1')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./tools/trainval_net.py", line 138, in
max_iters=args.max_iters)
File "/home/zhong/pytorch-faster-rcnn/tools/../lib/model/train_val.py", line 348, in train_net
sw.train_model(max_iters)
File "/home/zhong/pytorch-faster-rcnn/tools/../lib/model/train_val.py", line 255, in train_model
self.net.train_step_with_summary(blobs, self.optimizer)
File "/home/zhong/pytorch-faster-rcnn/tools/../lib/nets/network.py", line 470, in train_step_with_summary
summary = self._run_summary_op()
File "/home/zhong/pytorch-faster-rcnn/tools/../lib/nets/network.py", line 326, in _run_summary_op
summaries.append(self._add_gt_image_summary())
File "/home/zhong/pytorch-faster-rcnn/tools/../lib/nets/network.py", line 65, in _add_gt_image_summary
return tb.summary.image('GROUND_TRUTH', image[0].astype('float32')/255.0)
File "/home/zhong/anaconda3/lib/python3.6/site-packages/tensorboardX/summary.py", line 205, in image
image = make_image(tensor, rescale=rescale)
File "/home/zhong/anaconda3/lib/python3.6/site-packages/tensorboardX/summary.py", line 243, in make_image
image = Image.fromarray(tensor)
File "/home/zhong/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2431, in fromarray
raise TypeError("Cannot handle this data type")
TypeError: Cannot handle this data type
Command exited with non-zero status 1
5.83user 1.54system 0:06.26elapsed 117%CPU (0avgtext+0avgdata 3345880maxresident)k
0inputs+16outputs (0major+839969minor)pagefaults 0swaps
I made my own data set with my heart. The data set refers to the format of VOC2007, but when I train, I get error...
xiongdi ni shi zhong guo ren ma?
I have encountered a similar problem,is the problem solved?
./experiments/scripts/train_faster_rcnn.sh 0 pascal_voc vgg16
- set -e
- export PYTHONUNBUFFERED=True
- PYTHONUNBUFFERED=True
- GPU_ID=0
- DATASET=pascal_voc
- NET=vgg16
- array=($@)
- len=3
- EXTRA_ARGS=
- EXTRA_ARGS_SLUG=
- case ${DATASET} in
- TRAIN_IMDB=voc_2007_trainval
- TEST_IMDB=voc_2007_test
- STEPSIZE='[50000]'
- ITERS=70000
- ANCHORS='[8,16,32]'
- RATIOS='[0.5,1,2]'
++ date +%Y-%m-%d_%H-%M-%S - LOG=experiments/logs/vgg16_voc_2007_trainval__vgg16.txt.2018-12-25_16-49-42
- exec
++ tee -a experiments/logs/vgg16_voc_2007_trainval__vgg16.txt.2018-12-25_16-49-42 - echo Logging output to experiments/logs/vgg16_voc_2007_trainval__vgg16.txt.2018-12-25_16-49-42
Logging output to experiments/logs/vgg16_voc_2007_trainval__vgg16.txt.2018-12-25_16-49-42 - set +x
- '[' '!' -f output/vgg16/voc_2007_trainval/default/vgg16_faster_rcnn_iter_70000.pth.index ']'
- [[ ! -z '' ]]
- CUDA_VISIBLE_DEVICES=0
- time python ./tools/trainval_net.py --weight data/imagenet_weights/vgg16.pth --imdb voc_2007_trainval --imdbval voc_2007_test --iters 70000 --cfg experiments/cfgs/vgg16.yml --net vgg16 --set ANCHOR_SCALES '[8,16,32]' ANCHOR_RATIOS '[0.5,1,2]' TRAIN.STEPSIZE '[50000]'
Called with args:
Namespace(cfg_file='experiments/cfgs/vgg16.yml', imdb_name='voc_2007_trainval', imdbval_name='voc_2007_test', max_iters=70000, net='vgg16', set_cfgs=['ANCHOR_SCALES', '[8,16,32]', 'ANCHOR_RATIOS', '[0.5,1,2]', 'TRAIN.STEPSIZE', '[50000]'], tag=None, weight='data/imagenet_weights/vgg16.pth')
Using config:
{'ANCHOR_RATIOS': [0.5, 1, 2],
'ANCHOR_SCALES': [8, 16, 32],
'DATA_DIR': '/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/data',
'EXP_DIR': 'vgg16',
'MATLAB': 'matlab',
'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': 'crop',
'POOLING_SIZE': 7,
'RESNET': {'FIXED_BLOCKS': 1, 'MAX_POOL': False},
'RNG_SEED': 3,
'ROOT_DIR': '/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn',
'RPN_CHANNELS': 512,
'TEST': {'BBOX_REG': True,
'HAS_RPN': True,
'MAX_SIZE': 1000,
'MODE': 'nms',
'NMS': 0.3,
'PROPOSAL_METHOD': 'gt',
'RPN_NMS_THRESH': 0.7,
'RPN_POST_NMS_TOP_N': 300,
'RPN_PRE_NMS_TOP_N': 6000,
'RPN_TOP_N': 5000,
'SCALES': [600],
'SVM': False},
'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,
'DISPLAY': 20,
'DOUBLE_BIAS': True,
'FG_FRACTION': 0.25,
'FG_THRESH': 0.5,
'GAMMA': 0.1,
'HAS_RPN': True,
'IMS_PER_BATCH': 1,
'LEARNING_RATE': 0.001,
'MAX_SIZE': 1000,
'MOMENTUM': 0.9,
'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_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_ITERS': 5000,
'SNAPSHOT_KEPT': 3,
'SNAPSHOT_PREFIX': 'vgg16_faster_rcnn',
'STEPSIZE': [50000],
'SUMMARY_INTERVAL': 180,
'TRUNCATED': False,
'USE_ALL_GT': True,
'USE_FLIPPED': True,
'USE_GT': False,
'WEIGHT_DECAY': 0.0001},
'USE_GPU_NMS': True}
Loaded datasetvoc_2007_trainval
for training
Set proposal method: gt
Appending horizontally-flipped training examples...
voc_2007_trainval gt roidb loaded from /home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/data/cache/voc_2007_trainval_gt_roidb.pkl
done
Preparing training data...
done
10022 roidb entries
Output will be saved to/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/output/vgg16/voc_2007_trainval/default
TensorFlow summaries will be saved to/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/tensorboard/vgg16/voc_2007_trainval/default
Loaded datasetvoc_2007_test
for training
Set proposal method: gt
Preparing training data...
voc_2007_test gt roidb loaded from /home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/data/cache/voc_2007_test_gt_roidb.pkl
done
4952 validation roidb entries
Filtered 0 roidb entries: 10022 -> 10022
Filtered 0 roidb entries: 4952 -> 4952
Solving...
Loading initial model weights from data/imagenet_weights/vgg16.pth
Loaded.
Traceback (most recent call last):
File "/home/dane/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2490, in fromarray
mode, rawmode = _fromarray_typemap[typekey]
KeyError: ((1, 1, 375), '|u1')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./tools/trainval_net.py", line 138, in
max_iters=args.max_iters)
File "/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/tools/../lib/model/train_val.py", line 348, in train_net
sw.train_model(max_iters)
File "/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/tools/../lib/model/train_val.py", line 255, in train_model
self.net.train_step_with_summary(blobs, self.optimizer)
File "/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/tools/../lib/nets/network.py", line 470, in train_step_with_summary
summary = self._run_summary_op()
File "/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/tools/../lib/nets/network.py", line 326, in _run_summary_op
summaries.append(self._add_gt_image_summary())
File "/home/dane/Dane/Detection/fasterrcnn/pytorch-faster-rcnn/tools/../lib/nets/network.py", line 65, in _add_gt_image_summary
return tb.summary.image('GROUND_TRUTH', image[0].astype('float32')/255.0)
File "/home/dane/anaconda3/lib/python3.6/site-packages/tensorboardX/summary.py", line 213, in image
image = make_image(tensor, rescale=rescale)
File "/home/dane/anaconda3/lib/python3.6/site-packages/tensorboardX/summary.py", line 252, in make_image
image = Image.fromarray(tensor)
File "/home/dane/anaconda3/lib/python3.6/site-packages/PIL/Image.py", line 2492, in fromarray
raise TypeError("Cannot handle this data type")
TypeError: Cannot handle this data type
Command exited with non-zero status 1
7.61user 1.12system 0:06.18elapsed 141%CPU (0avgtext+0avgdata 2966816maxresident)k
0inputs+16outputs (0major+813099minor)pagefaults 0swaps
OK , the problem is solved. pip install tensorboard-pytorch