<p>You first have to well define your problem and your objectives:</p>
<ul>
<li>If you only want to detect if your image has a defect or not, it's a <strong>binary classification</strong> problem and you affect a label (0 or 1) to each image.</li>
<li>If you want to localise the defect approximatively (like a bounding box), it's an <strong>object detection</strong> problem and it can be realised with one or more classes.</li>
<li>If you want to localise precisely the defect (in order to performe measures for instance) the best is <strong>semantic segmentation</strong> or <strong>instance segmentation</strong>.</li>
<li>If you want to classify the defect, you will need to create classes for each defect you want to classify.</li>
</ul>
<p>There is no magical solution because it depends of the objectives of your project. I can give you the following advices because I made an internship on a similar project :</p>
<ul>
<li>Look carefully at your data, if you have thousands of images it will take a long to create your semantic segmentation dataset. Be smarter by using <a href="https://towardsdatascience.com/data-augmentation-techniques-in-python-f216ef5eed69" rel="nofollow noreferrer">data augmentation techniques</a>.</li>
<li>If you want to classify the defects, be sure to have enough defects of each type to train your network. If your network only sees one defect type per epoch, it can't learn to detect it.</li>
<li>Be sure that your network can detect the defects you're providing (not a scratch of two pixels for instance or alignement defects).</li>
</ul>
<p>Performing semantic segmentation to only knows if there is a defect or not seems overkill because it's a long and complex process (rebuilding the image, memory of intermediaries images in <a href="https://arxiv.org/abs/1505.04597" rel="nofollow noreferrer">Unet</a>, lot of computations). If you really want to apply this method, you may create a threshold to detect if the number of detected pixels as defect allows to classify the image as 'presenting a defect' or not.</p>
Semantic segmentation without labels in a single class
<p>I am kind of new to semantic segmentation. I am trying to perform segmentation of images having defects.
I have the defect images annotated using a annotation tool and I created the mask for each image. I wanted to predict If an image has defect and where exactly it is located. But my problem is my defects does not look same in all the images. Example: Defects on steel- Steel breakage, erroded surface etc. I am just trying to classify if the image has defect or not and where it is located. So is it wrong to train the neural network with these all types considered as defects even though not everything lookalike?</p>
<p>I thought to do a binary segmentation of defect to no defect. If I am not correct how can I perform segmentation for defect and non defect images?</p>