mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -76,7 +76,7 @@ module.exports = class Tensorflow {
|
|||||||
const [originalHeight, originalWidth] = imageTensor.shape.slice(0, 2);
|
const [originalHeight, originalWidth] = imageTensor.shape.slice(0, 2);
|
||||||
const desiredHeight = 400;
|
const desiredHeight = 400;
|
||||||
const aspectRatio = originalWidth / originalHeight;
|
const aspectRatio = originalWidth / originalHeight;
|
||||||
const newWidth = Math.round(desiredHeight / aspectRatio);
|
const newWidth = Math.round(desiredHeight * aspectRatio);
|
||||||
const resizedImage = tf.image.resizeBilinear(imageTensor, [desiredHeight, newWidth]);
|
const resizedImage = tf.image.resizeBilinear(imageTensor, [desiredHeight, newWidth]);
|
||||||
imageTensor.dispose();
|
imageTensor.dispose();
|
||||||
const loadedImage = resizedImage.toFloat().div(tf.scalar(255)).expandDims();
|
const loadedImage = resizedImage.toFloat().div(tf.scalar(255)).expandDims();
|
||||||
|
|||||||
Reference in New Issue
Block a user