Distortion in training data due to incorrect resizing of non-square images
Currently, training images in the dataset are resized with swapped width and height parameters in the cv2.resize function in dataset.py. This results in distortion of patches for non-square images, such as those from the PASCAL VOC 2012 dataset, where the majority of images are not square.
The problematic resizing affects only the training data and not the testing data, leading to a discrepancy in the data distribution. This mismatch could diminish the model's performance as it is trained on distorted images but evaluated on undistorted ones.
Steps to Reproduce:
- Use non-square images as input for training (e.g., images from PASCAL VOC 2012).
- Run the
prepare_datafunction. - Observe the saved patches in the resulting h5-file and notice distortion in non-square images.
Expected Behavior:
Non-square images should be resized proportionally to maintain their aspect ratio when patches are created, avoiding distortion in training patches.
Proposed Solution:
Modify the cv2.resize function to correctly handle the width and height parameters, ensuring that the resized images maintain their original aspect ratio.