Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in the code leading to bad performances #7

Open
MathiasGilson opened this issue May 29, 2018 · 0 comments
Open

Error in the code leading to bad performances #7

MathiasGilson opened this issue May 29, 2018 · 0 comments

Comments

@MathiasGilson
Copy link

Hi,
I found that you resize images with opencv for the validation (see val_generator arguments)

Keras-ICNet/utils.py

Lines 61 to 63 in 987a6aa

if self.resize_shape:
image = cv2.resize(image, self.resize_shape)
label = cv2.resize(label, self.resize_shape)

cv2.resize deforms the images and thus leads to bad learning

Instead I used the random crop function to always crop the image instead of deforming it
it's not and ideal fix but it leads to way better performances

change this line

val_generator = MapillaryGenerator(mode='validation', batch_size=opt.batch_size, crop_shape=None, resize_shape=(opt.image_width, opt.image_height))

to

val_generator = MapillaryGenerator(mode='validation', batch_size=opt.batch_size, crop_shape=(opt.image_width, opt.image_height))

and put this lines

Keras-ICNet/utils.py

Lines 91 to 92 in 987a6aa

if self.crop_shape:
image, label = _random_crop(image, label, self.crop_shape)

out of the if self.mode == 'training': condition
Now in each validation iteration the image will not be resized but randomly cropped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant