Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Mean subtraction after cropping #25

Closed
mgarbade opened this issue Feb 9, 2017 · 2 comments
Closed

Mean subtraction after cropping #25

mgarbade opened this issue Feb 9, 2017 · 2 comments
Labels

Comments

@mgarbade
Copy link

mgarbade commented Feb 9, 2017

There is a bug in the image transformation. The mean subtraction must happen before the zero padding performed by tf.image.resize_image_with_crop_or_pad.

I'm trying to squeeze the functions
img = tf.random_crop(img, [h, w, 3])
label = tf.random_crop(label, [h, w, 1])
in there as well to get a random instead of a center crop, but I'm not sure if they take the same crop from image and label if I do it like this... So I keep looking into that.

@arslan-chaudhry
Copy link
Contributor

Yes, this looks like a bug.
As for random crop, you can change the code to check if image dimensions are greater than '321', then do a random crop using tf.random_crop , else pad the inputs accordingly. I am also doing the same thing, as always doing a centre-crop effectively reduces the amount of training data.

@DrSleep DrSleep added the bug label Feb 11, 2017
@DrSleep
Copy link
Owner

DrSleep commented Feb 11, 2017

@mgarbade, nice catch! Fixed!

The tf.random_crop functions has a seed argument that you can provide to both instantiations to guarantee that the crop is the same for the image and the mask.

@DrSleep DrSleep closed this as completed Feb 11, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants