ManishSoni1908 / Mobilenet-ssd-keras

A Keras port of Single Shot MultiBox Detector as Mobilenet as a Backbone
62 stars 24 forks source link

ValueError when building #19

Open davideCremona opened 4 years ago

davideCremona commented 4 years ago

Hi, I'm experimenting with your repository but the training stops with error, raising this exception:

File "/home/davidecremona/PycharmProjects/Mobilenet-ssd-keras/training/drb_train_mobilenet_ssd.py", line 262, in <module>
    train(args)
  File "/home/davidecremona/PycharmProjects/Mobilenet-ssd-keras/training/drb_train_mobilenet_ssd.py", line 242, in train
    callbacks=callbacks
  File "/usr/local/lib/python3.6/dist-packages/keras/legacy/interfaces.py", line 91, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 1418, in fit_generator
    initial_epoch=initial_epoch)
  File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_generator.py", line 181, in fit_generator
    generator_output = next(output_generator)
  File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 709, in get
    six.reraise(*sys.exc_info())
  File "/home/davidecremona/.local/lib/python3.6/site-packages/six.py", line 703, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 685, in get
    inputs = self.queue.get(block=True).get()
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 670, in get
    raise self._value
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "/usr/local/lib/python3.6/dist-packages/keras/utils/data_utils.py", line 626, in next_sample
    return six.next(_SHARED_SEQUENCES[uid])
  File "/home/davidecremona/PycharmProjects/Mobilenet-ssd-keras/misc/ssd_batch_generator.py", line 1325, in generate
    batch_y_true = ssd_box_encoder.encode_y(batch_y, diagnostics=False) # Encode the labels into the `y_true` tensor that the SSD loss function needs.
  File "/home/davidecremona/PycharmProjects/Mobilenet-ssd-keras/misc/ssd_box_encode_decode_utils.py", line 929, in encode_y
    y_encode_template = self.generate_encode_template(batch_size=len(ground_truth_labels), diagnostics=False)
  File "/home/davidecremona/PycharmProjects/Mobilenet-ssd-keras/misc/ssd_box_encode_decode_utils.py", line 874, in generate_encode_template
    boxes_tensor = np.concatenate(boxes_batch, axis=1)
  File "<__array_function__ internals>", line 6, in concatenate

ValueError: all the input array dimensions for the concatenation axis must match exactly, but along dimension 2, the array at index 0 has size 19 and the array at index 1 has size 10

Process finished with exit code 1

Can you please give me some hint in what I'm doing wrong?

Thanks, Davide.

davideCremona commented 4 years ago

After printing that "boxes_batch" when the exception occurs, I see this:

[array([], shape=(0, 19, 19, 4, 4), dtype=float64), array([], shape=(0, 10, 10, 6, 4), dtype=float64), array([], shape=(0, 5, 5, 6, 4), dtype=float64), array([], shape=(0, 3, 3, 6, 4), dtype=float64), array([], shape=(0, 2, 2, 4, 4), dtype=float64), array([], shape=(0, 1, 1, 4, 4), dtype=float64)]

Is it correct?