TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 icon indicating copy to clipboard operation
TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10 copied to clipboard

Issue in generating tfrecord

Open RutvikBabar opened this issue 6 years ago • 6 comments
trafficstars

RutvikBabar avatar Jul 16 '19 02:07 RutvikBabar

Traceback (most recent call last): File "generate_tfrecord.py", line 102, in tf.app.run() File "C:\Users\Sarvesh Gharat\Anaconda3\envs\tensorflow-1\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\Sarvesh Gharat\Anaconda3\envs\tensorflow-1\lib\site-packages\absl\app.py", line 300, in run _run_main(main, args) File "C:\Users\Sarvesh Gharat\Anaconda3\envs\tensorflow-1\lib\site-packages\absl\app.py", line 251, in _run_main sys.exit(main(argv)) File "generate_tfrecord.py", line 93, in main tf_example = create_tf_example(group, path) File "generate_tfrecord.py", line 48, in create_tf_example encoded_jpg = fid.read() File "C:\Users\Sarvesh Gharat\Anaconda3\envs\tensorflow-1\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 122, in read self._preread_check() File "C:\Users\Sarvesh Gharat\Anaconda3\envs\tensorflow-1\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:\tensorflow-1\models\research\object_detection\06VZ-CHECK.jpg : The system cannot find the file specified. ; No such file or directory

SORRY FOR ASKING THIS DOUBT IN THE COMMENT, I POSTED IT VOID BY MISTAKE

RutvikBabar avatar Jul 16 '19 02:07 RutvikBabar

I've had this before. Have you ever copied your xml files to make it easier to label data for similiar images? Make sure you check all the xml files to see they have the correct name and point to the right file because if you copy xml files and edit the annotations the file names don't update sometimes.

aidoshacks avatar Jul 18 '19 05:07 aidoshacks

I've had this before. Have you ever copied your xml files to make it easier to label data for similiar images? Make sure you check all the xml files to see they have the correct name and point to the right file because if you copy xml files and edit the annotations the file names don't update sometimes.

I eventually got everything right, the tfrecord the training etc, and I will be honest, i dont know what I did. I think I deleted all the xml files, train labels and test labels and re-labeled the images. The problem is solved but can you explain what exactly was its cause? I wanna know since i have no idea how it got rectified just by relabeling

RutvikBabar avatar Jul 31 '19 15:07 RutvikBabar

It is more than likely that your XML files had the wrong names in them so they were pointing to files that either didn't exist or were in the wrong folder.

aidoshacks avatar Aug 01 '19 23:08 aidoshacks

I have created dataset for one category with 2500 images.I have divided the images into train(80% = 2000 ) and test (20% = 500) folder. CSV is generated successfully but tf record for test is generated successfully.When i want to generate tf record for train is not generating successfully.

But when,

I have created dataset for one category with 1000 images.I have divided the images into train(80% = 800 ) and test (20% = 200) folder CSV is generated successfully.CSV and TF record generated successfully for both train and test.

I dont know why it is happening. Can any one help me out with this?

SouradipBh avatar Aug 04 '19 04:08 SouradipBh

@SouradipBh Hey,

long time ago, but just for interest, did you find out why? I mean is it necesarry how the images are named for exmaple image1.jpg or image_1.jpg?

Petros626 avatar May 17 '22 05:05 Petros626