diff --git a/CHANGELOG.md b/CHANGELOG.md index e9b58ffd..07064935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ +## 1.5.4 + +### Enhancement +- Use `np.full()` instead of `np.ones() * scalar` in YoloX preprocessing to avoid a redundant temporary array + ## 1.5.3 +### Enhancement + - Store routing in LayoutElement ## 1.5.2 diff --git a/unstructured_inference/__version__.py b/unstructured_inference/__version__.py index e375e78d..e4b9acb5 100644 --- a/unstructured_inference/__version__.py +++ b/unstructured_inference/__version__.py @@ -1 +1 @@ -__version__ = "1.5.3" # pragma: no cover +__version__ = "1.5.4" # pragma: no cover diff --git a/unstructured_inference/models/yolox.py b/unstructured_inference/models/yolox.py index 932242ec..f467857d 100644 --- a/unstructured_inference/models/yolox.py +++ b/unstructured_inference/models/yolox.py @@ -150,9 +150,9 @@ def image_processing( def preprocess(img, input_size, swap=(2, 0, 1)): """Preprocess image data before YoloX inference.""" if len(img.shape) == 3: - padded_img = np.ones((input_size[0], input_size[1], 3), dtype=np.uint8) * 114 + padded_img = np.full((input_size[0], input_size[1], 3), 114, dtype=np.uint8) else: - padded_img = np.ones(input_size, dtype=np.uint8) * 114 + padded_img = np.full(input_size, 114, dtype=np.uint8) r = min(input_size[0] / img.shape[0], input_size[1] / img.shape[1]) resized_img = cv2.resize(