keras-io icon indicating copy to clipboard operation
keras-io copied to clipboard

INVALID_ARGUMENT: required broadcastable shapes in Classification Loss

Open nikeshdevkota opened this issue 2 years ago • 0 comments

Hi, I am trying to run RetinaNet on a custom dataset. To generate the dataset, I am using tf.data.Dataset.from_generator().

During model training, I run into INVALID_ARGUMENT: required broadcastable shapes while calculating classification loss and I can't seem to find any solution on the internet. I would appreciate it if I could get directions on how to solve this problem. I have uploaded the full error shown during model training below. Custom Generator

I had made some changes in the code and the deviations from the original code are as follows:

  1. For the custom generator, data_list is a list containing multiple dictionaries in the format [{"image":image,"image/filename":filenames, "objects": {"bbox":bbox,"label":labels}}] is passed to the tf.data.Dataset.from_generator() function.
  2. The custom dataset has only 3 classes in total.
  3. I have changed the area, aspect_ratio, and scale to fit my dataset.
  4. I haven't used horizontal flip as I don't want to flip the image.
  5. I want to have my shorter side of the image to be 256 pixels, so I have changed the min_side to 256 in the "resize_and_pad_image" function. However, I don't understand the function of stride, so I would appreciate it if I could get some explanation of it.
  6. I checked the maximum IOU returned for a limited sample of the dataset. Based on the limited data, on average, I was getting a maximum IOU of greater than 0.5 on 90% of the data.

Resize and Pad Full_Error Full_Error_1 Full_Error_2 Full_Error_3 @srihari-humbarwadi

nikeshdevkota avatar Nov 04 '22 10:11 nikeshdevkota