I have medical images and need to extract features from the layer before the classification layer using VGG for example but the resolution of the images is not efficient... Are the features without improving this resolution will not be affected or do I need to improve the resolution before extracting the features?

enter image description here

I was doing processing in color images for extracting the features using VGG by this processing

preprocess = T.Compose([
    T.Resize(256, interpolation=3),
    T.Normalize((0.485, 0.456, 0.406), (0.229, 0.224, 0.225)),
image= load_img("aa.jpg", target_size=(224, 224,3))

what if the images I have are grayscale or blur will this processing be suitable for them or do I need to change?

  • $\begingroup$ Question: what do you mean by "resolution of the images is not efficient"? Don't quite get it. $\endgroup$
    – lpounng
    May 23, 2022 at 9:37
  • $\begingroup$ i attached one of them $\endgroup$
    – samo
    May 23, 2022 at 9:39
  • $\begingroup$ What I mean is 1) what is not "efficient"? and 2) what does is it have to do with VGG? $\endgroup$
    – lpounng
    May 23, 2022 at 9:44
  • $\begingroup$ i mean not clear enough by not efficient. that is my question in real .. is there a relation between the resolution of the images if i need to extract it using vgg model or not $\endgroup$
    – samo
    May 23, 2022 at 9:46
  • $\begingroup$ I see. I don't think we usually use the word "efficient" to describe a blur image, but anyway let's go back to your question. $\endgroup$
    – lpounng
    May 23, 2022 at 9:50

1 Answer 1


IIUC, the question is "would blur images affect the features extracted from VGG?"

Yes and no, depends on your application (i.e. "what do I want to use these features for?"). In general we don't know till we try. Rule of thumb is that if a human doctor can do it, there is at least a chance to work.

But technically, there shouldn't be anything stopping you from training/fine-tuning an VGG architecture and extract the features from it. Note that you will need to adapt to the input size (e.g. 224x224x3 for VGG16) either by transforming your images or replacing the input layer of model.

Edit (to OP's additional comment)

Looks fine to me (though I admit not knowing what the interpolation does). It is a common practice to populate the 3 color channels with grayscale. There may be more advance techniques but I cannot recall (quite a while since I last work on medical image).

  • $\begingroup$ excuse me can you see the edit post , please $\endgroup$
    – samo
    May 23, 2022 at 10:02
  • $\begingroup$ thanks a lot so excuse me if the images ate grayscale in the basic not RGB so is there any change that i can do it with this snippet code $\endgroup$
    – samo
    May 23, 2022 at 10:48
  • $\begingroup$ Simplest way is to copy the same grayscale for all 3 channels. $\endgroup$
    – lpounng
    May 23, 2022 at 16:33
  • $\begingroup$ For more advance methods, you can do some literature review. $\endgroup$
    – lpounng
    May 23, 2022 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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