コード例 #1
0
                                     num_workers=0,
                                     num_rep=20,
                                     prob_rotate=1,
                                     max_angel=180,
                                     sagittal_size=dis_model.sagittal_size,
                                     transverse_size=dis_model.transverse_size,
                                     k_nearest=dis_model.k_nearest,
                                     sagittal_shift=dis_model.sagittal_shift,
                                     pin_memory=False,
                                     sampling_strategy=None)

    # 设定验证参数
    valid_evaluator = Evaluator(
        dis_model,
        valid_studies,
        '../data/lumbar_train51_annotation.json',
        num_rep=5,
        max_dist=6,
    )

    # 每个batch要训练的步骤
    step_per_batch = len(train_dataloader)
    # 设置Adam优化器,以及学习率
    optimizer = torch.optim.AdamW(dis_model.parameters(), lr=1e-5)
    # 设置最大训练轮次
    max_step = 30 * step_per_batch
    # 训练
    fit_result = torch_utils.fit(
        dis_model,
        train_data=train_dataloader,
        valid_data=None,
コード例 #2
0
                                     batch_size=8,
                                     num_workers=0,
                                     num_rep=20,
                                     prob_rotate=1,
                                     max_angel=180,
                                     sagittal_size=dis_model.sagittal_size,
                                     transverse_size=dis_model.sagittal_size,
                                     k_nearest=0,
                                     max_dist=6,
                                     sagittal_shift=1,
                                     pin_memory=False)

    # 设定验证参数
    valid_evaluator = Evaluator(dis_model,
                                valid_studies,
                                '../data/lumbar_train51_annotation.json',
                                num_rep=20,
                                max_dist=6,
                                metric='key point recall')

    # 每个batch要训练的步骤
    step_per_batch = len(train_dataloader)
    # 设置Adam优化器,以及学习率
    optimizer = torch.optim.AdamW(dis_model.parameters(), lr=1e-5)
    # 设置最大训练轮次
    max_step = 50 * step_per_batch
    # 训练
    fit_result = torch_utils.fit(
        dis_model,
        train_data=train_dataloader,
        valid_data=None,
        optimizer=optimizer,