MATLAB Answers

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

4 views (last 30 days)
Muhammad Tufail
Muhammad Tufail on 1 Aug 2021
Answered: Image Analyst on 5 Aug 2021
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)

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
Muhammad Tufail
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.


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');

Community Treasure Hunt

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

Start Hunting!

Translated by