Search code examples
pythontensorflowobject-detection

Object detection: Error with Export/Import for inference


I am a beginner in machine learning and currently trying to follow the tutorial given in the following link https://github.com/tensorflow/models/blob/master/object_detection/g3doc/exporting_models.md

I had completed training a model which gave me model.ckpt files.below is the command that I typed into window command prompt

{Your path}\tensor\flow\models\research>
python object_detection\export_inference_graph.py\
--input_type=image_tensor \
--pipeline_config_path="{Your path}\model\ssd_mobilenet_v1_pets.config" \
--trained_checkpoint_prefix="{Your path}\models\train\" \
--output_directory=output_inference_graph.pb \
1>mloutput.txt 2>mlerror.txt

so when I checked the error file, this was what I found:

Traceback (most recent call last):
  File "object_detection\export_inference_graph.py", line 106, in <module>
    tf.app.run()
  File "C:\Users\ericsen\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "object_detection\export_inference_graph.py", line 95, in main
    assert FLAGS.output_directory, '`output_directory` is missing'
AssertionError: `output_directory` is missing

I dont really understand why the output directory is missing. Is it purely my mistake or is it a bug. Your kind feedback and help will be highly appreciated. Thank you


Solution

  • I have try print all argument and see:

    trained_checkpoint_prefix = "{Your path}\models\train\" \ --output_directory=output_inference_graph.pb \

    Its seem to be missing "\" in "{Your path}\models\train\"

    Try with add more "\" after "train\" --> "train\\"

    {Your path}\tensor\flow\models\research>
    python object_detection\export_inference_graph.py\
    --input_type=image_tensor \
    --pipeline_config_path="{Your path}\model\ssd_mobilenet_v1_pets.config" \
    --trained_checkpoint_prefix="{Your path}\models\train\\" \ 
    --output_directory=output_inference_graph.pb \