Using tensorflow. If I have trained my image classifier many images of a close up of melanomas and other skin cancers.

Then ask it to classify using the trained model a photo that has another element for example melanoma on a hand (with other elements that look like melanoma in the background example a hypothetical tablecloth that has melanoma patterns).

Is there a way to visualize what the image classifier has identified as melanoma ? Outputting a circled/highlighted the found melanomas in the photo?

  • I am not so sure but you need to look at CAM's probably – Aditya Aug 13 at 12:26

What you are looking for is a model with an "Attention mechanism". Unfortunately, this means that you have to change your model and to retrain it. It is more complicated that a simple image classifier but I can assure you that it is worth it to learn how it works. Or you can simply find an existing repository that implement it.

Alternatively, you can train your model on smaller images that contain exactly the melanoma. The preprocessing will be much heavier. Then you will scan your bigger images with a bounding box. You will have probabilities for each small images.

  • What do you mean by "Then you will scan your bigger images with a bounding box"? – Azeworai Aug 15 at 12:03
  • You scan small parts of the new image (the parts inside a moving bounding box) the subimage with the highest probability is the one where the bounding box is on the melanoma. – bukwyrm Sep 12 at 15:33

Actually you don't need to retrain the model, you could use deconvolution networks (see this video of Matthew Zeiler explaining this paper: Visualizing and Understanding Deep Neural Networks) or get inspiration with this paper: Methods for Interpreting and Understanding Deep Neural Networks.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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