tensorflow - AWS Lambda 函数不正确地退出执行
问题描述
我有 Lambda 函数试图从 TensorflowJS 运行 PoseNet。程序正确执行,直到它到达
const net = await posenet.load({
architecture: 'MobileNetV1',
inputResolution: { width: 183, height: 275 },
scale: 0.8,
})
在这一行之后,我有一个函数detect(net, image)
,它在内部获取输入图像并执行const pose = await net.estimateSinglePose(image)
它应该简单地返回一个包含模型结果的 JSON 对象。但是,程序跳过了这个detect()
函数并成功完成了 Lambda 的执行。为什么是这样?
解决方案
检测是异步的,所以你必须await detect(....)
或然后使用
detect(img).then(predictions => {
console.log('Predictions: ', predictions);
});
推荐阅读
- wpf - 防止焦点/标签进入 UI 中的不可见元素
- python - 如何将 A 星算法的公式修改为我需要的以下内容?
- php - 数组中的 if 语句
- javascript - 使用momentjs获取用户选择的偏移值?
- python - 读取csv属性时Python字符串替换不起作用
- java - JPA,EclipseLink @Version +时间戳+精度?
- alexa - 我可以在没有 AWS lambda 的情况下使用 Alexa 技能提醒 API 和主动事件 API 吗?
- reactjs - 使用 react-redux translate 函数时,渲染的钩子比预期的要少
- swift - 你能挑选和选择在 Swift 的子类中继承的内容吗?
- javascript - filecleared of fileinput 删除