Git Product home page Git Product logo

ncnn-swift's Introduction

ncnn-swift

Examples on using ncnn with Swift.

ncnn is a really popular neural network inference framework optimzied for mobile platforms. Sadly, as for now there are few iOS examples and the existing ones (e.g. dangbo/ncnn-mobile, cmdbug/YOLOv5_NCNN) are mainly in Objective-C. In fact, Swift has gradually grown as the major prgramming language for iOS. As Apple releasing SwiftUI, a pure Swift UI framework, in WWDC2019, we could believe that most iOS developers will shift to Swift. Therefore, it is important for a mobile inference framework to support Swift.

And here we are. This project is include examples on how to connect ncnn framework with Swift.

SqueezenetSwift

Screenshots from simulator and an iPhone 8plus. SwiftUI helps the app adapt to dark mode automatically.

This is a simple image classification with squeezenet from nihui/ncnn-android-squeezenet. I used bridge header to connect C++ and Swift. For an introduction of bridge header, please check this nice blog.

Yolov5Swift

Screenshots an iPhone 8plus.

This is a simple object detection example with yolov5 from nihui/ncnn-android-yolov5. It provides some ideas on how to register custom layer with Swift and how to use nihui/opencv-mobile together with ncnn.

Notice that the time shown includes cv::imread (around 40 ms) and the image is resized so that the longer edge is 640.


If you have any question on this project, please feel free to file an issue or PR.

ncnn-swift's People

Contributors

zhuzilin avatar

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.