Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: zero-size array to reduction operation maximum which has no identity #98

Closed
Ram-Godavarthi opened this issue Jul 4, 2018 · 8 comments

Comments

@Ram-Godavarthi
Copy link

@ijkguo I have a question regarding input image size. I have dataset of some 300 images with size 31*512.
is it possible to train the network with this dimension??
when i run the train script. I am getting this below error..

ubuntu@ip-172-31-10-202:~/mx-rcnn$ python3 train.py --pretrained model/vgg16-0000.params --network vgg16 --rcnn-num-classes 3 --dataset voc --gpus 0
INFO:root:loading cache data/cache/voc_2007_trainval_roidb.pkl
INFO:root:voc_2007_trainval num_images 1500
INFO:root:voc_2007_trainval append flipped images to roidb
INFO:root:called with args
{'dataset': 'voc',
'epochs': 20,
'gpus': '0',
'imageset': '2007_trainval',
'img_long_side': 1000,
'img_pixel_means': (123.68, 116.779, 103.939),
'img_pixel_stds': (1.0, 1.0, 1.0),
'img_short_side': 600,
'log_interval': 100,
'lr': 0.001,
'lr_decay_epoch': '7',
'net_fixed_params': ['conv1', 'conv2'],
'network': 'vgg16',
'pretrained': 'model/vgg16-0000.params',
'rcnn_batch_rois': 128,
'rcnn_batch_size': 1,
'rcnn_bbox_stds': (0.1, 0.1, 0.2, 0.2),
'rcnn_feat_stride': 16,
'rcnn_fg_fraction': 0.25,
'rcnn_fg_overlap': 0.5,
'rcnn_num_classes': 3,
'rcnn_pooled_size': (7, 7),
'resume': '',
'rpn_allowed_border': 0,
'rpn_anchor_ratios': (0.5, 1, 2),
'rpn_anchor_scales': (8, 16, 32),
'rpn_batch_rois': 256,
'rpn_bg_overlap': 0.3,
'rpn_feat_stride': 16,
'rpn_fg_fraction': 0.5,
'rpn_fg_overlap': 0.7,
'rpn_min_size': 16,
'rpn_nms_thresh': 0.7,
'rpn_post_nms_topk': 2000,
'rpn_pre_nms_topk': 12000,
'save_prefix': 'model/vgg16',
'start_epoch': 0}
Traceback (most recent call last):
File "train.py", line 309, in
main()
File "train.py", line 305, in main
train_net(sym, roidb, args)
File "train.py", line 30, in train_net
args.img_pixel_means, args.img_pixel_stds, feat_sym, ag, asp, shuffle=True)
File "/home/ubuntu/mx-rcnn/data/loader.py", line 145, in init
self.next()
File "/home/ubuntu/mx-rcnn/data/loader.py", line 166, in next
data_batch = mx.io.DataBatch(data=self.getdata(), label=self.getlabel(),
File "/home/ubuntu/mx-rcnn/data/loader.py", line 204, in getlabel
b_label, b_bbox_target, b_bbox_weight = self._as.assign(anchors, b_gt_boxes, b_im_height, b_im_width)
File "/home/ubuntu/mx-rcnn/data/anchor.py", line 121, in assign
gt_max_overlaps = overlaps.max(axis=0)
File "/home/ubuntu/anaconda3/lib/python3.6/site-packages/numpy/core/_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
ValueError: zero-size array to reduction operation maximum which has no identity

Could you please let me know whats the problem??

@Ram-Godavarthi
Copy link
Author

I found the reason for this.. It was due to anchor box scales and min_size.
i have a new question regarding this. What is the best value for anchor scale and min_size to detect objects in 31512 image.. objects are of size 4100( width*height).
i have changed anchor scales form (8,16,32) to (2,4,6) and min_size to 2 and rpn_stride to 6..
And trained the network, but getting
AP for bicycle = 0.0000
Ap for pedestrian = 0.0000
mean AP = 0.0000.

Could you please help me out in finding the correct scale values. @ijkguo

@ijkguo
Copy link
Owner

ijkguo commented Jul 5, 2018

How about running demo on training data and visualize the results?

@Ram-Godavarthi
Copy link
Author

@ijkguo Demo on training data of 31*512??
I have not done.
But in general Demo is working ..

@ijkguo
Copy link
Owner

ijkguo commented Jul 9, 2018

I meant to visualize how the model performs on training data.

@Ram-Godavarthi
Copy link
Author

I am not getting the proper model..
It is not detecting 2nd object..
Even if both objects present in a single image.
Both are detecting as Same object...
If 1pedestrian and 1 bicycle is present, it is displaying 2 boxes for 2 objects and but same class...
I think there is something wrong in the repo..
But I could not able to find what it is..

Is it working properly for you??

@ijkguo
Copy link
Owner

ijkguo commented Jul 9, 2018

If you evaluate the released pretrained model, you would find that is is working.

@Ram-Godavarthi
Copy link
Author

I have used the pretrained mode resnet50 , resnet101, vgg16 . But no use..
i am not able to detect 2 objects..
My dataset is perfect..
But still the Output is not coming.

Also when using test.py.
At the end i am getting like
Ap for background = .6758
Ap for pedestrian = .7297
Mean AP = .7069

Is something wrong???
It should not supposed to print background right??

Can you check it n let me know??
Can u just try some own data for some images and train the model and test it..
then you will get an idea what is wrong in the code..
You might get an idea what it is...

@ijkguo
Copy link
Owner

ijkguo commented Aug 1, 2018

Moved to #105

@ijkguo ijkguo closed this as completed Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants