Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No such file or directory while running generate_tfrecord.py #104

Open
adityaksai opened this issue Sep 26, 2019 · 0 comments
Open

No such file or directory while running generate_tfrecord.py #104

adityaksai opened this issue Sep 26, 2019 · 0 comments

Comments

@adityaksai
Copy link

Hello, I have followed the tensorflow object detection API installation by following the below demo

https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10.

I am getting this problem while running the line---

python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record

Error:

(tf_gpu) C:\Tensorflow1\models\research\object_detection>python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record
WARNING: Logging before flag parsing goes to stderr.
W0927 00:55:20.335181 15036 deprecation_wrapper.py:119] From generate_tfrecord.py:121: The name tf.app.run is deprecated. Please use tf.compat.v1.app.run instead.

W0927 00:55:20.341163 15036 deprecation_wrapper.py:119] From generate_tfrecord.py:107: The name tf.python_io.TFRecordWriter is deprecated. Please use tf.io.TFRecordWriter instead.

W0927 00:55:20.512737 15036 deprecation_wrapper.py:119] From generate_tfrecord.py:66: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

Traceback (most recent call last):
File "generate_tfrecord.py", line 121, in
tf.app.run()
File "C:\Users\Aditya\Anaconda3\envs\tf_gpu\lib\site-packages\tensorflow\python\platform\app.py", line 40, in run
_run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
File "C:\Users\Aditya\Anaconda3\envs\tf_gpu\lib\site-packages\absl\app.py", line 300, in run
_run_main(main, args)
File "C:\Users\Aditya\Anaconda3\envs\tf_gpu\lib\site-packages\absl\app.py", line 251, in _run_main
sys.exit(main(argv))
File "generate_tfrecord.py", line 112, in main
tf_example = create_tf_example(group, path)
File "generate_tfrecord.py", line 67, in create_tf_example
encoded_jpg = fid.read()
File "C:\Users\Aditya\Anaconda3\envs\tf_gpu\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 122, in read
self._preread_check()
File "C:\Users\Aditya\Anaconda3\envs\tf_gpu\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 84, in _preread_check
compat.as_bytes(self.__name), 1024 * 512)
tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: C:\Tensorflow1\models\research\object_detection\images\train\img000000.jpg : The system cannot find the file specified.
; No such file or directory

Solution 1:
I have changed the xml to csv file by adding the .jpg extension.

I want to use it for my own dataset.

I am able to run the model for single class like
models/research/object_detection/images/train/class1
models/research/object_detection/images/test/class1

I want to extend it to my multi class dataset.
Folder structure:
models/research/object_detection/images/train/class1
models/research/object_detection/images/train/class2
models/research/object_detection/images/train/class3

models/research/object_detection/images/test/class1
models/research/object_detection/images/test/class2
models/research/object_detection/images/test/class3

train_labels.csv file contains

filename,width,height,class,xmin,ymin,xmax,ymax
img000000.jpg,640,480,auto,21,114,77,193
img000001.jpg,640,480,auto,332,10,504,229
img000000.jpg,640,480,bus,322,356,334,371
img000001.jpg,640,480,bus,341,357,351,370
img000002.jpg,5500,3667,car,2516,1933,2819,2422

Any help is much appreciated.
Thank you in advance .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant