Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion unstructured_inference/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.5.3" # pragma: no cover
__version__ = "1.5.4" # pragma: no cover
4 changes: 2 additions & 2 deletions unstructured_inference/models/yolox.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading