All Projects → hanleyweng → Coreml In Arkit

hanleyweng / Coreml In Arkit

Licence: mit
Simple project to detect objects and display 3D labels above them in AR. This serves as a basic Template for an ARKit project to use CoreML.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Coreml In Arkit

Gesture Recognition 101 Coreml Arkit
Simple project to recognize hands in realtime. 👋 Serves as an Example for building your own object recognizer.
Stars: ✭ 278 (-81.88%)
Mutual labels:  coreml, augmented-reality, arkit
Awesome Arkit
A curated list of awesome ARKit projects and resources. Feel free to contribute!
Stars: ✭ 7,139 (+365.38%)
Mutual labels:  augmented-reality, arkit
Arvisualizer
Prototype of a real-time visualization tool for ARKit sessions
Stars: ✭ 102 (-93.35%)
Mutual labels:  augmented-reality, arkit
Nativescript Ar
Augmented Reality NativeScript plugin
Stars: ✭ 107 (-93.02%)
Mutual labels:  augmented-reality, arkit
Ios Learning Materials
📚Curated list of articles, web-resources, tutorials and code repositories that may help you dig a little bit deeper into iOS [and Apple Platforms].
Stars: ✭ 1,380 (-10.04%)
Mutual labels:  coreml, arkit
Svrf Ios Sdk
iOS SDK for the Svrf API and ARKit Face Filters
Stars: ✭ 24 (-98.44%)
Mutual labels:  augmented-reality, arkit
Ar Ane
ARKit Adobe Air Native Extension for iOS11
Stars: ✭ 35 (-97.72%)
Mutual labels:  augmented-reality, arkit
Archarts
Lovely Augmented Reality Charts for iOS - Built with ARKit
Stars: ✭ 679 (-55.74%)
Mutual labels:  augmented-reality, arkit
React Arkit
AR library for React-Native based on ARKit
Stars: ✭ 57 (-96.28%)
Mutual labels:  augmented-reality, arkit
Augmentedsolarsystem
An Augmented reality experience to explore planets in our Solar System
Stars: ✭ 69 (-95.5%)
Mutual labels:  augmented-reality, arkit
Arkit Projects
Experimenting with ARKit
Stars: ✭ 70 (-95.44%)
Mutual labels:  augmented-reality, arkit
Xr Unity
8th Wall XR Unity projects and resources. Feel free to contribute!
Stars: ✭ 108 (-92.96%)
Mutual labels:  augmented-reality, arkit
Arshooter
A demo Augmented Reality shooter made with ARKit in Swift (iOS 11)
Stars: ✭ 794 (-48.24%)
Mutual labels:  augmented-reality, arkit
Arkit 2 Image Tracking Demo
iOS 12 + ARKit 2 + Image tracking means: Harry Potter style moving pictures, living movie posters, video postcards, paper-thin “displays,” and lots more augmented reality fun.
Stars: ✭ 102 (-93.35%)
Mutual labels:  augmented-reality, arkit
Facerecognition In Arkit
Detects faces using the Vision-API and runs the extracted face through a CoreML-model to identiy the specific persons.
Stars: ✭ 768 (-49.93%)
Mutual labels:  coreml, arkit
Partfolio
Rosberry Portfolio app made with Apple ARKit
Stars: ✭ 29 (-98.11%)
Mutual labels:  augmented-reality, arkit
Arkit Sampler
Code examples for ARKit.
Stars: ✭ 1,334 (-13.04%)
Mutual labels:  coreml, arkit
Arkit Corelocation
Combines the high accuracy of AR with the scale of GPS data.
Stars: ✭ 5,045 (+228.88%)
Mutual labels:  augmented-reality, arkit
Arpaint
Draw with bare fingers in the air using ARKit
Stars: ✭ 672 (-56.19%)
Mutual labels:  augmented-reality, arkit
Scenekit Scnline
Draw a tube or thick line in SceneKit
Stars: ✭ 49 (-96.81%)
Mutual labels:  augmented-reality, arkit

CoreML-in-ARKit

This simple project detects objects in Augmented Reality and displays 3D labels on top of them. This serves as a basic template for an ARKit project to use CoreML.

image of scene with 3d labels on objects

Demo Video - on Youtube

Model: Inception V3

Language: Swift 4.0

Written in: Xcode 9.0 GM (9A235) (Updated) XCode 9 beta 3 (9M174d)

Content Technology: SceneKit

Tested on iPhone 7 plus running iOS 11 beta 3 (15A5318g)

Note: SceneKit can achieve a 60 FPS on iPhone7+ - though when it gets hot, it'll drop to 30 FPS.

Instructions

You'll have to download "Inceptionv3.mlmodel" from Apple's Machine Learning page, and copy it into your XCode project. (As depicted in the following gif)

Gif to show dragging and dropping of model into XCode

(Gif via Atomic14)

If you're having issues, double check that the model is part of a target (source: stackoverflow).

Footnotes

  • SceneKit Text Labels are expensive to render. Too many polygons (too much text, smoothness, characters) - can cause crashes. In future, SpriteKit would be more efficient for text-labels.

  • Not entirely certain if the code is actually transferring RGB data to the Vision Model (as opposed to YUV). Proof-of-concept-wise, it appears to work just fine with the Inception V3 model for now.

  • Whilst ARKit's FPS , is displayed - CoreML's speed is not. However, it does appear sufficiently fast for real-time ARKit applications.

  • Placement of the label is simply determined by the raycast screen centre-point to a ARKit feature-point. This could be altered for more stable placement.

Building Blocks (Overview)

Get CoreML running in real time in ARKit

  • There are some good tutorials / sample projects for getting CoreML running. See: [ 1 ] [ 2 ] [ 3 ]

  • What we do differently here is we're using ARKit's ARFrame as the image to be fed into CoreML.

let pixbuff : CVPixelBuffer? = (sceneView.session.currentFrame?.capturedImage)
  • We also use Threading to continuously run requests to CoreML in realtime, and without disturbing ARKit / SceneView
let dispatchQueueML = DispatchQueue(label: "com.hw.dispatchqueueml")
...
loopCoreMLUpdate() // on viewLoad
...
func loopCoreMLUpdate() {
    dispatchQueueML.async {
        // 1. Run Update.
        self.updateCoreML()
        // 2. Loop this function.
        self.loopCoreMLUpdate()
    }
}

Add 3D Text

  • Add a Tap Gesture.
  • On Tap. Get the raycast centre point, translating it to appropriate coordinates.
  • Render 3D text at that location. Use the most likely object.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].