torchsat
torchsat copied to clipboard
pretrained models?
Dear @sshuair , thanks for this great work :)
do you have any pre-trained models for segmentation and detection?
Thanks!
Best regards
The pre-trained models for segmentation and detection is not a high priority. You can use the ImageNet's pre-trained model for feature extraction, it also very useful.
The ImageNet's pre-trained model only has 3 channels, Is this suitable for multi-channel(>3) training of remote sensing images? @sshuair Thanks!
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.
New Input Channels(7 Channel) | ImageNet Pre-trained Prameters |
---|---|
1,2,3 | R,G,B |
4,5,6 | R,G,B |
7 | R |
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