IsADirectoryError while running


I follow this tutorial jetson-inference/ at master · dusty-nv/jetson-inference · GitHub and when I run
python3 --model-dir=models/mymodel
, I get the following error:

Namespace(batch_size=1, height=300, input='', labels='labels.txt', model_dir='models/weeds', net='ssd-mobilenet', output='', width=300)
running on device cuda:0
found best checkpoint with loss 10000.000000 ()
creating network:  ssd-mobilenet
num classes:       3
loading checkpoint:  models/weeds/
Traceback (most recent call last):
  File "", line 86, in <module>
  File "/home/maria/jetson-inference/python/training/detection/ssd/vision/ssd/", line 135, in load
    self.load_state_dict(torch.load(model, map_location=lambda storage, loc: storage))
  File "/usr/local/lib/python3.6/dist-packages/torch/", line 594, in load
    with _open_file_like(f, 'rb') as opened_file:
  File "/usr/local/lib/python3.6/dist-packages/torch/", line 230, in _open_file_like
    return _open_file(name_or_buffer, mode)
  File "/usr/local/lib/python3.6/dist-packages/torch/", line 211, in __init__
    super(_open_file, self).__init__(open(name, mode))
IsADirectoryError: [Errno 21] Is a directory: 'models/mymodel/'

How can I solve this problem?

Thank you!

Hi, can you check the contents of your models/weeds/ directory with ls models/weeds/ ?

Does it have any checkpoint files in it?


Yes, there are .pth files in it.

Hmm, ok - not sure why the error then. What I recommend is manually specifying these command line arguments instead:

  • --input path to PTH checkpoint with the lowest loss
  • --output=models/weeds/ssd-mobilenet.onnx
  • --labels=models/weeds/labels.txt