Example #1
0
        e = s + 5
        opt.weights = opt.weights[:s] + ('fold%d' % fold) + opt.weights[e:]
        opt.fold = fold
        if opt.h5:
            testset = h5_dataset.H5Dataset(opt, split=2)
            opt.num_workers = 0
        else:
            testset = datasets.Dataset(opt, 'test')
        loader = DataLoader(testset,
                            batch_size=1,
                            shuffle=False,
                            num_workers=0)

        model.load_weights(opt.weights)
        model.cuda()
        log, rf, rt = mAP(model, loader, args, 0)
        rt['log'] = average_dictionary(rt['log'], r_keys)
        copy_log(rt)
        print(log)
        rts.append(rt)

else:
    log, _, avg = mAP(model, loader, args, 0)
    avg['log'] = average_dictionary(avg['log'], r_keys)
    copy_log(avg)
    rts = [avg]
    print(log)


def final_log(dicts, keys, title):
    res = average_dictionary(dicts, keys, False, True)
Example #2
0
args.score_threshold = opt.score_threshold
args.num_queries = -1
args.score_nms_overlap = opt.score_nms_overlap
args.overlap_threshold = 0.5
args.gpu = True
args.use_external_proposals = int(opt.external_proposals)
args.max_proposals = opt.max_proposals
args.rpn_nms_thresh = opt.test_rpn_nms_thresh
args.num_workers = 6
args.numpy = False

trainlog = ''
start = time.time()
loss_history, mAPs = [], []
if opt.eval_first_iteration:
    log, rf, rt = mAP(model, valloader, args, it)
    trainlog += log
    if show:
        print(log)
    best_score = (rt.mAP_qbe_50 + rt.mAP_qbs_50) / 2
    mAPs.append((it, [rt.mAP_qbe_50, rt.mAP_qbs_50]))

else:
    best_score = 0.0

if opt.weights:
    opt.save_id += '_pretrained'

if not os.path.exists('checkpoints/ctrlfnet_mini/'):
    os.makedirs('checkpoints/ctrlfnet_mini/')