Spaces:
Runtime error
Runtime error
jens
commited on
Commit
·
ca166b1
1
Parent(s):
b66242e
debug
Browse files- inference.py +4 -0
inference.py
CHANGED
|
@@ -39,7 +39,9 @@ class DepthPredictor:
|
|
| 39 |
return output
|
| 40 |
|
| 41 |
def generate_pcl(self, image):
|
|
|
|
| 42 |
depth = self.predict(image)
|
|
|
|
| 43 |
# Step 2: Create an RGBD image from the RGB and depth image
|
| 44 |
depth_o3d = o3d.geometry.Image(depth)
|
| 45 |
image_o3d = o3d.geometry.Image(np.array(image))
|
|
@@ -49,6 +51,7 @@ class DepthPredictor:
|
|
| 49 |
# Step 4: Convert PointCloud data to a NumPy array
|
| 50 |
points = np.asarray(pcd.points)
|
| 51 |
colors = np.asarray(pcd.colors)
|
|
|
|
| 52 |
return points, colors
|
| 53 |
|
| 54 |
def generate_fig(self, image):
|
|
@@ -94,6 +97,7 @@ class DepthPredictor:
|
|
| 94 |
def generate_obj_masks(self, image, n_samples, masks, cube_size):
|
| 95 |
# Generate a point cloud
|
| 96 |
point_cloud, color_array = self.generate_pcl(image)
|
|
|
|
| 97 |
mesh = o3d.geometry.TriangleMesh()
|
| 98 |
# Create cubes and add them to the mesh
|
| 99 |
cs = [(255,0,0),(0,255,0),(0,0,255)]
|
|
|
|
| 39 |
return output
|
| 40 |
|
| 41 |
def generate_pcl(self, image):
|
| 42 |
+
print(image.shape)
|
| 43 |
depth = self.predict(image)
|
| 44 |
+
print(depth.shape)
|
| 45 |
# Step 2: Create an RGBD image from the RGB and depth image
|
| 46 |
depth_o3d = o3d.geometry.Image(depth)
|
| 47 |
image_o3d = o3d.geometry.Image(np.array(image))
|
|
|
|
| 51 |
# Step 4: Convert PointCloud data to a NumPy array
|
| 52 |
points = np.asarray(pcd.points)
|
| 53 |
colors = np.asarray(pcd.colors)
|
| 54 |
+
print(points.shape, colors.shape)
|
| 55 |
return points, colors
|
| 56 |
|
| 57 |
def generate_fig(self, image):
|
|
|
|
| 97 |
def generate_obj_masks(self, image, n_samples, masks, cube_size):
|
| 98 |
# Generate a point cloud
|
| 99 |
point_cloud, color_array = self.generate_pcl(image)
|
| 100 |
+
print(point_cloud.shape)
|
| 101 |
mesh = o3d.geometry.TriangleMesh()
|
| 102 |
# Create cubes and add them to the mesh
|
| 103 |
cs = [(255,0,0),(0,255,0),(0,0,255)]
|