tensorflow-lambda
tensorflow-lambda copied to clipboard
Not working with posenet?
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.
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!