Code Monkey home page Code Monkey logo

Comments (7)

n-akram avatar n-akram commented on August 20, 2024 3

We are also trying this as well.

We were able to solve the issue @praneet195 has by adding the following line after line 91 in misc_functions.py.

heatmap_on_image = Image.alpha_composite(heatmap_on_image, org_im.convert('RGBA'))

heatmap_on_image = heatmap_on_image.resize(heatmap.size)

This is at least a temporary fix.

from yolov3-gradcam.

pifalken avatar pifalken commented on August 20, 2024

I'll need to look into this further as something deeper is broken in the forward pass. For your specific error, you can replace:

int(mdef["from"])

with:

int(mdef["from"][0])

However, doing so will bring to light the other issues which I need to look into.

from yolov3-gradcam.

wangtianlong1994 avatar wangtianlong1994 commented on August 20, 2024

我需要进一步研究这一点,因为前向传递中有更深层的问题。对于您的特定错误,您可以替换:

intmdef [ “ from” ])

与:

intmdef [ “ from” ] [ 0 ])

但是,这样做会发现我需要研究的其他问题。

I'll need to look into this further as something deeper is broken in the forward pass. For your specific error, you can replace:

int(mdef["from"])

with:

int(mdef["from"][0])

However, doing so will bring to light the other issues which I need to look into.

YES,When I do what you say, I will still display the type error

x = x + layer_outputs[int(mdef["from"][0])] TypeError: unsupported operand type(s) for +: 'Tensor' and 'list'

Looking forward to your solution

from yolov3-gradcam.

praneet195 avatar praneet195 commented on August 20, 2024

Ok
So on going through the code, Line #95 in gradcam.py should just be layer_outputs.append(x)
This seems to work for me after taking into account the fix mentioned above.
Now i'm running into the following error in misc_functions.py on the line:
heatmap_on_image = Image.alpha_composite(heatmap_on_image, heatmap)
saying images donot match.
Trying to fix this but please let me know if you think the above fix is good enough?

from yolov3-gradcam.

wllkk avatar wllkk commented on August 20, 2024
image 1/1 data/samples/Jujube_4501.bmp: Model Summary: 222 layers, 6.1556e+07 parameters, 6.1556e+07 gradients
Traceback (most recent call last):
  File "/home/zxzn/YOLOv3-GradCAM/gradcam/gradcam.py", line 178, in <module>
    cam = grad_cam.generate_cam(prep_img, target_class)
  File "/home/zxzn/YOLOv3-GradCAM/gradcam/gradcam.py", line 127, in generate_cam
    conv_output, model_output = self.extractor.forward_pass(input_image)
  File "/home/zxzn/YOLOv3-GradCAM/gradcam/gradcam.py", line 106, in forward_pass
    conv_output, x = self.forward_pass_on_convolutions(x)
  File "/home/zxzn/YOLOv3-GradCAM/gradcam/gradcam.py", line 91, in forward_pass_on_convolutions
    x = x + layer_outputs[int(mdef["from"])]
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'

Process finished with exit code 1

这是为什么?我使用了由yolov3 of Ultralytics训练的模型和相应的CFG,但无法正常工作。此外,我还从utils文件夹ultralytics models.py的yolov3文件中删除了该文件

这是我的目录结构

(cam) zxzn@zxzn:~/YOLOv3-GradCAM/gradcam$ ls
cfg  data  detect.py  gradcam.py  misc_functions.py  models.py  __pycache__  test.py  train.py  utils  weights

谢谢您的帮助@pifalken

你好,我也遇到了这个问题,请问您解决了吗?

from yolov3-gradcam.

wllkk avatar wllkk commented on August 20, 2024

好的,
所以在遍历代码时,gradcam.py中的第95行应该只是layer_outputs.append(x)。
考虑到上述修复后,这似乎对我有用。
现在,我在网上的misc_functions.py中遇到以下错误:
heatmap_on_image = Image.alpha_composite(heatmap_on_image, heatmap)
说图像不匹配。
尝试解决此问题,但是如果您认为上述修复足够好,请告诉我。
excause me,How do you fix this bug?
x = x + layer_outputs[int(mdef["from"])]
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
please help me。looking forward to your reply。

from yolov3-gradcam.

xielock avatar xielock commented on August 20, 2024

请问这个问题解决了吗????

from yolov3-gradcam.

Related Issues (10)

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.