mirror of
https://www.modelscope.cn/PaddlePaddle/PaddleOCR-VL.git
synced 2026-04-02 13:32:54 +08:00
Upload to PaddlePaddle/PaddleOCR-VL on ModelScope hub
This commit is contained in:
@ -141,18 +141,12 @@ def smart_resize(
|
||||
3. The aspect ratio of the image is maintained as closely as possible.
|
||||
|
||||
"""
|
||||
# if height < factor or width < factor:
|
||||
# raise ValueError(f"height:{height} or width:{width} must be larger than factor:{factor}")
|
||||
# if int(height < factor//4) + int(width < factor//4):
|
||||
# raise ValueError(f"height:{height} or width:{width} must be larger than factor:{factor//4}")
|
||||
|
||||
if height < factor:
|
||||
print(f"smart_resize: height={height} < factor={factor}, reset height=factor")
|
||||
width = round((width * factor) / height)
|
||||
height = factor
|
||||
|
||||
if width < factor:
|
||||
print(f"smart_resize: width={width} < factor={factor}, reset width=factor")
|
||||
height = round((height * factor) / width)
|
||||
width = factor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user