Introduction
VisionPack introduces two applications useful to test the model and see the results. detect application is the compiled version of detect.c (visionpack-latest/samples/detect.c) and it is mainly focused on performing inference and printing timings and inferenced boxes to the command line. However, detecgl is a more complicated application that render on a display the results using OpenGL acceleration (Vehicles and Pedestrians Detection).
Requirements
- i.MX 8M Plus EVK
- VisionPack properly installed in the system (Quick Start Guide)
Installation and Configuration
- Connect to your EVK by using any SSH client.
- Go to your home directory and install VisionPack (Quick Start Guide)
-
wget https://deepviewml.com/vpk/visionpack-latest-armv8.sh
sh visionpack-latest-armv8.sh
-
- Activate visionpack environment
-
source visionpack-latest/bin/env.sh
-
- Run a sample command
-
detect \
visionpack-latest/models/modelpack-detection-coco.rtm \
visionpack-latest/datasets/coco128/000000000641.jpg
-
Step 4 should return the following output:
over the following input image (000000000641.jpg):
Detect Application
To run detect application use the following command on the attached image (coco128 dataset is also included into visionpack-latest/dataset)
detect \
visionpack-latest/models/modelpack-detection-coco.rtm \
visionpack-latest/datasets/coco128/000000000641.jpg
Results will be like this:
[box] label (scr%): xmin ymin xmax ymax [ load infer boxes]
visionpack-latest/datasets/coco128/000000000641.jpg [ 138.75 16.15 4.44]
[ 0] person ( 73%): 0.88 0.55 0.91 0.67
[ 1] bus ( 95%): 0.15 0.23 0.87 0.82
Results in the command line are printed in the following order:
- box id
- label
- score (%)
- xmin
- ymin
- xmax
- ymax
- [ loadinferboxes]
- load time (load)
- inference time (infer)
- decoding time + NMS (boxes)
To visualize the results, use the following script on the input image:
import cv2
img = cv2.imread("000000000641.jpg")
H, W, _ = img.shape
bboxes = [
[0.88, 0.55, 0.91, 0.67],
[0.15, 0.23, 0.87, 0.82]
]
labels = ["person", "bus"]
for label, box in zip(labels, bboxes):
if label == "person":
color = (255, 0, 0) # BGR format
else:
color = (0, 255, 0) # BGR format
x1 = int(box[0] * W)
x2 = int(box[2] * W)
y1 = int(box[1] * H)
y2 = int(box[3] * H)
cv2.rectangle(img, (x1, y1), (x2, y2), color, 2)
cv2.imshow("img", img)
cv2.waitKey(-1)
DetectGL Application
DetectGL is an graphical OpenGL-based version of detect which you can download from the Deep View AI Application Zoo. The application shares the same options as the detect application, plus additional parameters which can be listed by calling detectgl --help.
Note: the application currently requires a display to operate, please inquire about upcoming off-screen version with remote streaming.
Launch Application
detectgl visionpack-latest/models/modelpack-detection-coco.rtm
The command above will raise a full-screen application showing in the display the overlay boxes. The used model was trained on COCO dataset and has 80 classes. At this time, the user can stand in front of the camera and see the results drawn in the application. Also, a summary about timing information is provided in a side panel.
Conclusions
In this article we have explained how to interpret the results returned by detect application. In addition to this, we provide a sample script capable of plotting the results in the input image. Notice the values in the terminal should be copied in the python script.
Comments
0 comments
Please sign in to leave a comment.