Giter Club home page Giter Club logo

ncnn-android-scrfd's Introduction

ncnn-android-scrfd

The SCRFD face detection

This is a sample ncnn android project, it depends on ncnn library and opencv

https://github.com/Tencent/ncnn

https://github.com/nihui/opencv-mobile

android apk file download

https://github.com/nihui/ncnn-android-scrfd/releases/latest

how to build and run

step1

https://github.com/Tencent/ncnn/releases

  • Download ncnn-YYYYMMDD-android-vulkan.zip or build ncnn for android yourself
  • Extract ncnn-YYYYMMDD-android-vulkan.zip into app/src/main/jni and change the ncnn_DIR path to yours in app/src/main/jni/CMakeLists.txt

step2

https://github.com/nihui/opencv-mobile

  • Download opencv-mobile-XYZ-android.zip
  • Extract opencv-mobile-XYZ-android.zip into app/src/main/jni and change the OpenCV_DIR path to yours in app/src/main/jni/CMakeLists.txt

step3

  • Open this project with Android Studio, build it and enjoy!

some notes

  • Android ndk camera is used for best efficiency
  • Crash may happen on very old devices for lacking HAL3 camera interface
  • All models are manually modified to accept dynamic input shape
  • Most small models run slower on GPU than on CPU, this is common
  • FPS may be lower in dark environment because of longer camera exposure time

screenshot

ncnn-android-scrfd's People

Contributors

mambawong avatar nihui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ncnn-android-scrfd's Issues

How to change the size of the anchor

Hi nihui,

I see that in generate_anchors, the largest anchor is 512*512 (base size=256, scale=2.f).

I want to change the size of the anchor to detect larger faces.

But I can't detect a larger face by increasing base_size or scale.

What should I do to detect larger face sizes?

BR

/ncnn-android-scrfd/app/src/main/jni/scrfd.h:29: error: undefined reference to 'ncnn::Net::Net()'

@nihui 大佬好,感谢大佬的代码,我已经按照设置把ncnn_dir 和 opencv_dir设置为自己的了,并且所有的ZIP下载下来解压后都放在了jni下,我的cmakelists像这样:

project(scrfdncnn)

cmake_minimum_required(VERSION 3.10)

set(OpenCV_DIR ./sdk/native/jni)
find_package(OpenCV REQUIRED core imgproc)

set(ncnn_DIR ./arm64-v8a/lib/cmake/ncnn)
find_package(ncnn REQUIRED)

add_library(scrfdncnn SHARED scrfdncnn.cpp scrfd.cpp ndkcamera.cpp)

target_link_libraries(scrfdncnn ncnn ${OpenCV_LIBS} camera2ndk mediandk)

但是在编译项目的时候还是找不到ncnn,想问下错在哪里了~感激不尽

c++ only version for linux

Hi,

would you mind to pack a linux (intel/arm/gpu) version of the scrfd ?

would love to see arm / linux perfoamance

Best

Frames dropping and slowness

The problem

Actually this is not a problem with your code or ncnn model it just a generic problem when it comes to face heavy operations. Slowness and image frame cuttering because you detect faces in every camera frame

So

Well actually phones cpus and gpus aren't much power than our desktops or laptops. It needs a different treatment and workaround to get the best results so far I have used many workarounds and really get some good results overall but still need much smoothness between frames, So far I tried

  • Resizing an image before getting into processing
  • Do the process task in a standalone thread
  • Trackers ?
  • If you know any workaround please mention it

How to get more good results

I believe using trackers play a powerful role in this problem but in myself didn't find a good resource to start implement that and see what the output. Did you ever tried to solve this problem using trackers? and if you have a good repos for trackers to use please mention them below

Thanks!

imwrite fail on android

undefined reference to `cv::imwrite(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&, cv::_InputArray const&, std::__ndk1::vector<int, std::__ndk1::allocator > const&)'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)

I am using your opencvmobile sdk.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.