HarissaForte

HarissaForte t1_jc9s369 wrote

For example you use a bubble mask to "cut" out a bubble patch from an image. Cutting can be a mix of rectangular selection + transparency where the mask equals zero.

Then you do some random change (flip, aspect ratio…) to this patch.

Then you take a defect free image, and you randomly choose a location where to paste this defect using the bottle mask. You can paste by simply over-writing on the image, or you can do a linear interpolation between the patch image and the defect-free image so it's smoother.

I assume you have very similar images, since they're from a standardized inspection process. Also the bubbles are a very simple pattern. So this could work quite well.

1

HarissaForte t1_jc6qhid wrote

Well first it really is a use case for anomaly detection, but I see there's a discussion on it in another comment.

I still don't know if you have (classification) labels, bbox, or masks for the images with defect… if you do not have any bbox or mask, I suggest you try creating mask annotations, as this will increase the "power" of each sample (instead of 1 label per image you get HxW labels for each pixel location).

It should be fast as:

  1. You say you do not have many images with defect.
  2. It seems the mask for defect-less bottles can be generated with a simple thresholding.
  3. Looking at your example you can create a bubble annotation in one click with a proper annotation tool (I can't tell for the other defect)

Then you ca try a simple supervised training. You could have a nice surprise since your picture are taken in a controlled, standardized environment (it's not like you'd have pictures of bottles on a beach or in the jungle).

If not then you will be able to use the segmentation data to create patches of defects that you can use on your defect-free bottle to create new data. It will be much easier than messing around with GANs and might give you good results.

1