-
Notifications
You must be signed in to change notification settings - Fork 49
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
pretrained models? #9
Comments
The pre-trained models for segmentation and detection is not a high priority. |
The ImageNet's pre-trained model only has 3 channels, Is this suitable for multi-channel(>3) |
The latest master branch is support ImageNet's pre-trained model with multi-channel(>3). @geoexploring Assuming the number of input channels/bands is 7, the first three channels is filled by ImageNet pre-trained model parameters (RGB channel). The 4, 5, 6 channel is also filled by ImageNet pre-trained RGB channel parameters. And the latest channel is filled by ImageNet pre-trained R channel parameters. Simply speaking, torchsat copies the ImageNet parameters in order.
Examples: In [1]: from torchsat.models.classification import resnet18
In [2]: num_class = 10
In [3]: model = resnet18(num_class, in_channels=7, pretrained=True)
In [4]: model.conv1
Out[4]: Conv2d(7, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
In [7]: model.conv1.weight[0,0,0,0]
Out[7]: tensor(-0.0104, grad_fn=<SelectBackward>)
In [8]: model.conv1.weight[0,6,0,0]
Out[8]: tensor(-0.0104, grad_fn=<SelectBackward>) |
This solution is interesting and may be a compromise to train multi-channel satellite images using ImageNet pre-trained models. Thanks for this excellent work , @sshuair |
Dear @sshuair , thanks for this great work :)
do you have any pre-trained models for segmentation and detection?
Thanks!
Best regards
The text was updated successfully, but these errors were encountered: