Skip to content

Commit 0a15bc5

Browse files
committed
fix: fix mypy errors
1 parent cdb8a62 commit 0a15bc5

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

DPF/filters/videos/image_filter_adapter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def preprocess_data(
6969
frame = iio.imread(io.BytesIO(video_bytes), index=frame_index, plugin="pyav")
7070

7171
buff = io.BytesIO()
72-
Image.fromarray(frame).convert('RGB').save(buff, format='JPEG', quality=95)
72+
Image.fromarray(frame).convert('RGB').save(buff, format='JPEG', quality=95) # type: ignore
7373
modality2data['image'] = buff.getvalue()
7474
metadata[self.image_filter.key_column] = ''
7575
return key, self.image_filter.preprocess_data(modality2data, metadata)

DPF/filters/videos/pllava_filter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def load_video(video_bytes: BytesIO, num_segments: int = 8, return_msg: bool = F
3131
frame_indices = get_index(num_frames, num_segments)
3232
images_group = []
3333
for frame_index in frame_indices:
34-
img = Image.fromarray(vr[frame_index].asnumpy())
34+
img = Image.fromarray(vr[frame_index].asnumpy()) # type: ignore
3535
images_group.append(transforms(img))
3636
if return_msg:
3737
fps = float(vr.get_avg_fps())

DPF/transforms/image_resize_transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _process_filepath(self, data: TransformsFileData) -> TransformsFileData:
4141
width, height = self.resizer.get_new_size(img.width, img.height)
4242

4343
if (width, height) != (img.width, img.height):
44-
img = img.resize((width, height)) # type: ignore
44+
img = img.resize((width, height))
4545
img.save(filepath, format=self.img_format)
4646

4747
return TransformsFileData(filepath, {'width': width, 'height': height})

DPF/utils/image_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ def read_image_rgb(path: str, force_rgb: bool = True) -> Image.Image:
77
pil_img = Image.open(path)
88
pil_img.load() # type: ignore
99
if pil_img.format == "PNG" and pil_img.mode != "RGBA":
10-
pil_img = pil_img.convert("RGBA") # type: ignore
10+
pil_img = pil_img.convert("RGBA")
1111
if force_rgb:
12-
pil_img = pil_img.convert("RGB") # type: ignore
12+
pil_img = pil_img.convert("RGB")
1313
return pil_img
1414

1515

1616
def read_image_rgb_from_bytes(img_bytes: bytes, force_rgb: bool = True) -> Image.Image:
1717
pil_img = Image.open(BytesIO(img_bytes))
1818
pil_img.load() # type: ignore
1919
if pil_img.format == "PNG" and pil_img.mode != "RGBA":
20-
pil_img = pil_img.convert("RGBA") # type: ignore
20+
pil_img = pil_img.convert("RGBA")
2121
if force_rgb:
22-
pil_img = pil_img.convert("RGB") # type: ignore
22+
pil_img = pil_img.convert("RGB")
2323
return pil_img

0 commit comments

Comments
 (0)