小编Suh*_*shi的帖子

你如何将 .onnx 转换为 tflite?

我已通过以下方式将模型导出到 ONNX:

# Export the model
torch_out = torch.onnx._export(learn.model,             # model being run
                           x,                       # model input (or a tuple for multiple inputs)
                          EXPORT_PATH + "mnist.onnx", # where to save the model (can be a file or file-like object)
                           export_params=True)      # store the trained parameter weights inside the model file
Run Code Online (Sandbox Code Playgroud)

现在我正在尝试将模型转换为 Tensorflow Lite 文件,以便我可以在 Android 上进行推理。不幸的是,PyTorch/Caffe2 对 Android 的支持相当缺乏或过于复杂,但 Tensorflow 看起来要简单得多。

ONNX 到 Tflite 的文档对此非常清楚。

我尝试通过以下方式导出到 Tensorflow GraphDef proto:

tf_rep.export_graph(EXPORT_PATH + 'mnist-test/mnist-tf-export.pb')

然后运行toco

toco \
--graph_def_file=mnist-tf-export.pb \
--input_format=TENSORFLOW_GRAPHDEF …
Run Code Online (Sandbox Code Playgroud)

deep-learning keras tensorflow pytorch onnx

15
推荐指数
1
解决办法
1万
查看次数

Firebase:使用令牌登录

Firebase 问题

我的目标是让用户登录主要使用 NodeJS 制作的桌面应用程序

  1. 用户登录
  2. 存储某种令牌以便用户稍后登录
  3. 当用户重新打开应用程序时,使用该令牌(如果可用)登录用户
  4. 令牌可能会过期/失效

目前,Firebase 似乎依赖于某种 ​​cookie。有没有办法让用户无需电子邮件/密码即可再次登录?

我目前正在尝试使用 Firebase 身份验证作为我的 Electron 应用程序的一部分,其中我无法让 Firebase 身份验证代码成为通常可以访问浏览器级存储的渲染器进程的一部分。

理想的情况是这样的:

    const auth_token = await user.getIdToken();

    firebase
      .auth()
      .signInWithCustomToken(auth_token) // But maybe some other method?
      .then((user) => {
        console.log(user);
      })

Run Code Online (Sandbox Code Playgroud)

在无法访问浏览器存储的 NodeJS 应用程序中,您将如何执行此操作,以便用户不需要持续登录?

引用此问题:Persist Firebase user for Node.js client application

fwiw,我不想与其他应用程序共享这些令牌。

电子题

一个稍微不同的问题:Electron 中的主进程可以存储 Firebase 可以访问的 cookie 吗?

最近读过这个:https://github.com/firebase/firebase-js-sdk/issues/292

firebase electron

5
推荐指数
1
解决办法
3261
查看次数

如何在 Electron 中播放自定义声音

我正在使用 Electron 8.0.3,我正在尝试播放自定义声音。这就是我正在做的:

  const notif = new Notification({
    title: 'Finished Download',
    body: 'test',
    sound: 'vapp/assets/sounds/mighty_sound.mp3',
  });

  notif.show();
Run Code Online (Sandbox Code Playgroud)

它似乎没有播放该声音,而是播放默认的 macOS 声音。我试过了:

  • 使用绝对路径,例如'/Users/<name>/Desktop/workspace/proj/vapp/assets/sounds/sound.mp3'
  • 打包应用程序以便将声音捆绑在一起
  • 播放不同的文件类型:.wav、.mp3、.aiff
  • 选择可能存在的其他 macOS 声音/System/Library/Sounds

无论出于何种原因,它都会播放相同的声音。

我已经参考了这个文档

electron

5
推荐指数
1
解决办法
2071
查看次数

标签 统计

electron ×2

deep-learning ×1

firebase ×1

keras ×1

onnx ×1

pytorch ×1

tensorflow ×1