finds.dev← search

// the find

nihui/ncnn-android-yolov5

★ 724 · C++ · updated Aug 2023

The YOLOv5 object detection android example

A minimal Android sample that runs YOLOv5s object detection on-device through ncnn, Tencent's inference framework. It is a reference for wiring ncnn into an Android Studio project through JNI, not an app you would ship as-is. It is most useful if you want to see the moving parts without much scaffolding.

The surface is small: one JNI source file, one Java wrapper, one activity, and the model shipped as an ncnn .param/.bin pair in assets, so there is no conversion step between you and a running detector. It depends on ncnn alone, and the README points at the Vulkan build of the prebuilt zip, so GPU inference is available if the JNI code enables it. The CMake file is the only place the native build is configured, so the whole native path is easy to read in one sitting.

The ncnn dependency is a manual step: you download a zip from the releases page and unpack it into app/src/main/jni, with no Gradle dependency, submodule, or version pin, so a fresh clone does not build until someone does that. The last push was August 2023 and ncnn has changed since, so expect to fix build or runtime breakage against current releases. The README says nothing about accuracy, input size, thresholds, or on-device speed, which are the things you would need to judge whether this is worth building on. The sample bundles only yolov5s, and the README does not say what swapping in another model would involve.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →