Open datwelk opened 7 years ago
I ran the code just as the readme shown, while i got this srror:
Traceback (most recent call last):
File "src/labelprobe.py", line 306, in
Is there anything wrong with my python2.7? or should I use the python3.5? and why?
@lingeo: please open new records for differnt issues; this is unrelated. I've moved your question to #5.
@datwelk: are you still encountering this ZeroDivisionError problem? Some of the logic in upsample.py depends on the specific way you have written things in your proto config. It will be easier to debug if you are able to share a specific proto that triggers the error.
@davidbau it's reproducible using any proto where the spatial dimension of the conv layer output is odd as opposed to even.
I'm running into the same problem, but not just for odd shaped output layers.
Using pytorch, blob="features.3"
in vgg19 (relu before first pool layer) has an activation shape of (224, 224)
, the reduction
is 2
but the fieldmap
is ((0,0), (1,1), (1,1))
, since the input size is (224, 224)
. Then, it's the same problem that @datwelk mentioned (t // s = 1 // 2 = 0
).
To get interior pytorch modules, I use the following function as such: get_pytorch_module(net, blob).register_forward_hook(hook_function)
def get_pytorch_module(net, blob):
modules = blob.split('.')
if len(modules) == 1:
return net._modules.get(blob)
else:
curr_m = net
for m in modules:
curr_m = curr_m._modules.get(m)
return curr_m
In
upsample.py
line 352, the step size (3rd param) passed tonp.arange
is 0, yielding aZeroDivisionError
. This is caused byt
having value 1, andreduction
having value 2:1 // 2 = 0
. The fieldmap is((0,0), (4,4), (1,1))
.The conv layer that is being analyzed has a 4x4 kernel, 4 output channels, and a stride of 1. Its input size is 3x120x120, the output size is 4x117x117.
I am going to debug this further but just wanted to share this already.