问题标签 [deeplearn.js]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
145 浏览

javascript - 我应该如何加载 deeplearn js?

https://deeplearnjs.org/index.html#demos,它说 API 将以“dl”的形式提供,这是该站点的打印屏幕:


在此处输入图像描述


但是当我试着把

它提示 Uncaught ReferenceError: dl is not defined

那我应该怎么加载呢?

0 投票
1 回答
31 浏览

deep-learning - 如何从 HxWxD 张量中获得 D 平均值

如何在 Deeplearnjs 中创建一个图形元素,将我的 [h, w, d] 形状张量变成一个 [d] 形状,其中每个都是该层的最大值。如果 h 和 w 相同,则可以使用 maxpool 函数来完成。如果喜欢同样的意思。使用 conv2d 可以实现均值,但前提是 w 和 h 相等。

我需要在图表中使用它,以便我可以应用培训。

0 投票
1 回答
153 浏览

javascript - 如何在 Deeplearn.js 中将 int32 转换为 float32?

这段代码在 2017 年 12 月为我工作,但随着 Deeplearn.js 的最新版本,它停止工作:

现在失败并显示以下消息:

如何将图像转换为介于 0.0 和 1.0 之间的 float32 值?

0 投票
1 回答
139 浏览

javascript - 如何在 React 组件中使用 deeplearn.js

我目前正在使用 react 和 deeplearn.js 创建一个项目,并且在将两者结合起来时遇到了障碍。在我的反应应用程序中,我正在导入我用来进行分类的deeplearnjs 库模型。不幸的是,当我尝试调用 predict() 方法时,出现以下错误:

TypeError: _this.variables is undefined

对于以下代码部分:

当我在普通 HTML 中使用生成的 Javascript 时,它工作得很好,所以我不确定为什么我在 react 中遇到这个错误。我感觉这与更严格的 React 规则或 Javascript 版本控制有关,但我不确定。

谢谢!

更新

最简单的重现方法如下:

  1. 创建一个新的 React 应用程序create-react-app
  2. 运行yarn add deeplearnyarn add deeplearn-squeezenet
  3. 将 App.js 修改为以下内容:

    /li>
  4. 将以下文件下载到公共文件夹:https ://raw.githubusercontent.com/PAIR-code/deeplearnjs/master/models/squeezenet/cat.jpg

  5. yarn start

作为参考,我正在使用 react 16.2.0

0 投票
0 回答
39 浏览

javascript - 构造 Array1D 时出错

我正在尝试使用 node-red 中的 deeplearn.js 开始学习机器学习。

首先,我创建了简单的Inject>Function>Debug节点流,导入了库并复制了入门示例并进行了编辑以在 node-red 中工作。这看起来像这样:

dl.Array1D.new([1,2,3]);抛出的问题

错误:构造 Array1D 时出错。值的形状不是一维的。

如果“a”是 Scalar 或 Array2D 一切正常。有人知道这个数组不是一维的或者如何强制它是一维的吗?

0 投票
4 回答
14576 浏览

node.js - 如何将 https 添加到纱线运行?

我正在尝试运行纱线服务器

它启动一个服务器,但使用 http 而不是 https。--https 选项适用于我正在处理的另一个项目,但不适用于这个项目。我想知道是否还需要在 package.json 中设置一些内容以启用 https。作为参考,这是我克隆并正在使用的 github 项目:https ://github.com/googlecreativelab/teachable-machine-boilerplate 。

0 投票
1 回答
1736 浏览

node.js - ReferenceError: ImageData is not defined at MathBackendCPU.fromPixels when pass image into the function

I got this error when my program read the .png image file and used the data as the parameter for the fromPixels() function in tensorflow.js. Why it said ImageData is not defined? Am I miss out any dependencies?

Here is the code:

p/s: Please inform me if need more information.

Thanks.