When I execute the following command I get the below error from Tensorflow "missing file or folder". I've checked all online solutions for this error, but nothing is resolving my error.
python generate_tfrecord.py --csv_input=images\train_labels.csv --image_dir=images\train --output_path=train.record
The error:
File "generate_tfrecord.py", line 110, in tf.app.run() File "C:\anaconda3\envs\tensorflowc\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run _sys.exit(main(argv)) File "generate_tfrecord.py", line 101, in main tf_example = create_tf_example(group, path) File "generate_tfrecord.py", line 56, in create_tf_example encoded_jpg = fid.read() File "C:\anaconda3\envs\tensorflowc\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 125, in read self._preread_check() File "C:\anaconda3\envs\tensorflowc\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 85, in _preread_check compat.as_bytes(self.__name), 1024 * 512, status) File "C:\anaconda3\envs\tensorflowc\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 519, in exit c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.NotFoundError: NewRandomAccessFile failed to Create/Open: C:\tensorflowc\models\research\object_detection\images\train\tr1138a1a1_3_lar : The system cannot find the file specified. ; No such file or directory
I resolved the problem
If you are making a .CSV file
using an xml_to_csv file.py
,
You have to check the file extensions such as .jpg, .png, and .jpeg in the train_labels.csv
file.
In my case, the extension names are not there!
Solution:
add the extensions like below example and run the following command:
python generate_tfrecord.py
--csv_input=images\train_labels.csv
--image_dir=images\train
--output_path=train.record
It will work!