Giter VIP home page Giter VIP logo

a-journey-into-convolutional-neural-network-visualization-'s Introduction

Hello there

Hello there πŸ‘‹ I'm Francesco

LinkedIn Medium

About me πŸš€

  • πŸŽ“ I am a Deep Learning (mostly Computer Vision) Engineer @PwC V7 hugging face RoboFlow
  • ❀️ I am passionate about Software Engineering, Open-Source, Machine Learning/Deep Learning, Computer Vision and Robotics
  • πŸ“œ BSc Informatics and MSc Artificial Intelligence
  • πŸ“« How to reach me: [email protected]
  • 🏠 Zurich(πŸ‡¨πŸ‡­) Lugano(πŸ‡¨πŸ‡­)

Francesco's github stats

visitors

a-journey-into-convolutional-neural-network-visualization-'s People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

a-journey-into-convolutional-neural-network-visualization-'s Issues

How to visualize a binary classification model using GradCam

Hi @FrancescoSaverioZuppichini,
I have used the EfficientNet_B2 model from torchvision and modified the input and output layers for binary classification of grayscale images. Now, I want to visualize the areas of interest in the model using GradCam. However, it seems that your function does not provide implementation for binary classification (or I might be using it incorrectly). I encountered the following error. Can you please help me? Thanks in advance!

Package Version:
torch 2.1.0
torchvision 0.16.0

Modify Source Code:

  • GradCam.py
# predictions = self.module(input_var)
predictions = torch.nn.Sigmoid()(self.module(input_var))
  • utils.py
def tensor2cam(image, cam):
#  image_with_heatmap = image2cam(image.squeeze().permute(1,2,0).cpu().numpy(), cam.detach().cpu().numpy())
    image_with_heatmap = image2cam(image.unsqueeze(-1).cpu().numpy(), cam.detach().cpu().numpy())

Modify Model Layer:

from torchvision.models import efficientnet_b2
from torchvision.models import EfficientNet_B2_Weights
from torchvision.models._api import WeightsEnum
from torch.hub import load_state_dict_from_url
def get_state_dict(self, *args, **kwargs):
    kwargs.pop("check_hash")
    return load_state_dict_from_url(self.url, *args, **kwargs)
WeightsEnum.get_state_dict = get_state_dict

model = efficientnet_b2(weights=EfficientNet_B2_Weights.IMAGENET1K_V1)
model.features[0][0] = torch.nn.Conv2d(1, 32, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
model.classifier[1] = torch.nn.Linear(in_features=1408, out_features=1, bias=True)

Implementation:

import torch
from visualisation.core import GradCam
from visualisation.core.utils import device

input_batch = torch.rand((1,1,256,256))
vis = GradCam(model, device)

outs = vis(
    input_image=input_batch.cuda(), 
    layer=None, 
    guide=False,
    target_class=None,
    regression=False)

I'm getting cam that are all zeros.

Saliency Visualization with googlenet or inception_v3

Hello, thanks for the great repo!

My problem is, when I use the googlenet or inception_v3 in Saliency Visualization, the unguided version works, but the guided saliency map seems not work at all when I added β€˜guide=True ’ in the vis function, the results are just same with the unguided Saliency map. I checked the SaliencyMap.py but I have no idea about how to make the guide works for the above 2 networks.
image
saliency map for googlenet

image
guided saliency map for googlenet

What can I do to implement the guided saliency map with googlenet or inception_ v3 networks?

Thanks a lot.

AttributeError: 'NoneType' object has no attribute 'data'

hello thanks for wonderful project, i am facing an error while visualizing an image.

AttributeError: 'NoneType' object has no attribute 'data'

and that error indication line below in visualisation/core/SaliencyMap.py:

image = self.gradients.data.cpu().numpy()[0]

it is understandable because self.gradients initialized as None.

how can i fix it ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.