I am trying to image classification by using this code. when user give image , then mobilenet model will be load for pre-trained the images. But , I can not load mobilenet model in nodejs . I am using latest version of nodejs. so , Here is my trying code:
const tf = require('@tensorflow/tfjs');
const mobilenet = require('@tensorflow-models/mobilenet');
const tfnode = require('@tensorflow/tfjs-node');
const fs = require('fs');
const readImage = path => {
const imageBuffer = fs.readFileSync(path);
const tfimage = tfnode.node.decodeImage(imageBuffer);
return tfimage;
}
const imageClassification = async path => {
const image = readImage(path);
const mobilenetModel = await mobilenet.load();
const predictions = await mobilenetModel.classify(image);
}
if (process.argv.length !== 3) throw new Error('Incorrect arguments: node classify.js <IMAGE_FILE>');
imageClassification(process.argv[2]);
when I run by using node classify banana.jpg , it give me this error . How it would be handled?
(node:17038) UnhandledPromiseRejectionWarning: FetchError: request to https://storage.googleapis.com/tfhub-tfjs-modules/google/imagenet/mobilenet_v1_100_224/classification/1/model.json failed, reason: Client network socket disconnected before secure TLS connection was established