Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Profile Performance in LabVIEWvs Performance meter in Vision Assistant: Doesn't match

Hi everyone,

 

I faced a strange problem about performance timing between these two measurements.

Here is my test

-used inbuilt example provided by labview in vision assistant-Bracket example-Uses two pattern matches, one edge detection algorithm and two calipers(one for calculating midpoint and other for finding angle between three points.

-When i ran the script provided by NI for the same in vision assistnat it took average inspection time of 12.45ms(even this also varies from 12-13ms:my guess is this little variation might be due to my cpu/processing load).

-Then i converted the script to vi and i used profile performance in labview and surprisingly it is showing way more than expected like almost ~300ms(In the beginning thought it is beacuse of all rotated search etc..but none of them make sense to me here).

Now my questions are

-Are the algorithms used in both tools are same? (I thought they are same)

-IMAQ read image and vision info is taking more than 100ms in labview, which doesn't count for vision assistant. why?( thought the template image might be loaded to cache am i right?)

-What about IMAQ read file(doesn't count for vision assistant?? In labview it takes around 15ms)

-Same for pattern match in vision assitant it takes around 3ms(this is also not consistant) in labview it takes almost 3times (around 15ms)

 

-Is this bug or am i missing somethings or this is how it is expected?

Please find attachments below.

-Vision Assistant-v12-Build 20120605072143

-Labview-12.0f3

 

Thanks
uday
0 Kudos
Message 1 of 9
(6,050 Views)
Got the reply from NI India support reply. For me its still not convincing particularly "xx parts/sec" they mention in vision assistant performance meter.

Greetings from National Instruments!!

When you actually write a script in Vision Assistant all the parameters such as ROI, Co-ordinate system etc all are pre-set and more importantly the image is already loaded in the memory. But when you convert the script into a labview code there is also a lot of redundancies involved because the generated code is a more generic one. There are lot of additional read and write involved when you are running the code in labview. At the same time the IMAQ read.vi reads the data sequentially from the file path provided. The code also checks for other redundancies as well.

Anyone else got any idea??
Thanks
uday
0 Kudos
Message 2 of 9
(6,023 Views)
Anyone else??
Thanks
uday
0 Kudos
Message 3 of 9
(5,978 Views)

Several differences between LabVIEW and Vision Assistant:

 

LabVIEW has to load the images, which takes time.  Vision Assistant already has the image loaded into memory.

 

Running different images will take different amounts of time.  It depends on the size of the image as well as the complexity of the image.  It depends on which analysis tools you are using as well.

 

The algorithms are the same.  LabVIEW might have a few more options that are hidden in Vision Assistant.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 4 of 9
(5,950 Views)
First, Thanks for the reply Bruce.
-Lets see what the performance meter in Vision Assistant tells
An estimation of the time required by NI Vision Assistant to perform the inspection on the current image is : xx ms or xxx parts/sec.
-Yes the image is loaded already which doesn't come into VA Performance meter. My question is, is it fair to give the inspection time without image read?
-Lets take Pattern match algorithm for example.
It needs IMAQ Read image and vision and info which is most important for other matching algorithms also like geometric or shape match also.
And it needs IMAQ setup Match Pattern which is must for pattern matching.
If you give time only for IMAQ Match pattern timing by eliminating the above two vis is it appropriate to tell that Pattern match algorithm takes x ms time?
-My worry is that the VA tells like for running these algorithms so much time for inspection which is not real in case. It has to add extra overhead time(and that's too big)
Thanks
uday
0 Kudos
Message 5 of 9
(5,931 Views)

I wouldn't include image load time.  In most cases, you are acquiring live images and processing them.  You can usually run the acquisition process in parallel to the analysis, so that time doesn't usually count.

 

Similarly, loading your template and running Setup Match Pattern only gets run once, then you do the analysis on a large number of images.  You shouldn't be loading your templates every time you analyze an image - that is bad programming.

 

I suppose you could be loading images for processing and loading a different template for each image.  This would be an unusual application that does not fit the usual assumptions, and the timing would be much longer for this sort of approach.

 

The time estimation in Vision Assistant is simply to give you an idea of how long the analysis part of your program will take.  You will still have to fine tune everything in LabVIEW, but it will give you an idea if you are in the right order of magnitude of speed.  For example, if Vision Assistant tells you one of the steps will take 100 msec, you will never get the entire process to run in 10 msec, no matter what you tweak.

 

There are many things you can do in LabVIEW that are not available in Vision Assistant.  You can split the analysis into parallel tasks and increase your overall processing speed, for one.  You can't directly compare the speeds of the two methods.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 6 of 9
(5,922 Views)

Hmm Bruce, Thanks again for reply.

-When i first read your reply, i was ok. But after reading it multiple times, i came to know that you didn't check my code and explanation first.

-I have added code and screenshot of Profile in both VA and LabVIEW.

 

In both Vision Assistant and Labview

-I am loading image only once.

Accounted in Labview but not in VA, because it is already in cache, But time to put the image into cache?

I do understand that, when we are capturing the image live from camera things are completely different.

-Loading template image multiple times??

This is where i was very much confused. Beacuase i didn't even think of it. I am well aware of that task.

-Run Setup Match Pattern once?

Sorry, so far i haven't seen any example which does pattern match for multiple images has Setup Match Pattern everytime. But it is negligible time i wouldn't mind.

-Loading images for processing and loading diffferent template for each image?

You are completely mistaken here and i don't see that how it is related to my specific question.

 

Briefly explaining you again

-I open an image both in LabVIEW and VA.

-Create two pattern match steps. and Calipers(Negligible)

-The pattern match step in VA shows me longest time of 4.65 ms where as IMAQ Match pattern showed me 15.6 ms.

-I am convinced about IMAQ Read and vision info timing, because it will account only in the initial phase when running for multiple image inspection.

But i am running for only once, then Vision assistant should show that time also isn't it?

 

-I do understand that, Labview has lot more features on paralell execution and many things than Vision Assistant.

-Yeah that time about 100ms to 10ms i completely agree. I take Vision Assistant profile timing as the ideal values( correct me if i am wrong).

-I like the last line especially, You cannot compare the speeds of the two methods.

 

 Please let me know if i am thinking in complete stupid way or at least some thing in right path.

Thanks
uday
0 Kudos
Message 7 of 9
(5,915 Views)

I looked at your screen shots.  A couple of things:

 

IMAQ Read Image and Vision is loading your template, which will only be done once.  That time is not included in Vision Assistant's report.

 

The smallest resolution in LabVIEW's profile is 15.6 msec.  Running the test once or twice will not get you a high resolution measurement.  If you use run continuously and run your test 1000 times, you will get a better average time.  Another option is to read the msec timer before and after the part of your code you are trying to time.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 8 of 9
(5,901 Views)

hi uday,,

        have found solution for you quesstion ... 

         i am also facing same problem ... 

         please help me if you answer 

0 Kudos
Message 9 of 9
(4,708 Views)