src/train.py
def init_model(opt):
    '''
    Initialize the pre-trained resnet
    '''
    model = resnet(pretrained=True)
    model.avgpool = nn.AdaptiveAvgPool2d((1, 1))
    model.conv1.weight.data = model.conv1.weight.data.sum(1).unsqueeze(1)
    for param in model.parameters():
        param.requires_grad = False
    model.fc = nn.Linear(model.fc.in_features, 64)
    model = model.cuda() if opt.cuda else model
    return model

    Initialize the pre-trained resnet
    
Initialize the pre-trained resnet
Initialize the pre - trained resnet
def init_model(opt):
    model = resnet(pretrained=True)
    model.avgpool = nn.AdaptiveAvgPool2d((1, 1))
    model.conv1.weight.data = model.conv1.weight.data.sum(1).unsqueeze(1)
    for param in model.parameters():
        param.requires_grad = False
    model.fc = nn.Linear(model.fc.in_features, 64)
    model = model.cuda() if opt.cuda else model
    return model
def init_model ( opt ) : model = resnet ( pretrained = True ) model . avgpool = nn . AdaptiveAvgPool2d ( ( 1 , 1 ) ) model . conv1 . weight . data = model . conv1 . weight . data . sum ( 1 ) . unsqueeze ( 1 ) for param in model . parameters ( ) : param . requires_grad = False model . fc = nn . Linear ( model . fc . in_features , 64 ) model = model . cuda ( ) if opt . cuda else model return model
Initialize the pre-trained resnet
Initialize the pre - trained resnet
'''
    Initialize the pre-trained resnet
    '''
opt