Exemple #1
0
def get_data_fields(mode, cfg):
    ''' Returns the data fields.

    Args:
        mode (str): the mode which is used
        cfg (dict): imported yaml config
    '''
    points_transform = data.SubsamplePoints(cfg['data']['points_subsample'])

    fields = {}

    fields['points'] = data.PointsField(
        cfg['data']['points_file'],
        points_transform,
        unpackbits=cfg['data']['points_unpackbits'],
        multi_files=cfg['data']['multi_files'])

    points_iou_file = cfg['data']['points_iou_file']

    if points_iou_file is not None:
        fields['points_iou'] = data.PointsField(
            points_iou_file,
            unpackbits=cfg['data']['points_unpackbits'],
            multi_files=cfg['data']['multi_files'])

    return fields
Exemple #2
0
def get_data_fields(mode, cfg):
    ''' Returns the data fields.

    Args:
        mode (str): the mode which is used
        cfg (dict): imported yaml config
    '''
    if cfg['data']['scale_rotate'] is not None:
        points_transform = transforms.Compose([
            data.ScaleAndRotatePoints(),
            data.SubsamplePoints(cfg['data']['points_subsample'])
        ])
    else:
        points_transform = data.SubsamplePoints(cfg['data']['points_subsample'])

    input_type = cfg['data']['input_type']
    fields = {}
    if cfg['data']['points_file'] is not None:
        if input_type != 'pointcloud_crop':
            fields['points'] = data.PointsField(
                cfg['data']['points_file'], points_transform,
                unpackbits=cfg['data']['points_unpackbits'],
                multi_files=cfg['data']['multi_files']
            )
        else:
            fields['points'] = data.PatchPointsField(
                cfg['data']['points_file'], 
                transform=points_transform,
                unpackbits=cfg['data']['points_unpackbits'],
                multi_files=cfg['data']['multi_files']
            )

    
    if mode in ('val', 'test'):
        points_iou_file = cfg['data']['points_iou_file']
        voxels_file = cfg['data']['voxels_file']
        if points_iou_file is not None:
            if input_type == 'pointcloud_crop':
                fields['points_iou'] = data.PatchPointsField(
                points_iou_file,
                unpackbits=cfg['data']['points_unpackbits'],
                multi_files=cfg['data']['multi_files']
                )
            else:
                fields['points_iou'] = data.PointsField(
                    points_iou_file,
                    unpackbits=cfg['data']['points_unpackbits'],
                    multi_files=cfg['data']['multi_files']
                )
        if voxels_file is not None:
            fields['voxels'] = data.VoxelsField(voxels_file)

    return fields
Exemple #3
0
cfg['data']['scale_rotate'] = None
cfg['data']['pointcloud_n'] = 3_000

# Shorthands
out_dir = cfg['training']['out_dir']
generation_dir = os.path.join(out_dir, cfg['generation']['generation_dir'])
if not args.eval_input:
    out_file = os.path.join(generation_dir, 'eval_meshes_full.pkl')
    out_file_class = os.path.join(generation_dir, 'eval_meshes.csv')
else:
    out_file = os.path.join(generation_dir, 'eval_input_full.pkl')
    out_file_class = os.path.join(generation_dir, 'eval_input.csv')

# Dataset
points_field = data.PointsField(cfg['data']['points_iou_file'],
                                unpackbits=cfg['data']['points_unpackbits'],
                                multi_files=cfg['data']['multi_files'])
pointcloud_field = data.PointCloudField(cfg['data']['pointcloud_chamfer_file'],
                                        multi_files=cfg['data']['multi_files'])
fields = {
    'points_iou': points_field,
    'pointcloud_chamfer': pointcloud_field,
    'idx': data.IndexField(),
}

print('Test split: ', cfg['data']['test_split'])

dataset_folder = cfg['data']['path']
dataset = data.Shapes3dDataset(dataset_folder,
                               fields,
                               cfg['data']['test_split'],