Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

I use a classifier file generated by NI Texture Training Interface to detect certain types of texture.

Textures in my samples vary. We would like to train new textures while we run vi. Is it possible to include and run NI Texture Training Interface program in my vi?

 

0 Kudos
Message 1 of 8
(7,300 Views)

Hello,

 

take a look at the "classification" subpallete on the "machine vision" pallete. You can train the classifier engine (I think SVM is used in the texture training utility), add/delete/classify samples, etc...

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 2 of 8
(7,289 Views)

Klemen-

I didn't know there are VIs for texture training. I am now trying to use them to add image samples with ROIs. Looks like I should be able to do it, but with little information or no examples, it is hard to make things work. It would be great if there are some example VIs for this type of training. Do you know if there is any?

Thanks!

0 Kudos
Message 3 of 8
(7,266 Views)

Hello,

 

I've created a simple example on how to create a custom texture classifier sample(s). Please see the attachment (saved for LV2011).

 

1. Load the image (TAB 1)

2. Select ROI and name the class (TAB 1)

3. Add sample(s) (TAB 1) by iterating 1. - 2.

4. Check the samples info (TAB 2)

5. Train support vector for all samples (TAB3)

 

and (1. - 5.) MODIFY THE SETTINGS ACCORDING TO YOUR APPLICATION...

 

This should give you the basic idea... Mind that no safety features/error handling is implemented. You should implement error handling in your application.

 

Hope this helps.

 

Best regards,

K

 


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 4 of 8
(7,259 Views)

I forgot to mention that you should also probably take a look at the "texture" subpallete under image processing...

 

Best regards,

K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
Message 5 of 8
(7,253 Views)

Klemen-

Thank you so much for your example. That is very helpful.

 

Now I can ask a better question because I was looking for a way to generate classifier file ( xxx.clf). I was using 'IMAQ Read Classifier File' vi with a classifier file I got when I trained texture with NI Texture Training Interface. I could save texture classifier file (xxx.clf) in the NI Texture Training Interface and use it in my program. Now I am trying to generate a classifier file in my program not using the NI Texture Training Interface.

 

Should I just connect 'IMAQ Write Classifier File' just before 'IMAQ Dispose Classifier' vi after training? I wonder what parameters are saved in the classifier file.

 

Thanks a lot!

0 Kudos
Message 6 of 8
(7,234 Views)

BTW, when I saved a classifier file in your example and used it in NI Texture Training Interface, it generates an error when I pressed 'Train Classifier' button. I attached the classifier file after changing the extension to 'txt' instead of 'clf'.

0 Kudos
Message 7 of 8
(7,232 Views)

Yes,you need to write to file before disposing the reference to the classifier.
What gets written in the classifier file? The parameters you set up in the initialization stage,the feature vectors,etc... How is it written - the structure of the file? Have no idea!

Did you train svm using the one-class model? The texture utility uses this model. I don't think its compatible with the others - read the documentation.

Best regards,
K


https://decibel.ni.com/content/blogs/kl3m3n



"Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
0 Kudos
Message 8 of 8
(7,225 Views)