ocrtoc_dataset_toolkit package

Submodules

ocrtoc_dataset_toolkit.ocrtoc_dataset module

class ocrtoc_dataset_toolkit.ocrtoc_dataset.OCRTOC_Dataset(root)[source]

Bases: object

OCRTOC Dataset toolkit class

Parameters

root (str) – root path for the dataset.

load_camera_param(scene_id)[source]

Load camera fake intrinsic matrix for open3d,

Parameters

scene_id (int) – scene index.

Returns

fake camera intrinsic matrix.

Return type

np.ndarray

load_camera_pose(scene_id, image_id)[source]

Load camera poses

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

Returns

camera pose with world frame.

Return type

np.ndarray

load_depth_image(scene_id, image_id)[source]

Load depth image

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

Returns

depth image.

Return type

np.ndarray

load_object_list(save=False)[source]

Load object list.

Parameters

save (bool) – save the object list or not.

Returns

object names and name-id mapping.

Return type

list, dict

load_object_mesh(model_name)[source]

Load model mesh file

Parameters

model_name (str) – model name.

Returns

model mesh.

Return type

o3d.geometry.TriangleMesh

load_object_number()[source]

Load total objects number

Returns

total objects number in the dataset.

Return type

int

load_object_pose_dict(scene_id)[source]

load object pose in each image

Parameters

scene_id (int) – scene index.

Returns

object poses.

Return type

dict

load_point_cloud(scene_id, image_id)[source]

Load partial view point cloud

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

Returns

partial view point cloud.

Return type

o3d.geometry.PointCloud

load_raw_image(scene_id, image_id, order='RGB')[source]

Load color image

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

  • order (str) – RGB or BGR.

Returns

color image.

Return type

np.ndarray

load_real_camera_intrinsic(scene_id)[source]

Load camera real intrinsic matrix

Parameters

scene_id (int) – scene index.

Returns

camera intrinsic matrix.

Return type

np.ndarray

load_scene_image_number(scene_id)[source]

Load images number in a scene

Parameters

scene_id (int) – scene index.

Returns

images number in a scene.

Return type

int

load_scene_name(scene_id)[source]

Load scene name

Parameters

scene_id (int) – scene index.

Returns

scene name.

Return type

str

load_scene_name_list(save=False)[source]

Load scene name list or generate one

Returns

scene names.

Return type

list

load_scene_number()[source]

Load total scenes number

Returns

total scenes number in the dataset.

Return type

int

load_scene_object_list(scene_id)[source]

Load object list in a scene

Parameters

scene_id (int) – scene index.

Returns

object name list.

Return type

list

load_scene_point_cloud(scene_id)[source]

Load full view scene point cloud

Parameters

scene_id (int) – scene index.

Returns

Reconstructed point cloud.

Return type

o3d.geometry.PointCloud

load_seg_mask(scene_id, image_id)[source]

load segmentation mask

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

Returns

segmentation mask.

Return type

np.ndarray

load_total_image_number()[source]

Load total images number

Returns

total images number in the dataset.

Return type

int

vis_6dpose(scene_id, image_id=None, dimension=3, show=True)[source]

Visualize 6d pose annotation in a scene or in an image

Parameters
  • scene_id (int) – the id of the scene.

  • image_id (int or None) – the id of the image, None for the whole scene.

  • dimension (int) – 2 for 2d visualization and 3 for 3d visualization.

  • show (bool) – whether to show the result using open3d.

Returns

If dimension==2, returns point cloud; elif dimension == 3, returns BGR image.

Return type

o3d.geometry.PointCloud or np.array

Module contents

class ocrtoc_dataset_toolkit.OCRTOC_Dataset(root)[source]

Bases: object

OCRTOC Dataset toolkit class

Parameters

root (str) – root path for the dataset.

load_camera_param(scene_id)[source]

Load camera fake intrinsic matrix for open3d,

Parameters

scene_id (int) – scene index.

Returns

fake camera intrinsic matrix.

Return type

np.ndarray

load_camera_pose(scene_id, image_id)[source]

Load camera poses

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

Returns

camera pose with world frame.

Return type

np.ndarray

load_depth_image(scene_id, image_id)[source]

Load depth image

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

Returns

depth image.

Return type

np.ndarray

load_object_list(save=False)[source]

Load object list.

Parameters

save (bool) – save the object list or not.

Returns

object names and name-id mapping.

Return type

list, dict

load_object_mesh(model_name)[source]

Load model mesh file

Parameters

model_name (str) – model name.

Returns

model mesh.

Return type

o3d.geometry.TriangleMesh

load_object_number()[source]

Load total objects number

Returns

total objects number in the dataset.

Return type

int

load_object_pose_dict(scene_id)[source]

load object pose in each image

Parameters

scene_id (int) – scene index.

Returns

object poses.

Return type

dict

load_point_cloud(scene_id, image_id)[source]

Load partial view point cloud

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

Returns

partial view point cloud.

Return type

o3d.geometry.PointCloud

load_raw_image(scene_id, image_id, order='RGB')[source]

Load color image

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

  • order (str) – RGB or BGR.

Returns

color image.

Return type

np.ndarray

load_real_camera_intrinsic(scene_id)[source]

Load camera real intrinsic matrix

Parameters

scene_id (int) – scene index.

Returns

camera intrinsic matrix.

Return type

np.ndarray

load_scene_image_number(scene_id)[source]

Load images number in a scene

Parameters

scene_id (int) – scene index.

Returns

images number in a scene.

Return type

int

load_scene_name(scene_id)[source]

Load scene name

Parameters

scene_id (int) – scene index.

Returns

scene name.

Return type

str

load_scene_name_list(save=False)[source]

Load scene name list or generate one

Returns

scene names.

Return type

list

load_scene_number()[source]

Load total scenes number

Returns

total scenes number in the dataset.

Return type

int

load_scene_object_list(scene_id)[source]

Load object list in a scene

Parameters

scene_id (int) – scene index.

Returns

object name list.

Return type

list

load_scene_point_cloud(scene_id)[source]

Load full view scene point cloud

Parameters

scene_id (int) – scene index.

Returns

Reconstructed point cloud.

Return type

o3d.geometry.PointCloud

load_seg_mask(scene_id, image_id)[source]

load segmentation mask

Parameters
  • scene_id (int) – scene index.

  • image_id (int) – image index.

Returns

segmentation mask.

Return type

np.ndarray

load_total_image_number()[source]

Load total images number

Returns

total images number in the dataset.

Return type

int

vis_6dpose(scene_id, image_id=None, dimension=3, show=True)[source]

Visualize 6d pose annotation in a scene or in an image

Parameters
  • scene_id (int) – the id of the scene.

  • image_id (int or None) – the id of the image, None for the whole scene.

  • dimension (int) – 2 for 2d visualization and 3 for 3d visualization.

  • show (bool) – whether to show the result using open3d.

Returns

If dimension==2, returns point cloud; elif dimension == 3, returns BGR image.

Return type

o3d.geometry.PointCloud or np.array