tensorflow-lambda icon indicating copy to clipboard operation
tensorflow-lambda copied to clipboard

Not working with posenet?

Open SparseSpeculator opened this issue 5 years ago • 0 comments

Hi!

This project is a great idea and would be ideal for me. Unfortunately it does not work for me when using posenet. I hope this is the right place for my question. I could not find any discussion about this in Stackoverflow.

Here is a minimal example:

`const loadTf = require("tensorflow-lambda"); const posenet = require("@tensorflow-models/posenet"); const Jimp = require("jimp"); const imageScaleFactor = 0.5; const outputStride = 16; const flipHorizontal = false; const tf = (async () => await loadTf())();

const example = async function (event, context, callback) { const tf = await loadTf(); //(AWS) const net = await posenet.load(); var jimpSrc = await Jimp.read("./person.jpg"); let input = jimpSrc.bitmap; const pose = await net.estimateSinglePose( input, imageScaleFactor, flipHorizontal, outputStride ); console.log(pose); }; example();`

When I use this in Amazon AWS , I get the following error: { "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module '@tensorflow/tfjs-core'\nRequire stack:\n- /var/task/node_modules/@tensorflow-models/posenet/dist/mobilenet.js\n- /var/task/node_modules/@tensorflow-models/posenet/dist/index.js\n- /var/task/index.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js", "trace": [ "Runtime.ImportModuleError: Error: Cannot find module '@tensorflow/tfjs-core'", "Require stack:", "- /var/task/node_modules/@tensorflow-models/posenet/dist/mobilenet.js", "- /var/task/node_modules/@tensorflow-models/posenet/dist/index.js", "- /var/task/index.js", "- /var/runtime/UserFunction.js", "- /var/runtime/index.js", " at _loadUserApp (/var/runtime/UserFunction.js:100:13)", " at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)", " at Object. (/var/runtime/index.js:43:30)", " at Module._compile (internal/modules/cjs/loader.js:1138:30)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)", " at Module.load (internal/modules/cjs/loader.js:986:32)", " at Function.Module._load (internal/modules/cjs/loader.js:879:14)", " at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)", " at internal/main/run_main_module.js:17:47" ] }

Seems to me like the model itself is trying and failing to import tensorflow. Am I doing anything wrong? It would be great to get this to work on AWS lambda!

SparseSpeculator avatar Aug 16 '20 17:08 SparseSpeculator