Skip to content

Commit 4b9193d

Browse files
johan-hultberg-workjimmy-rubin-workJimmy Rubin
authored
object-detection-yolov5: Rewrite application (#410)
Co-authored-by: Jimmy Rubin <[email protected]> Co-authored-by: Jimmy Rubin <[email protected]>
1 parent 2a138d0 commit 4b9193d

File tree

6 files changed

+1142
-689
lines changed

6 files changed

+1142
-689
lines changed

object-detection-yolov5/README.md

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ example specified.
105105
[Bounding Box API](https://developer.axis.com/acap/api/native-sdk-api/#bounding-box-api).
106106
5. Run the main program loop:
107107
1. Fetch image data from VDO.
108-
2. Convert image data to the correct format with the Larod pre-processing job.
108+
2. Convert image data to the correct format with the Larod pre-processing job, if needed.
109109
3. Run inference with the Larod model inference job.
110110
4. Perform YOLOv5-specific parsing of the output.
111111
5. Draw bounding boxes and log details about the detected objects.
@@ -318,31 +318,45 @@ Initially, the log will show this:
318318
```sh
319319
----- Contents of SYSTEM_LOG for 'object_detection_yolov5' -----
320320

321-
[ INFO ] object_detection_yolov5[1197318]: Model input size w/h: 640 x 640
322-
[ INFO ] object_detection_yolov5[1197318]: Quantization scale: 0.004191
323-
[ INFO ] object_detection_yolov5[1197318]: Quantization zero point: 0.000000
324-
[ INFO ] object_detection_yolov5[1197318]: Number of classes: 80
325-
[ INFO ] object_detection_yolov5[1197318]: Number of detections: 25200
326-
[ INFO ] object_detection_yolov5[1197318]: Axparameter ConfThresholdPercent: 25
327-
[ INFO ] object_detection_yolov5[1197318]: Axparameter IouThresholdPercent: 5
328-
[ INFO ] object_detection_yolov5[1197318]: choose_stream_resolution: We select stream w/h=1280 x 720 based on VDO channel info.
329-
[ INFO ] object_detection_yolov5[1197318]: Setting up larod connection with device axis-a8-dlpu-tflite
330-
[ INFO ] object_detection_yolov5[1197318]: Loading the model... This might take up to 5 minutes depending on your device model.
331-
[ INFO ] object_detection_yolov5[1197318]: Model loaded successfully
332-
[ INFO ] object_detection_yolov5[1197318]: Start fetching video frames from VDO
321+
[ INFO ] object_detection_yolov5[975576]: Model input size w/h: 640 x 640
322+
[ INFO ] object_detection_yolov5[975576]: Quantization scale: 0.004191
323+
[ INFO ] object_detection_yolov5[975576]: Quantization zero point: 0.000000
324+
[ INFO ] object_detection_yolov5[975576]: Number of classes: 80
325+
[ INFO ] object_detection_yolov5[975576]: Number of detections: 25200
326+
[ INFO ] object_detection_yolov5[975576]: Axparameter ConfThresholdPercent: 25
327+
[ INFO ] object_detection_yolov5[975576]: Axparameter IouThresholdPercent: 5
328+
[ INFO ] object_detection_yolov5[975576]: choose_stream_resolution: We select stream w/h=1280 x 720 based on VDO channel info.
329+
[ INFO ] object_detection_yolov5[975576]: Creating VDO image provider and creating stream 1280 x 720
330+
[ INFO ] object_detection_yolov5[975576]: Dump of vdo stream settings map =====
331+
[ INFO ] object_detection_yolov5[975576]: 'buffer.count'-----: <uint32 2>
332+
[ INFO ] object_detection_yolov5[975576]: 'dynamic.framerate': <true>
333+
[ INFO ] object_detection_yolov5[975576]: 'format'-----------: <uint32 3>
334+
[ INFO ] object_detection_yolov5[975576]: 'framerate'--------: <30.0>
335+
[ INFO ] object_detection_yolov5[975576]: 'height'-----------: <uint32 720>
336+
[ INFO ] object_detection_yolov5[975576]: 'input'------------: <uint32 1>
337+
[ INFO ] object_detection_yolov5[975576]: 'socket.blocking'--: <false>
338+
[ INFO ] object_detection_yolov5[975576]: 'width'------------: <uint32 1280>
339+
[ INFO ] object_detection_yolov5[975576]: Setting up larod connection with device axis-a8-dlpu-tflite
340+
[ INFO ] object_detection_yolov5[975576]: Loading the model... This might take up to 5 minutes depending on your device model.
341+
[ INFO ] object_detection_yolov5[975576]: Model loaded successfully
342+
[ INFO ] object_detection_yolov5[975576]: Created mmaped model output 0 with size 2142000
343+
[ INFO ] object_detection_yolov5[975576]: Start fetching video frames from VDO
333344
```
334345
335346
While the ACAP application is running, information about each frame will be logged. The log shows run
336347
times for pre-processing, inference, and parsing. Following that, each detected object will be
337348
logged. Below is the output log of a frame where one truck and two cars have been detected:
338349
339350
```sh
340-
[ INFO ] object_detection_yolov5[1197318]: Ran pre-processing for 20 ms
341-
[ INFO ] object_detection_yolov5[1197318]: Ran inference for 60 ms
342-
[ INFO ] object_detection_yolov5[1197318]: Ran parsing for 1 ms
343-
[ INFO ] object_detection_yolov5[1197318]: Object 1: Label=truck, Object Likelihood=0.57, Class Likelihood=0.75, Bounding Box: [0.99, 0.54, 0.91, 0.46]
344-
[ INFO ] object_detection_yolov5[1197318]: Object 2: Label=car, Object Likelihood=0.75, Class Likelihood=0.91, Bounding Box: [0.68, 0.48, 0.61, 0.43]
345-
[ INFO ] object_detection_yolov5[1197318]: Object 3: Label=car, Object Likelihood=0.83, Class Likelihood=0.94, Bounding Box: [0.43, 0.49, 0.36, 0.44]
351+
[ INFO ] object_detection_yolov5[975576]: Ran pre-processing for 20 ms
352+
[ INFO ] object_detection_yolov5[975576]: Ran inference for 60 ms
353+
[ INFO ] object_detection_yolov5[975576]: Ran parsing for 1 ms
354+
[ INFO ] object_detection_yolov5[975576]: Object 1: Label=truck, Object Likelihood=0.57, Class Likelihood=0.75,
355+
[ INFO ] object_detection_yolov5[975576]: Bounding Box: [0.99, 0.54, 0.91, 0.46]
356+
[ INFO ] object_detection_yolov5[975576]: Object 2: Label=car, Object Likelihood=0.75, Class Likelihood=0.91,
357+
[ INFO ] object_detection_yolov5[975576]: Bounding Box: [0.68, 0.48, 0.61, 0.43]
358+
[ INFO ] object_detection_yolov5[975576]: Object 3: Label=car, Object Likelihood=0.83, Class Likelihood=0.94,
359+
[ INFO ] object_detection_yolov5[975576]: Bounding Box: [0.43, 0.49, 0.36, 0.44]
346360
```
347361
348362
## License

0 commit comments

Comments
 (0)