[英]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.json
或output
任何变体,不会返回任何内容。
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.