Apply linter

Summary: Applies lint

Reviewed By: arpitkalla

Differential Revision: D98515496

fbshipit-source-id: 967c9bf19ef7e1e25906204075c37c8461ed2a0e
This commit is contained in:
Joseph Greer
2026-03-27 12:40:51 -07:00
committed by meta-codesync[bot]
parent 9f22cb976f
commit 5a3143c652
54 changed files with 618 additions and 618 deletions
+15 -15
View File
@@ -158,22 +158,22 @@ def plot_mask(mask, color="r", ax=None):
def normalize_bbox(bbox_xywh, img_w, img_h):
# Assumes bbox_xywh is in XYWH format
if isinstance(bbox_xywh, list):
assert (
len(bbox_xywh) == 4
), "bbox_xywh list must have 4 elements. Batching not support except for torch tensors."
assert len(bbox_xywh) == 4, (
"bbox_xywh list must have 4 elements. Batching not support except for torch tensors."
)
normalized_bbox = bbox_xywh.copy()
normalized_bbox[0] /= img_w
normalized_bbox[1] /= img_h
normalized_bbox[2] /= img_w
normalized_bbox[3] /= img_h
else:
assert isinstance(
bbox_xywh, torch.Tensor
), "Only torch tensors are supported for batching."
assert isinstance(bbox_xywh, torch.Tensor), (
"Only torch tensors are supported for batching."
)
normalized_bbox = bbox_xywh.clone()
assert (
normalized_bbox.size(-1) == 4
), "bbox_xywh tensor must have last dimension of size 4."
assert normalized_bbox.size(-1) == 4, (
"bbox_xywh tensor must have last dimension of size 4."
)
normalized_bbox[..., 0] /= img_w
normalized_bbox[..., 1] /= img_h
normalized_bbox[..., 2] /= img_w
@@ -245,9 +245,9 @@ def visualize_formatted_frame_output(
num_outputs = len(outputs_list)
if titles is None:
titles = [f"Set {i + 1}" for i in range(num_outputs)]
assert (
len(titles) == num_outputs
), "length of `titles` should match that of `outputs_list` if not None."
assert len(titles) == num_outputs, (
"length of `titles` should match that of `outputs_list` if not None."
)
_, axes = plt.subplots(1, num_outputs, figsize=figsize)
if num_outputs == 1:
@@ -703,9 +703,9 @@ def get_all_annotations_for_frame(
# Get the frame
video_df_current = video_df[video_df.id == video_id]
assert (
len(video_df_current) == 1
), f"Expected 1 video row, got {len(video_df_current)}"
assert len(video_df_current) == 1, (
f"Expected 1 video row, got {len(video_df_current)}"
)
video_row = video_df_current.iloc[0]
file_name = video_row.file_names[frame_idx]
file_path = os.path.join(