Search code examples
python-3.xtensorflowobject-detection

Using tensorflow object detection for either or detection


I have used Tensorflow object detection for quite awhile now. I am more of a user, I dont really know how it works. I am wondering is it possible to train it to recognize an object is something and not something? For example, I want to detect cracks on the tiles. Can i use object detection to do so where i show an image of a tile and it can tell me if there is a crack (and also show the location), or it will tell me if there is no crack on the tile?

I have tried to train using pictures with and without defect, using 2 classes (1 for defect and 1 for no defect). But the results keep showing both (if the picture have defect) in 1 picture. Is there a way to show only the one with defect?

Basically i would like to do defect checking. This is a simplistic case of 1 defect. but the actual case will have a few defects. Thank you.


Solution

  • In case you're only expecting input images of tiles, either with defects or not, you don't need a class for no defect. The API adds a background class for everything which is not the other classes. So you simply need to state one class - defect, and tiles which are not detected as such are not defected. So in your training set - simply give bounding boxes of defects, and no bounding box in case of no defect, and then your model should learn to detect the defects as mentioned above.