MNN Kit: An Out-of-the-Box Algorithms Kit from Alibaba

What Is MNN Kit?

A Brief Introduction to MNN Kit Models

Gesture Recognition

Portrait Segmentation

Extremely Simple Access Process

Create an Instance

void createKitInstance() {
// 定义Detector Config
FaceDetector.FaceDetectorCreateConfig createConfig = new FaceDetector.FaceDetectorCreateConfig();
createConfig.mode = FaceDetector.FaceDetectMode.MOBILE_DETECT_MODE_VIDEO;
FaceDetector.createInstanceAsync(this, createConfig, new InstanceCreatedListener<FaceDetector>() {
public void onSucceeded(FaceDetector faceDetector) {
// 获取回调实例
mFaceDetector = faceDetector;
public void onFailed(int i, Error error) {
Log.e(Common.TAG, "create face detetector failed: " + error);

Make an Inference

// 从相机API回调中获取视频流的一帧
byte[] data = ....;
// 定义哪些人脸的动作需要在视频流中进行检测
long detectConfig =
// 进行推理
FaceDetectionReport[] results = mFaceDetector.inference(data, width, height,
MNNCVImageFormat.YUV_NV21, detectConfig, inAngle, outAngle,
mCameraView.isFrontCamera() ? MNNFlipType.FLIP_Y : MNNFlipType.FLIP_NONE);

Release an Instance

protected void onDestroy() {
if (mFaceDetector! =null) {

Best Practices for Pre-Processing and Post-Processing


User Agreement

  1. MNN Kit itself is not open-source and the models are not provided separately. The ability to use these models requires APIs from the MNN Kit. Reverse engineering on MNN Kit is prohibited in the user agreement.
  2. The secondary encapsulation on the MNN Kit for profit or commercial purposes is not allowed. For example, encapsulation on the MNN Kit as other SDKs for commercial or profitable purposes.
  3. On the premise of complying with the MNN Kit license, integrating MNN Kit SDK with an application is allowed as well as any commercial value or benefit that is generated.

Original Source:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website: