Pre processing
determine_scaling_aspect_ratio(image_height, image_width, max_height, max_width)
¶
Determine the scaling aspect ratio.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image_height
|
int
|
The height of the image. |
required |
image_width
|
int
|
The width of the image. |
required |
max_height
|
int
|
The maximum height of the image. |
required |
max_width
|
int
|
The maximum width of the image. |
required |
Returns:
Type | Description |
---|---|
Optional[float]
|
The scaling aspect ratio. |
Source code in inference_sdk/http/utils/pre_processing.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
resize_opencv_image(image, max_height, max_width)
¶
Resize an OpenCV image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image
|
ndarray
|
The image to resize. |
required |
max_height
|
Optional[int]
|
The maximum height of the image. |
required |
max_width
|
Optional[int]
|
The maximum width of the image. |
required |
Returns:
Type | Description |
---|---|
Tuple[ndarray, Optional[float]]
|
The resized image and the scaling factor. |
Source code in inference_sdk/http/utils/pre_processing.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
resize_pillow_image(image, max_height, max_width)
¶
Resize a Pillow image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image
|
Image
|
The image to resize. |
required |
max_height
|
Optional[int]
|
The maximum height of the image. |
required |
max_width
|
Optional[int]
|
The maximum width of the image. |
required |
Returns:
Type | Description |
---|---|
Tuple[Image, Optional[float]]
|
The resized image and the scaling factor. |
Source code in inference_sdk/http/utils/pre_processing.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|