mirror of
https://github.com/lovell/sharp.git
synced 2025-07-09 18:40:16 +02:00
Tests: add tfjs to benchmark tests
This commit is contained in:
parent
4de74bea94
commit
df24b30755
@ -10,6 +10,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@squoosh/cli": "0.7.2",
|
"@squoosh/cli": "0.7.2",
|
||||||
"@squoosh/lib": "0.4.0",
|
"@squoosh/lib": "0.4.0",
|
||||||
|
"@tensorflow/tfjs-node": "^3.20.0",
|
||||||
"async": "3.2.4",
|
"async": "3.2.4",
|
||||||
"benchmark": "2.1.4",
|
"benchmark": "2.1.4",
|
||||||
"gm": "1.23.1",
|
"gm": "1.23.1",
|
||||||
|
@ -14,6 +14,8 @@ const imagemagick = require('imagemagick');
|
|||||||
const mapnik = require('mapnik');
|
const mapnik = require('mapnik');
|
||||||
const jimp = require('jimp');
|
const jimp = require('jimp');
|
||||||
const squoosh = require('@squoosh/lib');
|
const squoosh = require('@squoosh/lib');
|
||||||
|
process.env.TF_CPP_MIN_LOG_LEVEL = 1;
|
||||||
|
const tfjs = require('@tensorflow/tfjs-node');
|
||||||
|
|
||||||
const fixtures = require('../fixtures');
|
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
|
// sharp
|
||||||
jpegSuite.add('sharp-buffer-file', {
|
jpegSuite.add('sharp-buffer-file', {
|
||||||
defer: true,
|
defer: true,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user