Skip to content

Commit

Permalink
fix: add handling for filepaths to image grid (#2414)
Browse files Browse the repository at this point in the history
previously skipped due to not being in np.ndarray format but string
  • Loading branch information
mashb1t committed Mar 2, 2024
1 parent 9083943 commit 4ea3baf
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/async_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def worker():
import traceback
import math
import numpy as np
import cv2
import torch
import time
import shared
Expand Down Expand Up @@ -79,16 +80,20 @@ def yield_result(async_task, imgs, do_not_show_finished_images=False):
return

def build_image_wall(async_task):
results = async_task.results
results = []

if len(results) < 2:
if len(async_task.results) < 2:
return

for img in results:
for img in async_task.results:
if isinstance(img, str) and os.path.exists(img):
img = cv2.imread(img)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
if not isinstance(img, np.ndarray):
return
if img.ndim != 3:
return
results.append(img)

H, W, C = results[0].shape

Expand Down

0 comments on commit 4ea3baf

Please sign in to comment.