mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -74,7 +74,7 @@ module.exports = class Tensorflow {
|
|||||||
async stylizeImage(image, styleImg) {
|
async stylizeImage(image, styleImg) {
|
||||||
const imageTensor = await tf.node.decodeImage(image, 3);
|
const imageTensor = await tf.node.decodeImage(image, 3);
|
||||||
const [originalHeight, originalWidth] = imageTensor.shape.slice(0, 2);
|
const [originalHeight, originalWidth] = imageTensor.shape.slice(0, 2);
|
||||||
const desiredHeight = 400;
|
const desiredHeight = 256;
|
||||||
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]);
|
||||||
|
|||||||
Reference in New Issue
Block a user