How do I change the GridSize of segnet? I just got the grid size with GetGridSize like grid_width, grid_height = net.GetGridSize(), and executed with linear filter. I want to increase the resolution of mask image. It might be dropped the performance.
Hi @Nakhyun, the raw grid size is inherent to the model and can’t be altered after training. It is a ratio of the input resolution of the model. So to increase the grid size, you would need to re-train the model on higher resolution (which would in turn slow down the processing).
For example, if you check the grid sizes of cityscapes-512x256, cityscapes-1024x512, and cityscapes-2048x1024, the grid sizes increase with the resolution of the model.
Alternatively can pass in a larger buffer to
net.Mask() and it will use interpolation to up-scale the mask to match the size of your buffer.
Thanks dusty_nv. It is clear to me.
Is there any example for retraining the segnet? I just ran the pre-trained model.
There isn’t a tutorial about it, but the training code is here: https://github.com/dusty-nv/pytorch-segmentation
I have not tested the segmentation training on Jetson, I train it on PC (it is rather intensive, and the datasets are large)
To train FCN-Resnet18, you would also need to use my fork of torchvision (the
v0.3.0 branch): https://github.com/dusty-nv/vision/tree/v0.3.0
In train.py of pytorch-segmentation, is the gridsize of network directly related to --resolution or --width, --height?
When I ran the pre-trained model, the grid size is about 64x32(cityscapes-2048x1024), 36x16(1024x512), 16x8(512x256).
parser.add_argument('--resolution', default=320, type=int, metavar='N', help='NxN resolution used for scaling the training dataset (default: 320x320) ' 'to specify a non-square resolution, use the --width and --height options') parser.add_argument('--width', default=argparse.SUPPRESS, type=int, metavar='X', help='desired width of the training dataset. if this option is not set, --resolution will be used') parser.add_argument('--height', default=argparse.SUPPRESS, type=int, metavar='Y', help='desired height of the training dataset. if this option is not set, --resolution will be used')
Yes that is correct, the grid size will be a ratio of the input resolution. For FCN-ResNet18, I believe the grid size is 32X smaller than the input size.