Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/config/kitti_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
BEV_WIDTH = 608 # across y axis -25m ~ 25m
BEV_HEIGHT = 608 # across x axis 0m ~ 50m

DISCRETIZATION = (boundary["maxX"] - boundary["minX"]) / BEV_HEIGHT
DISCRETIZATION_X = (boundary["maxX"] - boundary["minX"]) / BEV_HEIGHT
DISCRETIZATION_Y = (boundary["maxY"] - boundary["minY"]) / BEV_WIDTH

colors = [[0, 255, 255], [0, 0, 255], [255, 0, 0]]

Expand Down
10 changes: 7 additions & 3 deletions src/data_process/kitti_bev_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,18 @@ def removePoints(PointCloud, BoundaryCond):
return PointCloud


def makeBVFeature(PointCloud_, Discretization, bc):
def makeBVFeature(PointCloud_, Discretization_X, Discretization_Y, bc):
Height = cnf.BEV_HEIGHT + 1
Width = cnf.BEV_WIDTH + 1

# Discretize Feature Map
PointCloud = np.copy(PointCloud_)
PointCloud[:, 0] = np.int_(np.floor(PointCloud[:, 0] / Discretization))
PointCloud[:, 1] = np.int_(np.floor(PointCloud[:, 1] / Discretization) + Width / 2)

offset_x = np.int_(np.floor(bc['minX'] / Discretization_X))
offset_y = np.int_(np.floor(bc['minY'] / Discretization_Y))

PointCloud[:, 0] = np.int_(np.floor(PointCloud[:, 0] / Discretization_X)) - offset_x
PointCloud[:, 1] = np.int_(np.floor(PointCloud[:, 1] / Discretization_Y)) - offset_y

# sort-3times
indices = np.lexsort((-PointCloud[:, 2], PointCloud[:, 1], PointCloud[:, 0]))
Expand Down
4 changes: 2 additions & 2 deletions src/data_process/kitti_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def load_img_only(self, index):
sample_id = int(self.sample_id_list[index])
lidarData = self.get_lidar(sample_id)
b = kitti_bev_utils.removePoints(lidarData, cnf.boundary)
rgb_map = kitti_bev_utils.makeBVFeature(b, cnf.DISCRETIZATION, cnf.boundary)
rgb_map = kitti_bev_utils.makeBVFeature(b, cnf.DISCRETIZATION_X, cnf.DISCRETIZATION_Y, cnf.boundary)
img_file = os.path.join(self.image_dir, '{:06d}.png'.format(sample_id))

return img_file, rgb_map
Expand All @@ -103,7 +103,7 @@ def load_img_with_targets(self, index):
lidarData, labels[:, 1:] = self.lidar_transforms(lidarData, labels[:, 1:])

b = kitti_bev_utils.removePoints(lidarData, cnf.boundary)
rgb_map = kitti_bev_utils.makeBVFeature(b, cnf.DISCRETIZATION, cnf.boundary)
rgb_map = kitti_bev_utils.makeBVFeature(b, cnf.DISCRETIZATION_X, cnf.DISCRETIZATION_Y, cnf.boundary)
target = kitti_bev_utils.build_yolo_target(labels)
img_file = os.path.join(self.image_dir, '{:06d}.png'.format(sample_id))

Expand Down