Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

VBAI: dynamically detect objects and inspect

Solved!
Go to solution

I am working with the NI Vision Builder AI tool. I need my detection program to identify the centers of ~100 objects, then perform a series of inspections on each.

 

My first attempt at this used the Detect Objects tool to find all the objects of interest, and then a loop of two states to pull the XY coordinates out of the results array and set the origin. I assume that I can then detect features as normal, however for simplicity I have not added that code.

 

The issue I am having is that running the program is incredibly slow. It takes over a minute to process all the points on a single frame, even when I am not doing any tests. I believe this either has to do with the state changes or the screen updates, but I so far I haven’t been able to figure out how to speed things up. I also have to wonder if there is a better way to process a group of objects.

0 Kudos
Message 1 of 3
(3,882 Views)
Solution
Accepted by topic author msmith01

You might want to try using the benchmarking tool or running your inspection in Inspection mode. There is a lot of UI updating and delays (delays are added so user can see things updating in Configuration mode) that occurs in Configuration mode like highlighting steps, showing state transitions, etc. Benchmark mode and Inspection mode don't do all the extra work or add delays. To benchmark your inspection in Configuration mode, go to Operate>>Benchmark Inspection. Or you can go to Inspection mode (Press Ctrl-I). If you have a Set Inspection Status step in your inspection, you will see the parts per second that can be analyzed.

 

Also make sure to uncheck the "Display Result Image for this State" option (directly above the steps and below the main image display in Configuration mode). This option takes awhile depending on your video card and OS, and you probably don't want to display an image at the end of a state that is continuously looped on..you could either have a Display step in your final state, or have this option selected in your final state that isn't called all the time. Benchmarking will show you if the Display is what is taking so long.

 

If these suggestions still don't help, maybe include you image and what you want to do with all the objects you found. There may be a way to process them all simultaneously depending on what you want to do.

 

Thanks,

Brad

0 Kudos
Message 2 of 3
(3,881 Views)

Thank you Brad, that is exactly what I needed to know. It looks like the 'Display Result' checkbox was the key.

0 Kudos
Message 3 of 3
(3,874 Views)