Skip to content

Commit

Permalink
Fix bug that creates an empty output image
Browse files Browse the repository at this point in the history
Bug in object-detection* examples.
Fixes #138
  • Loading branch information
Corallo authored and pataxis committed Sep 11, 2023
1 parent c6caf06 commit 448c274
Show file tree
Hide file tree
Showing 4 changed files with 419 additions and 191 deletions.
3 changes: 2 additions & 1 deletion object-detection-cv25/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ The following instructions can be executed to simply run the example.

## Designing the application

The whole principle is similar to the [tensorflow-to-larod-cv25](../tensorflow-to-larod-cv25). In this example, the original video stream has a resolution of 640x360, while MobileNet SSD COCO requires an input size of 300x300, so we set up two different streams: one is for MobileNet model, another is used to crop a higher resolution jpg image.
The whole principle is similar to the [tensorflow-to-larod-cv25](../tensorflow-to-larod-cv25). In this example, the original video stream has a resolution of 1280x720, while MobileNet SSD COCO requires an input size of 300x300, so we set up two different streams: one is for MobileNet model, another is used to crop a higher resolution jpg image.
Although the model takes an input of 300x300, the CV25 accelerator expects an input of size multiple of 32. This means that the input needs to be converted to a resolution of 300x320 to satisfy the chip requirements. This is done by adding 20 bytes of padding to each row of the image.
In general, it would be easier to use a model that has already by design an input of size multiple of 32 (typically 320x320 or 640x640).


### Setting up the MobileNet stream

There are two methods used to obtain a proper resolution. The [chooseStreamResolution](app/imgprovider.c#L221) method is used to select the smallest stream and assign them into streamWidth and streamHeight.
Expand Down
2 changes: 1 addition & 1 deletion object-detection-cv25/app/manifest.json.cv25
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"group": "sdk",
"username": "sdk"
},
"runOptions": "/usr/local/packages/object_detection/model/converted_model.bin 300 300 20 80 640 360 70 /usr/local/packages/object_detection/label/labels.txt 91 1917 /usr/local/packages/object_detection/model/anchor_boxes.bin -c ambarella-cvflow",
"runOptions": "/usr/local/packages/object_detection/model/converted_model.bin 300 300 20 80 1280 720 70 /usr/local/packages/object_detection/label/labels.txt 91 1917 /usr/local/packages/object_detection/model/anchor_boxes.bin -c ambarella-cvflow",
"vendorUrl": "https://www.axis.com",
"runMode": "never",
"version": "1.0.0"
Expand Down
Loading

0 comments on commit 448c274

Please sign in to comment.