mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 10:30:15 +02:00
Tests: add tfjs to benchmark tests
This commit is contained in:
parent
4de74bea94
commit
df24b30755
@ -10,6 +10,7 @@
|
||||
"devDependencies": {
|
||||
"@squoosh/cli": "0.7.2",
|
||||
"@squoosh/lib": "0.4.0",
|
||||
"@tensorflow/tfjs-node": "^3.20.0",
|
||||
"async": "3.2.4",
|
||||
"benchmark": "2.1.4",
|
||||
"gm": "1.23.1",
|
||||
|
@ -14,6 +14,8 @@ const imagemagick = require('imagemagick');
|
||||
const mapnik = require('mapnik');
|
||||
const jimp = require('jimp');
|
||||
const squoosh = require('@squoosh/lib');
|
||||
process.env.TF_CPP_MIN_LOG_LEVEL = 1;
|
||||
const tfjs = require('@tensorflow/tfjs-node');
|
||||
|
||||
const fixtures = require('../fixtures');
|
||||
|
||||
@ -250,6 +252,24 @@ async.series({
|
||||
});
|
||||
}
|
||||
});
|
||||
// tfjs
|
||||
jpegSuite.add('tfjs-node-buffer-buffer', {
|
||||
defer: true,
|
||||
fn: function (deferred) {
|
||||
const decoded = tfjs.node.decodeJpeg(inputJpgBuffer);
|
||||
const resized = tfjs.image.resizeBilinear(decoded, [height, width]);
|
||||
tfjs
|
||||
.node
|
||||
.encodeJpeg(resized, 'rgb', 80)
|
||||
.then(function () {
|
||||
deferred.resolve();
|
||||
tfjs.disposeVariables();
|
||||
})
|
||||
.catch(function (err) {
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
});
|
||||
// sharp
|
||||
jpegSuite.add('sharp-buffer-file', {
|
||||
defer: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user