docstr: create fragments from the rgbd frames ie a partial reconstruction of
  the scene with some frames(usually 50).
  We will only use the first sequence for each scene
docstr_tok: ["create","fragments","from","the","rgbd","frames","ie","a","partial","reconstruction","of","the","scene","with","some","frames","(","usually","50",")",".","We","will","only","use","the","first","sequence","for","each","scene"]
code: def _create_fragment(self, mod):
      r"""
      create fragments from the rgbd frames ie a partial reconstruction of
      the scene with some frames(usually 50).
      We will only use the first sequence for each scene
      """
  
      print("Create fragment from RGBD frames...")
      if files_exist(
          [osp.join(self.processed_dir, mod, "raw_fragment")]
      ):  # pragma: no cover
          log.warning(
              "the fragments on mode {} already exists".format(mod)
          )
          return
      for scene_path in os.listdir(osp.join(self.raw_dir, mod)):
          # TODO list the right sequences.
          list_seq = [
              f
              for f in os.listdir(
                  osp.join(self.raw_dir, mod, scene_path)
              )
              if "seq" in f
          ]
          for seq in list_seq:
              frames_dir = osp.join(
                  self.raw_dir, self.mode, scene_path, seq
              )
              out_dir = osp.join(
                  self.processed_dir,
                  mod,
                  "raw_fragment",
                  scene_path,
                  seq,
              )
              makedirs(out_dir)
              path_intrinsic = osp.join(
                  self.raw_dir,
                  self.mode,
                  scene_path,
                  "camera-intrinsics.txt",
              )
              list_path_frames = sorted(
                  [
                      osp.join(frames_dir, f)
                      for f in os.listdir(frames_dir)
                      if "png" in f and "depth" in f
                  ]
              )
              # list_path_color = sorted([osp.join(frames_dir, f)
              #                          for f in os.listdir(frames_dir)
              #                          if 'png' in f and 'color' in f])
              list_path_trans = sorted(
                  [
                      osp.join(frames_dir, f)
                      for f in os.listdir(frames_dir)
                      if "pose" in f and "txt" in f
                  ]
              )
              # compute each fragment and save it
              if not self.is_fine:
                  rgbd2fragment_rough(
                      list_path_frames,
                      path_intrinsic,
                      list_path_trans,
                      out_dir,
                      self.num_frame_per_fragment,
                      pre_transform=None,
                  )
              else:
                  assert len(list_path_frames) == len(
                      list_path_trans
                  ), log.error(
                      "For the sequence {},"
                      "the number of frame "
                      "and the number of "
                      "pose is different".format(frames_dir)
                  )
                  rgbd2fragment_fine(
                      list_path_frames,
                      path_intrinsic,
                      list_path_trans,
                      out_dir,
                      self.num_frame_per_fragment,
                      voxel_size=self.tsdf_voxel_size,
                      pre_transform=None,
                      depth_thresh=self.depth_thresh,
                      limit_size=self.limit_size,
                  )
  
imports: import json
  import logging
  import numpy
  import os
  import os.path
  from plyfile import PlyData
  import shutil
  import torch
  from torch_geometric.data import Dataset, download_url, extract_zip
  from torch_geometric.data import Data
  from torch_points3d.datasets.registration.detector import RandomDetector
  from torch_points3d.datasets.registration.utils import rgbd2fragment_rough
  from torch_points3d.datasets.registration.utils import rgbd2fragment_fine
  from torch_points3d.datasets.registration.utils import compute_overlap_and_matches
  from torch_points3d.datasets.registration.utils import to_list
  from torch_points3d.datasets.registration.utils import files_exist
  from torch_points3d.datasets.registration.utils import makedirs
  from torch_points3d.datasets.registration.utils import get_urls
  from torch_points3d.datasets.registration.utils import PatchExtractor
label_desc: Use image node_id 5 for calling the Base3DMatch obj's underlying member method code with example usage: obj._create_fragment(mod) without return types