code: def read_s3dis_format(
      train_file, room_name, label_out=True, verbose=False, debug=False
  ):
      """extract data from a room folder"""
  
      room_type = room_name.split("_")[0]
      room_label = ROOM_TYPES[room_type]
      raw_path = osp.join(train_file, "{}.txt".format(room_name))
      if debug:
          reader = pd.read_csv(raw_path, delimiter="\n")
          RECOMMENDED = 6
          for idx, row in enumerate(reader.values):
              row = row[0].split(" ")
              if len(row) != RECOMMENDED:
                  log.info(
                      "1: {} row {}: {}".format(raw_path, idx, row)
                  )
  
              try:
                  for r in row:
                      r = float(r)
              except:
                  log.info(
                      "2: {} row {}: {}".format(raw_path, idx, row)
                  )
  
          return True
      else:
          room_ver = pd.read_csv(raw_path, sep=" ", header=None).values
          xyz = np.ascontiguousarray(room_ver[:, 0:3], dtype="float32")
          try:
              rgb = np.ascontiguousarray(
                  room_ver[:, 3:6], dtype="uint8"
              )
          except ValueError:
              rgb = np.zeros((room_ver.shape[0], 3), dtype="uint8")
              log.warning(
                  "WARN - corrupted rgb data for file %s" % raw_path
              )
          if not label_out:
              return xyz, rgb
          n_ver = len(room_ver)
          del room_ver
          nn = NearestNeighbors(n_neighbors=1, algorithm="kd_tree").fit(
              xyz
          )
          semantic_labels = np.zeros((n_ver,), dtype="int64")
          room_label = np.asarray([room_label])
          instance_labels = np.zeros((n_ver,), dtype="int64")
          objects = glob.glob(osp.join(train_file, "Annotations/*.txt"))
          i_object = 1
          for single_object in objects:
              object_name = os.path.splitext(
                  os.path.basename(single_object)
              )[0]
              if verbose:
                  log.debug(
                      "adding object "
                      + str(i_object)
                      + " : "
                      + object_name
                  )
              object_class = object_name.split("_")[0]
              object_label = object_name_to_label(object_class)
              obj_ver = pd.read_csv(
                  single_object, sep=" ", header=None
              ).values
              _, obj_ind = nn.kneighbors(obj_ver[:, 0:3])
              semantic_labels[obj_ind] = object_label
              instance_labels[obj_ind] = i_object
              i_object = i_object + 1
  
          return (
              torch.from_numpy(xyz),
              torch.from_numpy(rgb),
              torch.from_numpy(semantic_labels),
              torch.from_numpy(instance_labels),
              torch.from_numpy(room_label),
          )
  
imports: import os
  import os.path
  from itertools import repeat, product
  import numpy
  import h5py
  import torch
  import random
  import glob
  from plyfile import PlyData, PlyElement
  from torch_geometric.data import InMemoryDataset, Data, extract_zip, Dataset
  from torch_geometric.data.dataset import files_exist
  from torch_geometric.data import DataLoader
  from torch_geometric.datasets import S3DIS
  import torch_geometric.transforms
  import logging
  from sklearn.neighbors import NearestNeighbors, KDTree
  from tqdm.auto import tqdm
  import csv
  import pandas
  import pickle
  import gdown
  import shutil
  from torch_points3d.datasets.samplers import BalancedRandomSampler
  import torch_points3d.core.data_transform
  from torch_points3d.datasets.base_dataset import BaseDataset
label_desc: Use image node_id 2 for calling a global function with example usage: read_s3dis_format(train_file, room_name, label_out, verbose, debug) and returns: True, torch,  torch,  torch,  torch,  torch, xyz,  rgb