nghiacblk5 commited on
Commit
9e32578
·
verified ·
1 Parent(s): 3b5efd1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +86 -1
README.md CHANGED
@@ -51,6 +51,92 @@ finalized_data
51
  │ └───...
52
  └───...
53
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  ## Citation
55
  If you find this work interesting and helpful, please consider citing
56
  ```
@@ -61,6 +147,5 @@ If you find this work interesting and helpful, please consider citing
61
  booktitle = {CVPR},
62
  }
63
  ```
64
-
65
  ## License
66
  MIT License
 
51
  │ └───...
52
  └───...
53
  ```
54
+
55
+ ## Data Visualization
56
+
57
+ We visualize the point cloud affordance and visual cue image in our dataset.
58
+ Modify the scene ID, affordance label and data directory for other visualizations
59
+ ```python
60
+ import open3d as o3d
61
+ import numpy as np
62
+ import cv2
63
+ import random
64
+ import os
65
+ import json
66
+
67
+ scene_id = '420673' #modify this
68
+ base_point_cloud_dir = './data' #modify this
69
+ point_cloud_annotation_dir = os.path.join(base_point_cloud_dir, scene_id, f"{scene_id}_annotations.json")
70
+ point_cloud_dir = os.path.join(base_point_cloud_dir, scene_id, f"{scene_id}_laser_scan.ply")
71
+
72
+ image_base_dir = './train' #modify this
73
+ image_scene_dir = os.path.join(image_base_dir, scene_id)
74
+ action_list = os.listdir(image_scene_dir)
75
+
76
+ label = 'hook_turn' #modify this
77
+ action_label = [i for i in action_list if label in i]
78
+ action_folder = random.choice(action_label)
79
+ action_dir = os.path.join(image_scene_dir, action_folder)
80
+ image_list = os.listdir(action_dir)
81
+ image_dir = os.path.join(action_dir, random.choice(image_list))
82
+
83
+
84
+ pcd = o3d.io.read_point_cloud(point_cloud_dir)
85
+
86
+ annotation = json.load(open(point_cloud_annotation_dir))
87
+ for annotation_data in annotation['annotations']:
88
+ if annotation_data['label'] == label:
89
+ affordance_idx = annotation_data['indices']
90
+
91
+
92
+ # color affordance red
93
+ colors[affordance_idx] = [1, 0, 0]
94
+ pcd = pcd.select_by_index(affordance_idx)
95
+ pcd.colors = o3d.utility.Vector3dVector(colors)
96
+
97
+ # render scene
98
+ vis = o3d.visualization.Visualizer()
99
+ vis.create_window(width=800, height=800, visible=False)
100
+ vis.add_geometry(pcd)
101
+ vis.poll_events()
102
+ vis.update_renderer()
103
+
104
+ scene_img = np.asarray(vis.capture_screen_float_buffer())
105
+ scene_img = (scene_img * 255).astype(np.uint8)
106
+ scene_img = cv2.cvtColor(scene_img, cv2.COLOR_RGB2BGR)
107
+
108
+ vis.destroy_window()
109
+
110
+ # load demonstration image
111
+ demo_img = cv2.imread(image_dir)
112
+
113
+ # resize to same height
114
+ h = min(scene_img.shape[0], demo_img.shape[0])
115
+
116
+ scene_img = cv2.resize(
117
+ scene_img,
118
+ (int(scene_img.shape[1] * h / scene_img.shape[0]), h)
119
+ )
120
+
121
+ demo_img = cv2.resize(
122
+ demo_img,
123
+ (int(demo_img.shape[1] * h / demo_img.shape[0]), h)
124
+ )
125
+
126
+ # concatenate
127
+ combined = np.hstack([scene_img, demo_img])
128
+
129
+ cv2.imshow("Visualization", combined)
130
+ cv2.waitKey(0)
131
+ exit()
132
+ ```
133
+ ![](docs/visualization.png)
134
+
135
+ ## Progress
136
+ - **AffordBridge Dataset release**: ✅
137
+ - **Detailed reasoning descriptions**: TBD
138
+
139
+
140
  ## Citation
141
  If you find this work interesting and helpful, please consider citing
142
  ```
 
147
  booktitle = {CVPR},
148
  }
149
  ```
 
150
  ## License
151
  MIT License