LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute samples classification based on a trained texture classifier(a .clf file)?

I'm new in LabView. I will appreciate it if anyone can give me some advice about my question.

 

Firstly, I trained a texture classifier using SVM engine and saved as a clf file.The VI is not created by myself, I  search the training VI on Internet. I just used it and change some parameters. And the clf file was obtained.

 

Then I want to use the clf file to execute samples classification. In the classification diagram,I mainly use a IMAQ Classify function and IMAQ Overlay Text function. I hope that the classification results can show on the image. When I run the VI, there is no error show up, but there is also no classification result shown on the image. Is there any error with my diagram?

 

I attach the training VI and classification VI.

0 Kudos
Message 1 of 7
(2,266 Views)

Hi, @Bella93,

I've never used IMAQ, so all you'll get from me is basic logic and research, but I'll do my best to help by asking questions.

 

In your "texture_testing-classification.vi", are you getting results in your "Class Results" indicator? Is anything showing there when you run the .vi?

 

If so, what?

Assuming there are results, then to show them, you can

  1. Run the .vi,
  2. In your front panel, in the "Class Results" indicator, right-click the outer-border of the indicator,
  3. Move your mouse to "Data Operations",
  4. Select "Make Current Value Default",
  5. Save the .vi (preferably with a new name), and
  6. Attach the newly saved .vi to a reply.

You could do the same for all of your indicators, actually.

Then we can see the outputs you're getting by looking in your (re-attached).vi. This could help a lot with troubleshooting.

 

-joeorbob

0 Kudos
Message 2 of 7
(2,201 Views)

Thank you,@joeorbob,

 

In my "texture_testing-classification.vi", I didn't get any result in my "Class Results" indicator. There is nothing showing there when I run the .vi. It seemed that it didn't calculated out the classification result. So Maybe there is something wrong with my diagram. But I can not figure it out.

 

 

Bella

0 Kudos
Message 3 of 7
(2,194 Views)

OK, looking more into the functions you're using, here are some more questions and comments. Try to respond to each bullet point separately. (You don't need to reply to the numbers, just the bullets.)

 

  • How many images are you analyzing? It looks like it will just overwrite each iterations output data each time the while loop executes. Is that what is supposed to happen?
    1. You might try removing the while loop and trying to get just one image to work.
    2. Then add the while loop back in.
    3. (Unless you're planning to run a continuous stream of images, a For loop might make more sense.)
  • Are you sure that "Grayscale (U8)" is the option you want? (Another forum user recently had an issue regarding that, so I thought I'd ask, but I have no idea what you need in your application)
  • What is the image property that you're feeding into your Region of Interest (ROI)?
    1. (Again, I don't have IMAQ, so I can't tell what it is.)
    2. If you want the ROI to be the whole image, you can leave it unwired - that's the default behavior of IMAQ Classify.
  • I see you're using "IMAQ Create.vi" - The documentation for that .vi says you should use it with the "IMAQ Dispose.vi" to make sure the image memory is released.
    1. Is "IMAQ Dispose.vi" on your diagram?
    2. It should be after you're done with the image, but before the Application run completes.

Let's see where that gets you...

-joeorbob

0 Kudos
Message 4 of 7
(2,188 Views)
Thank you,Joeorbob,
I want to analyze about 60 images,when I using while loop in the VI of last version , I expect both the images and the classify result will update with each iteration. You are right, for loop is more suitable. 
 
In the former version I attached, firstly, I try just one image without any loop. There is nothing shown in the classify result, of course the image is shown in the display box. Then I add while loop, I want it to deal with more images,in the running process, the images in the display box is updated but there is nothing changing in the classify results.
 
The image I use is saturation channel image from color image. So I use"Grayscale (U8)".  I also try all the other image types, most of them can show the image in the display box except for Complex(CSG) and RGB(U64). I thought the saturation channel image belongs to "Grayscale (U8)". Even though displaying the image, there is nothing in the classify results.
 
The ROI I want to feed into the classifier is a minimum rectangular area for the target I circled out in the image display box. The image is a Grayscale(U8).
 
I have try two ways: adding "IMAQ dispose " and  not adding "IMAQ dispose " . There is no difference in the classify results."IMAQ dispose " is mainly used to release the memory, it didn't influence the results. The running pictures are as follows:
(1) one image without loop using IMAQ dispose
Bella93_0-1596660715148.png

 

    Bella93_1-1596660715134.png

 


(2)one image without loop and not using IMAQ dispose
Bella93_2-1596660715136.png

 


 
Bella93_3-1596660715137.png

 


(3) Using  while loop and IMAQ dispose
Bella93_4-1596660715139.png

 


Bella93_5-1596660715140.png

 


(4)Using  while loop, not using IMAQ dispose
 
Bella93_6-1596660715145.png

 


Bella93_7-1596660715141.png

 


 
And I also check the slowing process. I find that "#0" was calculated out by "IMAQ calssify" and "#0" was transferred to the "Class results" in the block diagram. I try different images which belongs to different class, but they all get "#0". The pictures is as follows:
Bella93_8-1596660715146.png

 

 
The above is all what I have try. 
 
I will appreciate it if you  have any idea.
 
Thank you!
 
Best,
Bella
0 Kudos
Message 5 of 7
(2,172 Views)

Hi, @Bella93,

 


In the former version I attached, firstly, I try just one image without any loop. There is nothing shown in the classify result, of course the image is shown in the display box.

Let's try to tackle one issue at a time. The reason I recommended you start without using the loop is to get something to work. If the "IMAQ Classify" isn't working when you try to label just one image, it won't work when you label 60. Get that working first, then add looping.

 

 


I have try two ways: adding "IMAQ dispose " and  not adding "IMAQ dispose " . There is no difference in the classify results."IMAQ dispose " is mainly used to release the memory, it didn't influence the results.

I'm sorry for the confusion - I did not expect "IMAQ dispose" to influence the results. I was just pointing out that it should probably be used. I recommend you use it, but I think the "IMAQ Classify" issue is something different.

 

 

And I also check the slowing process. I find that "#0" was calculated out by "IMAQ calssify" and "#0" was transferred to the "Class results" in the block diagram. I try different images which belongs to different class, but they all get "#0". The pictures is as follows:
Bella93_8-1596660715146.png

This is actually really useful information! When you use "Highlight Execution" (The light bulb button, what you described as "the slowing process"), it shows what information is being passed on each wire. However, it can't show every element of an array, so it instead says how many elements are in the array. In your case, the "IMAQ Classify" VI is outputting an array with zero elements. That's why it says "#0".

 

This makes me think there is an issue with one of the inputs into "IMAQ Classify".

  • I suspect the Image input is just fine (I don't know how it could be wrong), so we can leave that alone..
  • How is the ROI being determined? Are you manually drawing it?
  • Is there a VI (either an example or an IMAQ subVI) that you can use to make sure your "texture.clf" file is good?

 

See where that gets you. Hopefully I'm helping (and not making things worse...😅).

-joeorbob

0 Kudos
Message 6 of 7
(2,138 Views)

Even Im facing same issue with my vi i.e im not able to read class names.

Download All
0 Kudos
Message 7 of 7
(96 Views)