Python datasets.factory.get_dataset() Examples

The following are 18 code examples of datasets.factory.get_dataset(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module datasets.factory , or try the search function .
Example #1
Source File: script_preprocess_annoations_S3DIS.py    From object_detection_kitti with Apache License 2.0 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True) 
Example #2
Source File: script_preprocess_annoations_S3DIS.py    From multilabel-image-classification-tensorflow with MIT License 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True) 
Example #3
Source File: script_env_vis.py    From multilabel-image-classification-tensorflow with MIT License 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #4
Source File: script_preprocess_annoations_S3DIS.py    From models with Apache License 2.0 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True) 
Example #5
Source File: script_env_vis.py    From models with Apache License 2.0 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #6
Source File: script_preprocess_annoations_S3DIS.py    From g-tensorflow-models with Apache License 2.0 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True) 
Example #7
Source File: script_env_vis.py    From g-tensorflow-models with Apache License 2.0 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #8
Source File: script_preprocess_annoations_S3DIS.py    From object_detection_with_tensorflow with MIT License 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True) 
Example #9
Source File: script_env_vis.py    From object_detection_with_tensorflow with MIT License 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #10
Source File: script_env_vis.py    From DOTA_models with Apache License 2.0 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #11
Source File: script_env_vis.py    From object_detection_kitti with Apache License 2.0 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #12
Source File: script_preprocess_annoations_S3DIS.py    From hands-detection with MIT License 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True) 
Example #13
Source File: script_env_vis.py    From hands-detection with MIT License 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #14
Source File: script_preprocess_annoations_S3DIS.py    From Gun-Detector with Apache License 2.0 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True) 
Example #15
Source File: script_env_vis.py    From Gun-Detector with Apache License 2.0 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #16
Source File: script_preprocess_annoations_S3DIS.py    From yolo_v2 with Apache License 2.0 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True) 
Example #17
Source File: script_env_vis.py    From yolo_v2 with Apache License 2.0 6 votes vote down vote up
def load_building(dataset_name, building_name):
  dataset = factory.get_dataset(dataset_name)

  navtask = get_args()
  cp = navtask.camera_param
  rgb_shader, d_shader = renderer.get_shaders(cp.modalities)
  r_obj = SwiftshaderRenderer()
  r_obj.init_display(width=cp.width, height=cp.height,
                     fov=cp.fov, z_near=cp.z_near, z_far=cp.z_far,
                     rgb_shader=rgb_shader, d_shader=d_shader)
  r_obj.clear_scene()
  b = VisualNavigationEnv(robot=navtask.robot, env=navtask.env,
                          task_params=navtask.task_params,
                          building_name=building_name, flip=False,
                          logdir=None, building_loader=dataset,
                          r_obj=r_obj)
  b.load_building_into_scene()
  b.set_building_visibility(False)
  return b 
Example #18
Source File: script_preprocess_annoations_S3DIS.py    From DOTA_models with Apache License 2.0 6 votes vote down vote up
def _write_map_files(b_in, b_out, transform):
  cats = get_categories()

  env = utils.Foo(padding=10, resolution=5, num_point_threshold=2,
                  valid_min=-10, valid_max=200, n_samples_per_face=200)
  robot = utils.Foo(radius=15, base=10, height=140, sensor_height=120,
                    camera_elevation_degree=-15)
  
  building_loader = factory.get_dataset('sbpd')
  for flip in [False, True]:
    b = nav_env.Building(b_out, robot, env, flip=flip,
                         building_loader=building_loader)
    logging.info("building_in: %s, building_out: %s, transform: %d", b_in,
                 b_out, transform)
    maps = _get_semantic_maps(b_in, transform, b.map, flip, cats)
    maps = np.transpose(np.array(maps), axes=[1,2,0])

    #  Load file from the cache.
    file_name = '{:s}_{:d}_{:d}_{:d}_{:d}_{:d}_{:d}.pkl'
    file_name = file_name.format(b.building_name, b.map.size[0], b.map.size[1],
                                 b.map.origin[0], b.map.origin[1],
                                 b.map.resolution, flip)
    out_file = os.path.join(DATA_DIR, 'processing', 'class-maps', file_name)
    logging.info('Writing semantic maps to %s.', out_file)
    save_variables(out_file, [maps, cats], ['maps', 'cats'], overwrite=True)