pytorch/projects/tools/completion.py [18:94]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def download_point_clouds():
  # download via wget
  if not os.path.exists(root_folder):
    os.makedirs(root_folder)
  url = 'https://www.dropbox.com/s/z2x0mw4ai18f855/ocnn_completion.zip?dl=0'
  cmd = 'wget %s -O %s.zip' % (url, root_folder)
  print(cmd)
  os.system(cmd)

  # unzip
  cmd = 'unzip %s.zip -d %s' % (root_folder, root_folder)
  print(cmd)
  os.system(cmd)


def _convert_ply_to_points(prefix='shape'):
  ply_folder = os.path.join(root_folder, prefix + '.ply')
  points_folder = os.path.join(root_folder, prefix + '.points')

  folders = os.listdir(ply_folder)
  for folder in folders:
    curr_folder = os.path.join(ply_folder, folder)

    # write filelist to disk
    filenames = os.listdir(curr_folder)
    filelist_name = os.path.join(curr_folder, 'filelist.txt')
    with open(filelist_name, 'w') as fid:
      for filename in filenames:
        if filename.endswith('.ply'):
          fid.write(os.path.join(curr_folder, filename) + '\n')

    # run points2ply
    output_path = os.path.join(points_folder, folder)
    if not os.path.exists(output_path):
      os.makedirs(output_path)
    cmd = '%s --filenames %s --output_path %s --verbose 0' % \
          (ply2points, filelist_name, output_path)
    print(cmd)
    os.system(cmd)
    os.remove(filelist_name)


def convert_ply_to_points():
  _convert_ply_to_points('shape')
  _convert_ply_to_points('test.scans')


def _convert_points_to_ply(prefix='shape'):
  ply_folder = os.path.join(root_folder, prefix + '.ply')
  points_folder = os.path.join(root_folder, prefix + '.points')

  folders = os.listdir(points_folder)
  for folder in folders:
    curr_folder = os.path.join(points_folder, folder)

    # write filelist to disk
    filenames = os.listdir(curr_folder)
    filelist_name = os.path.join(curr_folder, 'filelist.txt')
    with open(filelist_name, 'w') as fid:
      for filename in filenames:
        if filename.endswith('.points'):
          fid.write(os.path.join(curr_folder, filename) + '\n')

    # run points2ply
    output_path = os.path.join(ply_folder, folder)
    if not os.path.exists(output_path):
      os.makedirs(output_path)
    cmd = '%s --filenames %s --output_path %s --verbose 0' % \
          (points2ply, filelist_name, output_path)
    print(cmd)
    os.system(cmd)
    os.remove(filelist_name)


def convert_points_to_ply():
  _convert_points_to_ply('shape')
  _convert_points_to_ply('test.scans')
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



tensorflow/data/completion.py [19:95]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
def download_point_clouds():
  # download via wget
  if not os.path.exists(root_folder):
    os.makedirs(root_folder)
  url = 'https://www.dropbox.com/s/z2x0mw4ai18f855/ocnn_completion.zip?dl=0'
  cmd = 'wget %s -O %s.zip' % (url, root_folder)
  print(cmd)
  os.system(cmd)

  # unzip
  cmd = 'unzip %s.zip -d %s' % (root_folder, root_folder)
  print(cmd)
  os.system(cmd)


def _convert_ply_to_points(prefix='shape'):
  ply_folder = os.path.join(root_folder, prefix + '.ply')
  points_folder = os.path.join(root_folder, prefix + '.points')

  folders = os.listdir(ply_folder)
  for folder in folders:
    curr_folder = os.path.join(ply_folder, folder)

    # write filelist to disk
    filenames = os.listdir(curr_folder)
    filelist_name = os.path.join(curr_folder, 'filelist.txt')
    with open(filelist_name, 'w') as fid:
      for filename in filenames:
        if filename.endswith('.ply'):
          fid.write(os.path.join(curr_folder, filename) + '\n')

    # run points2ply
    output_path = os.path.join(points_folder, folder)
    if not os.path.exists(output_path):
      os.makedirs(output_path)
    cmd = '%s --filenames %s --output_path %s --verbose 0' % \
          (ply2points, filelist_name, output_path)
    print(cmd)
    os.system(cmd)
    os.remove(filelist_name)


def convert_ply_to_points():
  _convert_ply_to_points('shape')
  _convert_ply_to_points('test.scans')


def _convert_points_to_ply(prefix='shape'):
  ply_folder = os.path.join(root_folder, prefix + '.ply')
  points_folder = os.path.join(root_folder, prefix + '.points')

  folders = os.listdir(points_folder)
  for folder in folders:
    curr_folder = os.path.join(points_folder, folder)

    # write filelist to disk
    filenames = os.listdir(curr_folder)
    filelist_name = os.path.join(curr_folder, 'filelist.txt')
    with open(filelist_name, 'w') as fid:
      for filename in filenames:
        if filename.endswith('.points'):
          fid.write(os.path.join(curr_folder, filename) + '\n')

    # run points2ply
    output_path = os.path.join(ply_folder, folder)
    if not os.path.exists(output_path):
      os.makedirs(output_path)
    cmd = '%s --filenames %s --output_path %s --verbose 0' % \
          (points2ply, filelist_name, output_path)
    print(cmd)
    os.system(cmd)
    os.remove(filelist_name)


def convert_points_to_ply():
  _convert_points_to_ply('shape')
  _convert_points_to_ply('test.scans')
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



