示例#1
0
文件: apply.py 项目: eguomin/3D-RCAN
    if gt_path is None:
        data = itertools.zip_longest(raw_files, [])
    else:
        gt_files = sorted(gt_path.glob('*.tif'))

        if len(raw_files) != len(gt_files):
            raise ValueError(
                'Mismatch between raw and ground truth file counts '
                f'({len(raw_files)} vs. {len(gt_files)})')

        data = zip(raw_files, gt_files)
else:
    data = [(input_path, gt_path)]

model_path = get_model_path(args.model_dir)
print('Loading model from', model_path)
model = load_model(str(model_path), input_shape=args.block_shape)

if args.block_overlap_shape is None:
    overlap_shape = [
        max(1, x // 8) if x > 2 else 0
        for x in model.input.shape.as_list()[1:-1]
    ]
else:
    overlap_shape = args.block_overlap_shape

if args.scale_value is None:
    sValue = 2000
else:
    sValue = args.scale_value
示例#2
0
        step2_output_path.mkdir(parents=True)

    if config['step3_trigger'] and config[
            'step3_output_trigger'] and not step3_output_path.exists():
        print('Creating step3 output directory', step3_output_path)
        step3_output_path.mkdir(parents=True)

if input_path.is_dir():
    data = sorted(input_path.glob('*.tif'))
    # raw_files = sorted(input_path.glob('*.tif'))
    # data = itertools.zip_longest(raw_files, [])
else:
    data = input_path

if config['step1_trigger']:
    step1_model_path = get_model_path(config['step1_model_dir'])
    print('Loading step1 model from', step1_model_path)
    step1_model = load_model(str(step1_model_path),
                             input_shape=config['step1_block_shape'])

    if config['step1_block_overlap_shape'] is None:
        step1_overlap_shape = [
            max(1, x // 8) if x > 2 else 0
            for x in step1_model.input.shape.as_list()[1:-1]
        ]
    else:
        step1_overlap_shape = config['step1_block_overlap_shape']

if config['step2_trigger']:
    step2_model_path = get_model_path(config['step2_model_dir'])
    print('Loading step2 model from', step2_model_path)