Skip to content

Commit

Permalink
fix: Fix lint.
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyYang0714 committed Jul 10, 2024
1 parent 59534e9 commit 91b2fca
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion requirements/install.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ h5py
jsonargparse[signatures]
lightning
ml_collections==0.1.1 # Config interface. Need exact version since we overwrite internal functions
numpy>=1.21.0
numpy>=1.21.0,<2.0.0
opencv-python
pandas
pillow
Expand Down
1 change: 1 addition & 0 deletions requirements/viewer.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
open3d
matplotlib>3.9
5 changes: 3 additions & 2 deletions vis4d/data/datasets/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ def im_decode(
"L",
}, f"{mode} not supported for image decoding!"
if backend == "PIL":
pil_img = Image.open(BytesIO(bytearray(im_bytes)))
pil_img = ImageOps.exif_transpose(pil_img) # type: ignore
pil_img_file = Image.open(BytesIO(bytearray(im_bytes)))
pil_img = ImageOps.exif_transpose(pil_img_file)
assert pil_img is not None, "Image could not be loaded!"
if pil_img.mode == "L": # pragma: no cover
if mode == "L":
img: NDArrayUI8 = np.array(pil_img)[..., None]
Expand Down
7 changes: 5 additions & 2 deletions vis4d/vis/image/canvas/pillow_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ def create_canvas(
Raises:
ValueError: If the canvas is not initialized.
"""
if image is None and image_hw is None:
raise ValueError("Image or Image Shapes required to create canvas")
if image_hw is not None:
white_image = np.ones([*image_hw, 3]) * 255
image = white_image.astype(np.uint8)
else:
assert (
image is not None
), "Image or Image Shapes required to create canvas"

self._image = Image.fromarray(image)
self._image_draw = ImageDraw.Draw(self._image)

Expand Down

0 comments on commit 91b2fca

Please sign in to comment.