Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- configs/dry/cambogan_20250812_122101.yaml +1 -1
- configs/dry/cambogan_20250812_122339.yaml +1 -1
- configs/dry/cambogan_20250812_122621.yaml +1 -1
- configs/dry/dairycreek_20250812_122954.yaml +1 -1
- configs/dry/dairycreek_20250812_123312.yaml +1 -1
- configs/dry/holmview_20250812_120100.yaml +1 -1
- configs/dry/holmview_20250812_120856.yaml +1 -1
- configs/dry/pullenvale_20250812_134316.yaml +1 -1
- configs/dry/pullenvale_20250812_134524.yaml +1 -1
- configs/flooded/cambogan.yaml +1 -1
- configs/flooded/dairycreek.yaml +1 -1
- configs/flooded/holmview.yaml +1 -1
- configs/flooded/mountcotton.yaml +1 -1
- configs/flooded/pullenvale.yaml +1 -1
- lidar_postprocessing/create_pointcloud_labels.py +15 -42
- lidar_postprocessing/fill_pointcloud_gaps.py +16 -26
- lidar_postprocessing/project_water_label.py +15 -7
- localisation/VPR_eval-all.py +6 -23
- localisation/groundtruth_utm_checker-all.py +26 -9
- segmentation/evaluate-predictions.py +15 -24
- segmentation/show_labels-all.py +16 -18
- visualisation/points2image-all.py +19 -20
configs/dry/cambogan_20250812_122101.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Cambogan"
|
|
| 2 |
sequence: "20250812_122101"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_122101"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/dry/cambogan_20250812_122339.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Cambogan"
|
|
| 2 |
sequence: "20250812_122339"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_122339"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/dry/cambogan_20250812_122621.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Cambogan"
|
|
| 2 |
sequence: "20250812_122621"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_122621"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/dry/dairycreek_20250812_122954.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Dairy-Creek"
|
|
| 2 |
sequence: "20250812_122954"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_122954"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/dry/dairycreek_20250812_123312.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Dairy-Creek"
|
|
| 2 |
sequence: "20250812_120856"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_120856"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/dry/holmview_20250812_120100.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Holmview"
|
|
| 2 |
sequence: "20250812_120100"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_120100"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/dry/holmview_20250812_120856.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Holmview"
|
|
| 2 |
sequence: "20250812_120100"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_120100"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/dry/pullenvale_20250812_134316.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Pullenvale"
|
|
| 2 |
sequence: "20250812_134316"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_134316"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/dry/pullenvale_20250812_134524.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Pullenvale"
|
|
| 2 |
sequence: "20250812_134524"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250812_134524"
|
| 3 |
condition: "dry"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/flooded/cambogan.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Cambogan"
|
|
| 2 |
sequence: "20250811_113017"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250811_113017"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/flooded/dairycreek.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "DairyCreek"
|
|
| 2 |
sequence: "20250811_103318"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250811_103318"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/flooded/holmview.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Holmview"
|
|
| 2 |
sequence: "20250820_130327"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250820_130327"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/flooded/mountcotton.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Mount-Cotton"
|
|
| 2 |
sequence: "20241217_113410"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20241217_113410"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
configs/flooded/pullenvale.yaml
CHANGED
|
@@ -2,5 +2,5 @@ location: "Pullenvale"
|
|
| 2 |
sequence: "20250916_124105"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
-
root: "
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
|
|
|
| 2 |
sequence: "20250916_124105"
|
| 3 |
condition: "flooded"
|
| 4 |
camera_pos: "front"
|
| 5 |
+
root: "/data/FRED/"
|
| 6 |
img_calib_file: "./camera_calib.txt"
|
lidar_postprocessing/create_pointcloud_labels.py
CHANGED
|
@@ -12,20 +12,29 @@ from utils.camera import ImageData
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
cmap = plt.get_cmap("jet")
|
| 16 |
LABEL_UNKNOWN = -1
|
| 17 |
|
| 18 |
# User parameters
|
| 19 |
location = 'Cambogan'
|
| 20 |
sequence = '20250811_113017'
|
| 21 |
-
# location = 'Holmview'
|
| 22 |
-
# sequence = '20250820_130327'
|
| 23 |
-
# location = 'Mount-Cotton'
|
| 24 |
-
# sequence = '20241217_113410'
|
| 25 |
condition = 'flooded'
|
| 26 |
camera_pos = 'front'
|
| 27 |
-
root_directory = f"
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
############ Define filenames and directories ####################################
|
| 31 |
|
|
@@ -41,10 +50,8 @@ timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(ima
|
|
| 41 |
groundplane_eqn = tuple(np.loadtxt(f"{root_directory}/{location}_{sequence}/ground_plane_eqn.txt"))
|
| 42 |
a, b, c, d = groundplane_eqn
|
| 43 |
|
| 44 |
-
# timestamps.sort()
|
| 45 |
|
| 46 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 47 |
-
# idx = [0] # mutable index
|
| 48 |
idx = [183]
|
| 49 |
|
| 50 |
def show_image(i):
|
|
@@ -83,43 +90,9 @@ def show_image(i):
|
|
| 83 |
|
| 84 |
img_vis, uv, valid_img = image.project_points(all_points_cam, semantic_labels, cmap, valid_cam) #, beam_id, azimuth
|
| 85 |
|
| 86 |
-
# filtered_points = pointcloud.points[(semantic_labels==0) & (abs(pointcloud.points[:,1]) < 1),:]
|
| 87 |
-
# max_lookahead = filtered_points[:,0].max()
|
| 88 |
-
# far_points = filtered_points[filtered_points[:,0]==max_lookahead,:]
|
| 89 |
-
|
| 90 |
-
# if far_points.shape[0] > 1:
|
| 91 |
-
# far_point = far_points[abs(far_points[:,1]) == abs(far_points[:,1]).min(),:]
|
| 92 |
-
# else:
|
| 93 |
-
# far_point = far_points
|
| 94 |
-
# far_point_cam, far_point_distnace, far_point_intensity = pointcloud.select_points_ouster_to_cam(far_point)
|
| 95 |
-
# far_pixel = image.get_image_coords(far_point_cam)
|
| 96 |
-
|
| 97 |
-
# if far_pixel is not None and len(far_pixel) > 0:
|
| 98 |
-
# u, v = far_pixel[0] # pixel coordinates
|
| 99 |
-
|
| 100 |
-
# h, w = img_vis.shape[:2]
|
| 101 |
-
# bottom_center = (w // 2, h)
|
| 102 |
-
|
| 103 |
-
# ax.plot(
|
| 104 |
-
# [bottom_center[0], u],
|
| 105 |
-
# [bottom_center[1], v],
|
| 106 |
-
# color="lime",
|
| 107 |
-
# linewidth=2
|
| 108 |
-
# )
|
| 109 |
-
# ax.text(
|
| 110 |
-
# u,
|
| 111 |
-
# v - 10,
|
| 112 |
-
# f"{far_point[0,0]:.2f}",
|
| 113 |
-
# color="lime",
|
| 114 |
-
# fontsize=12,
|
| 115 |
-
# ha="center",
|
| 116 |
-
# bbox=dict(facecolor="black", alpha=0.6, edgecolor="none")
|
| 117 |
-
# )
|
| 118 |
-
|
| 119 |
ax.imshow(img_vis[:, :, ::-1])
|
| 120 |
ax.set_title(f"{image_timestamp}.png")
|
| 121 |
ax.axis("off")
|
| 122 |
-
# plt.savefig('paper_figures/labelled_pointcloud.pdf', format="pdf", bbox_inches='tight')
|
| 123 |
fig.canvas.draw()
|
| 124 |
|
| 125 |
except Exception as e:
|
|
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
| 15 |
+
hf_app = True
|
| 16 |
+
|
| 17 |
+
if hf_app:
|
| 18 |
+
from huggingface_hub import snapshot_download
|
| 19 |
+
|
| 20 |
cmap = plt.get_cmap("jet")
|
| 21 |
LABEL_UNKNOWN = -1
|
| 22 |
|
| 23 |
# User parameters
|
| 24 |
location = 'Cambogan'
|
| 25 |
sequence = '20250811_113017'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
condition = 'flooded'
|
| 27 |
camera_pos = 'front'
|
| 28 |
+
root_directory = f"/data/FRED/{condition}/KITTI-style"
|
| 29 |
+
|
| 30 |
+
if (not os.path.exists(root_directory)) and (hf_app):
|
| 31 |
+
snapshot_download(
|
| 32 |
+
repo_id="CMalone-Jupiter/FRED",
|
| 33 |
+
repo_type="dataset",
|
| 34 |
+
local_dir="/data/FRED",
|
| 35 |
+
allow_patterns=f"{condition}/KITTI-style/{location}_{sequence}/**",
|
| 36 |
+
token=os.environ.get("HF_TOKEN")
|
| 37 |
+
)
|
| 38 |
|
| 39 |
############ Define filenames and directories ####################################
|
| 40 |
|
|
|
|
| 50 |
groundplane_eqn = tuple(np.loadtxt(f"{root_directory}/{location}_{sequence}/ground_plane_eqn.txt"))
|
| 51 |
a, b, c, d = groundplane_eqn
|
| 52 |
|
|
|
|
| 53 |
|
| 54 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
|
|
|
| 55 |
idx = [183]
|
| 56 |
|
| 57 |
def show_image(i):
|
|
|
|
| 90 |
|
| 91 |
img_vis, uv, valid_img = image.project_points(all_points_cam, semantic_labels, cmap, valid_cam) #, beam_id, azimuth
|
| 92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
ax.imshow(img_vis[:, :, ::-1])
|
| 94 |
ax.set_title(f"{image_timestamp}.png")
|
| 95 |
ax.axis("off")
|
|
|
|
| 96 |
fig.canvas.draw()
|
| 97 |
|
| 98 |
except Exception as e:
|
lidar_postprocessing/fill_pointcloud_gaps.py
CHANGED
|
@@ -12,20 +12,29 @@ from utils.camera import ImageData
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
cmap = plt.get_cmap("jet")
|
| 16 |
LABEL_UNKNOWN = -1
|
| 17 |
|
| 18 |
# User parameters
|
| 19 |
location = 'Cambogan'
|
| 20 |
sequence = '20250811_113017'
|
| 21 |
-
# location = 'Holmview'
|
| 22 |
-
# sequence = '20250820_130327'
|
| 23 |
-
# location = 'Mount-Cotton'
|
| 24 |
-
# sequence = '20241217_113410'
|
| 25 |
condition = 'flooded'
|
| 26 |
camera_pos = 'front'
|
| 27 |
-
root_directory = f"
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
############ Define filenames and directories ####################################
|
| 31 |
|
|
@@ -41,12 +50,9 @@ timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(ima
|
|
| 41 |
groundplane_eqn = tuple(np.loadtxt(f"{root_directory}/{location}_{sequence}/ground_plane_eqn.txt"))
|
| 42 |
a, b, c, d = groundplane_eqn
|
| 43 |
|
| 44 |
-
# timestamps.sort()
|
| 45 |
|
| 46 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 47 |
|
| 48 |
-
# idx = [0] # mutable index
|
| 49 |
-
# idx = [0]
|
| 50 |
idx = [160]
|
| 51 |
|
| 52 |
def show_image(i):
|
|
@@ -62,10 +68,7 @@ def show_image(i):
|
|
| 62 |
|
| 63 |
image = ImageData(image_filename, img_calib_file, label_filename)
|
| 64 |
pointcloud = PointCloud(lidar_filename, lidar_calib_file)
|
| 65 |
-
|
| 66 |
-
# # print(f"Nan's in pointcloud? {np.any( == np.nan)}")
|
| 67 |
-
# print(f"Number of zeroed points: {np.sum(np.all(pointcloud.points == 0, axis=1))}")
|
| 68 |
-
# print(f"invalid points in ground plane: {np.sum(pointcloud.ground_semantic[np.all(pointcloud.points == 0, axis=1)]==0)}")
|
| 69 |
pointcloud.points, pointcloud.ground_semantic, pointcloud.ground_inlier = pointcloud.destagger() #pointcloud.points, pointcloud.ground_semantic, pointcloud.ground_inlier
|
| 70 |
groundplane_eqn = utils.fit_height_field_linear(pointcloud.points[pointcloud.ground_semantic==0,:3])
|
| 71 |
pointcloud.points, interp_flags = utils.complete_cloud(pointcloud.points, groundplane_eqn)
|
|
@@ -74,20 +77,7 @@ def show_image(i):
|
|
| 74 |
|
| 75 |
point_cam, distances_cam, intensities_cam, all_points_cam, valid_cam = pointcloud.points_ouster_to_cam() #, beam_id, azimuth
|
| 76 |
img_vis, uv, valid_img, _ = image.project_points(all_points_cam, intensities_cam, cmap, valid_cam, colour_norm=255) #, beam_id, azimuth
|
| 77 |
-
# semantic_labels = interp_flags.astype(int) + 1
|
| 78 |
-
|
| 79 |
-
# labels_norm = semantic_labels.astype(np.float64) / semantic_labels.max()
|
| 80 |
-
|
| 81 |
-
# colors = np.stack(
|
| 82 |
-
# (labels_norm, np.zeros(labels_norm.shape[0]), np.zeros(labels_norm.shape[0])),
|
| 83 |
-
# axis=1
|
| 84 |
-
# ) # shape (N, 3)
|
| 85 |
-
|
| 86 |
-
# pcd = o3d.geometry.PointCloud()
|
| 87 |
-
# pcd.points = o3d.utility.Vector3dVector(pointcloud.points[:,:3])
|
| 88 |
|
| 89 |
-
# pcd.colors = o3d.utility.Vector3dVector(colors)
|
| 90 |
-
# o3d.visualization.draw_geometries([pcd,])
|
| 91 |
ax.imshow(img_vis[:,:,::-1])
|
| 92 |
ax.set_title(f"{i+1}/{len(timestamps)} — {image_timestamp}.png\n(close window or press any key to continue)")
|
| 93 |
ax.axis("off")
|
|
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
| 15 |
+
hf_app = True
|
| 16 |
+
|
| 17 |
+
if hf_app:
|
| 18 |
+
from huggingface_hub import snapshot_download
|
| 19 |
+
|
| 20 |
cmap = plt.get_cmap("jet")
|
| 21 |
LABEL_UNKNOWN = -1
|
| 22 |
|
| 23 |
# User parameters
|
| 24 |
location = 'Cambogan'
|
| 25 |
sequence = '20250811_113017'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
condition = 'flooded'
|
| 27 |
camera_pos = 'front'
|
| 28 |
+
root_directory = f"/data/FRED/{condition}/KITTI-style"
|
| 29 |
+
|
| 30 |
+
if (not os.path.exists(root_directory)) and (hf_app):
|
| 31 |
+
snapshot_download(
|
| 32 |
+
repo_id="CMalone-Jupiter/FRED",
|
| 33 |
+
repo_type="dataset",
|
| 34 |
+
local_dir="/data/FRED",
|
| 35 |
+
allow_patterns=f"{condition}/KITTI-style/{location}_{sequence}/**",
|
| 36 |
+
token=os.environ.get("HF_TOKEN")
|
| 37 |
+
)
|
| 38 |
|
| 39 |
############ Define filenames and directories ####################################
|
| 40 |
|
|
|
|
| 50 |
groundplane_eqn = tuple(np.loadtxt(f"{root_directory}/{location}_{sequence}/ground_plane_eqn.txt"))
|
| 51 |
a, b, c, d = groundplane_eqn
|
| 52 |
|
|
|
|
| 53 |
|
| 54 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 55 |
|
|
|
|
|
|
|
| 56 |
idx = [160]
|
| 57 |
|
| 58 |
def show_image(i):
|
|
|
|
| 68 |
|
| 69 |
image = ImageData(image_filename, img_calib_file, label_filename)
|
| 70 |
pointcloud = PointCloud(lidar_filename, lidar_calib_file)
|
| 71 |
+
|
|
|
|
|
|
|
|
|
|
| 72 |
pointcloud.points, pointcloud.ground_semantic, pointcloud.ground_inlier = pointcloud.destagger() #pointcloud.points, pointcloud.ground_semantic, pointcloud.ground_inlier
|
| 73 |
groundplane_eqn = utils.fit_height_field_linear(pointcloud.points[pointcloud.ground_semantic==0,:3])
|
| 74 |
pointcloud.points, interp_flags = utils.complete_cloud(pointcloud.points, groundplane_eqn)
|
|
|
|
| 77 |
|
| 78 |
point_cam, distances_cam, intensities_cam, all_points_cam, valid_cam = pointcloud.points_ouster_to_cam() #, beam_id, azimuth
|
| 79 |
img_vis, uv, valid_img, _ = image.project_points(all_points_cam, intensities_cam, cmap, valid_cam, colour_norm=255) #, beam_id, azimuth
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
|
|
|
|
|
|
| 81 |
ax.imshow(img_vis[:,:,::-1])
|
| 82 |
ax.set_title(f"{i+1}/{len(timestamps)} — {image_timestamp}.png\n(close window or press any key to continue)")
|
| 83 |
ax.axis("off")
|
lidar_postprocessing/project_water_label.py
CHANGED
|
@@ -12,19 +12,28 @@ from utils.camera import ImageData
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
cmap = plt.get_cmap("jet")
|
| 16 |
|
| 17 |
# User parameters
|
| 18 |
location = 'Cambogan'
|
| 19 |
sequence = '20250811_113017'
|
| 20 |
-
# location = 'Holmview'
|
| 21 |
-
# sequence = '20250820_130327'
|
| 22 |
-
# location = 'Mount-Cotton'
|
| 23 |
-
# sequence = '20241217_113410'
|
| 24 |
condition = 'flooded'
|
| 25 |
camera_pos = 'front'
|
| 26 |
-
root_directory = f"
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
############ Define filenames and directories ####################################
|
| 30 |
|
|
@@ -37,7 +46,6 @@ lidar_calib_file = f"./calib.txt"
|
|
| 37 |
|
| 38 |
timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(image_dir)) if os.path.isfile(image_dir+filename)]
|
| 39 |
|
| 40 |
-
# timestamps.sort()
|
| 41 |
|
| 42 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 43 |
idx = [0] # mutable index
|
|
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
| 15 |
+
hf_app = True
|
| 16 |
+
|
| 17 |
+
if hf_app:
|
| 18 |
+
from huggingface_hub import snapshot_download
|
| 19 |
+
|
| 20 |
cmap = plt.get_cmap("jet")
|
| 21 |
|
| 22 |
# User parameters
|
| 23 |
location = 'Cambogan'
|
| 24 |
sequence = '20250811_113017'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
condition = 'flooded'
|
| 26 |
camera_pos = 'front'
|
| 27 |
+
root_directory = f"/data/FRED/{condition}/KITTI-style"
|
| 28 |
+
|
| 29 |
+
if (not os.path.exists(root_directory)) and (hf_app):
|
| 30 |
+
snapshot_download(
|
| 31 |
+
repo_id="CMalone-Jupiter/FRED",
|
| 32 |
+
repo_type="dataset",
|
| 33 |
+
local_dir="/data/FRED",
|
| 34 |
+
allow_patterns=f"{condition}/KITTI-style/{location}_{sequence}/**",
|
| 35 |
+
token=os.environ.get("HF_TOKEN")
|
| 36 |
+
)
|
| 37 |
|
| 38 |
############ Define filenames and directories ####################################
|
| 39 |
|
|
|
|
| 46 |
|
| 47 |
timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(image_dir)) if os.path.isfile(image_dir+filename)]
|
| 48 |
|
|
|
|
| 49 |
|
| 50 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 51 |
idx = [0] # mutable index
|
localisation/VPR_eval-all.py
CHANGED
|
@@ -14,6 +14,12 @@ from natsort import natsorted, index_natsorted
|
|
| 14 |
import torch
|
| 15 |
from tqdm import tqdm
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
################## set device based on cuda availability #################
|
| 18 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 19 |
|
|
@@ -99,15 +105,8 @@ dist_tolerance = 10 # metres
|
|
| 99 |
# qry_idx = 4
|
| 100 |
|
| 101 |
# User parameters
|
| 102 |
-
# vpr_desc = 'cosplace'
|
| 103 |
-
# location = 'Holmview'
|
| 104 |
-
# location = 'Cambogan'
|
| 105 |
|
| 106 |
################ Reference filenames and directories #################################
|
| 107 |
-
# ref_sequence = '20250812_120100'
|
| 108 |
-
# 20250812_120856
|
| 109 |
-
# ref_sequence = '20250812_122339'
|
| 110 |
-
# 20250812_122621
|
| 111 |
ref_condition = 'dry'
|
| 112 |
ref_camera_pos = 'front'
|
| 113 |
|
|
@@ -160,14 +159,7 @@ for vpr_desc in vpr_descs:
|
|
| 160 |
for qry_set in qry_sets:
|
| 161 |
|
| 162 |
################ Query filenames and directories #################################
|
| 163 |
-
# qry_sequence = '20250820_130327'
|
| 164 |
-
# qry_sequence = '20250812_120856'
|
| 165 |
-
###
|
| 166 |
-
# qry_sequence = '20250811_113017'
|
| 167 |
-
# qry_sequence = '20250812_122621'
|
| 168 |
qry_condition = 'flooded'
|
| 169 |
-
# qry_sequence = '20250812_122339'
|
| 170 |
-
# qry_condition = 'dry'
|
| 171 |
qry_camera_pos = 'front'
|
| 172 |
qry_root_directory = f"../Datasets/FRED/{qry_condition}/KITTI-style"
|
| 173 |
qry_vpr_root = f"../Datasets/FRED/vpr_ftrs/{qry_condition}/KITTI-style"
|
|
@@ -192,12 +184,6 @@ for vpr_desc in vpr_descs:
|
|
| 192 |
qry_utm_timestamp = utils.get_corr_files(qry_image_timestamp, [qry_utm_dir,])
|
| 193 |
qry_utm = np.loadtxt(qry_utm_timestamp)
|
| 194 |
|
| 195 |
-
# print(f"Number of queries: {len(qry_timestamps)}")
|
| 196 |
-
# print(f"Number of references{ {len(ref_timestamps)}}")
|
| 197 |
-
# print(f"Matche {mInds[qry_idx]}")
|
| 198 |
-
# print(natsorted(os.listdir(qry_image_dir)))
|
| 199 |
-
# print(os.listdir(qry_image_dir))
|
| 200 |
-
|
| 201 |
diffs = ref_utms - qry_utm # shape (N, 2)
|
| 202 |
qry_dists = np.linalg.norm(diffs, axis=1) # shape (N,)
|
| 203 |
if qry_dists.min() > dist_tolerance:
|
|
@@ -205,9 +191,6 @@ for vpr_desc in vpr_descs:
|
|
| 205 |
else:
|
| 206 |
valid_qry += 1
|
| 207 |
|
| 208 |
-
|
| 209 |
-
# ref_utm_timestamp = utils.get_corr_files(ref_timestamps[int(mInds[qry_idx])], [ref_utm_dir,])
|
| 210 |
-
# ref_utm = np.loadtxt(ref_utm_timestamp)
|
| 211 |
ref_utm = np.loadtxt(ref_utm_filenames[int(mInds[qry_idx])])
|
| 212 |
|
| 213 |
diff = ref_utm - qry_utm # shape (N, 2)
|
|
|
|
| 14 |
import torch
|
| 15 |
from tqdm import tqdm
|
| 16 |
|
| 17 |
+
# Toggle the following boolean to False if not using HuggingFace App
|
| 18 |
+
hf_app = True
|
| 19 |
+
|
| 20 |
+
if hf_app:
|
| 21 |
+
from huggingface_hub import snapshot_download
|
| 22 |
+
|
| 23 |
################## set device based on cuda availability #################
|
| 24 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
| 25 |
|
|
|
|
| 105 |
# qry_idx = 4
|
| 106 |
|
| 107 |
# User parameters
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
################ Reference filenames and directories #################################
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
ref_condition = 'dry'
|
| 111 |
ref_camera_pos = 'front'
|
| 112 |
|
|
|
|
| 159 |
for qry_set in qry_sets:
|
| 160 |
|
| 161 |
################ Query filenames and directories #################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
qry_condition = 'flooded'
|
|
|
|
|
|
|
| 163 |
qry_camera_pos = 'front'
|
| 164 |
qry_root_directory = f"../Datasets/FRED/{qry_condition}/KITTI-style"
|
| 165 |
qry_vpr_root = f"../Datasets/FRED/vpr_ftrs/{qry_condition}/KITTI-style"
|
|
|
|
| 184 |
qry_utm_timestamp = utils.get_corr_files(qry_image_timestamp, [qry_utm_dir,])
|
| 185 |
qry_utm = np.loadtxt(qry_utm_timestamp)
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
diffs = ref_utms - qry_utm # shape (N, 2)
|
| 188 |
qry_dists = np.linalg.norm(diffs, axis=1) # shape (N,)
|
| 189 |
if qry_dists.min() > dist_tolerance:
|
|
|
|
| 191 |
else:
|
| 192 |
valid_qry += 1
|
| 193 |
|
|
|
|
|
|
|
|
|
|
| 194 |
ref_utm = np.loadtxt(ref_utm_filenames[int(mInds[qry_idx])])
|
| 195 |
|
| 196 |
diff = ref_utm - qry_utm # shape (N, 2)
|
localisation/groundtruth_utm_checker-all.py
CHANGED
|
@@ -12,29 +12,50 @@ from utils.camera import ImageData
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
cmap = plt.get_cmap("jet")
|
| 16 |
|
| 17 |
# User parameters
|
| 18 |
-
# location = 'Holmview'
|
| 19 |
location = 'Cambogan'
|
| 20 |
|
| 21 |
################ Query filenames and directories #################################
|
| 22 |
-
# qry_sequence = '20250820_130327'
|
| 23 |
qry_sequence = '20250811_113017'
|
| 24 |
qry_condition = 'flooded'
|
| 25 |
qry_camera_pos = 'front'
|
| 26 |
-
qry_root_directory = f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
qry_image_dir = f"{qry_root_directory}/{location}_{qry_sequence}/{qry_camera_pos}-imgs/"
|
| 29 |
qry_utm_dir = f"{qry_root_directory}/{location}_{qry_sequence}/utm/"
|
| 30 |
qry_timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(qry_image_dir)) if os.path.isfile(qry_image_dir+filename)]
|
| 31 |
|
| 32 |
################ Reference filenames and directories #################################
|
| 33 |
-
# ref_sequence = '20250812_120100'
|
| 34 |
ref_sequence = '20250812_122339'
|
| 35 |
ref_condition = 'dry'
|
| 36 |
ref_camera_pos = 'front'
|
| 37 |
-
ref_root_directory = f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
ref_image_dir = f"{ref_root_directory}/{location}_{ref_sequence}/{ref_camera_pos}-imgs/"
|
| 40 |
ref_utm_dir = f"{ref_root_directory}/{location}_{ref_sequence}/utm/"
|
|
@@ -48,8 +69,6 @@ dist_tolerance = 10 # metres
|
|
| 48 |
|
| 49 |
|
| 50 |
fig, ax = plt.subplots(1, 2, figsize=(19.4, 6))
|
| 51 |
-
# idx = [0] # mutable index
|
| 52 |
-
# idx = [183]
|
| 53 |
idx = [130]-
|
| 54 |
|
| 55 |
def show_image(i):
|
|
@@ -59,7 +78,6 @@ def show_image(i):
|
|
| 59 |
plt.close(fig)
|
| 60 |
return
|
| 61 |
qry_image_timestamp = qry_timestamps[i]
|
| 62 |
-
# try:
|
| 63 |
qry_image_filename = f"{qry_image_dir}/{qry_image_timestamp}.png"
|
| 64 |
qry_utm_timestamp = utils.get_corr_files(qry_image_timestamp, [qry_utm_dir,])
|
| 65 |
qry_utm = np.loadtxt(qry_utm_timestamp)
|
|
@@ -94,7 +112,6 @@ def show_image(i):
|
|
| 94 |
ax[1].set_title(f"No Match (min dist={closest_dist:.2f}m)")
|
| 95 |
|
| 96 |
ax[1].axis("off")
|
| 97 |
-
# plt.savefig('paper_figures/localization_check.pdf', format="pdf", bbox_inches='tight')
|
| 98 |
fig.canvas.draw()
|
| 99 |
|
| 100 |
def on_key(event):
|
|
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
| 15 |
+
# Toggle the following boolean to False if not using HuggingFace App
|
| 16 |
+
hf_app = True
|
| 17 |
+
|
| 18 |
+
if hf_app:
|
| 19 |
+
from huggingface_hub import snapshot_download
|
| 20 |
+
|
| 21 |
cmap = plt.get_cmap("jet")
|
| 22 |
|
| 23 |
# User parameters
|
|
|
|
| 24 |
location = 'Cambogan'
|
| 25 |
|
| 26 |
################ Query filenames and directories #################################
|
|
|
|
| 27 |
qry_sequence = '20250811_113017'
|
| 28 |
qry_condition = 'flooded'
|
| 29 |
qry_camera_pos = 'front'
|
| 30 |
+
qry_root_directory = f"/data/FRED/{qry_condition}/KITTI-style"
|
| 31 |
+
|
| 32 |
+
if (not os.path.exists(qry_root_directory)) and (hf_app):
|
| 33 |
+
snapshot_download(
|
| 34 |
+
repo_id="CMalone-Jupiter/FRED",
|
| 35 |
+
repo_type="dataset",
|
| 36 |
+
local_dir="/data/FRED",
|
| 37 |
+
allow_patterns=f"{qry_condition}/KITTI-style/{location}_{qry_sequence}/**",
|
| 38 |
+
token=os.environ.get("HF_TOKEN")
|
| 39 |
+
)
|
| 40 |
|
| 41 |
qry_image_dir = f"{qry_root_directory}/{location}_{qry_sequence}/{qry_camera_pos}-imgs/"
|
| 42 |
qry_utm_dir = f"{qry_root_directory}/{location}_{qry_sequence}/utm/"
|
| 43 |
qry_timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(qry_image_dir)) if os.path.isfile(qry_image_dir+filename)]
|
| 44 |
|
| 45 |
################ Reference filenames and directories #################################
|
|
|
|
| 46 |
ref_sequence = '20250812_122339'
|
| 47 |
ref_condition = 'dry'
|
| 48 |
ref_camera_pos = 'front'
|
| 49 |
+
ref_root_directory = f"/data/FRED/{ref_condition}/KITTI-style"
|
| 50 |
+
|
| 51 |
+
if (not os.path.exists(ref_root_directory)) and (hf_app):
|
| 52 |
+
snapshot_download(
|
| 53 |
+
repo_id="CMalone-Jupiter/FRED",
|
| 54 |
+
repo_type="dataset",
|
| 55 |
+
local_dir="/data/FRED",
|
| 56 |
+
allow_patterns=f"{ref_condition}/KITTI-style/{location}_{ref_sequence}/**",
|
| 57 |
+
token=os.environ.get("HF_TOKEN")
|
| 58 |
+
)
|
| 59 |
|
| 60 |
ref_image_dir = f"{ref_root_directory}/{location}_{ref_sequence}/{ref_camera_pos}-imgs/"
|
| 61 |
ref_utm_dir = f"{ref_root_directory}/{location}_{ref_sequence}/utm/"
|
|
|
|
| 69 |
|
| 70 |
|
| 71 |
fig, ax = plt.subplots(1, 2, figsize=(19.4, 6))
|
|
|
|
|
|
|
| 72 |
idx = [130]-
|
| 73 |
|
| 74 |
def show_image(i):
|
|
|
|
| 78 |
plt.close(fig)
|
| 79 |
return
|
| 80 |
qry_image_timestamp = qry_timestamps[i]
|
|
|
|
| 81 |
qry_image_filename = f"{qry_image_dir}/{qry_image_timestamp}.png"
|
| 82 |
qry_utm_timestamp = utils.get_corr_files(qry_image_timestamp, [qry_utm_dir,])
|
| 83 |
qry_utm = np.loadtxt(qry_utm_timestamp)
|
|
|
|
| 112 |
ax[1].set_title(f"No Match (min dist={closest_dist:.2f}m)")
|
| 113 |
|
| 114 |
ax[1].axis("off")
|
|
|
|
| 115 |
fig.canvas.draw()
|
| 116 |
|
| 117 |
def on_key(event):
|
segmentation/evaluate-predictions.py
CHANGED
|
@@ -16,6 +16,12 @@ import json
|
|
| 16 |
import yaml # pip install pyyaml
|
| 17 |
from tqdm import tqdm
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
cmap = plt.get_cmap("jet")
|
| 20 |
|
| 21 |
# ---------------- Argument Parsing ---------------- #
|
|
@@ -27,7 +33,7 @@ parser.add_argument("--location", type=str, default="Cambogan", help="Location n
|
|
| 27 |
parser.add_argument("--sequence", type=str, default="20250811_113017", help="Sequence ID (e.g., 20250811_113017)")
|
| 28 |
parser.add_argument("--condition", type=str, default="flooded", help="Condition (e.g., flooded)")
|
| 29 |
parser.add_argument("--camera_pos", type=str, default="front", help="Camera position (e.g., front)")
|
| 30 |
-
parser.add_argument("--root", type=str, default="
|
| 31 |
parser.add_argument("--masks", type=str, required=True, help="Where predicted masks are saved")
|
| 32 |
parser.add_argument("--img_calib_file", type=str, default="./camera_calib.txt", help="Path to camera calibration file (e.g., ./camera_calib.txt)")
|
| 33 |
parser.add_argument('--vis', action='store_true', help="Store visual comparisons of the predictions and labels")
|
|
@@ -68,19 +74,14 @@ else:
|
|
| 68 |
root_directory = f"{args.root}/{args.condition}/KITTI-style"
|
| 69 |
img_calib_file = args.img_calib_file
|
| 70 |
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
# sequence = '20241217_113410'
|
| 80 |
-
# condition = 'flooded'
|
| 81 |
-
# camera_pos = 'front'
|
| 82 |
-
# root_directory = f"../Datasets/FRED/{condition}/KITTI-style"
|
| 83 |
-
# # 01000000
|
| 84 |
|
| 85 |
############ Define filenames and directories ####################################
|
| 86 |
|
|
@@ -93,7 +94,6 @@ mask_filenames = [filename for filename in natsorted(os.listdir(args.masks)) if
|
|
| 93 |
|
| 94 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 95 |
idx = 0 # mutable index
|
| 96 |
-
# idx = 183 # mutable index
|
| 97 |
|
| 98 |
def load_image_data(i):
|
| 99 |
image_timestamp = timestamps[i]
|
|
@@ -105,7 +105,6 @@ def load_image_data(i):
|
|
| 105 |
|
| 106 |
return water_label.astype(int)
|
| 107 |
|
| 108 |
-
# label_mask = np.any(image.colour_label != image.semantic_classes['other'], axis=-1)
|
| 109 |
except Exception as e:
|
| 110 |
print(f"Could not show label for {image_timestamp}.png: {e}")
|
| 111 |
|
|
@@ -171,21 +170,13 @@ iou_scores = []
|
|
| 171 |
for i in tqdm(range(idx, len(timestamps))):
|
| 172 |
|
| 173 |
img_label = load_image_data(i)
|
| 174 |
-
# print(mask_filenames[i])
|
| 175 |
pred_label = (cv2.cvtColor(cv2.imread(args.masks+mask_filenames[i]), cv2.COLOR_BGR2GRAY)/255).astype(int)
|
| 176 |
|
| 177 |
-
# cv2.imshow('pred', cv2.resize(cv2.cvtColor(cv2.imread(args.masks+mask_filenames[i]), cv2.COLOR_BGR2GRAY), (640, 480)))
|
| 178 |
-
# cv2.waitKey(0)
|
| 179 |
-
|
| 180 |
-
# print(f"label shape: {img_label.shape}, label values: {np.unique(img_label)}")
|
| 181 |
-
# print(f"pred shape: {pred_label.shape}, pred values: {np.unique(pred_label)}")
|
| 182 |
-
# break
|
| 183 |
iou = calculate_iou(img_label, pred_label)
|
| 184 |
iou_scores.append(iou)
|
| 185 |
if args.vis:
|
| 186 |
os.makedirs(args.output, exist_ok=True)
|
| 187 |
save_mask_comparison(img_label, pred_label, f"{args.output}/{timestamps[i]}.png", iou)
|
| 188 |
|
| 189 |
-
# break
|
| 190 |
|
| 191 |
print(f"Mean IOU for water predictions: {np.mean(np.array(iou_scores))}")
|
|
|
|
| 16 |
import yaml # pip install pyyaml
|
| 17 |
from tqdm import tqdm
|
| 18 |
|
| 19 |
+
# Toggle the following boolean to False if not using HuggingFace App
|
| 20 |
+
hf_app = True
|
| 21 |
+
|
| 22 |
+
if hf_app:
|
| 23 |
+
from huggingface_hub import snapshot_download
|
| 24 |
+
|
| 25 |
cmap = plt.get_cmap("jet")
|
| 26 |
|
| 27 |
# ---------------- Argument Parsing ---------------- #
|
|
|
|
| 33 |
parser.add_argument("--sequence", type=str, default="20250811_113017", help="Sequence ID (e.g., 20250811_113017)")
|
| 34 |
parser.add_argument("--condition", type=str, default="flooded", help="Condition (e.g., flooded)")
|
| 35 |
parser.add_argument("--camera_pos", type=str, default="front", help="Camera position (e.g., front)")
|
| 36 |
+
parser.add_argument("--root", type=str, default="/data/FRED/", help="Root dataset directory (e.g., ../Datasets/FRED/)")
|
| 37 |
parser.add_argument("--masks", type=str, required=True, help="Where predicted masks are saved")
|
| 38 |
parser.add_argument("--img_calib_file", type=str, default="./camera_calib.txt", help="Path to camera calibration file (e.g., ./camera_calib.txt)")
|
| 39 |
parser.add_argument('--vis', action='store_true', help="Store visual comparisons of the predictions and labels")
|
|
|
|
| 74 |
root_directory = f"{args.root}/{args.condition}/KITTI-style"
|
| 75 |
img_calib_file = args.img_calib_file
|
| 76 |
|
| 77 |
+
if (not os.path.exists(root_directory)) and (hf_app):
|
| 78 |
+
snapshot_download(
|
| 79 |
+
repo_id="CMalone-Jupiter/FRED",
|
| 80 |
+
repo_type="dataset",
|
| 81 |
+
local_dir="/data/FRED",
|
| 82 |
+
allow_patterns=f"{condition}/KITTI-style/{location}_{sequence}/**",
|
| 83 |
+
token=os.environ.get("HF_TOKEN")
|
| 84 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
############ Define filenames and directories ####################################
|
| 87 |
|
|
|
|
| 94 |
|
| 95 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 96 |
idx = 0 # mutable index
|
|
|
|
| 97 |
|
| 98 |
def load_image_data(i):
|
| 99 |
image_timestamp = timestamps[i]
|
|
|
|
| 105 |
|
| 106 |
return water_label.astype(int)
|
| 107 |
|
|
|
|
| 108 |
except Exception as e:
|
| 109 |
print(f"Could not show label for {image_timestamp}.png: {e}")
|
| 110 |
|
|
|
|
| 170 |
for i in tqdm(range(idx, len(timestamps))):
|
| 171 |
|
| 172 |
img_label = load_image_data(i)
|
|
|
|
| 173 |
pred_label = (cv2.cvtColor(cv2.imread(args.masks+mask_filenames[i]), cv2.COLOR_BGR2GRAY)/255).astype(int)
|
| 174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
iou = calculate_iou(img_label, pred_label)
|
| 176 |
iou_scores.append(iou)
|
| 177 |
if args.vis:
|
| 178 |
os.makedirs(args.output, exist_ok=True)
|
| 179 |
save_mask_comparison(img_label, pred_label, f"{args.output}/{timestamps[i]}.png", iou)
|
| 180 |
|
|
|
|
| 181 |
|
| 182 |
print(f"Mean IOU for water predictions: {np.mean(np.array(iou_scores))}")
|
segmentation/show_labels-all.py
CHANGED
|
@@ -15,6 +15,12 @@ from natsort import natsorted
|
|
| 15 |
import json
|
| 16 |
import yaml # pip install pyyaml
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
cmap = plt.get_cmap("jet")
|
| 19 |
|
| 20 |
# ---------------- Argument Parsing ---------------- #
|
|
@@ -26,7 +32,7 @@ parser.add_argument("--location", type=str, default="Cambogan", help="Location n
|
|
| 26 |
parser.add_argument("--sequence", type=str, default="20250811_113017", help="Sequence ID (e.g., 20250811_113017)")
|
| 27 |
parser.add_argument("--condition", type=str, default="flooded", help="Condition (e.g., flooded)")
|
| 28 |
parser.add_argument("--camera_pos", type=str, default="front", help="Camera position (e.g., front)")
|
| 29 |
-
parser.add_argument("--root", type=str, default="
|
| 30 |
parser.add_argument("--img_calib_file", type=str, default="./camera_calib.txt", help="Path to camera calibration file (e.g., ./camera_calib.txt)")
|
| 31 |
|
| 32 |
args = parser.parse_args()
|
|
@@ -64,19 +70,14 @@ else:
|
|
| 64 |
root_directory = f"{args.root}/{args.condition}/KITTI-style"
|
| 65 |
img_calib_file = args.img_calib_file
|
| 66 |
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
# sequence = '20241217_113410'
|
| 76 |
-
# condition = 'flooded'
|
| 77 |
-
# camera_pos = 'front'
|
| 78 |
-
# root_directory = f"D:/Datasets/FRED/{condition}/KITTI-style"
|
| 79 |
-
# # 01000000
|
| 80 |
|
| 81 |
############ Define filenames and directories ####################################
|
| 82 |
|
|
@@ -86,9 +87,7 @@ img_calib_file = f"./camera_calib.txt"
|
|
| 86 |
timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(image_dir)) if os.path.isfile(image_dir+filename)]
|
| 87 |
|
| 88 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 89 |
-
|
| 90 |
-
# idx = [183] # mutable index
|
| 91 |
-
idx = [130]
|
| 92 |
|
| 93 |
def show_image(i):
|
| 94 |
ax.clear()
|
|
@@ -111,7 +110,6 @@ def show_image(i):
|
|
| 111 |
ax.imshow(overlay_img[:, :, ::-1])
|
| 112 |
ax.set_title(f"{image_timestamp}.png")
|
| 113 |
ax.axis("off")
|
| 114 |
-
# plt.savefig('paper_figures/semantic_image_labels.pdf', format="pdf", bbox_inches='tight')
|
| 115 |
fig.canvas.draw()
|
| 116 |
except Exception as e:
|
| 117 |
print(f"Could not show label for {image_timestamp}.png: {e}")
|
|
|
|
| 15 |
import json
|
| 16 |
import yaml # pip install pyyaml
|
| 17 |
|
| 18 |
+
# Toggle the following boolean to False if not using HuggingFace App
|
| 19 |
+
hf_app = True
|
| 20 |
+
|
| 21 |
+
if hf_app:
|
| 22 |
+
from huggingface_hub import snapshot_download
|
| 23 |
+
|
| 24 |
cmap = plt.get_cmap("jet")
|
| 25 |
|
| 26 |
# ---------------- Argument Parsing ---------------- #
|
|
|
|
| 32 |
parser.add_argument("--sequence", type=str, default="20250811_113017", help="Sequence ID (e.g., 20250811_113017)")
|
| 33 |
parser.add_argument("--condition", type=str, default="flooded", help="Condition (e.g., flooded)")
|
| 34 |
parser.add_argument("--camera_pos", type=str, default="front", help="Camera position (e.g., front)")
|
| 35 |
+
parser.add_argument("--root", type=str, default="/data/FRED/", help="Root dataset directory (e.g., D:/Datasets/FRED/)")
|
| 36 |
parser.add_argument("--img_calib_file", type=str, default="./camera_calib.txt", help="Path to camera calibration file (e.g., ./camera_calib.txt)")
|
| 37 |
|
| 38 |
args = parser.parse_args()
|
|
|
|
| 70 |
root_directory = f"{args.root}/{args.condition}/KITTI-style"
|
| 71 |
img_calib_file = args.img_calib_file
|
| 72 |
|
| 73 |
+
if (not os.path.exists(root_directory)) and (hf_app):
|
| 74 |
+
snapshot_download(
|
| 75 |
+
repo_id="CMalone-Jupiter/FRED",
|
| 76 |
+
repo_type="dataset",
|
| 77 |
+
local_dir="/data/FRED",
|
| 78 |
+
allow_patterns=f"{condition}/KITTI-style/{location}_{sequence}/**",
|
| 79 |
+
token=os.environ.get("HF_TOKEN")
|
| 80 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
############ Define filenames and directories ####################################
|
| 83 |
|
|
|
|
| 87 |
timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(image_dir)) if os.path.isfile(image_dir+filename)]
|
| 88 |
|
| 89 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 90 |
+
idx = [0] # mutable index
|
|
|
|
|
|
|
| 91 |
|
| 92 |
def show_image(i):
|
| 93 |
ax.clear()
|
|
|
|
| 110 |
ax.imshow(overlay_img[:, :, ::-1])
|
| 111 |
ax.set_title(f"{image_timestamp}.png")
|
| 112 |
ax.axis("off")
|
|
|
|
| 113 |
fig.canvas.draw()
|
| 114 |
except Exception as e:
|
| 115 |
print(f"Could not show label for {image_timestamp}.png: {e}")
|
visualisation/points2image-all.py
CHANGED
|
@@ -12,26 +12,29 @@ from utils.camera import ImageData
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
cmap = plt.get_cmap("jet")
|
| 16 |
|
| 17 |
# User parameters
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
# sequence = '20250812_122339' #'20250812_122101'
|
| 21 |
-
# location = 'Holmview'
|
| 22 |
-
# sequence = '20250820_130327'
|
| 23 |
-
# location = 'Mount-Cotton'
|
| 24 |
-
# sequence = '20241217_113410'
|
| 25 |
-
# location = 'Pullenvale'
|
| 26 |
-
# sequence = '20250916_124105'
|
| 27 |
-
location = 'DairyCreek'
|
| 28 |
-
sequence = '20250811_103318'
|
| 29 |
condition = 'flooded'
|
| 30 |
-
# condition = 'dry'
|
| 31 |
camera_pos = 'front'
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
############ Define filenames and directories ####################################
|
| 37 |
|
|
@@ -44,12 +47,9 @@ lidar_calib_file = f"./calib.txt"
|
|
| 44 |
|
| 45 |
timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(image_dir)) if os.path.isfile(image_dir+filename)]
|
| 46 |
|
| 47 |
-
# timestamps.sort()
|
| 48 |
|
| 49 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 50 |
-
|
| 51 |
-
# idx = [183]
|
| 52 |
-
idx = [200]
|
| 53 |
|
| 54 |
def show_image(i):
|
| 55 |
ax.clear()
|
|
@@ -75,7 +75,6 @@ def show_image(i):
|
|
| 75 |
ax.imshow(img_vis[:, :, ::-1])
|
| 76 |
ax.set_title(f"{image_timestamp}.png")
|
| 77 |
ax.axis("off")
|
| 78 |
-
# plt.savefig('paper_figures/CADRRAS/projected_pointcloud_distance_flooded.svg', format="svg", bbox_inches='tight')
|
| 79 |
fig.canvas.draw()
|
| 80 |
except Exception as e:
|
| 81 |
print(f"Could not project pointcloud onto {image_timestamp}.png: {e}")
|
|
|
|
| 12 |
import utils.utils as utils
|
| 13 |
from natsort import natsorted
|
| 14 |
|
| 15 |
+
# Toggle the following boolean to False if not using HuggingFace App
|
| 16 |
+
hf_app = True
|
| 17 |
+
|
| 18 |
+
if hf_app:
|
| 19 |
+
from huggingface_hub import snapshot_download
|
| 20 |
+
|
| 21 |
cmap = plt.get_cmap("jet")
|
| 22 |
|
| 23 |
# User parameters
|
| 24 |
+
location = 'Cambogan'
|
| 25 |
+
sequence = '20250811_113017'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
condition = 'flooded'
|
|
|
|
| 27 |
camera_pos = 'front'
|
| 28 |
+
root_directory = f"/data/FRED/{condition}/KITTI-style"
|
| 29 |
+
|
| 30 |
+
if (not os.path.exists(root_directory)) and (hf_app):
|
| 31 |
+
snapshot_download(
|
| 32 |
+
repo_id="CMalone-Jupiter/FRED",
|
| 33 |
+
repo_type="dataset",
|
| 34 |
+
local_dir="/data/FRED",
|
| 35 |
+
allow_patterns=f"{condition}/KITTI-style/{location}_{sequence}/**",
|
| 36 |
+
token=os.environ.get("HF_TOKEN")
|
| 37 |
+
)
|
| 38 |
|
| 39 |
############ Define filenames and directories ####################################
|
| 40 |
|
|
|
|
| 47 |
|
| 48 |
timestamps = [filename.split('.png')[0] for filename in natsorted(os.listdir(image_dir)) if os.path.isfile(image_dir+filename)]
|
| 49 |
|
|
|
|
| 50 |
|
| 51 |
fig, ax = plt.subplots(figsize=(12.8, 8))
|
| 52 |
+
idx = [0] # mutable index
|
|
|
|
|
|
|
| 53 |
|
| 54 |
def show_image(i):
|
| 55 |
ax.clear()
|
|
|
|
| 75 |
ax.imshow(img_vis[:, :, ::-1])
|
| 76 |
ax.set_title(f"{image_timestamp}.png")
|
| 77 |
ax.axis("off")
|
|
|
|
| 78 |
fig.canvas.draw()
|
| 79 |
except Exception as e:
|
| 80 |
print(f"Could not project pointcloud onto {image_timestamp}.png: {e}")
|