β’ Creating a Deep Learning Pipeline
β’ Deploying Models on AWS Lambda
β’ Deploying Models on Edge Devices
β’ Showcasing Models Hugging Face Spaces
π
How do you use transfer learning with images with 3+ (or 1) channel(s)?
Timm library, developed by @wightmanr, has an elegant way to handle that:
You can specify any input channel number (e.g. in_chans=1 or in_chans=8) using timm.create_model() function like this:
@wightmanr m = timm.create_model('resnet34', pretrained=True, in_chans=8)
How does it work?
β’ Case 1: number of input channels is 1
timm simply sums the 3 channel weights into one single channel
@wightmanr β’ Case 2: number of input channels is 8 (more than 3)
timm repeats the 3 channel weights as many times as required, and then select the required number of input channels weights
In 8 channels example, that would be: repeat 3 times (9 channels generated), then keep the first 8