Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deep_convnet.py #60

Open
littleeboy opened this issue Jun 10, 2021 · 1 comment
Open

deep_convnet.py #60

littleeboy opened this issue Jun 10, 2021 · 1 comment

Comments

@littleeboy
Copy link

littleeboy commented Jun 10, 2021

in deep_convnet.py
pre_node_nums = np.array([1*3*3, 16*3*3, 16*3*3, 32*3*3, 32*3*3, 64*3*3, 64*4*4, hidden_size])

how to compute the neurons number in each convolution layer? why not pre_node_nums = np.array([1*3*3, 16, 16, 32, 32, 64, 64*4*4, hidden_size]

thanks

@Arandinglv
Copy link

Arandinglv commented Oct 23, 2023

Hey bro, If I'm not wrong, I think the pre_node_num is decided by yours, no matter you what value you assign, the code can run successfully ang get a suitable result. However, it is noteworthy that the self.params['W7'] = wight_init_scales[6] * np.random.randn(64 * 4 * 4, hidden_size) should be paid more anttention to calculate, cus I spent a long time to find that how to calculate the final result.
The result should folow the order of layer, and the feature map size will be changed accoding to the pooling and convolution layer:

    `self.layers = []
    self.layers.append(Convolution(self.params['W1'], self.params['b1'], 
                       conv_param_1['stride'], conv_param_1['pad']))
    self.layers.append(Relu())
    self.layers.append(Convolution(self.params['W2'], self.params['b2'], 
                       conv_param_2['stride'], conv_param_2['pad']))
    self.layers.append(Relu())
    self.layers.append(Pooling(pool_h=2, pool_w=2, stride=2))
    self.layers.append(Convolution(self.params['W3'], self.params['b3'], 
                       conv_param_3['stride'], conv_param_3['pad']))
    self.layers.append(Relu())
    self.layers.append(Convolution(self.params['W4'], self.params['b4'],
                       conv_param_4['stride'], conv_param_4['pad']))
    self.layers.append(Relu())
    self.layers.append(Pooling(pool_h=2, pool_w=2, stride=2))
    self.layers.append(Convolution(self.params['W5'], self.params['b5'],
                       conv_param_5['stride'], conv_param_5['pad']))
    self.layers.append(Relu())
    self.layers.append(Convolution(self.params['W6'], self.params['b6'],
                       conv_param_6['stride'], conv_param_6['pad']))
    self.layers.append(Relu())
    self.layers.append(Pooling(pool_h=2, pool_w=2, stride=2))
    self.layers.append(Affine(self.params['W7'], self.params['b7']))
    self.layers.append(Relu())
    self.layers.append(Dropout(0.5))
    self.layers.append(Affine(self.params['W8'], self.params['b8']))
    self.layers.append(Dropout(0.5))`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants