resize bug while skipped detector

This commit is contained in:
Sefik Ilkin Serengil 2023-02-10 14:05:40 +00:00 committed by GitHub
parent f9ec08ec04
commit ab8470f96f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -657,6 +657,13 @@ def represent(
img = img_path.copy() img = img_path.copy()
else: else:
raise ValueError(f"unexpected type for img_path - {type(img_path)}") raise ValueError(f"unexpected type for img_path - {type(img_path)}")
# --------------------------------
if len(img.shape) == 4:
img = img[0] # e.g. (1, 224, 224, 3) to (224, 224, 3)
if len(img.shape) == 3:
img = cv2.resize(img, target_size)
img = np.expand_dims(img, axis=0)
# --------------------------------
img_region = [0, 0, img.shape[1], img.shape[0]] img_region = [0, 0, img.shape[1], img.shape[0]]
img_objs = [(img, img_region, 0)] img_objs = [(img, img_region, 0)]
# --------------------------------- # ---------------------------------