Skip to content

Commit c517065

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5a89c0d commit c517065

File tree

8 files changed

+26
-38
lines changed

8 files changed

+26
-38
lines changed

examples/devkit_tutorial.ipynb

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,10 @@
6060
"plt.rcParams[\"figure.figsize\"] = [20, 10]\n",
6161
"\n",
6262
"# import the ZOD DevKit\n",
63-
"from zod import ZodFrames\n",
64-
"from zod import ZodSequences\n",
65-
"\n",
6663
"# import default constants\n",
6764
"import zod.constants as constants\n",
68-
"from zod.constants import Camera, Lidar, Anonymization, AnnotationProject\n",
65+
"from zod import ZodFrames, ZodSequences\n",
66+
"from zod.constants import AnnotationProject, Anonymization, Camera, Lidar\n",
6967
"\n",
7068
"# import useful data classes\n",
7169
"from zod.data_classes import LidarData\n",
@@ -427,9 +425,7 @@
427425
"# but for this we also need the calibrations of the sensor\n",
428426
"calibrations = zod_frame.calibration\n",
429427
"assert annotation_3d is not None\n",
430-
"image = overlay_object_3d_box_on_image(\n",
431-
" image, annotation_3d, calibrations, color=(255, 0, 0), line_thickness=10\n",
432-
")\n",
428+
"image = overlay_object_3d_box_on_image(image, annotation_3d, calibrations, color=(255, 0, 0), line_thickness=10)\n",
433429
"\n",
434430
"plt.figure()\n",
435431
"plt.axis(\"off\")\n",
@@ -570,12 +566,8 @@
570566
" np.hstack((pcd.points, pcd.intensity[:, None])),\n",
571567
" (\n",
572568
" np.array([obj.name for obj in object_annotations if obj.box3d]),\n",
573-
" np.concatenate(\n",
574-
" [obj.box3d.center[None, :] for obj in object_annotations if obj.box3d], axis=0\n",
575-
" ),\n",
576-
" np.concatenate(\n",
577-
" [obj.box3d.size[None, :] for obj in object_annotations if obj.box3d], axis=0\n",
578-
" ),\n",
569+
" np.concatenate([obj.box3d.center[None, :] for obj in object_annotations if obj.box3d], axis=0),\n",
570+
" np.concatenate([obj.box3d.size[None, :] for obj in object_annotations if obj.box3d], axis=0),\n",
579571
" np.array([obj.box3d.orientation for obj in object_annotations if obj.box3d]),\n",
580572
" ),\n",
581573
")"
@@ -612,9 +604,7 @@
612604
"plt.show()\n",
613605
"\n",
614606
"# Plot aggregated Lidar point cloud\n",
615-
"aggregated_lidar = zod_frame.get_aggregated_lidar(\n",
616-
" num_before=10, num_after=0, timestamp=image_timestamp\n",
617-
")\n",
607+
"aggregated_lidar = zod_frame.get_aggregated_lidar(num_before=10, num_after=0, timestamp=image_timestamp)\n",
618608
"lid_image = visualize_lidar_on_image(\n",
619609
" aggregated_lidar,\n",
620610
" zod_frame.calibration,\n",

zod/cli/download.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def _download(download_path: str, dbx: ResumableDropbox, info: DownloadExtractIn
138138
)
139139
if pbar.n > info.size:
140140
tqdm.write(
141-
f"Error! File {download_path} already exists and is larger than expected. " "Please delete and try again."
141+
f"Error! File {download_path} already exists and is larger than expected. Please delete and try again."
142142
)
143143
if pbar.n > 0:
144144
# this means we are retrying or resuming a previously interrupted download

