Skip to content

Commit

Permalink
Fix mypy check error
Browse files Browse the repository at this point in the history
  • Loading branch information
BreezeWhite committed Nov 29, 2023
1 parent 0c407c3 commit ac6405d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions oemer/ete.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ def extract(args: Namespace) -> str:
pickle.dump(data, open(pkl_path, "wb"))

# Load the original image, resize to the same size as prediction.
image = Image.open(str(img_path))
if "GIF" != image.format:
image_pil = Image.open(str(img_path))
if "GIF" != image_pil.format:
image = cv2.imread(str(img_path))
else:
gif_image = image.convert('RGB')
gif_image = np.array(gif_image)
image = gif_image[:, :, ::-1].copy()
gif_image = image_pil.convert('RGB')
gif_img_arr = np.array(gif_image)
image = gif_img_arr[:, :, ::-1].copy()

image = cv2.resize(image, (staff.shape[1], staff.shape[0]))

Expand Down
12 changes: 6 additions & 6 deletions oemer/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def inference(
output_shape = metadata['output_shape']

# Collect data
image = Image.open(img_path)
if "GIF" != image.format:
image_pil = Image.open(img_path)
if "GIF" != image_pil.format:
# Tricky workaround to avoid random mistery transpose when loading with 'Image'.
image = cv2.imread(img_path)
image = Image.fromarray(image)
image_pil = cv2.imread(img_path)
image_pil = Image.fromarray(image_pil)

image = image.convert("RGB")
image = np.array(resize_image(image))
image_pil = image_pil.convert("RGB")
image = np.array(resize_image(image_pil))
win_size = input_shape[1]
data = []
for y in range(0, image.shape[0], step_size):
Expand Down

0 comments on commit ac6405d

Please sign in to comment.