Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Example of Faster R-CNN failed to change batch size #589

Closed
atinfinity opened this issue Apr 29, 2018 · 1 comment
Closed

Example of Faster R-CNN failed to change batch size #589

atinfinity opened this issue Apr 29, 2018 · 1 comment

Comments

@atinfinity
Copy link

System information (version)

  • Chainer : 4.0.0
  • CuPy : 4.0.0
  • ChainerCV : 0.9.0
  • CUDA : 9.1.85
  • cuDNN : 7.1.3
  • Operating System : Ubuntu 16.04 64bit
  • Python : Python 3.5.2

Detailed description

I tried to change batch size of examples/faster_rcnn/train.py.
But, the following error message was displayed.

Exception in main training loop: all the input array dimensions except for the concatenation axis must match exactly
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/chainer/training/trainer.py", line 306, in run
    update()
  File "/usr/local/lib/python3.5/dist-packages/chainer/training/updaters/standard_updater.py", line 149, in update
    self.update_core()
  File "/usr/local/lib/python3.5/dist-packages/chainer/training/updaters/standard_updater.py", line 154, in update_core
    in_arrays = self.converter(batch, self.device)
  File "/usr/local/lib/python3.5/dist-packages/chainer/dataset/convert.py", line 133, in concat_examples
    [example[i] for example in batch], padding[i])))
  File "/usr/local/lib/python3.5/dist-packages/chainer/dataset/convert.py", line 163, in _concat_arrays
    return xp.concatenate([array[None] for array in arrays])
Will finalize trainer extensions and updater before reraising the exception.
Traceback (most recent call last):
  File "train.py", line 137, in <module>
    main()
  File "train.py", line 133, in main
    trainer.run()
  File "/usr/local/lib/python3.5/dist-packages/chainer/training/trainer.py", line 320, in run
    six.reraise(*sys.exc_info())
  File "/usr/local/lib/python3.5/dist-packages/six.py", line 693, in reraise
    raise value
  File "/usr/local/lib/python3.5/dist-packages/chainer/training/trainer.py", line 306, in run
    update()
  File "/usr/local/lib/python3.5/dist-packages/chainer/training/updaters/standard_updater.py", line 149, in update
    self.update_core()
  File "/usr/local/lib/python3.5/dist-packages/chainer/training/updaters/standard_updater.py", line 154, in update_core
    in_arrays = self.converter(batch, self.device)
  File "/usr/local/lib/python3.5/dist-packages/chainer/dataset/convert.py", line 133, in concat_examples
    [example[i] for example in batch], padding[i])))
  File "/usr/local/lib/python3.5/dist-packages/chainer/dataset/convert.py", line 163, in _concat_arrays
    return xp.concatenate([array[None] for array in arrays])
ValueError: all the input array dimensions except for the concatenation axis must match exactly

Is this a limitation of ChainerCV(or Chainer)?

Steps to reproduce

I changed batch size of examples/faster_rcnn/train.py.

train_iter = chainer.iterators.MultiprocessIterator(
-    train_data, batch_size=1, n_processes=None, shared_mem=100000000)
+    train_data, batch_size=2, n_processes=None, shared_mem=100000000)
test_iter = chainer.iterators.SerialIterator(
-    test_data, batch_size=1, repeat=False, shuffle=False)
+    test_data, batch_size=2, repeat=False, shuffle=False)    

And, I executed train.py.

$ python3 train.py
@Hakuyume
Copy link
Member

Hakuyume commented Apr 29, 2018

Currently, our implementation of Faster R-CNN supports only batchsize=1. Please see here.

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

No branches or pull requests

2 participants