简体   繁体   English

如何从 Unix 可执行文件导出结果?

[英]How to export result from Unix executable?

I'm running deep learning inference from this great image quality assessment library:我正在从这个出色的图像质量评估库中运行深度学习推理:

./predict  \
--docker-image nima-cpu \
--base-model-name MobileNet \
--weights-file $(pwd)/models/MobileNet/weights_mobilenet_technical_0.11.hdf5 \
--image-source $(pwd)/src/tests/test_images

Running predict , which is a Unix Executable, returns the following sample output:运行predict ,这是一个 Unix 可执行文件,返回以下示例输出:

[
  {
    "image_id": "42039",
    "mean_score_prediction": 5.154480201676051
  },
  {
    "image_id": "42040",
    "mean_score_prediction": 4.297615758532629
  },
  {
    "image_id": "42041",
    "mean_score_prediction": 5.450399260735139
  },
  {
    "image_id": "42042",
    "mean_score_prediction": 5.163813116261736
  },
  {
    "image_id": "42044",
    "mean_score_prediction": 5.728919437354534
  }
] 

I'm trying to save this output, ideally to json, but don't know how.我正在尝试将此输出保存到 json,但不知道如何保存。 Appending --output $(pwd)/src/out.json , or any variants of output , doesn't return anything.附加--output $(pwd)/src/out.jsonoutput任何变体,不会返回任何内容。

Do Unix exe's have a default flag for exporting data? Unix exe 是否具有用于导出数据的默认标志? Or is there a way to view all the flag options in this exe?或者有没有办法查看这个exe中的所有标志选项?

Looks like predict is a bash script.看起来 predict 是一个 bash 脚本。 There's no rule on how the arguments should work.没有关于参数应该如何工作的规则。 I would just pipe your output to a file like this:我只是将您的输出通过管道传输到这样的文件:

./predict  \
--docker-image nima-cpu \
--base-model-name MobileNet \
--weights-file $(pwd)/models/MobileNet/weights_mobilenet_technical_0.11.hdf5 \
--image-source $(pwd)/src/tests/test_images
> output.json

The last part tells your terminal to send stdout (what would normally show in your screen) to the mentioned file, either creating it or overwriting it.最后一部分告诉您的终端将标准输出(通常会显示在您的屏幕上)发送到提到的文件,要么创建它,要么覆盖它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用python从GUI可执行文件导出数据 - How to export data from a GUI executable using python 如何将 statsmodels 测试的结果导出到 CSV? - How to export the result from statsmodels test to CSV? 如何将从 Python 获得的结果导出到 excel - How to export result obtained from Python into excel 如何将UNIX可执行文件转换为桌面图标快捷方式? - How to turn a UNIX executable into a desktop icon shortcut? 如果我的脚本使用从其他文件导入的函数,如何让我的脚本从 Unix 上的可执行 python 文件运行? (ModuleNotFoundError) - How can I make my script run from executable python file on Unix if it uses functions imported from other files? (ModuleNotFoundError) unix symbolic 的问题灵感来自 python venv 可执行符号链接的使用 - The question of unix symbolic inspired from the usage of python venv executable symlink 我们如何从Arango DB noSQL获取结果导出 - how we can get the result export from Arango DB noSQL 如何从命令行导出数据(这是Python程序的结果)? - How to export data (which is as result of Python program) from command line? 如何从 function 导出结果? (更新了更多代码) - How to export a result from function? (updated with more code) 将结果从子流程传递到Unix排序 - Pipe result from subprocess to unix sort
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM