Application Design

The following table summarizes application design characteristics that may produce faster runtime performance. Application design choices that improve performance typically have minimal impact on the behavior of the system.

Design pattern Why it's faster Best value option Watch out for...

Use a small number of tools per stream.

The processing time for a single Deep Learning tool does not vary significantly based on the amount of information that the tool returns.

For example, a single Blue tool that is trained to find 100 different features runs at the same speed as a tool that is trained to find only a single feature. Further, the number of features returned makes only a minimal speed difference.

Similarly, a Red tool runs at the same speed regardless of how many defects it finds, and a Green tool can classify into 2 classes or 200 classes at the same speed.

Start building your application with a single tool.

 

Avoid image conversions.

During tool operation, the image must be sampled for processing by the neural network. This sampling requires a raster (uncompressed) format image such as a bitmap. Performing this conversion takes time.

Similarly, if the tool is configured to use a single-channel (grey-scale) image as input, but the supplied images are multi-channel color images, the luminance value must be computed for each image at run time.

Attempt to solve your application using a single-channel grayscale image.

Some applications require color information.

Reduce the amount of processed data.

Reduce the quantity of processed data by doing the following:

  • Use a smaller ROI
  • Use a mask
  • Use as few image channels as possible

These help to improve processing speed by reducing the total amount of data that is processed.

Restrict the ROI.

VisionPro Deep Learning tools need contextual information to work well, so try not to constrain the ROI too much.

Downsampling (set through the Sampling Density parameter) is usually not needed. By selecting a larger Feature Size, you can improve speed and remove the need for runtime downsampling.

Use Multiple GPUs

On systems with multiple GPUs, processing multiple streams concurrently allows tools to execute in parallel, increasing throughput.

Note: You can train and process multiple tools in parallel across Streams using multiple GPUs. See Configure Multiple GPUs for more details.

On single GPU systems, you can configure the system to allow multiple processes to make use of the same GPU. This allows a higher GPU occupancy and can improve throughput, although tool execution time will increase.

Use the --max-process-count command line argument to enable multiple threads to access a single GPU.

To enable multi-process GPU access for a runtime application using the local control's GlobalConfig() method:

control.GlobalConfig("max_process_count=2");

The processing time for an individual tool will increase.

C++ (unmanaged)

Use of an unmanaged language environment reduces the impact of system activity on tool execution.

For low-latency, high-performance applications, do not use Cognex Designer.

Windows is not a real-time operating system (RTOS).

 

General Tips for Development

These topics provide a few useful tips and tricks to follow when developing your VisionPro Deep Learning application.

Consider the following tips when developing your VisionPro Deep Learning application:

  • Create clones of tools to do A to B comparisons of the tools.

    By making a clone of a tool, you can then change parameters and retrain, and then compare the original against the clone to see the effect of the tool parameter changes.

  • Create clones of streams to perform image set testing.

    If you have a large batch of images that you want to use for testing, but you do not want to contaminate your database, clone a stream and add the images to the clone. Then you can process the current tool state to test. When you are done, delete the cloned stream.

  • Do not add duplicate images in order to "trick" the tools.

    This will negatively impact the model. Instead, if you want to increase the training weight for specific images, use the Class Weights option of Green Classify Tool in High Detail Mode.

  • Perform "bootstrap" labeling.

    "Bootstrap" labeling refers to the process of beginning your labeling process by just labeling a small sample size of your images, then training the tool, and reviewing the results by accepting views with correct markings to convert them into labels, and removing incorrect markings and replacing them with correct labels. You can speed up this process further by dividing images into multiple views and only labeling a single view. In addition, you can also temporarily reduce the Epoch Count parameter (one of the ), which will make the training time shorter.