├── Hand Timer.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings │ └── xcuserdata │ │ └── rudrajikadra.xcuserdatad │ │ └── WorkspaceSettings.xcsettings └── xcuserdata │ └── rudrajikadra.xcuserdatad │ └── xcschemes │ ├── Hand Timer.xcscheme │ └── xcschememanagement.plist ├── Hand Timer ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── ViewController.swift └── hand.mlmodel └── README.md /Hand Timer.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 73F96C7D1FDE5BBB0054AB29 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73F96C7C1FDE5BBB0054AB29 /* AppDelegate.swift */; }; 11 | 73F96C7F1FDE5BBB0054AB29 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73F96C7E1FDE5BBB0054AB29 /* ViewController.swift */; }; 12 | 73F96C821FDE5BBB0054AB29 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73F96C801FDE5BBB0054AB29 /* Main.storyboard */; }; 13 | 73F96C841FDE5BBB0054AB29 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 73F96C831FDE5BBB0054AB29 /* Assets.xcassets */; }; 14 | 73F96C871FDE5BBB0054AB29 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 73F96C851FDE5BBB0054AB29 /* LaunchScreen.storyboard */; }; 15 | 73FBD9852003FC360033D094 /* hand.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = 73FBD9842003FC360033D094 /* hand.mlmodel */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 73F96C791FDE5BBB0054AB29 /* Hand Timer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Hand Timer.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 73F96C7C1FDE5BBB0054AB29 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 21 | 73F96C7E1FDE5BBB0054AB29 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 22 | 73F96C811FDE5BBB0054AB29 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 23 | 73F96C831FDE5BBB0054AB29 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 24 | 73F96C861FDE5BBB0054AB29 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 25 | 73F96C881FDE5BBB0054AB29 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 26 | 73FBD9842003FC360033D094 /* hand.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; path = hand.mlmodel; sourceTree = ""; }; 27 | /* End PBXFileReference section */ 28 | 29 | /* Begin PBXFrameworksBuildPhase section */ 30 | 73F96C761FDE5BBB0054AB29 /* Frameworks */ = { 31 | isa = PBXFrameworksBuildPhase; 32 | buildActionMask = 2147483647; 33 | files = ( 34 | ); 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXFrameworksBuildPhase section */ 38 | 39 | /* Begin PBXGroup section */ 40 | 73F96C701FDE5BBB0054AB29 = { 41 | isa = PBXGroup; 42 | children = ( 43 | 73F96C7B1FDE5BBB0054AB29 /* Hand Timer */, 44 | 73F96C7A1FDE5BBB0054AB29 /* Products */, 45 | ); 46 | sourceTree = ""; 47 | }; 48 | 73F96C7A1FDE5BBB0054AB29 /* Products */ = { 49 | isa = PBXGroup; 50 | children = ( 51 | 73F96C791FDE5BBB0054AB29 /* Hand Timer.app */, 52 | ); 53 | name = Products; 54 | sourceTree = ""; 55 | }; 56 | 73F96C7B1FDE5BBB0054AB29 /* Hand Timer */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | 73F96C7C1FDE5BBB0054AB29 /* AppDelegate.swift */, 60 | 73F96C7E1FDE5BBB0054AB29 /* ViewController.swift */, 61 | 73F96C801FDE5BBB0054AB29 /* Main.storyboard */, 62 | 73FBD9842003FC360033D094 /* hand.mlmodel */, 63 | 73F96C831FDE5BBB0054AB29 /* Assets.xcassets */, 64 | 73F96C851FDE5BBB0054AB29 /* LaunchScreen.storyboard */, 65 | 73F96C881FDE5BBB0054AB29 /* Info.plist */, 66 | ); 67 | path = "Hand Timer"; 68 | sourceTree = ""; 69 | }; 70 | /* End PBXGroup section */ 71 | 72 | /* Begin PBXNativeTarget section */ 73 | 73F96C781FDE5BBB0054AB29 /* Hand Timer */ = { 74 | isa = PBXNativeTarget; 75 | buildConfigurationList = 73F96C8B1FDE5BBB0054AB29 /* Build configuration list for PBXNativeTarget "Hand Timer" */; 76 | buildPhases = ( 77 | 73F96C751FDE5BBB0054AB29 /* Sources */, 78 | 73F96C761FDE5BBB0054AB29 /* Frameworks */, 79 | 73F96C771FDE5BBB0054AB29 /* Resources */, 80 | ); 81 | buildRules = ( 82 | ); 83 | dependencies = ( 84 | ); 85 | name = "Hand Timer"; 86 | productName = "Object Detection"; 87 | productReference = 73F96C791FDE5BBB0054AB29 /* Hand Timer.app */; 88 | productType = "com.apple.product-type.application"; 89 | }; 90 | /* End PBXNativeTarget section */ 91 | 92 | /* Begin PBXProject section */ 93 | 73F96C711FDE5BBB0054AB29 /* Project object */ = { 94 | isa = PBXProject; 95 | attributes = { 96 | LastSwiftUpdateCheck = 0920; 97 | LastUpgradeCheck = 0920; 98 | ORGANIZATIONNAME = "Rudra Jikadra"; 99 | TargetAttributes = { 100 | 73F96C781FDE5BBB0054AB29 = { 101 | CreatedOnToolsVersion = 9.2; 102 | ProvisioningStyle = Automatic; 103 | }; 104 | }; 105 | }; 106 | buildConfigurationList = 73F96C741FDE5BBB0054AB29 /* Build configuration list for PBXProject "Hand Timer" */; 107 | compatibilityVersion = "Xcode 8.0"; 108 | developmentRegion = en; 109 | hasScannedForEncodings = 0; 110 | knownRegions = ( 111 | en, 112 | Base, 113 | ); 114 | mainGroup = 73F96C701FDE5BBB0054AB29; 115 | productRefGroup = 73F96C7A1FDE5BBB0054AB29 /* Products */; 116 | projectDirPath = ""; 117 | projectRoot = ""; 118 | targets = ( 119 | 73F96C781FDE5BBB0054AB29 /* Hand Timer */, 120 | ); 121 | }; 122 | /* End PBXProject section */ 123 | 124 | /* Begin PBXResourcesBuildPhase section */ 125 | 73F96C771FDE5BBB0054AB29 /* Resources */ = { 126 | isa = PBXResourcesBuildPhase; 127 | buildActionMask = 2147483647; 128 | files = ( 129 | 73F96C871FDE5BBB0054AB29 /* LaunchScreen.storyboard in Resources */, 130 | 73F96C841FDE5BBB0054AB29 /* Assets.xcassets in Resources */, 131 | 73F96C821FDE5BBB0054AB29 /* Main.storyboard in Resources */, 132 | ); 133 | runOnlyForDeploymentPostprocessing = 0; 134 | }; 135 | /* End PBXResourcesBuildPhase section */ 136 | 137 | /* Begin PBXSourcesBuildPhase section */ 138 | 73F96C751FDE5BBB0054AB29 /* Sources */ = { 139 | isa = PBXSourcesBuildPhase; 140 | buildActionMask = 2147483647; 141 | files = ( 142 | 73F96C7F1FDE5BBB0054AB29 /* ViewController.swift in Sources */, 143 | 73FBD9852003FC360033D094 /* hand.mlmodel in Sources */, 144 | 73F96C7D1FDE5BBB0054AB29 /* AppDelegate.swift in Sources */, 145 | ); 146 | runOnlyForDeploymentPostprocessing = 0; 147 | }; 148 | /* End PBXSourcesBuildPhase section */ 149 | 150 | /* Begin PBXVariantGroup section */ 151 | 73F96C801FDE5BBB0054AB29 /* Main.storyboard */ = { 152 | isa = PBXVariantGroup; 153 | children = ( 154 | 73F96C811FDE5BBB0054AB29 /* Base */, 155 | ); 156 | name = Main.storyboard; 157 | sourceTree = ""; 158 | }; 159 | 73F96C851FDE5BBB0054AB29 /* LaunchScreen.storyboard */ = { 160 | isa = PBXVariantGroup; 161 | children = ( 162 | 73F96C861FDE5BBB0054AB29 /* Base */, 163 | ); 164 | name = LaunchScreen.storyboard; 165 | sourceTree = ""; 166 | }; 167 | /* End PBXVariantGroup section */ 168 | 169 | /* Begin XCBuildConfiguration section */ 170 | 73F96C891FDE5BBB0054AB29 /* Debug */ = { 171 | isa = XCBuildConfiguration; 172 | buildSettings = { 173 | ALWAYS_SEARCH_USER_PATHS = NO; 174 | CLANG_ANALYZER_NONNULL = YES; 175 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 176 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 177 | CLANG_CXX_LIBRARY = "libc++"; 178 | CLANG_ENABLE_MODULES = YES; 179 | CLANG_ENABLE_OBJC_ARC = YES; 180 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 181 | CLANG_WARN_BOOL_CONVERSION = YES; 182 | CLANG_WARN_COMMA = YES; 183 | CLANG_WARN_CONSTANT_CONVERSION = YES; 184 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 185 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 186 | CLANG_WARN_EMPTY_BODY = YES; 187 | CLANG_WARN_ENUM_CONVERSION = YES; 188 | CLANG_WARN_INFINITE_RECURSION = YES; 189 | CLANG_WARN_INT_CONVERSION = YES; 190 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 191 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 192 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 193 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 194 | CLANG_WARN_STRICT_PROTOTYPES = YES; 195 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 196 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 197 | CLANG_WARN_UNREACHABLE_CODE = YES; 198 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 199 | CODE_SIGN_IDENTITY = "iPhone Developer"; 200 | COPY_PHASE_STRIP = NO; 201 | DEBUG_INFORMATION_FORMAT = dwarf; 202 | ENABLE_STRICT_OBJC_MSGSEND = YES; 203 | ENABLE_TESTABILITY = YES; 204 | GCC_C_LANGUAGE_STANDARD = gnu11; 205 | GCC_DYNAMIC_NO_PIC = NO; 206 | GCC_NO_COMMON_BLOCKS = YES; 207 | GCC_OPTIMIZATION_LEVEL = 0; 208 | GCC_PREPROCESSOR_DEFINITIONS = ( 209 | "DEBUG=1", 210 | "$(inherited)", 211 | ); 212 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 213 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 214 | GCC_WARN_UNDECLARED_SELECTOR = YES; 215 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 216 | GCC_WARN_UNUSED_FUNCTION = YES; 217 | GCC_WARN_UNUSED_VARIABLE = YES; 218 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 219 | MTL_ENABLE_DEBUG_INFO = YES; 220 | ONLY_ACTIVE_ARCH = YES; 221 | SDKROOT = iphoneos; 222 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 223 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 224 | }; 225 | name = Debug; 226 | }; 227 | 73F96C8A1FDE5BBB0054AB29 /* Release */ = { 228 | isa = XCBuildConfiguration; 229 | buildSettings = { 230 | ALWAYS_SEARCH_USER_PATHS = NO; 231 | CLANG_ANALYZER_NONNULL = YES; 232 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 233 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 234 | CLANG_CXX_LIBRARY = "libc++"; 235 | CLANG_ENABLE_MODULES = YES; 236 | CLANG_ENABLE_OBJC_ARC = YES; 237 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 238 | CLANG_WARN_BOOL_CONVERSION = YES; 239 | CLANG_WARN_COMMA = YES; 240 | CLANG_WARN_CONSTANT_CONVERSION = YES; 241 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 242 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 243 | CLANG_WARN_EMPTY_BODY = YES; 244 | CLANG_WARN_ENUM_CONVERSION = YES; 245 | CLANG_WARN_INFINITE_RECURSION = YES; 246 | CLANG_WARN_INT_CONVERSION = YES; 247 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 248 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 249 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 250 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 251 | CLANG_WARN_STRICT_PROTOTYPES = YES; 252 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 253 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 254 | CLANG_WARN_UNREACHABLE_CODE = YES; 255 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 256 | CODE_SIGN_IDENTITY = "iPhone Developer"; 257 | COPY_PHASE_STRIP = NO; 258 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 259 | ENABLE_NS_ASSERTIONS = NO; 260 | ENABLE_STRICT_OBJC_MSGSEND = YES; 261 | GCC_C_LANGUAGE_STANDARD = gnu11; 262 | GCC_NO_COMMON_BLOCKS = YES; 263 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 264 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 265 | GCC_WARN_UNDECLARED_SELECTOR = YES; 266 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 267 | GCC_WARN_UNUSED_FUNCTION = YES; 268 | GCC_WARN_UNUSED_VARIABLE = YES; 269 | IPHONEOS_DEPLOYMENT_TARGET = 11.2; 270 | MTL_ENABLE_DEBUG_INFO = NO; 271 | SDKROOT = iphoneos; 272 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 273 | VALIDATE_PRODUCT = YES; 274 | }; 275 | name = Release; 276 | }; 277 | 73F96C8C1FDE5BBB0054AB29 /* Debug */ = { 278 | isa = XCBuildConfiguration; 279 | buildSettings = { 280 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 281 | CODE_SIGN_STYLE = Automatic; 282 | DEVELOPMENT_TEAM = 7L65JSHTUM; 283 | INFOPLIST_FILE = "Hand Timer/Info.plist"; 284 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 285 | PRODUCT_BUNDLE_IDENTIFIER = "com.RedRudy.Hand-Timer"; 286 | PRODUCT_NAME = "$(TARGET_NAME)"; 287 | SWIFT_VERSION = 4.0; 288 | TARGETED_DEVICE_FAMILY = "1,2"; 289 | }; 290 | name = Debug; 291 | }; 292 | 73F96C8D1FDE5BBB0054AB29 /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 296 | CODE_SIGN_STYLE = Automatic; 297 | DEVELOPMENT_TEAM = 7L65JSHTUM; 298 | INFOPLIST_FILE = "Hand Timer/Info.plist"; 299 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 300 | PRODUCT_BUNDLE_IDENTIFIER = "com.RedRudy.Hand-Timer"; 301 | PRODUCT_NAME = "$(TARGET_NAME)"; 302 | SWIFT_VERSION = 4.0; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | }; 305 | name = Release; 306 | }; 307 | /* End XCBuildConfiguration section */ 308 | 309 | /* Begin XCConfigurationList section */ 310 | 73F96C741FDE5BBB0054AB29 /* Build configuration list for PBXProject "Hand Timer" */ = { 311 | isa = XCConfigurationList; 312 | buildConfigurations = ( 313 | 73F96C891FDE5BBB0054AB29 /* Debug */, 314 | 73F96C8A1FDE5BBB0054AB29 /* Release */, 315 | ); 316 | defaultConfigurationIsVisible = 0; 317 | defaultConfigurationName = Release; 318 | }; 319 | 73F96C8B1FDE5BBB0054AB29 /* Build configuration list for PBXNativeTarget "Hand Timer" */ = { 320 | isa = XCConfigurationList; 321 | buildConfigurations = ( 322 | 73F96C8C1FDE5BBB0054AB29 /* Debug */, 323 | 73F96C8D1FDE5BBB0054AB29 /* Release */, 324 | ); 325 | defaultConfigurationIsVisible = 0; 326 | defaultConfigurationName = Release; 327 | }; 328 | /* End XCConfigurationList section */ 329 | }; 330 | rootObject = 73F96C711FDE5BBB0054AB29 /* Project object */; 331 | } 332 | -------------------------------------------------------------------------------- /Hand Timer.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Hand Timer.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Hand Timer.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Hand Timer.xcodeproj/project.xcworkspace/xcuserdata/rudrajikadra.xcuserdatad/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildLocationStyle 6 | UseAppPreferences 7 | CustomBuildLocationType 8 | RelativeToDerivedData 9 | DerivedDataLocationStyle 10 | Default 11 | EnabledFullIndexStoreVisibility 12 | 13 | IssueFilterStyle 14 | ShowActiveSchemeOnly 15 | LiveSourceIssuesEnabled 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Hand Timer.xcodeproj/xcuserdata/rudrajikadra.xcuserdatad/xcschemes/Hand Timer.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /Hand Timer.xcodeproj/xcuserdata/rudrajikadra.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Hand Timer.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Hand Timer/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Object Detection 4 | // 5 | // Created by Rudra Jikadra on 11/12/17. 6 | // Copyright © 2017 Rudra Jikadra. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | var window: UIWindow? 15 | 16 | 17 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 18 | // Override point for customization after application launch. 19 | return true 20 | } 21 | 22 | func applicationWillResignActive(_ application: UIApplication) { 23 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 24 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 25 | } 26 | 27 | func applicationDidEnterBackground(_ application: UIApplication) { 28 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 29 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 30 | } 31 | 32 | func applicationWillEnterForeground(_ application: UIApplication) { 33 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 34 | } 35 | 36 | func applicationDidBecomeActive(_ application: UIApplication) { 37 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 38 | } 39 | 40 | func applicationWillTerminate(_ application: UIApplication) { 41 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 42 | } 43 | 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Hand Timer/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /Hand Timer/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 | -------------------------------------------------------------------------------- /Hand Timer/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 | 27 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Hand Timer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Hand Timer 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | NSCameraUsageDescription 26 | Give access 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /Hand Timer/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Object Detection 4 | // 5 | // Created by Rudra Jikadra on 11/12/17. 6 | // Copyright © 2017 Rudra Jikadra. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | import AVKit 11 | import Vision 12 | 13 | class ViewController: UIViewController, AVCaptureVideoDataOutputSampleBufferDelegate { 14 | 15 | override var prefersStatusBarHidden: Bool { 16 | return true 17 | } 18 | 19 | var b = 0 20 | @IBOutlet weak var but: UIButton! 21 | 22 | @IBOutlet weak var timerLabel: UILabel! 23 | 24 | var mlModel = hand().model 25 | 26 | var timer = Timer() 27 | var fractions: Int = 0 28 | var seconds: Int = 0 29 | var minutes: Int = 0 30 | 31 | var timerStarted: Bool = false 32 | 33 | var previewLayer: AVCaptureVideoPreviewLayer! 34 | 35 | override func viewDidLoad() { 36 | super.viewDidLoad() 37 | // Do any additional setup after loading the view, typically from a nib. 38 | 39 | but.isEnabled = true 40 | 41 | timerLabel.text = "00:00.00" 42 | 43 | but.titleLabel?.textAlignment = NSTextAlignment.center 44 | but.titleLabel?.lineBreakMode = NSLineBreakMode.byWordWrapping 45 | 46 | //camera 47 | let captureSession = AVCaptureSession() 48 | 49 | guard let captureDevice = AVCaptureDevice.default(for: .video) else { return } 50 | guard let input = try? AVCaptureDeviceInput(device: captureDevice) else { return } 51 | captureSession.addInput(input) 52 | 53 | 54 | captureSession.startRunning() 55 | 56 | 57 | previewLayer = AVCaptureVideoPreviewLayer(session: captureSession) 58 | view.layer.addSublayer(previewLayer) 59 | previewLayer.frame = view.frame 60 | previewLayer.opacity = 0 61 | // camera is created 62 | 63 | 64 | let dataOutput = AVCaptureVideoDataOutput() 65 | dataOutput.setSampleBufferDelegate(self, queue: DispatchQueue(label: "videoQueue")) 66 | captureSession.addOutput(dataOutput) 67 | 68 | 69 | } 70 | 71 | @IBAction func butTap(_ sender: Any) { 72 | if b == 0 { 73 | 74 | UIView.transition(with: but, duration: 1.0, options: .transitionCrossDissolve, animations: { 75 | self.but.setTitle("", for: .normal) 76 | }, completion: { (completed) in 77 | self.but.setTitle(" Well, what if I say you can Control Time? ", for: .normal) 78 | UIView.transition(with: self.but, duration: 2.0, options: .transitionCrossDissolve, animations: { 79 | self.but.alpha = 1 80 | }, completion: nil) 81 | }) 82 | 83 | b = 1 84 | } else if b == 1 { 85 | UIView.transition(with: but, duration: 1.0, options: .transitionCrossDissolve, animations: { 86 | self.but.setTitle("", for: .normal) 87 | }, completion: { (completed) in 88 | self.but.setTitle(" I'll Prove It To You!\n Just put your hand in front of the back camera....\n\n And\n See The Magic Yourself!", for: .normal) 89 | UIView.transition(with: self.but, duration: 2.0, options: .transitionCrossDissolve, animations: { 90 | self.but.alpha = 1 91 | }, completion: nil) 92 | }) 93 | b = 2 94 | } else { 95 | UIView.transition(with: but, duration: 1.0, options: .transitionCrossDissolve, animations: { 96 | self.but.setTitle("", for: .normal) 97 | }, completion: { (completed) in 98 | self.but.alpha = 0 99 | self.but.isEnabled = false 100 | self.previewLayer.opacity = 0.2 101 | }) 102 | } 103 | } 104 | 105 | 106 | override func didReceiveMemoryWarning() { 107 | super.didReceiveMemoryWarning() 108 | // Dispose of any resources that can be recreated. 109 | } 110 | 111 | func captureOutput(_ output: AVCaptureOutput, didOutput sampleBuffer: CMSampleBuffer, from connection: AVCaptureConnection) { 112 | guard let pixelBuffer: CVPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) else { return } 113 | 114 | guard let model = try? VNCoreMLModel(for: mlModel) else { return } 115 | let request = VNCoreMLRequest(model: model) { (finishedReq, err) in 116 | 117 | guard let results = finishedReq.results as? [VNClassificationObservation] else {return} 118 | guard let firstObservation = results.first else {return} 119 | 120 | DispatchQueue.main.async(){ 121 | 122 | if firstObservation.identifier == "openFist"{ 123 | 124 | if self.timerStarted == false { 125 | 126 | self.timerStarted = true 127 | self.timer = Timer.scheduledTimer(timeInterval: 0.01, target: self, selector: #selector(self.updateTimer), userInfo: nil, repeats: true) 128 | } 129 | 130 | } else if firstObservation.identifier == "closedFist" { 131 | 132 | if self.timerStarted == true { 133 | 134 | self.timerStarted = false 135 | self.timer.invalidate() 136 | } 137 | 138 | } else { 139 | 140 | self.timer.invalidate() 141 | 142 | self.fractions = 0 143 | self.seconds = 0 144 | self.minutes = 0 145 | 146 | self.timerStarted = false 147 | self.timerLabel.text = "00:00.00" 148 | 149 | } 150 | } 151 | // print(firstObservation.identifier, firstObservation.confidence) 152 | } 153 | 154 | try? VNImageRequestHandler(cvPixelBuffer: pixelBuffer, options: [:]).perform([request]) 155 | } 156 | 157 | @objc func updateTimer(){ 158 | fractions += 1 159 | 160 | if fractions == 100 { 161 | fractions = 0 162 | seconds += 1 163 | } 164 | 165 | if seconds == 60 { 166 | seconds = 0 167 | minutes += 1 168 | } 169 | 170 | 171 | let fracStr: String = fractions > 9 ? "\(fractions)" : "0\(fractions)" 172 | let secStr: String = seconds > 9 ? "\(seconds)" : "0\(seconds)" 173 | let minStr: String = minutes > 9 ? "\(minutes)" : "0\(minutes)" 174 | 175 | timerLabel.text = "\(minStr):\(secStr).\(fracStr)" 176 | } 177 | 178 | 179 | } 180 | 181 | -------------------------------------------------------------------------------- /Hand Timer/hand.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rudrajikadra/Hand-Timer-CoreML-Custom-Vision-ML-Model-iOS-Xcode/b86e5c190a1545aa21668bb10bc99f60a27eceea/Hand Timer/hand.mlmodel -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hand-Timer-CoreML-Custom-Vision-ML-Model-iOS-Xcode 2 | 3 | * Using Microsoft's Custom Vision "https://www.customvision.ai" I build a Core ML Model using hand images dataset of my own and created a model that can classify different hand gestures(static). It will get the image (input) from the custom camera feed in the iOS Application that i build and gives the output as the tag that was assigned to it while training. The hand can be Open Fist, Close Fist or there wont be a hand at all. It will classify between these 3 states. 4 | * The application is a timer that has start stop reset functionality feature that will be controlled by your hand. 5 | 6 | ### How it works 7 | - Give access to the Camera 8 | - Place your hand in front of the back camera, you can see your hand with a little transparency in the background of the app. 9 | - If you put your open fist in front of the camera, the timer will start or resume if you paused(next point) in middle. 10 | - If you place closed fist in front of the camera, then the timer will be stopped or paused. 11 | - If you take away your hand then the timer will be reset to 00:00.00 12 | 13 | ## Note 14 | * Xcode 9 and Swift 4 was used for this project. 15 | * The CoreML model for the hand detection is included in the project repository. 16 | 17 | ## How it looks like 18 | (Gif) 19 | 20 | ![ezgif com-optimize](https://user-images.githubusercontent.com/15246084/41507647-1b027e54-7254-11e8-94c8-6c234f20ce40.gif) 21 | 22 | Try it out. Download the project and run it on your iDevice, it works like a charm. 23 | --------------------------------------------------------------------------------