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

Plan Your Own (Fun!) Agile Workshop

THM Linux Fundamentals PT 2

What is the Serverless Edge?

Cisco DUO Multi-Factor Authentication with SalesForce

hic et nunc // updatable NFTs using IPNS

Java 8: Lamda and Stream

TIL 2021. 02. 23

Download Keygen Autocad 2019 For Mac

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

An Introduction to PCI Compliance

How to use code-free Datadog Synthetic Monitoring for simulated API and browser testing

Process of development

Recommendation System with Apache Beam as the Streaming Data-Parallel Processing Pipeline