コード例 #1
0
 def evalute_model(self, model, loader, gpu_id, input_size, num_classes, whole):
     mean_IU, IU_array = evaluate_main(model=model, loader = loader,  
             gpu_id = gpu_id, 
             input_size = input_size, 
             num_classes = num_classes,
             whole = whole)
     return mean_IU, IU_array 
コード例 #2
0
from torch.utils import data
from networks.pspnet_combine_S import Res_pspnet, BasicBlock, Bottleneck
from networks.evaluate import evaluate_main
from dataset.datasets import CSDataTestSet
from utils.train_options import TrainOptionsForTest
import torch
from utils.utils import *

if __name__ == '__main__':
    args = TrainOptionsForTest().initialize()
    testloader = data.DataLoader(CSDataTestSet(
        args.data_dir,
        './dataset/list/cityscapes/test.lst',
        crop_size=(1024, 2048)),
                                 batch_size=2,
                                 shuffle=False,
                                 pin_memory=True)

    # student = Res_pspnet(BasicBlock, [2, 2, 2, 2], num_classes = 19)
    # student.load_state_dict(torch.load(args.resume_from))
    # evaluate_main(student, testloader, '0', '512,512', 19, True, type = 'test')

    teacher = Res_pspnet(Bottleneck, [3, 4, 23, 3], num_classes=19)
    # teacher.load_state_dict(torch.load(args.resume_from))
    teacher.cuda()
    load_T_model(teacher, args.resume_from)
    evaluate_main(teacher, testloader, '0', '512,512', 19, True, type='test')
コード例 #3
0
from torch.utils import data
from networks.pspnet_combine import Res_pspnet, BasicBlock, Bottleneck
from networks.evaluate import evaluate_main
from dataset.datasets import CSDataTestSet
from utils.train_options import TrainOptionsForTest
import torch

if __name__ == '__main__':
    args = TrainOptionsForTest().initialize()
    testloader = data.DataLoader(CSDataTestSet(
        args.data_dir,
        './dataset/list/cityscapes/test.lst',
        crop_size=(1024, 2048)),
                                 batch_size=1,
                                 shuffle=False,
                                 pin_memory=True)
    student = Res_pspnet(BasicBlock, [2, 2, 2, 2], num_classes=19)  # resnet
    student.load_state_dict(torch.load(args.resume_from))
    evaluate_main(student, testloader, '512,512', 19, True, type='test')