diff --git a/structures/Tensorflow.js b/structures/Tensorflow.js index 0e42c0bb..a0d04ca2 100644 --- a/structures/Tensorflow.js +++ b/structures/Tensorflow.js @@ -76,7 +76,7 @@ module.exports = class Tensorflow { const [originalHeight, originalWidth] = imageTensor.shape.slice(0, 2); const desiredHeight = 400; const aspectRatio = originalWidth / originalHeight; - const newWidth = Math.round(desiredHeight / aspectRatio); + const newWidth = Math.round(desiredHeight * aspectRatio); const resizedImage = tf.image.resizeBilinear(imageTensor, [desiredHeight, newWidth]); imageTensor.dispose(); const loadedImage = resizedImage.toFloat().div(tf.scalar(255)).expandDims();