What happens to image labels when I resize the image? Are labels also resized?

28 views (last 30 days)
Hi,
I have labelled images (mostly above 640x480) using MATLAB's Image Labeler App. Now for trying different deep learning architectures, I have to resize the images to a smaller dimesion (e.g., for alexnet, defult input image size is 227-by-227). My question is what happens to the labels when I resize (make small) the oringinal images? Are they also resized?
Thanks.

Answers (2)

Image Analyst
Image Analyst on 5 Aug 2021
Resizing a labeled image will not change the labels if you use the 'nearest' option
resizedImage = imresize(labeledImage, [227, 227], 'nearest');

Matt J
Matt J on 1 Aug 2021
Edited: Matt J on 1 Aug 2021
If you are doing object classification, the labels are not images (they might be numeric scalars or string labels) so it is not clear what you mean by "resize" them. The answer is probably no, they are not resized and you shouldn't need to.
For semantic segmentation, the per-pixel labels do form an image so you would need to resize them, but alexnet is not the architecture you would use.
  3 Comments
Matt J
Matt J on 3 Aug 2021
Edited: Matt J on 3 Aug 2021
How is it that you have ROI labels if the entire image is intended to receive only a single classification label?
If you are classifying on a pixel-by-pixel basis (i.e., if this is semantic segmentation), then how were you able to adapt alexnet? Alexnet does not do pixel-by-pixel classification. It outputs a single classification label for the entire image. If you have a picture of a cat, then alexnet will output "cat" when working correctly. It is not intended to process ROIs or sub-regions of the image.
Muhammad Tufail
Muhammad Tufail on 4 Aug 2021
Edited: Muhammad Tufail on 4 Aug 2021
I am doing object detection, not classification. There are certain objects in the image which need to be detected. It is not semantic segmentation also. I just need a bounding box to be put around the object. I am not using alexnet.
I have found answer to my question. Initially I labeled the images and then resized them. By doing this I got worried about the labels (coordinates of the top left pixel, width, and height) as I thought resizing might disturb them. The best approach is to first resize all the iamges, and then label.
Thanks for your response, anyways.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!