models icon indicating copy to clipboard operation
models copied to clipboard

AssertionError: `train_dir` is missing.

Open Iqbal0007 opened this issue 7 years ago • 7 comments

Please go to Stack Overflow for help and support:

http://stackoverflow.com/questions/tagged/tensorflow

Also, please understand that many of the models included in this repository are experimental and research-style code. If you open a GitHub issue, here is our policy:

  1. It must be a bug, a feature request, or a significant problem with documentation (for small docs fixes please send a PR instead).
  2. The form below must be filled out.

Here's why we have that policy: TensorFlow developers respond to issues. We want to focus on work that benefits the whole community, e.g., fixing bugs and adding features. Support only helps individuals. GitHub also notifies thousands of people when issues are filed. We want them to see you communicating an interesting problem, rather than being redirected to Stack Overflow.


System information

  • I am implementing the procedure from this blog post. Which is similar - https://www.freecodecamp.org/news/how-to-play-quidditch-using-the-tensorflow-object-detection-api-b0742b99065d/

  • No I didn't

  • Windows 10

  • Tensorflow installed in pycharm

  • Tensorflow 1.8

  • Bazel version (if compiling from source):

  • NVIDIA 1050ti

  • Exact command to reproduce:

You can collect some of this information using our environment capture script:

https://github.com/tensorflow/tensorflow/tree/master/tools/tf_env_collect.sh

You can obtain the TensorFlow version with

python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

Describe the problem

When I am trying to run python object_detection/train.py --logtostderr --pipeline_config_path=pipeline.config --train_dir=train this command for object detection using Tensorflow I'm getting this error - AssertionError: train_dir is missing.

I have tried to find for a solution but couldn't find one. Not sure where is the problem.

Source code / logs

Traceback (most recent call last): File "object_detection/train.py", line 163, in tf.app.run() File "C:\Users\User\Anaconda3\envs\Quidditch\lib\site-packages\tensorflow\python\pla tform\app.py", line 126, in run _sys.exit(main(argv)) File "object_detection/train.py", line 87, in main assert FLAGS.train_dir, 'train_dir is missing.' AssertionError: train_dir is missing.

Iqbal0007 avatar Jun 17 '19 16:06 Iqbal0007

Check once, I think there is no 'train' directory in the directory containing train.py .

QuickLearner171998 avatar Jun 18 '19 09:06 QuickLearner171998

@QuickLearner171998 bro the code should create a Train folder by itself.

Iqbal0007 avatar Jun 22 '19 18:06 Iqbal0007

No I read the code again. See line 87. If the train_dir is missing then it will throw assertion error. Moreover there is no command in it to create a new dir.

QuickLearner171998 avatar Jun 23 '19 03:06 QuickLearner171998

Tensorflow Object Detection API requires Tensorflow (>=1.12.0) See https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

ymodak avatar Jul 10 '19 21:07 ymodak

How I solved is typing the whole training command by myself, not copy-paste.

elonashatri avatar Mar 03 '20 17:03 elonashatri

I went inside the train.py file and saw the following:

Screen Shot 2020-05-12 at 9 34 33 AM

Make sure that you type the command exactly like that. In my case, I was not passing in the "train_dir" argument. Hope this helps.

aeaguilarn avatar May 12 '20 13:05 aeaguilarn

same error train_dir is missing

!python /content/drive/MyDrive/nvidia-tao/models/research/object_detection/dataset_tools/create_coco_tf_record.py \
  --logtostderr \
  --train_image_dir= /content/drive/MyDrive/kitti_data/training/test_trecord/train/ \
  --val_image_dir= /content/drive/MyDrive/kitti_data/training/test_trecord/train/ \
  --train_object_annotations_file= /content/drive/MyDrive/kitti_data/training/test_trecord/_annotations.coco.json \
  --val_object_annotations_file= /content/drive/MyDrive/kitti_data/training/test_trecord/_annotations.coco.json \
  --output_dir= /content/drive/MyDrive/kitti_data/training/test_trecord/test_tfrecord

why i am getting error when i run create_coco_tf_record.py file on colab

faridelya avatar Jan 11 '23 09:01 faridelya