Viewing a single comment thread. View all comments

HarissaForte t1_jc66t3m wrote

> a model to detect defects

… as in object detection?

1

Tekno-12345 OP t1_jc6drqj wrote

It could be..
However, such models require the data I am seeking

1

HarissaForte t1_jc6gder wrote

I don't get it… what do you have so far?

How many of

  • image alone,
  • image + labels,
  • image + bbox,
  • image + mask ?
1

Tekno-12345 OP t1_jc6jl0q wrote

I have a lot of good images with no defects.
And very few images with defects.

In order to train a good object detector for this task, a huge amount of defects will be needed.

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

Tekno-12345 OP t1_jc9pgbl wrote

Thanks for the good ideas, i'll try them out.
What do you mean by the last part? How can I create patches of defects using the segmentation data?
You mean by classical methods?

1

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

Tekno-12345 OP t1_jc9zmeh wrote

Ow I see,
I have already done something similar but the results were not convincing.
Maybe I'll try it again using the masks.

1