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>() {
@Override
public void onSucceeded(FaceDetector faceDetector) {
// 获取回调实例
mFaceDetector = faceDetector;
}
@Override
public void onFailed(int i, Error error) {
Log.e(Common.TAG, "create face detetector failed: " + error);
}
});
}

Make an Inference

// 从相机API回调中获取视频流的一帧
byte[] data = ....;
// 定义哪些人脸的动作需要在视频流中进行检测
long detectConfig =
FaceDetectConfig.ACTIONTYPE_EYE_BLINK |
FaceDetectConfig.ACTIONTYPE_MOUTH_AH |
FaceDetectConfig.ACTIONTYPE_HEAD_YAW |
FaceDetectConfig.ACTIONTYPE_HEAD_PITCH |
FaceDetectConfig.ACTIONTYPE_BROW_JUMP;
// 进行推理
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() {
super.onDestroy();
if (mFaceDetector! =null) {
mFaceDetector.release();
}
}

Best Practices for Pre-Processing and Post-Processing

Future

User Agreement

Original Source:

--

--

--

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

solving C2 RE Challenge from hackaday course

Hack The Box — Spectra Writeup

Nagendra Reddy’s Review

SOLID Principles of OOP: Single Responsibility Principle

Eliminating 1-Star App Reviews

Kotlin RecyclerView Adapter

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:https://www.alibabacloud.com

More from Medium

System Integration: Why is it crucial for warehouse automation?

Hash Tables or Hash Maps

What is Encryption vs Hashing vs Encoding vs Compression?