Skip to content

Commit

Permalink
Added Yolov5s example
Browse files Browse the repository at this point in the history
  • Loading branch information
ibaiGorordo committed Mar 1, 2022
1 parent 040b89c commit bd2b6ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Binary file added app/src/main/assets/yolov5s_416_6shave.blob
Binary file not shown.
8 changes: 6 additions & 2 deletions app/src/main/cpp/native-lib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ Java_com_example_depthai_1android_1jni_1example_MainActivity_startDevice(JNIEnv
detectionNetwork->setConfidenceThreshold(0.5f);
detectionNetwork->setNumClasses(80);
detectionNetwork->setCoordinateSize(4);
detectionNetwork->setAnchors({10, 14, 23, 27, 37, 58, 81, 82, 135, 169, 344, 319});
detectionNetwork->setAnchorMasks({{"side26", {1, 2, 3}}, {"side13", {3, 4, 5}}});
// Yolov3/v4 tiny
// detectionNetwork->setAnchors({10, 14, 23, 27, 37, 58, 81, 82, 135, 169, 344, 319});
// detectionNetwork->setAnchorMasks({{"side26", {1, 2, 3}}, {"side13", {3, 4, 5}}});
// Yolov5s
detectionNetwork->setAnchors({10,13, 16,30, 33,23, 30,61, 62,45, 59,119, 116,90, 156,198, 373,326});
detectionNetwork->setAnchorMasks({{"side52", {0, 1, 2}}, {"side26", {3, 4, 5}}, {"side13", {6, 7, 8}}});
detectionNetwork->setIouThreshold(0.5f);
detectionNetwork->setBlob(model_blob);
detectionNetwork->setNumInferenceThreads(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class MainActivity extends AppCompatActivity {

private static final String yolov3_model_path = "yolo-v3-tiny-tf.blob";
private static final String yolov4_model_path = "yolov4_tiny_coco_416x416_6shave.blob";
private static final String yolov5_model_path = "yolov5s_416_6shave.blob";
private static final String mobilenet_model_path = "mobilenet-ssd.blob";

private ImageView rgbImageView, depthImageView;
Expand Down Expand Up @@ -73,7 +74,7 @@ public void run() {
if(running){
if(firstTime){
// Start the device
startDevice(yolov4_model_path, rgbWidth, rgbHeight);
startDevice(yolov5_model_path, rgbWidth, rgbHeight);
firstTime = false;
}

Expand Down

0 comments on commit bd2b6ff

Please sign in to comment.