Guillem96 / efficientdet-tf

Custom implementation of EfficientDet https://arxiv.org/abs/1911.09070
GNU General Public License v3.0
96 stars 23 forks source link

Error while training with data in pascal voc format #6

Closed tekotan closed 4 years ago

tekotan commented 4 years ago

Hi,

I have setup the files as outlined in the beginning of the README.

I tried running training on my own custom data in pascalVOC format. After looking through the code, I noticed the area where the classes are defined for the voc data format and have updated those class maps along with the num-classses flag when training.

Here is my training command:

python3.7 -m efficientdet.train --efficientdet 0 --no-freeze-backbone --train-dataset /home/tanish/pascal_full/ --format VOC --n-classes 5 --epochs 200 --batch-size 4 --learning-rate 3e-4 --save-dir ./models/parking/ --val-dataset /home/tanish/pascal_full

I have organized my custom data in the standard pascalVOC format following the example given in the repo.

However, when running the training procedure, I am getting the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)  File "/home/tanish/efficientdet-tf/efficientdet/train.py", line 179, in <module>
    main()
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)  File "/home/tanish/efficientdet-tf/efficientdet/train.py", line 175, in main
    train(**kwargs)
  File "/home/tanish/efficientdet-tf/efficientdet/train.py", line 110, in train
    epoch=epoch)
  File "/home/tanish/efficientdet-tf/efficientdet/engine.py", line 62, in train_single_epoch
    labels=target_clf)  File "/home/tanish/efficientdet-tf/efficientdet/engine.py", line 26, in _train_step    l2_loss = 0.01 * tf.reduce_sum(tf.pow(model.weights, 2))  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/util/dispatch.py", line 180, in wrapper    return target(*args, **kwargs)  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/math_ops.py", line 459, in pow    return gen_math_ops._pow(x, y, name=name)  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_math_ops.py", line 7170, in _pow
    x, y, name=name, ctx=_ctx)  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_math_ops.py", line 7202, in _pow_eager_fallback
    _attr_T, _inputs_T = _execute.args_to_matching_eager([x, y], _ctx)
  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/eager/execute.py", line 257, in args_to_matching_eager
    t, dtype, preferred_dtype=default_dtype, ctx=ctx))
  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1296, in internal_convert_to_tensor    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py", line 1278, in _autopacking_conversion_function    return _autopacking_helper(v, dtype, name or "packed")
  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/array_ops.py", line 1184, in _autopacking_helper    return gen_array_ops.pack(list_or_tuple, name=name)
  File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_array_ops.py", line 6293, in pack
    _six.raise_from(_core._status_to_exception(e.code, message), None)  File "<string>", line 3, in raise_fromtensorflow.python.framework.errors_impl.InvalidArgumentError: Shapes of all inputs must match: values[0].shape = [3,3,3,32] != values[1].shape = [32] [Op:Pack] name: packed

Can you please help? I am really excited that someone has taken the time to implement such an influential paper in Tensorflow 2.0, as all the other implementations of EfficientDet is either in Tensorflow 1.x or Pytorch, along with most of the current papers being released.

Thanks for your help, -tekotan

Guillem96 commented 4 years ago

Try it now, should be fixed.

Also I want to thank you for your interest 😃