Hello everyone!
I’m a complete newbie here, I’ve tried to search related info, but haven’t found any results so far.
According to this, I don’t really get what’s dls and arch, more what is a backbone for e.g;
learn = unet_learner(dls, models.resnet34, loss_func=CrossEntropyLossFlat(axis=1), y_range=(0,1))
Is it possible to visualize learn.summary() into an architecture?
Does anyone have a visualization of such architecture? Is it an original u-net architecture + resnet34 backbone, how does it look like?
Hope you guys could help me to understand.
I had to go deeper, so in case that if someone is interested in how to visualize neural networks from learn.summary() here it goes.
*Firstly I have exported the .pth format and opened it with Netron, which was not really what I was looking for.The best option is to import the .onnx format to Netron software to see the architecture. I have found an article which describes the process of converting to onnx. https://medium.com/@hungminhnguyen/convert-fast-ai-trained-image-classification-model-to-ios-app-via-onnx-and-apple-core-ml-5fdb612379f1
I have added verbose and export params to it.
But I’m still confused about the backbone in the Dynamic u-net, can someone refer me to it? I have read the official documentations and did some investigations into terms, but i still didnt get it. Thanks
The backbone of the U-Net is a ResNet34. If you type learn.model it will print the different layers for you.
In PyTorch the pretrained ResNets are all structured very similar:
Stem (ConvLayer + BatchNorm + ReLU)
|
V
Block 1 (Multiple ConvLayers + BatchNorm + ReLU)
|
V
Block 2 (Multiple ConvLayers + BatchNorm + ReLU)
|
V
Block 3 (Multiple ConvLayers + BatchNorm + ReLU)
|
V
Block 4 (Multiple ConvLayers + BatchNorm + ReLU)
|
V
Head (Flatten input, Linear Layers)
if you type model[0] you’ll get the stem, model[1] will give you the first block, model[-1] will give you the last layer (the head).
If you pass resnet34 to unet_learner the following will happen:
the resnet34 is constructed and, if pretrained=True, the weights are loaded as well.
the create_body function of fastai cuts off the head of the model, leaving only stem and encoder.
hooks are placed into the model after each major block (so after the stem, block1, block2, …) which will catch the output of each layer, given the size of the feature maps did change in between layers, to use it in the skip connections.
A BatchNorm, ReLU and double convolutional Layer is appended to the encoder.
Hello! I have made an initial architecture draft according to the model.summary() output. Could you please point me on my mistakes where should i fix it? I’m not really good at math i’ve literally copied this learn.summary() outputs as blocks, but im still confused at concatenations. Any ideas how to make it more simple and solid?
This is my model.summary() output: