Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Improve performance of VBAI application

Solved!
Go to solution

Hello,

 

I have an application I wrote in VBAI and am satisfied with it. The problem is that it uses VBAI states to do circle detection multiple times (via looping). This causes an maximum of 300ms extra CPU usage per inspection.

 

What I'm wondering is this: If I migrate my VBAI app to LabVIEW, how can I run it again on the target using LabVIEW RT?

 

I'm running a NI 1752 Smart Camera, with 600MHz clock and 512MB RAM. Required inspection rate is 1 inspection/second minimum.

My application is inspecting a conveyor which shows (0-8) units per inspection. When no units are present, the inspection time is fine, but when there are 8 units present it lags to ~1200 ms per iteration. I suspect it's due to me using VBAI State machines which introduces a lot of delays. I'm sure LabVIEW code would be more efficient.

 

Thanks,

Hazim Salem

0 Kudos
Message 1 of 8
(4,632 Views)

Would it be possible to post your inspection and a sample image to see if we can improve the performance to meet your needs? There is a way to migrate to LV RT, but before doing that, let's see if there are changes we can make in VBAI to get the performance you need. I wouldn't expect the states to add that much overhead, but it would be helpful to see what you're talking about with a sample inspection and image.

 

Thanks,

Brad

0 Kudos
Message 2 of 8
(4,624 Views)

Hello,

 

I believe VBAI could be very efficient. I believe we must check your settings in order to see if we can give any recommendations.

 

 

Randy @Rscd27@
0 Kudos
Message 3 of 8
(4,601 Views)

Thanks for the reply. 

 

I attached a stripped-down version of the application I'm talking about, same functionality. And I attached a sample picture.

Download All
0 Kudos
Message 4 of 8
(4,590 Views)
Solution
Accepted by hsalem

So the original inspection took about 1 second per iteration. I think there is some benchmark overhead we are including in those numbers we show that doesn't actually happen when you run in inspection mode and this is why there is ~7ms of extra overhead time compared with the sum of all the steps in the inspection. Anyway, I made some minor edits to the PM step and this took off about 70ms. I also tried using a Run LV step to do all the Circle Detections at once and overlays so you don't need to do looping and this saved another 250ms.

Original time ~1000ms

New time ~680ms

 

I attached the modified inspection and LV code used by the Run LV step. Make sure to copy the LLB in Build folder to the target at c:\User VIs. If you need to make changes, update the Detect Multiple Circles.vi and rebuild the LLB from the project and then copy resulting LLB to target.

 

Hope that helps and let me know if you just want to do everything in LV (that would be the fastest), but maybe the modified VBAI inspection is fast enough now.

Brad

0 Kudos
Message 5 of 8
(4,581 Views)

You're the best! I will load this on the camera tomorrow and try it out.

 

Quick question: Do you think I'll see any significant gains by converting any heavy processes to LabVIEW (pattern matching, circle detection), or are the gains seen only related to overhead on VBAI state loops?

I'd love to convert the entire application to LabVIEW myself if it meant significant performance improvement. The client is wanting more features in the future (defects spotting, etc) which will take up room in that 1 second window.

 

Thanks again!

 

Hazim Salem

 

0 Kudos
Message 6 of 8
(4,575 Views)

If you want the fastest possible performance, instead of trying to convert VBAI to LV, I would use the Vision Assistant Express VI which generates relatively simple LV code and you could even use multiple Express blocks (i.e. one to do pre-processing and find patterns, another inside a For Loop to find circles and overlay, etc.) Using the Express VI will also make it easy to double click and get a nice editing experience similar to VBAI but the code it generates is much easier to use in LV (if you convert Express VI to regular sub VI so you can see the generated code, but you can no longer launch Vision Assistant from the Express VI). I always make a copy of the Express VI and convert one to a regular VI so I can see what it looks like if I want more details and then delete it whewn I'm done or keep the subVI and make changes and delete the Express VI if you need additional custimization.

 

Hope this helps,

Brad

0 Kudos
Message 7 of 8
(4,572 Views)

Also the vision assistant can be a easy way of generate code and try to understand it. It is also a good way to do a preview of how some parameters will affect the inspection.

Randy @Rscd27@
0 Kudos
Message 8 of 8
(4,554 Views)