deepjavalibrary / djl

An Engine-Agnostic Deep Learning Framework in Java
https://djl.ai
Apache License 2.0
4.05k stars 648 forks source link

resize diff between java djl and python cv2 #3222

Open GuoQuanhao opened 3 months ago

GuoQuanhao commented 3 months ago

Does NDImageUtils.resize has the same result with cv2.resize? They all use bilinear by default. I got some diff between NDImageUtils.resize and cv2.resize

frankfliu commented 3 months ago

They are not the same. If you want to get the same result you should resize the Image object instead of resize NDArray use OpenCVImageFactory class

See this example: https://github.com/deepjavalibrary/djl/blob/master/examples/src/main/java/ai/djl/examples/inference/cv/SemanticSegmentation.java#L89