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

Invalid argument: ValueError: attempt to get argmax of an empty sequence #101

Open
18342960922 opened this issue Sep 6, 2019 · 12 comments

Comments

@18342960922
Copy link

W tensorflow/core/framework/op_kernel.cc:1306] Invalid argument: ValueError: attempt to get argmax of an empty sequence
Traceback (most recent call last):

File "/home/wangyiqing/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/script_ops.py", line 158, in call
ret = func(*args)

File "/home/wangyiqing/last-Faster-RCNN/lib/layer_utils/anchor_target_layer.py", line 52, in anchor_target_layer
argmax_overlaps = overlaps.argmax(axis=1)

ValueError: attempt to get argmax of an empty sequence

image invalid, skipping
Terminated

@morpheusthewhite morpheusthewhite changed the title Invalid argument: ValueError: attempt to get argmax of an empty sequence.how to solve it?thanks Invalid argument: ValueError: attempt to get argmax of an empty sequence Sep 6, 2019
@morpheusthewhite
Copy link
Collaborator

Make sure you placed all the needed files in the correct places, then start again the training

@18342960922
Copy link
Author

This problem occurred only 20,000 times.
speed: 0.689s / iter
iter: 22030 / 40000, total loss: 0.123911

rpn_loss_cls: 0.015359
rpn_loss_box: 0.023703
loss_cls: 0.041235
loss_box: 0.043614

speed: 0.689s / iter
2019-09-06 14:18:52.664032: W tensorflow/core/framework/op_kernel.cc:1306] Invalid argument: ValueError: attempt to get argmax of an empty sequence
Traceback (most recent call last):

File "/home/wangyiqing/anaconda3/lib/python3.5/site-packages/tensorflow/python/ops/script_ops.py", line 158, in call
ret = func(*args)

File "/home/wangyiqing/last-Faster-RCNN/lib/layer_utils/anchor_target_layer.py", line 52, in anchor_target_layer
argmax_overlaps = overlaps.argmax(axis=1)

ValueError: attempt to get argmax of an empty sequence

@morpheusthewhite
Copy link
Collaborator

It is likely caused by some invalid image; trying to solve it means changing a lot of code, but I have not the time to do it.

Since the choice of images is random and no one else found the same issue, restarting it will most likely skip that

@18342960922
Copy link
Author

18342960922 commented Sep 28, 2019 via email

@18342960922
Copy link
Author

18342960922 commented Sep 28, 2019 via email

@morpheusthewhite
Copy link
Collaborator

morpheusthewhite commented Sep 28, 2019

The training pictures are entered into the network in the order of the data set

No, they are shuffled in a random manner.

tf.app.flags.DEFINE_integer('im_per_batch' 1,"Images to use per minibatch")

That is the number of image in each minibatch, it does not represent an image itself

@18342960922
Copy link
Author

18342960922 commented Sep 28, 2019 via email

@morpheusthewhite
Copy link
Collaborator

You just need to change the_shuffle_roidb_inds() in lib/layer_utils/roi_data_layer.py

@18342960922
Copy link
Author

18342960922 commented Oct 7, 2019 via email

@morpheusthewhite
Copy link
Collaborator

I was referring in general to images which are not correctly processed in the algorithm, in your case images which have an empty sequence as overlaps

@18342960922
Copy link
Author

18342960922 commented Oct 14, 2019 via email

@morpheusthewhite
Copy link
Collaborator

Can I understand this? Invalid image means that there is no overlap between any anchors and the ground thruth.

Yes, I'm almost sure it is so.

In your code,i see a function which is def append_flipped_images(self).This function augment the data by rotating the picture 180 degrees. now I want to augment the data by ratating the picture 90 degrees.can i achieve it like the function def append_flipped_images(self)? but By rotating 90 degrees,The width and height of the picture have changed.

You need to adjust bbox (similar to what it's done when they're flipped by 180 degrees) etc. like in append_flipped_images and then you need to rotate the image when it is loaded (in utils/minibatch.py the called function is _get_image_blob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants