dBeker / Faster-RCNN-TensorFlow-Python3

Tensorflow Faster R-CNN for Windows/Linux and Python 3 (3.5/3.6/3.7)
MIT License
612 stars 329 forks source link

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

Open 18342960922 opened 5 years ago

18342960922 commented 5 years ago

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 commented 5 years ago

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

18342960922 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

thank you what is an invalid picture ? you said the choice of images is random.In config.py tf.app.flags.DEFINE_integer('im_per_batch' 1,"Images to use per minibatch") .so Is this one image random in dataset?

Thank you again. I learned a lot.

------------------ 原始邮件 ------------------ 发件人: "morpheusthewhite"notifications@github.com; 发送时间: 2019年9月12日(星期四) 下午4:03 收件人: "dBeker/Faster-RCNN-TensorFlow-Python3"Faster-RCNN-TensorFlow-Python3@noreply.github.com; 抄送: "没时间当网红"2283934965@qq.com; "Author"author@noreply.github.com; 主题: Re: [dBeker/Faster-RCNN-TensorFlow-Python3] Invalid argument:ValueError: attempt to get argmax of an empty sequence (#101)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

18342960922 commented 5 years ago

thank you what is an invalid picture ? you said the choice of images is random.In config.py tf.app.flags.DEFINE_integer('im_per_batch' 1,"Images to use per minibatch") .so Is this one image random in dataset?

I want to do this. The training pictures are entered into the network in the order of the data set. What should I do? Thank you again. I learned a lot.

------------------ 原始邮件 ------------------ 发件人: "morpheusthewhite"notifications@github.com; 发送时间: 2019年9月12日(星期四) 下午4:03 收件人: "dBeker/Faster-RCNN-TensorFlow-Python3"Faster-RCNN-TensorFlow-Python3@noreply.github.com; 抄送: "没时间当网红"2283934965@qq.com; "Author"author@noreply.github.com; 主题: Re: [dBeker/Faster-RCNN-TensorFlow-Python3] Invalid argument:ValueError: attempt to get argmax of an empty sequence (#101)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

morpheusthewhite commented 5 years ago

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 commented 5 years ago

Can I change it? I want to scramble the pictures in the dataset.Then, training in a sequential manner.

------------------ 原始邮件 ------------------ 发件人: "morpheusthewhite"notifications@github.com; 发送时间: 2019年9月28日(星期六) 下午5:52 收件人: "dBeker/Faster-RCNN-TensorFlow-Python3"Faster-RCNN-TensorFlow-Python3@noreply.github.com; 抄送: "没时间当网红"2283934965@qq.com; "Author"author@noreply.github.com; 主题: Re: [dBeker/Faster-RCNN-TensorFlow-Python3] Invalid argument:ValueError: attempt to get argmax of an empty sequence (#101)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

morpheusthewhite commented 5 years ago

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

18342960922 commented 5 years ago

Trouble again I want to konw what is what is an invalid picture ? Thank you

------------------ 原始邮件 ------------------ 发件人: "morpheusthewhite"notifications@github.com; 发送时间: 2019年9月29日(星期天) 凌晨3:28 收件人: "dBeker/Faster-RCNN-TensorFlow-Python3"Faster-RCNN-TensorFlow-Python3@noreply.github.com; 抄送: "没时间当网红"2283934965@qq.com; "Author"author@noreply.github.com; 主题: Re: [dBeker/Faster-RCNN-TensorFlow-Python3] Invalid argument:ValueError: attempt to get argmax of an empty sequence (#101)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

morpheusthewhite commented 5 years ago

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 commented 5 years ago

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

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.

------------------ 原始邮件 ------------------ 发件人: "morpheusthewhite"notifications@github.com; 发送时间: 2019年10月7日(星期一) 晚上10:28 收件人: "dBeker/Faster-RCNN-TensorFlow-Python3"Faster-RCNN-TensorFlow-Python3@noreply.github.com; 抄送: "没时间当网红"2283934965@qq.com; "Author"author@noreply.github.com; 主题: Re: [dBeker/Faster-RCNN-TensorFlow-Python3] Invalid argument:ValueError: attempt to get argmax of an empty sequence (#101)

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

morpheusthewhite commented 5 years ago

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