In this section, you'll run a vehicle detection application. By default, this sample application runs on the CPU and detects vehicles in a static image, using the Intel® Distribution for OpenVINO™ toolkit. You'll modify the project to run on a sample video instead, and offload the processing to your GPU.

Intel® technologies’ features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. Check with your system manufacturer or retailer or learn more at software.intel.com.

Before you begin

These steps were tested with the following configuration:
  • IEI Tank* AIoT Dev Kit with Intel® System Studio 2019 Update 4
  • Version 2019 R2 of the Intel® Distribution of OpenVINO™ toolkit
The models used in this example are pre-trained models included with the Intel® Distribution of OpenVINO™ toolkit.   For additional information about each of these models, refer to the model descriptions, located by default in the appropriate directories in:
/opt/intel/openvino/deployment_tools/intel_models/

Run Intel® System Studio

Launch the application using the desktop ISS icon. The environment variable is preset for use.

Tip: Check that the environment variables are set in Intel® System Studio. If not, run the following command to set environment variables: sudo cp /opt/intel/openvino/bin/setupvars.sh /opt/intel/system_studio_2019/env.d/linux/

  1. Click the icon for Intel® System Studio to open.
  2. Keep the default workspace and click Launch to launch Intel® System Studio.

Run a sample project on the CPU

Your sample project has already been included in Intel® System Studio for you. Follow the steps below to run it for the first time.

  1. In the Project Explorer, expand the demos folder. Expand the Binaries folder and select the security_barrier_camera_demo folder.

  2. From the Run drop-down list in the toolbar, select Run Configurations.

  3.  The Run Configurations dialog box opens.  
  4. On the left under C/C++ Application, select security_barrier_camera_demo.
  5. Click the Arguments tab.  

  6. Next, you'll change the existing program arguments to run the project on the accelerator card. This information and more details about the arguments you can supply to the sample can be found in the README.md file in the security barrier camera demo source files.
  7. Copy the following argument string:
    -t 0 -d CPU -i "/opt/intel/openvino/deployment_tools/demo/car_1.bmp"  -m "${MODEL_DIR}/Security/object_detection/barrier/0106/dldt/FP32/vehicle-license-plate-detection-barrier-0106.xml" -m_va "${MODEL_DIR}/Security/object_attributes/vehicle/resnet10_update_1/dldt/FP32/vehicle-attributes-recognition-barrier-0039.xml" -m_lpr "${MODEL_DIR}/Security/optical_character_recognition/license_plate/dldt/FP32/license-plate-recognition-barrier-0001.xml"
  8. Paste the string into Program arguments field.

  9. Once finished, click Run.

    The sample runs on an image, highlighting the vehicles it detects in bounding boxes. You'll see labels displayed next to the cars it detects, such as "black car".

    In the text displayed over the image, you can see data about the sample. Note the fps value, which you can use to estimate performance; a higher fps value corresponds to better performance.

The image used in the example is a simple .bmp image:

Format .bmp
Dimension 749x637 pixels
Size 1.36 MB

Congratulations, you've successfully run the sample! Now that you're finished, click the red X icon at the top of the pop-up window to close it.

After you close the window, you can check the Console for averaged statistics about the sample you just ran, including the fps data.

View CPU utilization

You can view CPU utilization on your device, then compare the performance change when you move processing to the GPU or a vision accelerator.

  1. Click the Ubuntu* icon in your taskbar. From the search bar, search for and open the System Monitor application.
  2. Click the Resources tab to bring up the CPU History chart. You can see how the CPU utilization changes when you run the sample on the CPU, as described below.

Afterwards, keep the application open so you can compare the utilization numbers when you offload application processing to the GPU or an accelerator.

Modify your program to run on a video

