keras-io
keras-io copied to clipboard
INVALID_ARGUMENT: required broadcastable shapes in Classification Loss
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.
I had made some changes in the code and the deviations from the original code are as follows:
- 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.
- The custom dataset has only 3 classes in total.
- I have changed the area, aspect_ratio, and scale to fit my dataset.
- I haven't used horizontal flip as I don't want to flip the image.
- 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.
- 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.
@srihari-humbarwadi