Skip to content

Instantly share code, notes, and snippets.

@ih4cku
Last active June 4, 2018 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ih4cku/d53f691cc79b9b433e3703740195b9f7 to your computer and use it in GitHub Desktop.
Save ih4cku/d53f691cc79b9b433e3703740195b9f7 to your computer and use it in GitHub Desktop.
calc DeepLab receptive field
#!/usr/bin/env python
# net architecture of http://ccvl.stat.ucla.edu/ccvl/DeepLab/train.prototxt
# format: [kernel, stride]
deep_lab_vgg = [
# 1
[3, 1],
[3, 1],
[2, 2],
# 2
[3, 1],
[3, 1],
[2, 2],
# 3
[3, 1],
[3, 1],
[3, 1],
[2, 2],
# 4
[3, 1],
[3, 1],
[3, 1],
[2, 1],
# 5
[5, 1],
[5, 1],
[5, 1],
[3, 1],
# fc6, kernel=4, hole=4
[13, 1]
]
# K: composed kernel, also the receptive field
# S: composed stride
K, S = 1, 1
for i in range(len(deep_lab_vgg)):
k, s = deep_lab_vgg[i]
K = (k-1) * S + K
S = S * s
print 'layer:', i, deep_lab_vgg[i], '[', K, S, ']'
@qivigor
Copy link

qivigor commented Jun 4, 2018

i have the same questions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment