2
$\begingroup$

I have the following binary classification problem, my labeled dataset contains images 96x96 px. Now in every image the interest area is of size 32x32 px in the center of the image, and the images are labeled based on that 32x32 px area. If whatever i am trying to detect is in the outer region of the 32x32 px area the label of that image is not affected.

The problem here is that if i use the whole image when traing, my model will not learn that the interest area is only in the center of the image but on the other hand if i crop the images to be of size 32x32 i am loosing a lot of information which can help the model to train on. I found out that i am getting the best results if i crop the images to be of size 64x64 (kind of a trade of).

Now going to the test set, for the test set it doesn't make sense to use this trade of because the model is not learning anything anyways so i would rather crop the test images to 32x32 but then the test set and train set sizes are not the same.

Has anyone came across this problem before? Can i just pad the test images to the size of the train images? is this a good way to go?

$\endgroup$
3
$\begingroup$

"The problem here is that if i use the whole image when training, my model will not learn that the interest area is only in the center of the image" Yes, it will, if you have enough samples and they are all classified based on this area only.

"but on the other hand if i crop the images to be of size 32x32 i am loosing a lot of information which can help the model to train on" . I don't understand what information you are loosing if you only care about the center 32x32 area.

In the end, you need to ask yourself how will the test input look like and work based on that. If you only care about an area of 32x32 which is always is (and will be) at the center of all images, ignore everything and train and evaluate based just on that area (why add extra unnecessary calculations to the model?). If the size and location of the area might change, don't crop the image.

Bottom line, the test set and the train set need to be of the nature (shape) for the model to work properly.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.