0
0
Computer Visionml~10 mins

3D object detection in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to load a 3D point cloud from a file.

Computer Vision
import open3d as o3d

point_cloud = o3d.io.read_point_cloud([1])
print(point_cloud)
Drag options to blanks, or click blank then click option'
Apointcloud
B12345
CNone
D"data/pointcloud.pcd"
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a number instead of a string path.
Forgetting to put quotes around the file path.
2fill in blank
medium

Complete the code to create a 3D bounding box from a point cloud.

Computer Vision
bbox = point_cloud.get_axis_aligned_bounding_box()
print(bbox.[1]())
Drag options to blanks, or click blank then click option'
Aarea
Bvolume
Clength
Dcenter
Attempts:
3 left
💡 Hint
Common Mistakes
Using area() which is for 2D shapes.
Using center() which returns a point, not a size.
3fill in blank
hard

Fix the error in the code to visualize the point cloud with bounding box.

Computer Vision
import open3d as o3d

vis = o3d.visualization.Visualizer()
vis.create_window()
vis.add_geometry(point_cloud)
vis.add_geometry([1])
vis.run()
vis.destroy_window()
Drag options to blanks, or click blank then click option'
Abbox
BNone
Co3d.geometry.PointCloud()
Dpoint_cloud
Attempts:
3 left
💡 Hint
Common Mistakes
Adding the point cloud twice instead of the bounding box.
Adding None or creating a new empty geometry.
4fill in blank
hard

Fill both blanks to filter points inside the bounding box.

Computer Vision
points = np.asarray(point_cloud.points)
mask = (points[:, [1]] >= bbox.min_bound[[2]]) & (points[:, [1]] <= bbox.max_bound[[2]])
filtered_points = points[mask]
Drag options to blanks, or click blank then click option'
A0
B1
C2
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using different indices for points and bounding box bounds.
Using an invalid axis index like 3.
5fill in blank
hard

Fill all three blanks to train a simple 3D object detection model using PyTorch.

Computer Vision
import torch
import torch.nn as nn

class Simple3DDetector(nn.Module):
    def __init__(self):
        super().__init__()
        self.fc1 = nn.Linear([1], 64)
        self.relu = nn.ReLU()
        self.fc2 = nn.Linear(64, [2])

    def forward(self, x):
        x = self.relu(self.fc1(x))
        x = self.fc2(x)
        return x

model = Simple3DDetector()
input_tensor = torch.randn(10, [3])
output = model(input_tensor)
print(output.shape)
Drag options to blanks, or click blank then click option'
A3
B2
C5
D10
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatching input tensor size with model input layer.
Wrong output size for classification.