├── .gitignore ├── ARKit-CoreML-Emotion-Classification ├── ARKit-CoreML-Emotion-Classification.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── ARKit-CoreML-Emotion-Classification │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ ├── SceneDelegate.swift │ ├── ViewController.swift │ └── demo.gif └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## User settings 6 | xcuserdata/ 7 | 8 | ## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) 9 | *.xcscmblueprint 10 | *.xccheckout 11 | 12 | ## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) 13 | build/ 14 | DerivedData/ 15 | *.moved-aside 16 | *.pbxuser 17 | !default.pbxuser 18 | *.mode1v3 19 | !default.mode1v3 20 | *.mode2v3 21 | !default.mode2v3 22 | *.perspectivev3 23 | !default.perspectivev3 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | 28 | ## App packaging 29 | *.ipa 30 | *.dSYM.zip 31 | *.dSYM 32 | 33 | ## Playgrounds 34 | timeline.xctimeline 35 | playground.xcworkspace 36 | 37 | # Swift Package Manager 38 | # 39 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 40 | # Packages/ 41 | # Package.pins 42 | # Package.resolved 43 | # *.xcodeproj 44 | # 45 | # Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata 46 | # hence it is not needed unless you have added a package configuration file to your project 47 | # .swiftpm 48 | 49 | .build/ 50 | 51 | # CocoaPods 52 | # 53 | # We recommend against adding the Pods directory to your .gitignore. However 54 | # you should judge for yourself, the pros and cons are mentioned at: 55 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 56 | # 57 | # Pods/ 58 | # 59 | # Add this line if you want to avoid checking in source code from the Xcode workspace 60 | # *.xcworkspace 61 | 62 | # Carthage 63 | # 64 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 65 | # Carthage/Checkouts 66 | 67 | Carthage/Build/ 68 | 69 | # Accio dependency management 70 | Dependencies/ 71 | .accio/ 72 | 73 | # fastlane 74 | # 75 | # It is recommended to not store the screenshots in the git repo. 76 | # Instead, use fastlane to re-generate the screenshots whenever they are needed. 77 | # For more information about the recommended setup visit: 78 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 79 | 80 | fastlane/report.xml 81 | fastlane/Preview.html 82 | fastlane/screenshots/**/*.png 83 | fastlane/test_output 84 | 85 | # Code Injection 86 | # 87 | # After new code Injection tools there's a generated folder /iOSInjectionProject 88 | # https://github.com/johnno1962/injectionforxcode 89 | 90 | iOSInjectionProject/ 91 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | AB76A43825F79EDB007350DA /* demo.gif in Resources */ = {isa = PBXBuildFile; fileRef = AB76A43725F79EDB007350DA /* demo.gif */; }; 11 | AB8F1DDB25EC199700C56F6B /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB8F1DDA25EC199700C56F6B /* AppDelegate.swift */; }; 12 | AB8F1DDD25EC199700C56F6B /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB8F1DDC25EC199700C56F6B /* SceneDelegate.swift */; }; 13 | AB8F1DDF25EC199700C56F6B /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB8F1DDE25EC199700C56F6B /* ViewController.swift */; }; 14 | AB8F1DE225EC199700C56F6B /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB8F1DE025EC199700C56F6B /* Main.storyboard */; }; 15 | AB8F1DE425EC199800C56F6B /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AB8F1DE325EC199800C56F6B /* Assets.xcassets */; }; 16 | AB8F1DE725EC199800C56F6B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AB8F1DE525EC199800C56F6B /* LaunchScreen.storyboard */; }; 17 | AB8FB5E825F53788008678DB /* CNNEmotions.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = AB8FB5E725F53788008678DB /* CNNEmotions.mlmodel */; }; 18 | /* End PBXBuildFile section */ 19 | 20 | /* Begin PBXFileReference section */ 21 | AB76A43725F79EDB007350DA /* demo.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = demo.gif; sourceTree = ""; }; 22 | AB8F1DD725EC199700C56F6B /* ARKit-CoreML-Emotion-Classification.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ARKit-CoreML-Emotion-Classification.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | AB8F1DDA25EC199700C56F6B /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | AB8F1DDC25EC199700C56F6B /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 25 | AB8F1DDE25EC199700C56F6B /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 26 | AB8F1DE125EC199700C56F6B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | AB8F1DE325EC199800C56F6B /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 28 | AB8F1DE625EC199800C56F6B /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 29 | AB8F1DE825EC199800C56F6B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 30 | AB8FB5E725F53788008678DB /* CNNEmotions.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; path = CNNEmotions.mlmodel; sourceTree = ""; }; 31 | /* End PBXFileReference section */ 32 | 33 | /* Begin PBXFrameworksBuildPhase section */ 34 | AB8F1DD425EC199700C56F6B /* Frameworks */ = { 35 | isa = PBXFrameworksBuildPhase; 36 | buildActionMask = 2147483647; 37 | files = ( 38 | ); 39 | runOnlyForDeploymentPostprocessing = 0; 40 | }; 41 | /* End PBXFrameworksBuildPhase section */ 42 | 43 | /* Begin PBXGroup section */ 44 | AB8F1DCE25EC199700C56F6B = { 45 | isa = PBXGroup; 46 | children = ( 47 | AB8F1DD925EC199700C56F6B /* ARKit-CoreML-Emotion-Classification */, 48 | AB8F1DD825EC199700C56F6B /* Products */, 49 | ); 50 | sourceTree = ""; 51 | }; 52 | AB8F1DD825EC199700C56F6B /* Products */ = { 53 | isa = PBXGroup; 54 | children = ( 55 | AB8F1DD725EC199700C56F6B /* ARKit-CoreML-Emotion-Classification.app */, 56 | ); 57 | name = Products; 58 | sourceTree = ""; 59 | }; 60 | AB8F1DD925EC199700C56F6B /* ARKit-CoreML-Emotion-Classification */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | AB8F1DDA25EC199700C56F6B /* AppDelegate.swift */, 64 | AB8F1DDC25EC199700C56F6B /* SceneDelegate.swift */, 65 | AB8F1DDE25EC199700C56F6B /* ViewController.swift */, 66 | AB8F1DE025EC199700C56F6B /* Main.storyboard */, 67 | AB8F1DE325EC199800C56F6B /* Assets.xcassets */, 68 | AB8F1DE525EC199800C56F6B /* LaunchScreen.storyboard */, 69 | AB8FB5E725F53788008678DB /* CNNEmotions.mlmodel */, 70 | AB8F1DE825EC199800C56F6B /* Info.plist */, 71 | AB76A43725F79EDB007350DA /* demo.gif */, 72 | ); 73 | path = "ARKit-CoreML-Emotion-Classification"; 74 | sourceTree = ""; 75 | }; 76 | /* End PBXGroup section */ 77 | 78 | /* Begin PBXNativeTarget section */ 79 | AB8F1DD625EC199700C56F6B /* ARKit-CoreML-Emotion-Classification */ = { 80 | isa = PBXNativeTarget; 81 | buildConfigurationList = AB8F1DEB25EC199800C56F6B /* Build configuration list for PBXNativeTarget "ARKit-CoreML-Emotion-Classification" */; 82 | buildPhases = ( 83 | AB8F1DD325EC199700C56F6B /* Sources */, 84 | AB8F1DD425EC199700C56F6B /* Frameworks */, 85 | AB8F1DD525EC199700C56F6B /* Resources */, 86 | ); 87 | buildRules = ( 88 | ); 89 | dependencies = ( 90 | ); 91 | name = "ARKit-CoreML-Emotion-Classification"; 92 | productName = "ARKit-CoreML-Face-Classification"; 93 | productReference = AB8F1DD725EC199700C56F6B /* ARKit-CoreML-Emotion-Classification.app */; 94 | productType = "com.apple.product-type.application"; 95 | }; 96 | /* End PBXNativeTarget section */ 97 | 98 | /* Begin PBXProject section */ 99 | AB8F1DCF25EC199700C56F6B /* Project object */ = { 100 | isa = PBXProject; 101 | attributes = { 102 | LastSwiftUpdateCheck = 1240; 103 | LastUpgradeCheck = 1240; 104 | TargetAttributes = { 105 | AB8F1DD625EC199700C56F6B = { 106 | CreatedOnToolsVersion = 12.4; 107 | }; 108 | }; 109 | }; 110 | buildConfigurationList = AB8F1DD225EC199700C56F6B /* Build configuration list for PBXProject "ARKit-CoreML-Emotion-Classification" */; 111 | compatibilityVersion = "Xcode 9.3"; 112 | developmentRegion = en; 113 | hasScannedForEncodings = 0; 114 | knownRegions = ( 115 | en, 116 | Base, 117 | ); 118 | mainGroup = AB8F1DCE25EC199700C56F6B; 119 | productRefGroup = AB8F1DD825EC199700C56F6B /* Products */; 120 | projectDirPath = ""; 121 | projectRoot = ""; 122 | targets = ( 123 | AB8F1DD625EC199700C56F6B /* ARKit-CoreML-Emotion-Classification */, 124 | ); 125 | }; 126 | /* End PBXProject section */ 127 | 128 | /* Begin PBXResourcesBuildPhase section */ 129 | AB8F1DD525EC199700C56F6B /* Resources */ = { 130 | isa = PBXResourcesBuildPhase; 131 | buildActionMask = 2147483647; 132 | files = ( 133 | AB76A43825F79EDB007350DA /* demo.gif in Resources */, 134 | AB8F1DE725EC199800C56F6B /* LaunchScreen.storyboard in Resources */, 135 | AB8F1DE425EC199800C56F6B /* Assets.xcassets in Resources */, 136 | AB8F1DE225EC199700C56F6B /* Main.storyboard in Resources */, 137 | ); 138 | runOnlyForDeploymentPostprocessing = 0; 139 | }; 140 | /* End PBXResourcesBuildPhase section */ 141 | 142 | /* Begin PBXSourcesBuildPhase section */ 143 | AB8F1DD325EC199700C56F6B /* Sources */ = { 144 | isa = PBXSourcesBuildPhase; 145 | buildActionMask = 2147483647; 146 | files = ( 147 | AB8F1DDF25EC199700C56F6B /* ViewController.swift in Sources */, 148 | AB8FB5E825F53788008678DB /* CNNEmotions.mlmodel in Sources */, 149 | AB8F1DDB25EC199700C56F6B /* AppDelegate.swift in Sources */, 150 | AB8F1DDD25EC199700C56F6B /* SceneDelegate.swift in Sources */, 151 | ); 152 | runOnlyForDeploymentPostprocessing = 0; 153 | }; 154 | /* End PBXSourcesBuildPhase section */ 155 | 156 | /* Begin PBXVariantGroup section */ 157 | AB8F1DE025EC199700C56F6B /* Main.storyboard */ = { 158 | isa = PBXVariantGroup; 159 | children = ( 160 | AB8F1DE125EC199700C56F6B /* Base */, 161 | ); 162 | name = Main.storyboard; 163 | sourceTree = ""; 164 | }; 165 | AB8F1DE525EC199800C56F6B /* LaunchScreen.storyboard */ = { 166 | isa = PBXVariantGroup; 167 | children = ( 168 | AB8F1DE625EC199800C56F6B /* Base */, 169 | ); 170 | name = LaunchScreen.storyboard; 171 | sourceTree = ""; 172 | }; 173 | /* End PBXVariantGroup section */ 174 | 175 | /* Begin XCBuildConfiguration section */ 176 | AB8F1DE925EC199800C56F6B /* Debug */ = { 177 | isa = XCBuildConfiguration; 178 | buildSettings = { 179 | ALWAYS_SEARCH_USER_PATHS = NO; 180 | CLANG_ANALYZER_NONNULL = YES; 181 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 182 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 183 | CLANG_CXX_LIBRARY = "libc++"; 184 | CLANG_ENABLE_MODULES = YES; 185 | CLANG_ENABLE_OBJC_ARC = YES; 186 | CLANG_ENABLE_OBJC_WEAK = YES; 187 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 188 | CLANG_WARN_BOOL_CONVERSION = YES; 189 | CLANG_WARN_COMMA = YES; 190 | CLANG_WARN_CONSTANT_CONVERSION = YES; 191 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 192 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 193 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 194 | CLANG_WARN_EMPTY_BODY = YES; 195 | CLANG_WARN_ENUM_CONVERSION = YES; 196 | CLANG_WARN_INFINITE_RECURSION = YES; 197 | CLANG_WARN_INT_CONVERSION = YES; 198 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 199 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 200 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 201 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 202 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 203 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 204 | CLANG_WARN_STRICT_PROTOTYPES = YES; 205 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 206 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 207 | CLANG_WARN_UNREACHABLE_CODE = YES; 208 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 209 | COPY_PHASE_STRIP = NO; 210 | DEBUG_INFORMATION_FORMAT = dwarf; 211 | ENABLE_STRICT_OBJC_MSGSEND = YES; 212 | ENABLE_TESTABILITY = YES; 213 | GCC_C_LANGUAGE_STANDARD = gnu11; 214 | GCC_DYNAMIC_NO_PIC = NO; 215 | GCC_NO_COMMON_BLOCKS = YES; 216 | GCC_OPTIMIZATION_LEVEL = 0; 217 | GCC_PREPROCESSOR_DEFINITIONS = ( 218 | "DEBUG=1", 219 | "$(inherited)", 220 | ); 221 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 222 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 223 | GCC_WARN_UNDECLARED_SELECTOR = YES; 224 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 225 | GCC_WARN_UNUSED_FUNCTION = YES; 226 | GCC_WARN_UNUSED_VARIABLE = YES; 227 | IPHONEOS_DEPLOYMENT_TARGET = 14.4; 228 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 229 | MTL_FAST_MATH = YES; 230 | ONLY_ACTIVE_ARCH = YES; 231 | SDKROOT = iphoneos; 232 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 233 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 234 | }; 235 | name = Debug; 236 | }; 237 | AB8F1DEA25EC199800C56F6B /* Release */ = { 238 | isa = XCBuildConfiguration; 239 | buildSettings = { 240 | ALWAYS_SEARCH_USER_PATHS = NO; 241 | CLANG_ANALYZER_NONNULL = YES; 242 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 243 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 244 | CLANG_CXX_LIBRARY = "libc++"; 245 | CLANG_ENABLE_MODULES = YES; 246 | CLANG_ENABLE_OBJC_ARC = YES; 247 | CLANG_ENABLE_OBJC_WEAK = YES; 248 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 249 | CLANG_WARN_BOOL_CONVERSION = YES; 250 | CLANG_WARN_COMMA = YES; 251 | CLANG_WARN_CONSTANT_CONVERSION = YES; 252 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 253 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 254 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 255 | CLANG_WARN_EMPTY_BODY = YES; 256 | CLANG_WARN_ENUM_CONVERSION = YES; 257 | CLANG_WARN_INFINITE_RECURSION = YES; 258 | CLANG_WARN_INT_CONVERSION = YES; 259 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 260 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 261 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 262 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 263 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 264 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 265 | CLANG_WARN_STRICT_PROTOTYPES = YES; 266 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 267 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 268 | CLANG_WARN_UNREACHABLE_CODE = YES; 269 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 270 | COPY_PHASE_STRIP = NO; 271 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 272 | ENABLE_NS_ASSERTIONS = NO; 273 | ENABLE_STRICT_OBJC_MSGSEND = YES; 274 | GCC_C_LANGUAGE_STANDARD = gnu11; 275 | GCC_NO_COMMON_BLOCKS = YES; 276 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 277 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 278 | GCC_WARN_UNDECLARED_SELECTOR = YES; 279 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 280 | GCC_WARN_UNUSED_FUNCTION = YES; 281 | GCC_WARN_UNUSED_VARIABLE = YES; 282 | IPHONEOS_DEPLOYMENT_TARGET = 14.4; 283 | MTL_ENABLE_DEBUG_INFO = NO; 284 | MTL_FAST_MATH = YES; 285 | SDKROOT = iphoneos; 286 | SWIFT_COMPILATION_MODE = wholemodule; 287 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 288 | VALIDATE_PRODUCT = YES; 289 | }; 290 | name = Release; 291 | }; 292 | AB8F1DEC25EC199800C56F6B /* Debug */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 296 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 297 | CODE_SIGN_STYLE = Automatic; 298 | DEVELOPMENT_TEAM = V7C3R87KYJ; 299 | INFOPLIST_FILE = "ARKit-CoreML-Emotion-Classification/Info.plist"; 300 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 301 | LD_RUNPATH_SEARCH_PATHS = ( 302 | "$(inherited)", 303 | "@executable_path/Frameworks", 304 | ); 305 | PRODUCT_BUNDLE_IDENTIFIER = "bogdan-razvan.ARKit-CoreML-Face-Classification"; 306 | PRODUCT_NAME = "$(TARGET_NAME)"; 307 | SWIFT_VERSION = 5.0; 308 | TARGETED_DEVICE_FAMILY = 1; 309 | }; 310 | name = Debug; 311 | }; 312 | AB8F1DED25EC199800C56F6B /* Release */ = { 313 | isa = XCBuildConfiguration; 314 | buildSettings = { 315 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 316 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 317 | CODE_SIGN_STYLE = Automatic; 318 | DEVELOPMENT_TEAM = V7C3R87KYJ; 319 | INFOPLIST_FILE = "ARKit-CoreML-Emotion-Classification/Info.plist"; 320 | IPHONEOS_DEPLOYMENT_TARGET = 13.0; 321 | LD_RUNPATH_SEARCH_PATHS = ( 322 | "$(inherited)", 323 | "@executable_path/Frameworks", 324 | ); 325 | PRODUCT_BUNDLE_IDENTIFIER = "bogdan-razvan.ARKit-CoreML-Face-Classification"; 326 | PRODUCT_NAME = "$(TARGET_NAME)"; 327 | SWIFT_VERSION = 5.0; 328 | TARGETED_DEVICE_FAMILY = 1; 329 | }; 330 | name = Release; 331 | }; 332 | /* End XCBuildConfiguration section */ 333 | 334 | /* Begin XCConfigurationList section */ 335 | AB8F1DD225EC199700C56F6B /* Build configuration list for PBXProject "ARKit-CoreML-Emotion-Classification" */ = { 336 | isa = XCConfigurationList; 337 | buildConfigurations = ( 338 | AB8F1DE925EC199800C56F6B /* Debug */, 339 | AB8F1DEA25EC199800C56F6B /* Release */, 340 | ); 341 | defaultConfigurationIsVisible = 0; 342 | defaultConfigurationName = Release; 343 | }; 344 | AB8F1DEB25EC199800C56F6B /* Build configuration list for PBXNativeTarget "ARKit-CoreML-Emotion-Classification" */ = { 345 | isa = XCConfigurationList; 346 | buildConfigurations = ( 347 | AB8F1DEC25EC199800C56F6B /* Debug */, 348 | AB8F1DED25EC199800C56F6B /* Release */, 349 | ); 350 | defaultConfigurationIsVisible = 0; 351 | defaultConfigurationName = Release; 352 | }; 353 | /* End XCConfigurationList section */ 354 | }; 355 | rootObject = AB8F1DCF25EC199700C56F6B /* Project object */; 356 | } 357 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // ARKit-CoreML-Emotion-Classification 4 | // 5 | // Created by bogdan razvan on 28.02.2021. 6 | // 7 | 8 | import UIKit 9 | 10 | @main 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | 14 | 15 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 16 | // Override point for customization after application launch. 17 | return true 18 | } 19 | 20 | // MARK: UISceneSession Lifecycle 21 | 22 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 23 | // Called when a new scene session is being created. 24 | // Use this method to select a configuration to create the new scene with. 25 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 26 | } 27 | 28 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 29 | // Called when the user discards a scene session. 30 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 31 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 32 | } 33 | 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/Assets.xcassets/AccentColor.colorset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "colors" : [ 3 | { 4 | "idiom" : "universal" 5 | } 6 | ], 7 | "info" : { 8 | "author" : "xcode", 9 | "version" : 1 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "scale" : "1x", 46 | "size" : "20x20" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "scale" : "2x", 51 | "size" : "20x20" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "scale" : "1x", 56 | "size" : "29x29" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "scale" : "2x", 61 | "size" : "29x29" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "scale" : "1x", 66 | "size" : "40x40" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "scale" : "2x", 71 | "size" : "40x40" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "scale" : "1x", 76 | "size" : "76x76" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "scale" : "2x", 81 | "size" : "76x76" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "scale" : "2x", 86 | "size" : "83.5x83.5" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "scale" : "1x", 91 | "size" : "1024x1024" 92 | } 93 | ], 94 | "info" : { 95 | "author" : "xcode", 96 | "version" : 1 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSCameraUsageDescription 6 | Camera will be used for face recognition. 7 | CFBundleDevelopmentRegion 8 | $(DEVELOPMENT_LANGUAGE) 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UIApplicationSceneManifest 26 | 27 | UIApplicationSupportsMultipleScenes 28 | 29 | UISceneConfigurations 30 | 31 | UIWindowSceneSessionRoleApplication 32 | 33 | 34 | UISceneConfigurationName 35 | Default Configuration 36 | UISceneDelegateClassName 37 | $(PRODUCT_MODULE_NAME).SceneDelegate 38 | UISceneStoryboardFile 39 | Main 40 | 41 | 42 | 43 | 44 | UIApplicationSupportsIndirectInputEvents 45 | 46 | UILaunchStoryboardName 47 | LaunchScreen 48 | UIMainStoryboardFile 49 | Main 50 | UIRequiredDeviceCapabilities 51 | 52 | armv7 53 | 54 | UISupportedInterfaceOrientations 55 | 56 | UIInterfaceOrientationPortrait 57 | 58 | UISupportedInterfaceOrientations~ipad 59 | 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationPortraitUpsideDown 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // ARKit-CoreML-Emotion-Classification 4 | // 5 | // Created by bogdan razvan on 28.02.2021. 6 | // 7 | 8 | import UIKit 9 | 10 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 11 | 12 | var window: UIWindow? 13 | 14 | 15 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 16 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 17 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 18 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 19 | guard let _ = (scene as? UIWindowScene) else { return } 20 | } 21 | 22 | func sceneDidDisconnect(_ scene: UIScene) { 23 | // Called as the scene is being released by the system. 24 | // This occurs shortly after the scene enters the background, or when its session is discarded. 25 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 26 | // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead). 27 | } 28 | 29 | func sceneDidBecomeActive(_ scene: UIScene) { 30 | // Called when the scene has moved from an inactive state to an active state. 31 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 32 | } 33 | 34 | func sceneWillResignActive(_ scene: UIScene) { 35 | // Called when the scene will move from an active state to an inactive state. 36 | // This may occur due to temporary interruptions (ex. an incoming phone call). 37 | } 38 | 39 | func sceneWillEnterForeground(_ scene: UIScene) { 40 | // Called as the scene transitions from the background to the foreground. 41 | // Use this method to undo the changes made on entering the background. 42 | } 43 | 44 | func sceneDidEnterBackground(_ scene: UIScene) { 45 | // Called as the scene transitions from the foreground to the background. 46 | // Use this method to save data, release shared resources, and store enough scene-specific state information 47 | // to restore the scene back to its current state. 48 | } 49 | 50 | 51 | } 52 | 53 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // ARKit-CoreML-Emotion-Classification 4 | // 5 | // Created by bogdan razvan on 28.02.2021. 6 | // 7 | 8 | import UIKit 9 | import ARKit 10 | 11 | class ViewController: UIViewController { 12 | 13 | //The sceneview that we are going to display. 14 | private let sceneView = ARSCNView(frame: UIScreen.main.bounds) 15 | //The CoreML model we use for emotion classification. 16 | private let model = try! VNCoreMLModel(for: CNNEmotions().model) 17 | //The scene node containing the emotion text. 18 | private var textNode: SCNNode? 19 | 20 | override func viewDidLoad() { 21 | super.viewDidLoad() 22 | guard ARWorldTrackingConfiguration.isSupported else { return } 23 | 24 | view.addSubview(sceneView) 25 | sceneView.delegate = self 26 | sceneView.showsStatistics = true 27 | sceneView.session.run(ARFaceTrackingConfiguration(), options: [.resetTracking, .removeExistingAnchors]) 28 | } 29 | 30 | /// Creates a scene node containing yellow coloured text. 31 | /// - Parameter faceGeometry: the geometry the node is using. 32 | private func addTextNode(faceGeometry: ARSCNFaceGeometry) { 33 | let text = SCNText(string: "", extrusionDepth: 1) 34 | text.font = UIFont.systemFont(ofSize: 20, weight: .medium) 35 | let material = SCNMaterial() 36 | material.diffuse.contents = UIColor.systemYellow 37 | text.materials = [material] 38 | 39 | let textNode = SCNNode(geometry: faceGeometry) 40 | textNode.position = SCNVector3(-0.1, 0.3, -0.5) 41 | textNode.scale = SCNVector3(0.003, 0.003, 0.003) 42 | textNode.geometry = text 43 | self.textNode = textNode 44 | sceneView.scene.rootNode.addChildNode(textNode) 45 | } 46 | 47 | } 48 | 49 | extension ViewController: ARSCNViewDelegate { 50 | 51 | func renderer(_ renderer: SCNSceneRenderer, nodeFor anchor: ARAnchor) -> SCNNode? { 52 | guard let device = sceneView.device else { return nil } 53 | let node = SCNNode(geometry: ARSCNFaceGeometry(device: device)) 54 | //Projects the white lines on the face. 55 | node.geometry?.firstMaterial?.fillMode = .lines 56 | return node 57 | } 58 | 59 | func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) { 60 | guard let faceGeometry = node.geometry as? ARSCNFaceGeometry, textNode == nil else { return } 61 | addTextNode(faceGeometry: faceGeometry) 62 | } 63 | 64 | func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) { 65 | guard let faceAnchor = anchor as? ARFaceAnchor, 66 | let faceGeometry = node.geometry as? ARSCNFaceGeometry, 67 | let pixelBuffer = self.sceneView.session.currentFrame?.capturedImage 68 | else { 69 | return 70 | } 71 | 72 | //Updates the face geometry. 73 | faceGeometry.update(from: faceAnchor.geometry) 74 | 75 | //Creates Vision Image Request Handler using the current frame and performs an MLRequest. 76 | try? VNImageRequestHandler(cvPixelBuffer: pixelBuffer, orientation: .right, options: [:]).perform([VNCoreMLRequest(model: model) { [weak self] request, error in 77 | //Here we get the first result of the Classification Observation result. 78 | guard let firstResult = (request.results as? [VNClassificationObservation])?.first else { return } 79 | DispatchQueue.main.async { 80 | // print("identifier: \(topResult.identifier), confidence: \(topResult.confidence)") 81 | //Check if the confidence is high enough - used an arbitrary value here - and update the text to display the resulted emotion. 82 | if firstResult.confidence > 0.92 { 83 | (self?.textNode?.geometry as? SCNText)?.string = firstResult.identifier 84 | } 85 | } 86 | }]) 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bogdan-razvan/ARKit-CoreML-Emotion-Classification/322d52c641b1710d1932806ca46429844c73674d/ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/demo.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ARKit-CoreML-Emotion-Classification 2 | Example of ARKit and CoreML Usage on Emotion Classification 3 | 4 | Download the MLModel from here and import it in your project: 5 | https://drive.google.com/file/d/1ElCJvnEvhtIxZkyEzVUAFPJAMgyBXo57/view?usp=sharing 6 | 7 | 8 | [Paper](https://talhassner.github.io/home/publication/2015_ICMI) 9 | 10 | 11 | Read the tutorial here: 12 | https://bogdanrazvan.medium.com/emotion-classification-and-face-detection-using-arkit-and-coreml-6f4582363e7d 13 | 14 | ![](https://github.com/bogdan-razvan/ARKit-CoreML-Emotion-Classification/blob/main/ARKit-CoreML-Emotion-Classification/ARKit-CoreML-Emotion-Classification/demo.gif) 15 | --------------------------------------------------------------------------------