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:
[
{
"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. Appending --output $(pwd)/src/out.json
, or any variants of output
, doesn't return anything.
Do Unix exe's have a default flag for exporting data? Or is there a way to view all the flag options in this exe?
CodePudding user response:
Looks like predict is a bash script. 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.