Next, you'll modify the project to run on a video instead of an image.
  1. Make sure you have a copy of the sample video in your Downloads folder: ${HOME}/Downloads/car-detection.mp4

    If you don't have the sample video, download it from: https://github.com/intel-iot-devkit/sample-videos/blob/master/car-detection.mp4

  2. Back in the Project Explorer, make sure you have the security_barrier_camera_demo folder selected.

     

  3. From the Run drop-down list in the toolbar, select Run Configurations.
  4. Under C/C++ Application, select the security_barrier_camera_demo run configuration.
  5. Click the Arguments tab.

    Next, you'll change the existing program arguments to use a video file instead of a static image, and to define the confidence threshold level for the Intel® object detection model being used. You’ll use a high value of 0 to avoid getting false positives when your application is detecting the cars in the video.

    This information and more details about the arguments you can supply to the sample can be found in the README.md file in the security_barrier_camera_demo source files.  

  6. Copy the following argument string.
    -t 0 -d CPU -i "/home/ieisw/Downloads/car-detection.mp4" -m "${MODEL_DIR}/Security/object_detection/barrier/0106/dldt/FP16/vehicle-license-plate-detection-barrier-0106.xml" -m_va "${MODEL_DIR}/Security/object_attributes/vehicle/resnet10_update_1/dldt/FP16/vehicle-attributes-recognition-barrier-0039.xml" -m_lpr "${MODEL_DIR}/Security/optical_character_recognition/license_plate/dldt/FP16/license-plate-recognition-barrier-0001.xml"
  7. Paste the string into the Program arguments field.  
  8. Once finished, click Run.

    Your project runs. The results appear in the Console and in a separate video window. In the video, you'll see several cars driving through a parking lot. The application will highlight the vehicles it detects in bounding boxes and display a label next to each car ("white car", "red car", etc.).

    In the text displayed over the video, you can see live data about the sample. Note the fps value, which you can use to estimate performance. A higher fps value corresponds to better performance.

    Intel® technologies’ features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. Check with your system manufacturer or retailer or learn more at software.intel.com

    The video used in the example is an .mp4 file:

    Format .mp4
    Duration 31 seconds*
    Dimensions 768x432 pixels
    Size 2.8 MB
           * played at accelerated speed for 6-7 seconds

     

    If you have the System Monitor open, you can see the CPU utilization spike as the project runs. Notice how the CPU utilization for all cores rises while the sample runs.

  9. After the video closes automatically, you can check the Console for averaged statistics about the sample you just ran, including the fps data. IMAGE is not 242 -update

    To close the video, you can press ESC or click the red Terminate icon from the Console at any time. The video will close automatically when it reaches the end of the playback.

 

Modify your project to run on the GPU

Next, you'll modify the project to run on a GPU.

  1. Back in the Project Explorer, make sure you still have the security_barrier_camera_demo folder selected.
  2. Run drop-down list in the toolbar, select Run Configurations.
  3. C/C++ Application, select security_barrier_camera_demo.
  4. Click the Arguments

    Next, you'll change the existing program arguments to run the project on the GPU.

    This information and more details about the arguments you can supply to the sample can be found in the README.md file in the security_barrier_camera_demo source files.

  5. Copy the following argument string:
    -t 0 -d GPU -d_va GPU -d_lpr GPU -i "/home/ieisw/Downloads/car-detection.mp4" -m "${MODEL_DIR}/Security/object_detection/barrier/0106/dldt/FP16/vehicle-license-plate-detection-barrier-0106.xml" -m_va "${MODEL_DIR}/Security/object_attributes/vehicle/resnet10_update_1/dldt/FP16/vehicle-attributes-recognition-barrier-0039.xml" -m_lpr "${MODEL_DIR}/Security/optical_character_recognition/license_plate/dldt/FP16/license-plate-recognition-barrier-0001.xml"
  6. Paste the string into Program arguments field.

     

  7. Once finished, click Run.

Your project runs. The results appear in the Console and in a separate video window. In the video, you'll see several cars driving through a parking lot. The application will highlight the vehicles it detects in bounding boxes and display a label next to each car ("white car", "red car", etc.).

In the text displayed over the video, you can see live data about the sample. Note the fps value, which you can use to estimate performance. A higher fps value corresponds to better performance.

Intel® technologies’ features and benefits depend on system configuration and may require enabled hardware, software or service activation. Performance varies depending on system configuration. Check with your system manufacturer or retailer or learn more at software.intel.com.

If you have the System Monitor open, you can see the CPU utilization spike as the project runs. Compared to running the project on the CPU only, only about one CPU core is utilized at 100% at a time, as work is being offloaded to the GPU.

To close the video, you can press ESC or click the red Terminate icon from the Console at any time. The video will close automatically when it reaches the end of the playback.  

Note: To loop the video, add the argument -loop video to the end of the arguments, then rerun the sample project.

After the video closes automatically, you can check the Console for averaged statistics about the sample you just ran, including the fps data.

Next Steps

Next, you can modify the project to offload the application processing to different hardware, as follows:

Уведомление об оптимизации: 

standard

Для получения подробной информации о возможностях оптимизации компилятора обратитесь к нашему Уведомлению об оптимизации.