Pytorch
How to finetune a network
- Modify dataLoader / Class for custom dataset
- segmentation tasks
- modify the
palette
for rendering the result labels
- modify the
- modify
num_classes
- dataloader part: modify
__init__
and__getitem__
- segmentation tasks
- Modify training code:
- Change dataset.
- import new dataset functions and classes
- change initialization for the dataset
- change mean-std
- modify all parts associated with dataset: eg.
xxxDataset.num_class
- Net Surgery
- Load initial net
- modify
net_init.final._modules['4'] = nn.Conv2d(512, UAVDataset.num_classes, kernel_size=1).cuda()
- Change dataset.
- Hook https://pytorch.org/tutorials/beginner/former_torchies/nn_tutorial.html#forward-and-backward-function-hooks
- Extract Features: https://becominghuman.ai/extract-a-feature-vector-for-any-image-with-pytorch-9717561d1d4c