XinJCheng / CSPN

Convolutional Spatial Propagation Network
496 stars 92 forks source link

I test your code in PyTorch0.4.1 and find some bugs #9

Closed dontLoveBugs closed 5 years ago

dontLoveBugs commented 5 years ago

`

    x = self.gud_up_proj_layer4(x, skip4)       # 64 channels features
    x= self.gud_up_proj_layer5(x)                  # blur depth
    guidance = self.gud_up_proj_layer6(x)    # affinity matrix
    x = self.post_process_layer(guidance, x, sparse_depth)

` I think the first x is 64 channels features, which are used to generate blur depth and affinity matrix, and the second x is blur depth. Therefore, the input of self.gud_up_proj_layer6 is the first x. I modify the code as follows:

`

    x = self.gud_up_proj_layer4(x, skip4)
    blur_depth = self.gud_up_proj_layer5(x)
    guidance = self.gud_up_proj_layer6(x)
    x = self.post_process_layer(guidance, blur_depth, sparse_depth)

` And I find the cspn.py have the following errors.

IndexError: only integers, slices (:), ellipsis (...), None and long or byte Variables are valid indices (got float)

So, I suggest replace '/'(div operation) using '//' when you want to get 'int' rather than 'float'.

XinJCheng commented 5 years ago

This is independent of the version of pytorch. I guess you used python3, In python3 the default types output from div is float. My configuration is python2 + pytorch0.3. So If you use python3, you could add int() to convert the type from float to int.

sshan-zhao commented 5 years ago

`

    x = self.gud_up_proj_layer4(x, skip4)       # 64 channels features
    x= self.gud_up_proj_layer5(x)                  # blur depth
    guidance = self.gud_up_proj_layer6(x)    # affinity matrix
    x = self.post_process_layer(guidance, x, sparse_depth)

` I think the first x is 64 channels features, which are used to generate blur depth and affinity matrix, and the second x is blur depth. Therefore, the input of self.gud_up_proj_layer6 is the first x. I modify the code as follows:

`

    x = self.gud_up_proj_layer4(x, skip4)
    blur_depth = self.gud_up_proj_layer5(x)
    guidance = self.gud_up_proj_layer6(x)
    x = self.post_process_layer(guidance, blur_depth, sparse_depth)

I also find this bug. Can you double-check it? @XinJCheng Thanks!