ValueError: A`Concatenate`layer requires inputs with matching shapes except for the concat axis.Got inputs shapes: [(4, 256, 46, 80),(4, 512, 45, 80)]

Hello
ValueError occurred when start learning tlt-yolo.

Size of the training image is 1280 x 720.
The below error occurred when setting output_image_width, crop_right, output_image_height, and crop_bottom to the default values (1280, 720) and then starting learning.
However, I started learning by setting output_image_width, crop_right, output_image_height, and crop_bottom to the default values (960, 544), there is no error.
What is the reason for the error?
I wanna start training with 1280 x 720 training image.

Here is a train command and a full text of error :

tlt-train yolo -e yolo_start_train.txt -r /workspace/tlt/train_result_unpruned -k KEY -m /workspace/tlt/pretrained_model/darknet_53.hdf5

Using TensorFlow backend.
--------------------------------------------------------------------------
[[12734,1],0]: A high-performance Open MPI point-to-point messaging module
was unable to find any relevant network interfaces:

Module: OpenFabrics (openib)
  Host: 1e257e6e231a

Another transport will be used instead, although this may result in
lower performance.

NOTE: You can disable this warning by setting the MCA parameter
btl_base_warn_component_unused to 0.
--------------------------------------------------------------------------
2020-07-06 07:44:33,725 [INFO] iva.yolo.scripts.train: Loading experiment spec at yolo_start_train.txt.
2020-07-06 07:44:33,726 [INFO] /usr/local/lib/python2.7/dist-packages/iva/yolo/utils/spec_loader.pyc: Merging specification from yolo_start_train.txt
target/truncation is not updated to match the crop areaif the dataset contains target/truncation.
target/truncation is not updated to match the crop areaif the dataset contains target/truncation.
target/truncation is not updated to match the crop areaif the dataset contains target/truncation.
target/truncation is not updated to match the crop areaif the dataset contains target/truncation.
Traceback (most recent call last):
  File "/usr/local/bin/tlt-train-g1", line 8, in <module>
    sys.exit(main())
  File "./common/magnet_train.py", line 43, in main
  File "./yolo/scripts/train.py", line 237, in main
  File "./yolo/scripts/train.py", line 101, in run_experiment
  File "./yolo/builders/model_builder.py", line 84, in build
  File "./yolo/architecture/yolo_arch.py", line 211, in YOLO
  File "./yolo/architecture/yolo_arch.py", line 91, in YOLO_FCN
  File "/usr/local/lib/python2.7/dist-packages/keras/engine/base_layer.py", line 431, in __call__
    self.build(unpack_singleton(input_shapes))
  File "/usr/local/lib/python2.7/dist-packages/keras/layers/merge.py", line 362, in build
    'Got inputs shapes: %s' % (input_shape))
ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(4, 256, 46, 80), (4, 512, 45, 80)]
1 Like

Please share your yolo_start_train.txt.

Please see the requirement in tlt user guide.

YOLOv3

  • Input size: C * W * H (where C = 1 or 3, W >= 128, H >= 128, W, H are multiples of 32)

Your 720 is not the multiples of 32.

thx!
I found mistake.
solve it

I found out 720 is a problem because it is not divided by 32. But the training image height is 720 and all labels are already attached. Now, What is the best way to do it for me?

  1. Resize the vertical image size of the already labeled image.
    ( 1280 x 720 to ( 1280 x 704 or 736 ) )
  2. Resize the input size without resizing the training image height.
    a. Reduce height Input size to 704 (32 * 22)
    b. Increase height Input size to 736 (32 * 23)

Actually it can run for (2).
But suggest you to resize your image as (1).

I encountered the same problem as you. I used opencv.resize to resize, but the loss was very large and not quite right. How did you resize?