You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As trying to train my model I have found the following issue in the DataGenerator.py file.
In read_image_and_gt(), the original width and height are stored after the image was resized thus resulting in the fact that the scaling coefficients for X and Y will always be 1. If you were to train on images with different sizes this could be a major problem, because the bounding boxes won't be scaled accordingly.
def read_image_and_gt(img_files, gt_files, config):
.............
for img_name, gt_name in zip(img_files, gt_files):
#open img
img = cv2.imread(img_name).astype(np.float32, copy=False)
# scale image
img = cv2.resize( img, (config.IMAGE_WIDTH, config.IMAGE_HEIGHT))
#subtract means
img = (img - np.mean(img))/ np.std(img)
#store original height and width?
orig_h, orig_w, _ = [float(v) for v in img.shape]
.............................................................
# scale annotation
x_scale = config.IMAGE_WIDTH / orig_w
y_scale = config.IMAGE_HEIGHT / orig_h
# scale boxes
bboxes_per_file[:, 0::2] = bboxes_per_file[:, 0::2] * x_scale
bboxes_per_file[:, 1::2] = bboxes_per_file[:, 1::2] * y_scale
The text was updated successfully, but these errors were encountered:
Hi,
As trying to train my model I have found the following issue in the DataGenerator.py file.
In read_image_and_gt(), the original width and height are stored after the image was resized thus resulting in the fact that the scaling coefficients for X and Y will always be 1. If you were to train on images with different sizes this could be a major problem, because the bounding boxes won't be scaled accordingly.
The text was updated successfully, but these errors were encountered: