How to use "inference.py"
Previously, when I requested a way to Deploy accurately DIGITSClassifyOne result, inference.py was introduced me to. Then, I wote next code..
$ Python ~ / DIGITS / tools / inference.py --db / usr / share / digits / digits / jobs imglist.txt ~ / 20160609-110634-1c10
( imglist.txt is the path of the test image List)
Execution result,
inference.py: error: unrecognized arguments: 20160609-110634-1c10
According to the Help
Inference tool - DIGITS positional arguments: input_list An input file containing paths to input data output_dir Directory to write outputs to model Model ID
What is the Model ID? There is "0160609-110634-1c10" folder,It is in DIGITS model files ,Not found what appears to Model ID.
Or there is a problem with the other?
@shinfo001 I don't know if it's due to your copy/paste but there are a bunch of extra spaces in your command line. You want to do something like:
.../inference.py /path/to/image-list.txt /path/to/output-folder model-job-id --gpu=0
You can find the model ID on your model page. The model ID is the basename of the job directory. For example if your model is in .../jobs/20160117-135614-955c then the model ID is 20160117-135614-955c.
Currently inference.py stores the inference output into an HDF5 file. You will need to either write code to read the HDF5 database or change the code to extract the information you need. If you are not comfortable with this you can use the REST API. For example:
curl localhost:5000/models/images/classification/classify_many.json -XPOST -F job_id=20160117-135614-955c -F image_list=@/path/to/image-list.txt
Thank you as always comment.
I tried to run the following code:
curl localhost/models/images/classification/classify_many.json -XPOST -F job_id=20160609-110634-1c10 -F image_list=~/eclipse-workspace/DIGITS_Classify/image-list.txt
"Error": { "Description": "image_list is a required field", "Message": "400: Bad Request",
Is there a mistake on the command line?
Succses next code.
python ~/DIGITS/tools/inference.py image-list.txt ./ 20160609-110634-1c10 -j=/usr/share/digits/digits/jobs --gpu=0
"" not found 2016-06-10 13:39:52 [INFO ] Saved data to ./inference.hdf5
What is error "" not found?
Hello @shinfo001, I think you omitted the @ sign before the path to the image list in your curl command line. See curl manual. It should be something like:
curl localhost/models/images/classification/classify_many.json -XPOST -F job_id=20160609-110634-1c10 -F image_list=@~/eclipse-workspace/DIGITS_Classify/image-list.txt
Regarding the "" not found message, perhaps you just have a blank line in your image list? That shouldn't be an issue, invalid paths are ignored.
Both went well. I'm very grateful.
By the way, classify_many.json have the option of GPU acceleration?
By the way, classify_many.json have the option of GPU acceleration?
Yes, by default classify_many will try to reserve one GPU for inference. If there is a free GPU it will use it. If there is no free GPU (e.g. all your GPUs are already busy for training a model) then it will resort to CPU inference, which will be noticeably slower.
Thanks for the feedback. I understand these answers are acceptable so I will be closing the issue. Don't hesitate to let us know if you need any further information.