EdjeElectronics / TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10

How to train a TensorFlow Object Detection Classifier for multiple object detection on Windows
Apache License 2.0
2.92k stars 1.3k forks source link

generate_tfrecord give me Windows fatal exception: access violation #311

Open Dougdaddyboy opened 5 years ago

Dougdaddyboy commented 5 years ago

hello everybody, at the moment i do "python generate_tfrecord" i get this message, do you have any idea of what is the problem?

Windows fatal exception: access violation

Current thread 0x00000a20 (most recent call first): File "C:\Users\Dougdaddyboy\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 84 in _preread_check File "C:\Users\Dougdaddyboy\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 122 in read File "generate_tfrecord.py", line 47 in create_tf_example File "generate_tfrecord.py", line 92 in main File "C:\Users\Dougdaddyboy\Anaconda3\envs\tensorflow1\lib\site-packages\absl\app.py", line 251 in _run_main File "C:\Users\Dougdaddyboy\Anaconda3\envs\tensorflow1\lib\site-packages\absl\app.py", line 300 in run File "C:\Users\Dougdaddyboy\Anaconda3\envs\tensorflow1\lib\site-packages\tensorflow\python\platform\app.py", line 40 in run File "generate_tfrecord.py", line 101 in

lsyang1111 commented 5 years ago

I have the same problem.

matchumen commented 5 years ago

Same here.

lsyang1111 commented 5 years ago

Maybe you can re-check there are corresponding files within the "images" under object_detection folder.

marisna commented 5 years ago

Hello, same here. Have you understood what was the matter?

kryuki commented 5 years ago

Same here...

ZOUHEIRBN commented 5 years ago

Did you use the command line written at the beginning of the 'generate_tfrecords.py' file? If you did so and it got you that error try to add the following argument to your command line: --image_dir=/images (or wherever you put your images)

I had the same problem and this worked for me

kryuki commented 5 years ago

Oh I solved this! Actually I don't know exactly what was the problem, but I changed my version of tensorflow, python, cuda, and cudnn, and then I could finish. It was a hard work, but version seems to be very important... This is what I used for your information. TensorFlow 1.8.0 Python 3.6 Cuda 9.0 CuDNN 7.6.3 for Cuda9.0 ...and of cource, GitHub Models Repository Commit for tensorflow 1.8! (+alpha, I deleted so many files to spare enough space of my Drives)

As the tutorial says, as of tensorflow 1.9, the folder does not include train.py file. There seem to be so many differences in the files according to the versions and I tried in a way that seemed easier. So I chose 1.8.

I hope it helps.

pengrush commented 4 years ago

If you train your own data, check the csv table you generated. Maybe there is no .jpg in filename.

AmalMtibaa commented 4 years ago

In my case, I am creating my own object detractor, First the problem was that I had few images without its xml, I created this script to detect them.

import glob
TEST_IMAGES_PATH='C:/Users/Asus/Desktop/my_tf_model/images/test/'
for image_path in glob.glob(TEST_IMAGES_PATH + '*.jpg'):
    xml=glob.glob(image_path[:-4]+'.xml')
    if xml==[]:
        print('JPG problem with : '+ image_path)

for xml_path in glob.glob(TEST_IMAGES_PATH + '*.xml'):
    jpg=glob.glob(xml_path[:-4]+'.jpg')
    if jpg==[]:
        print('XML problem with : '+ xml_path)

After solving that, I still had the same error , I added "print(row['filename']) in generate_tfrecord.py to see where the program is blocking to realize that I had an xml file that has the wrong image filename.

In my opinion, try first to run the generate_tfrecord with few images, if it works, then you are sure your problem isn't retaliated to environment and versions but with the data.