Hi,



 avijit_dasgupta:

Now, I have images of 6 channels. So, I want to change the num_of_input_channels of the first convolutional layer to 6 from 3. How can I do that?


If you want to pass 6-channel images to AlexNet directly, there will be a need to replace the 1st convolution layer of AlexNet.
Because the model is defined using nn.Sequential code 86, it’s a bit confusing to replacing the specific layer.



 avijit_dasgupta:

I want to use the pre-trained weights for the RGB channels and for other 3 I want to initialize the weights with random numbers.


You can prepare the pretrained & not trained AlexNet by torchvision.models.alexnet(pretrained=True) and torchvision.models.alexnet(pretrained=False) respectively. Then, split the 6-channel images into 2 3-channel images before pass them to the 2 alexnets.