How to use the torchfcn.utils.conv function in torchfcn

To help you get started, we’ve selected a few torchfcn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wkentaro / pytorch-fcn / torchfcn / utils / fcn.py View on Github external
l2 = fcn32s.classifier[i2]
        l2.weight.data = l1.weight.data.view(l2.weight.size())
        l2.bias.data = l1.bias.data.view(l2.bias.size())
    n_class = fcn32s.classifier[6].weight.size()[0]
    if copy_fc8:
        l1 = vgg16.classifier[6]
        l2 = fcn32s.classifier[6]
        l2.weight.data = l1.weight.data[:n_class, :].view(l2.weight.size())
        l2.bias.data = l1.bias.data[:n_class]
    if init_upscore:
        # initialize upscore layer
        upscore = fcn32s.upscore[0]
        c1, c2, h, w = upscore.weight.data.size()
        assert c1 == c2 == n_class
        assert h == w
        weight = conv.get_upsample_filter(h)
        upscore.weight.data = weight.view(1, 1, h, w).repeat(c1, c2, 1, 1)
github wkentaro / pytorch-fcn / torchfcn / utils / __init__.py View on Github external
from torchfcn.utils import conv  # NOQA
from torchfcn.utils import fcn   # NOQA


get_upsample_filter = conv.get_upsample_filter
copy_params_vgg16_to_fcn32s = fcn.copy_params_vgg16_to_fcn32s