simpledet icon indicating copy to clipboard operation
simpledet copied to clipboard

batch image detection test

Open zerojuzi opened this issue 5 years ago • 1 comments

    loader = Loader(roidb=roidb,
                    transform=transform,
                    data_name=data_name,
                    label_name=label_name,
                    batch_size=2,
                    shuffle=False,
                    num_worker=4,
                    num_collector=2,
                    worker_queue_depth=2,
                    collector_queue_depth=2,
                    kv=None)

I set batch_size 2 in detection_test.py of loader, config is retina_r50v1_fpn_1x, model can give true batch detection result (r) . but config is tridentnet_r50v1c4_c5_1x , get following error.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/imdl/Desktop/pycharm-2019.1.1/helpers/pydev/pydevd.py", line 1741, in main() File "/home/imdl/Desktop/pycharm-2019.1.1/helpers/pydev/pydevd.py", line 1735, in main globals = debugger.run(setup['file'], None, None, is_module) File "/home/imdl/Desktop/pycharm-2019.1.1/helpers/pydev/pydevd.py", line 1135, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/imdl/Desktop/pycharm-2019.1.1/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/imdl/workspace/simpledet/detection_test_batch.py", line 120, in mod.bind(data_shapes=loader.provide_data, for_training=False) File "/home/imdl/workspace/simpledet/core/detection_module.py", line 446, in bind state_names=self._state_names) File "/usr/local/lib/python3.6/dist-packages/mxnet-1.5.0-py3.6.egg/mxnet/module/executor_group.py", line 280, in init self.bind_exec(data_shapes, label_shapes, shared_group) File "/usr/local/lib/python3.6/dist-packages/mxnet-1.5.0-py3.6.egg/mxnet/module/executor_group.py", line 376, in bind_exec shared_group)) File "/usr/local/lib/python3.6/dist-packages/mxnet-1.5.0-py3.6.egg/mxnet/module/executor_group.py", line 670, in _bind_ith_exec shared_buffer=shared_data_arrays, **input_shapes) File "/usr/local/lib/python3.6/dist-packages/mxnet-1.5.0-py3.6.egg/mxnet/symbol/symbol.py", line 1629, in simple_bind raise RuntimeError(error_msg) RuntimeError: simple_bind error. Arguments: data: (2, 3, 800, 800) im_info: (2, 3) im_id: (2,) rec_id: (2,) Error in operator decode_bbox: broadcast_mul0: [18:34:56] src/operator/tensor/./elemwise_binary_broadcast_op.h:68: Check failed: l == 1 || r == 1: operands could not be broadcast together with shapes [3,600,1] [6,300,1]

zerojuzi avatar Aug 29 '19 10:08 zerojuzi

Because during training tridentnet creates two separate data providers for landscape and portrait images. During testing everything is taken from one iterator, since batch size = 1 it doesn't matter. You can't combine images with different dimensions inside one batch.

ps. batching images during inference usually doesn't improve performance.

apatsekin avatar Sep 10 '19 18:09 apatsekin