Code Monkey home page Code Monkey logo

Comments (8)

tungchey avatar tungchey commented on August 31, 2024

本人萌新,同样遇到了'tuple' object has no attribute 'cpu'问题,想请教下怎么解决的

from dan.

rlleshi avatar rlleshi commented on August 31, 2024

Write a wrapper around the model such that only the prediction of the model is returned:

class ModelInferenceGradCam(torch.nn.Module):
  def __init__(self, model):
    super().__init__()
    self.model = model

  def forward(self, x):
    return self.model(x)[0]

Use this wrapper for GradCam instead of the raw model.

from dan.

woshishauibi avatar woshishauibi commented on August 31, 2024

本人萌新,同样遇到了'tuple' object has no attribute 'cpu'问题,想请教下怎么解决的

请问您解决了吗,我也有这个问题

from dan.

tungchey avatar tungchey commented on August 31, 2024

from dan.

woshishauibi avatar woshishauibi commented on August 31, 2024

嗯,使用DAN可视化的时候把网络的输出改为单输出即可

------------------ 原始邮件 ------------------ 发件人: "yaoing/DAN" @.>; 发送时间: 2023年5月28日(星期天) 中午1:07 @.>; @.@.>; 主题: Re: [yaoing/DAN] Question in demo.py and run_grad_cam.py (Issue #27) 本人萌新,同样遇到了'tuple' object has no attribute 'cpu'问题,想请教下怎么解决的 请问您解决了吗,我也有这个问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

您好,我是萌新不好意思打扰了,
51abe04d0911923817049e7ff2cab85
单输出是指只保留out,x和heads中的一个吧,保留哪个呢,谢谢

from dan.

woshishauibi avatar woshishauibi commented on August 31, 2024

嗯,使用DAN可视化的时候把网络的输出改为单输出即可

------------------ 原始邮件 ------------------ 发件人: "yaoing/DAN" @.>; 发送时间: 2023年5月28日(星期天) 中午1:07 @.>; @.@.>; 主题: Re: [yaoing/DAN] Question in demo.py and run_grad_cam.py (Issue #27) 本人萌新,同样遇到了'tuple' object has no attribute 'cpu'问题,想请教下怎么解决的 请问您解决了吗,我也有这个问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>
可以提供一下您修改好的版本吗,我的邮箱是:[email protected]
十分感谢您!

from dan.

tungchey avatar tungchey commented on August 31, 2024

from dan.

woshishauibi avatar woshishauibi commented on August 31, 2024

印象中是保留out。因为grad-cam原理是要通过单个输出获得反向传播的梯度值,希望可以帮到你。

------------------ 原始邮件 ------------------ 发件人: "yaoing/DAN" @.>; 发送时间: 2023年5月28日(星期天) 下午2:59 @.>; @.@.>; 主题: Re: [yaoing/DAN] Question in demo.py and run_grad_cam.py (Issue #27) 嗯,使用DAN可视化的时候把网络的输出改为单输出即可 … ------------------ 原始邮件 ------------------ 发件人: "yaoing/DAN" @.>; 发送时间: 2023年5月28日(星期天) 中午1:07 @.>; @.@.>; 主题: Re: [yaoing/DAN] Question in demo.py and run_grad_cam.py (Issue #27) 本人萌新,同样遇到了'tuple' object has no attribute 'cpu'问题,想请教下怎么解决的 请问您解决了吗,我也有这个问题 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> 您好,我是萌新不好意思打扰了, 单输出是指只保留out,x和heads中的一个吧,保留哪个呢,谢谢 — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.>

好的,感谢你!

from dan.

Related Issues (20)

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.