Comments (4)
@Iron4dam 感谢您的反馈;在main.py中增加了如下代码;测试resnet34没有错误;不清楚您是怎么改动channel数的, 可否详细描述下,谢谢!
elif net_name in ['resnet34']:
net = models.resnet34(pretrained=pretrain)
from grad-cam.pytorch.
@yizt 感谢回复!我的model是:
model = models.resnet34(pretrained=True)
kernel = model.conv1.weight
new_conv = nn.Conv2d(4, 64, kernel_size=7, stride=2, padding=3, bias=False)
with torch.no_grad():
new_conv.weight[:,:] = torch.stack([torch.mean(kernel, 1)]*4, dim=1)
model.conv1 = new_conv
model.fc = torch.nn.Linear(512, 2)
input也是四个channel(类似RGBY),dimension是(1,4,2048,2048)
from grad-cam.pytorch.
@Iron4dam 您,我测试报了如下错:
Traceback (most recent call last):
File "main.py", line 211, in <module>
main(arguments)
File "main.py", line 172, in main
mask = grad_cam(inputs, args.class_id) # cam mask
File "E:\pyspace\Grad-CAM.pytorch\interpretability\grad_cam.py", line 60, in __call__
output = self.net(inputs) # [1,num_classes]
File "F:\Anaconda3-5.0.1\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "F:\Anaconda3-5.0.1\envs\pytorch\lib\site-packages\torchvision\models\resnet.py", line 196, in forward
x = self.conv1(x)
File "F:\Anaconda3-5.0.1\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 547, in __call__
result = self.forward(*input, **kwargs)
File "F:\Anaconda3-5.0.1\envs\pytorch\lib\site-packages\torch\nn\modules\conv.py", line 343, in forward
return self.conv2d_forward(input, self.weight)
File "F:\Anaconda3-5.0.1\envs\pytorch\lib\site-packages\torch\nn\modules\conv.py", line 340, in conv2d_forward
self.padding, self.dilation, self.groups)
RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight'
from grad-cam.pytorch.
@yizt 这个我好像没有遇到,不过我加了一个inputs.requires_grad=True
就解决了之前的问题,谢谢!
from grad-cam.pytorch.
Related Issues (20)
- centernet如何生成gradcam图?
- Hi, Could you give some hints for transfer your great works into YOLOv3?
- 移植您的方法到YOLOv3遇到点问题,请您指点一二 HOT 2
- 在自定义的数据集上提取到的热图不稳定,应该怎样finetune
- Grad-CAM for Faster-RCNN with config file faster_rcnn_X_101_32x8d_FPN_3x.yaml HOT 4
- 强化学习使用GradCAM HOT 3
- Fasterrcnn+fpn 可以用吗 HOT 1
- 如何将faster_rcnn的Grad-CAM映射到整张图像? HOT 7
- 你好,请问为什么基于frcnn的cam值这么低 HOT 1
- 全图cam HOT 1
- 请问怎么在yolov2中实现呢?
- 不是官方的预训练模型该怎么办呢
- 批量处理图像时的问题 HOT 5
- gradient = self.gradient[proposal_idx].cpu().data.numpy() HOT 2
- 你好yolo中该如何使用
- 你好 请问如何在分类项目里面用您的cam
- 关于gradcam在异常检测场景的应用问题
- Question about "gradient" HOT 1
- cam如何对孪生网络的语义分割网络使用呢?
- 如何分别可视化目标检中分类任务和定位任务的cam
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grad-cam.pytorch.