У меня есть несколько сценариев тензорного потока, которые могут работать в браузерах. Однако я хотел бы повысить производительность, перенеся сценарии на серверную часть. Кажется, он не работает.
UnhandledPromiseRejectionWarning: TypeError: Невозможно прочитать свойство loadObjectDetection с неопределенным значением
const tf = require('@tensorflow/tfjs'),
automl = require('@tensorflow/tfjs-automl'),
fs = require('fs');
fs.readFile('./image.jpg', function (err, data) {
if (err) throw err;
async function run() {
const model = await tf.automl.loadObjectDetection( './model.json' );
const options = {score: 0.1, iou: 0.1, topk: 20};
async function prediction(){
const predictions = await model.detect(data, options);
if(predictions.length>0){
//console.log(predictions.length);
for(var i=0; i<predictions.length; i++){
console.log( predictions[i].label + " " + predictions[i].score );
}
}
prediction();
}
//prediction();
};
run();
});