Beispiel #1
0
def get_preprocessor(cfg, dataset=None, device=None):
    ''' Returns preprocessor instance.

    Args:
        cfg (dict): config dictionary
        dataset (dataset): dataset
        device (device): pytorch device
    '''
    p_type = cfg['preprocessor']['type']
    cfg_path = cfg['preprocessor']['config']
    model_file = cfg['preprocessor']['model_file']

    if p_type == 'psgn':
        preprocessor = preprocess.PSGNPreprocessor(
            cfg_path=cfg_path,
            pointcloud_n=cfg['data']['pointcloud_n'],
            dataset=dataset,
            device=device,
            model_file=model_file,
        )
    elif p_type is None:
        preprocessor = None
    else:
        raise ValueError('Invalid Preprocessor %s' % p_type)

    return preprocessor
def get_preprocessor(cfg, dataset=None):
    """ Returns preprocessor instance.

  Args:
      cfg (dict): config dictionary
      dataset (dataset): dataset
  """
    p_type = cfg["preprocessor"]["type"]
    cfg_path = cfg["preprocessor"]["config"]
    model_file = cfg["preprocessor"]["model_file"]

    if p_type == "psgn":
        preprocessor = preprocess.PSGNPreprocessor(
            cfg_path=cfg_path,
            pointcloud_n=cfg["data"]["pointcloud_n"],
            dataset=dataset,
            model_file=model_file,
        )
    elif p_type is None:
        preprocessor = None
    else:
        raise ValueError("Invalid Preprocessor %s" % p_type)

    return preprocessor