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

Accuracy For Detection (Issues) #60

Open mronda opened 6 years ago

mronda commented 6 years ago

I ran the RCNN for around 3 hours and got up to 50K steps but when I tested the images I got weird accuracy when running random images. What could be the issue? Do I need more data sets?

Setup: Running on a GeForce GTX 970 with compute capability of 5.2.

image

Running some random objects image

Djacob502 commented 6 years ago

I am also interested in this. The tensorflow object detection api works well just on the trained dataset but ends up falsely classifying images that are not similar to the trained dataset. I'm not sure if this is the correct place to discuss but how to exclude images that are not part of the dataset? Can we include additional images the classifier might encounter and then place those images into a other category? It seems like the other category would need to have a very large number of images in it.

Ibrahimq commented 6 years ago

i also have the same problem, different checkpoints yields to different classes, but still the same problem!

leccyril commented 6 years ago

i have same problem, i trained my own dataset, only one class, but it detect this class even in picture where is not this object.... someone could answer us ? i tried from several days to make it work with no end...

asxasxdscsd commented 6 years ago

@leccyril i have same problem. in traning options, there is a parameter that resize the input images to 1024*600 with this code :

model { faster_rcnn { num_classes: 4 image_resizer { keep_aspect_ratio_resizer { min_dimension: 600 max_dimension: 1024 } }

in other hand, the orginal traning images of the tutorial has nearly same dimension.

so i think we must convert the training images to 1024*600 resolution.

have you got better way to solve it ?????

alper-d commented 5 years ago

i have same problem, i trained my own dataset, only one class, but it detect this class even in picture where is not this object.... someone could answer us ? i tried from several days to make it work with no end...

Exactly same issue. I just need to detect presence of some particular object(num_of_class = 1) and it captures every part of the frame. I am using ssdlite_mobilenet and planning to move run inference graph on raspberry pi3. How much iteration I should go for proper detection?

ZAFERSHAMIM commented 5 years ago

i have same problem, i trained my own dataset, only one class, but it detect this class even in picture where is not this object.... someone could answer us ? i tried from several days to make it work with no end...

https://github.com/EdjeElectronics/TensorFlow-Object-Detection-API-Tutorial-Train-Multiple-Objects-Windows-10/issues/175 try the no ground truth images as your background images i am also working on that lets see whether it reduces error while detection or not

ZAFERSHAMIM commented 5 years ago

i have same problem, i trained my own dataset, only one class, but it detect this class even in picture where is not this object.... someone could answer us ? i tried from several days to make it work with no end...

https://github.com/tensorflow/models/issues/5954 try implementing balajis comment about noground truth images where he talks about adding background images and reply if it works ,reduces your error i would do the same

leccyril commented 5 years ago

for this demo i just use the tutorial datas so i don't think we have to add things.... juste use like this but not working

shamik111691 commented 5 years ago

@ZAFERSHAMIM could you please tell me how to add background images. Do I just need to add background images to my CSV file? My CSV file has the following specifications: filename,width,height,class,xmin,ymin,xmax,ymax

So for a background image it should be: background.jpg,200,200,background,some number,some number,some number,some number

I don't need to add anything to the label .pbtxt file?

From that CSV file I can convert to TFR?

ZAFERSHAMIM commented 5 years ago

@ZAFERSHAMIM could you please tell me how to add background images. Do I just need to add background images to my CSV file? My CSV file has the following specifications: filename,width,height,class,xmin,ymin,xmax,ymax

So for a background image it should be: background.jpg,200,200,background,some number,some number,some number,some number

I don't need to add anything to the label .pbtxt file?

From that CSV file I can convert to TFR?

For adding background images you just need to add some images to train directory without their xml annotations after that follow the same procedure ,generate csv than tfr and run training. U dont need to change .pbtxt file and i am talking in context of faster rcnn models

shamik111691 commented 5 years ago

@ZAFERSHAMIM Thanks a lot. I don't have xml files. I just have CSV files which I am writing manually. So for these background images what will the CSV file contain. Right now my CSV file has the specifications: filename,width,height,class,xmin,ymin,xmax,ymax

So will it be filename.jpg,{width of file}, {height of file},background,,,,

Thanks for your help

ZAFERSHAMIM commented 5 years ago

for this demo i just use the tutorial datas so i don't think we have to add things.... juste use like this but not working

developers talked about that groundtruth images method u can give it a try cause everyone is facing that issue and its the only solution api developer has talked about. This weekend i will post my results whether that worked or not you can also try only training would take time nothing else.

ZAFERSHAMIM commented 5 years ago

@ZAFERSHAMIM Thanks a lot. I don't have xml files. I just have CSV files which I am writing manually. So for these background images what will the CSV file contain. Right now my CSV file has the specifications: filename,width,height,class,xmin,ymin,xmax,ymax

So will it be filename.jpg,{width of file}, {height of file},background,,,,

Thanks for your help

nope you dont have to write xml files manualy u can use https://github.com/tzutalin/labelImg/releases labelimg it would create xml files automaticlly

shamik111691 commented 5 years ago

@ZAFERSHAMIM I am sorry for not being clear. I am not using XML files at all. I generate CSV files directly without using XML. Please let me know what will the CSV file entry for a background image look like. Thanks.

ZAFERSHAMIM commented 5 years ago

@ZAFERSHAMIM I am sorry for not being clear. I am not using XML files at all. I generate CSV files directly without using XML. Please let me know what will the CSV file entry for a background image look like. Thanks.

exactly i dont know that cos i will use generate csv script and it would auto generate csv for all data, My method is to add some images without xml files in train split of images and generate csv out of them.

shamik111691 commented 5 years ago

@ZAFERSHAMIM Once you generate the CSV file could you please let me know the value of the fields corresponding to the background image? Thanks, Shamik

ZAFERSHAMIM commented 5 years ago

i will give you csv and other output this weekend

shamik111691 commented 5 years ago

@ZAFERSHAMIM Thanks a lot. Looking forward to it.

leccyril commented 5 years ago

i don't think we have to add background image in other discussions they explained that when your creating annotation on your picture there are areas not annotated, it is like background ...

and in his tutorial and in all tutorials i saw there is not "background" pictures

ZAFERSHAMIM commented 5 years ago

i don't think we have to add background image in other discussions they explained that when your creating annotation on your picture there are areas not annotated, it is like background ...

and in his tutorial and in all tutorials i saw there is not "background" pictures

i watched a comment pkulzc he is developer of this api regarding adding that back ground images that is why i recommended you to do so

leccyril commented 5 years ago

so we put pictures without annotation where is not present our objects ?

ZAFERSHAMIM commented 5 years ago

so we put pictures without annotation where is not present our objects ?

yes just put pictures without annotations

apoorva1999 commented 5 years ago

does adding background images work for other models like ssd in tensorflow_api?

Petros626 commented 2 years ago

The models are pretrained on other datasets, that's right, but this is about learning shapes not exactly the content of the image. So if you train your own model and do transfer-learning, which is recommended, because training from scratch isn't an easy job, it should be possible to train it on customs classes. If you train on playing cards, it can't detect a car or a bus, the problem some of you describe here is overfitting, detecting false positives