Cla*_*Kim 6 machine-learning tensorflow.js glitch-framework
曾尝试运行https://glitch.com/~tar-understood-exoplanet 并且模型无法加载,我将无法使用启用网络摄像头。
有人遇到过同样的问题吗?
当程序运行时,在控制台中我得到以下信息:
tfjs:2 Uncaught (in promise) Error: The dtype of dict['image_tensor'] provided in model.execute(dict) must be int32, but was float32
at Object.b [as assert] (tfjs:2)
at tfjs:2
at Array.forEach (<anonymous>)
at t.checkInputShapeAndType (tfjs:2)
at t.<anonymous> (tfjs:2)
at tfjs:2
at Object.next (tfjs:2)
at tfjs:2
at new Promise (<anonymous>)
at Zv (tfjs:2)
Run Code Online (Sandbox Code Playgroud)
我有一台 Macbook Pro,Windows 上的其他一些人在运行该模型时也遇到了一些问题。我们还在不同的浏览器上进行了尝试,Safari 和 Chrome。
成功!切换到 coco-ssd 2.0.2 后:
我在第 62 行添加了 2.0.2 版本,如下所示:
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd@2.0.2"></script>
Run Code Online (Sandbox Code Playgroud)
小智 3
这是由使用 tf.zeros 张量的 coco-ssd 的预热运行引起的。在最新版本的 TFJS 中,tf.zeros 的默认数据类型是“float”。我已经发布了带有修复程序的新版本。如果您在故障示例 (index.html) 中使用最新版本的 coco-ssd (2.0.2),它应该可以工作,如下所示。
<!-- Load the coco-ssd model to use to recognize things in images -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/coco-ssd@2.0.2"></script>
Run Code Online (Sandbox Code Playgroud)