Training Images
Anonymous from Your Country  [16 posts]
1 year
Hi STeven,

Is there a way to programmatically train images for matching - for example for "Object Matching" and "Image Matching" using VB.Net?

Steven Gentner from United States  [263 posts] 1 year

If you look in the training GUI on those modules where you specify which folder to use you will notice a "monitor folder" checkbox. Once that is set, the system will update its training DB each time an image is added or removed from that folder.

So no need to use the API to force a training ... just place a new image into that folder and have that checkbox checked.

Anonymous from Your Country  [16 posts] 1 year
STeve - thanks for the reply.

Background - I am developing an inspection machine - I am trying to build a library of parts.  I am putting a single part (with possible alternates) in a directory to be trained.  However, The part to match changes possibly with every individual inspection. So I  am creating a directory for each unique part because there will be a lot of them.  

So, is there a way to change the training directory programmatically on the fly from VB.net?
Steven from Your Country  [1376 posts] 1 year

That's not the ideal way to use the Object Recognition module as its very slow to train since it assumes a relatively stable database. I'd try to put all objects within a single folder structure and see how the training works on those. If you have more than about 10 objects I'd recommend looking into a different route .. perhaps using the Image Matching or other modules that are better tuned to hundreds of objects. You will find the OR module will really slow down for each new object added ... and perform even worse if the database has to be retrained for each new image. So no, there isn't any way to trigger a re-train of the directory other than just placing new images within that folder structure with the auto-train checkbox in the training dialog checked.

Most people gravitate towards the OR module but in fact really  need something simpler. If your QA process can be done in a more systematic way like using the Blob Filter that might be a better way to do. We've not used the OR module in any QA process yet!

Anonymous from Your Country  [16 posts] 1 year
Thanks STeven,

A little more background on what I am trying to do.  I could have hundreds of parts that I want to inspect for.  But for each one I inspect I know what it should be - and there would only be one or a few images to train for that particular part that I am inspecting.  In other words, Since I know what part I am inspecting for, I just want to use the trained image(s) for that part.

So to work with your system, I could create a file structure where each part I want to inspect for has a folder to put it's trained image(s) in.  i.e. there would be hundreds of folders each with only one image or a few images in each folder.  

I tried using the SetParameter("Object_Recognition",1,"base_folder", "c:\xxxxx") to change the base directory quickly.   But it doesn't seem to switch the directory for me.  Are you able to modify the software so that if I change the path in the "base_folder" that it would point to the new directory on the next pass thru the pipeline?

This technique would require me to train hundreds of sub directories - is there a way to get the "monitor_folder" to work as well when I change the directory?

And lastly - if the "monitor folder" fix is not possible - is there a way that you could add a programmatic way to change train the images???  Then I could just command a train each time I add or remove an image.....


Anonymous from Your Country  [16 posts] 4 months
Hi STeven - Are you able to respond to my last post on this thread about training and such?  - Bob
Steven from Your Country  [1376 posts] 4 months

As mentioned in my previous post, you are trying to get the module to do something it was NOT built to do. The module will accept several images and take quite a while (i.e. seconds) to train on those images. Even loading and saving the training file is SLOW. So switching to different images on each pipeline iteration will NOT work. The system will slow down too much to be effective.

Instead, you need to better understand what qualities about your images make them different. I.e. if you are switching to different images each pipeline iteration what you are doing is NOT identification BUT verification. That is a different process since you know what image you are expecting and just want to verify that in fact the object is in view.

Have you looked at the Image Match module? That is built to be trained on hundreds of images and return back the one most similar. It uses a VERY different technique than the OR module does and thus is much faster.

The other way is to compare images directly. I.e. load in the image you expect to see using Load Image. Use the Math module to remove known bits and then check to see how much "different" stuff remains in order to quantify the quality of the match. We often use this simple and effective technique for many verification tasks ... note we've NEVER used the OR module in any industrial application to date! Its normally overkill for most tasks.

Anonymous from Your Country  [16 posts] 2 months
Hi Steven,

I am interested in the part of your reply that says to try the Math module to compare 2 images for differences.  Could you elaborate on that?  Do you have an example of how you would do that generically for 2 images that are supposes to be the same?

Take a look at my REGION command section to see how I have it working now.  But it does not work very well.



 Reply  New Post   Forum Index