zod/cli/extract_tsr_patches.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ def extract_tsr_patches(
7878
print("Will save dataset to", output_dir)
7979
output_dir.mkdir(parents=True, exist_ok=True)
8080

81-
assert not (
82-
padding_factor is not None and (padding_px_x is not None or padding_px_y is not None)
83-
), "Cannot specify both padding and padding_factor"
81+
assert not (padding_factor is not None and (padding_px_x is not None or padding_px_y is not None)), (
82+
"Cannot specify both padding and padding_factor"
83+
)
8484

8585
padding = (padding_px_x, padding_px_y) if (padding_px_x is not None and padding_px_y is not None) else None
8686

zod/cli/generate_coco_json.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,7 @@ def convert_to_coco(
135135
if cls not in OBJECT_CLASSES:
136136
typer.echo(f"ERROR: Invalid class: {cls}.")
137137
raise typer.Exit(1)
138-
typer.echo(
139-
"Converting ZOD to COCO format. " f"Version: {version}, anonymization: {anonymization}, classes: {classes}"
140-
)
138+
typer.echo(f"Converting ZOD to COCO format. Version: {version}, anonymization: {anonymization}, classes: {classes}")
141139

142140
zod_frames = ZodFrames(str(dataset_root), version.value)
143141

zod/data_classes/box.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ def crop_from_image(
244244
tuple: padding in all four directions | (left, top, right, bottom)
245245
"""
246246

247-
assert not (
248-
padding is not None and padding_factor is not None
249-
), "Cannot specify both padding and padding_factor"
247+
assert not (padding is not None and padding_factor is not None), (
248+
"Cannot specify both padding and padding_factor"
249+
)
250250

251251
if padding is not None:
252252
padding_x, padding_y = padding

zod/data_classes/ego_motion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ def get_poses(self, target_ts: Union[np.ndarray, float]) -> np.ndarray:
3333
[N, 4, 4] array of interpolated poses for each timestamp.
3434
"""
3535
selfmin, selfmax = np.min(self.timestamps), np.max(self.timestamps)
36-
assert (selfmin <= np.min(target_ts)) and (
37-
selfmax >= np.max(target_ts)
38-
), f"targets not between pose timestamps, must be [{selfmin}, {selfmax}]"
36+
assert (selfmin <= np.min(target_ts)) and (selfmax >= np.max(target_ts)), (
37+
f"targets not between pose timestamps, must be [{selfmin}, {selfmax}]"
38+
)
3939

4040
if np.isin(target_ts, self.timestamps).all():
4141
return self.poses[self.timestamps.searchsorted(target_ts)]

zod/data_classes/info.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def get_camera_lidar_map(
6767
A tuple of the camera frame and the closest lidar frame.
6868
"""
6969
camera_name = f"{camera.value}_{anonymization.value}"
70-
assert (
71-
camera_name in self.camera_frames
72-
), f"Camera {camera_name} not found. Available cameras: {self.camera_frames.keys()}"
70+
assert camera_name in self.camera_frames, (
71+
f"Camera {camera_name} not found. Available cameras: {self.camera_frames.keys()}"
72+
)
7373
assert lidar in self.lidar_frames, f"Lidar {lidar} not found. Available lidars: {self.lidar_frames.keys()}"
7474

7575
for camera_frame in self.camera_frames[camera_name]:

zod/eval/detection/_experimental/matching.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,12 @@ def match_one_frame(
285285
A list of tuples. Each tuple contains the ground truth object and the prediction.
286286
"""
287287
# check that all objects are in the evaluation frame
288-
assert all(
289-
gt.box3d.frame == EVALUATION_FRAME for gt in ground_truth if gt.box3d is not None
290-
), "All ground truth objects must be in the evaluation frame."
291-
assert all(
292-
pred.box3d.frame == EVALUATION_FRAME for pred in predictions
293-
), "All predictions must be in the evaluation frame."
288+
assert all(gt.box3d.frame == EVALUATION_FRAME for gt in ground_truth if gt.box3d is not None), (
289+
"All ground truth objects must be in the evaluation frame."
290+
)
291+
assert all(pred.box3d.frame == EVALUATION_FRAME for pred in predictions), (
292+
"All predictions must be in the evaluation frame."
293+
)
294294

295295
if method == "greedy":
296296
return greedy_match(

0 commit comments

Comments
 (0)