├── ImageSegmentationML ├── ImageSegmentationML.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ │ └── xcuserdata │ │ │ └── osamanaeem.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── osamanaeem.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist ├── ImageSegmentationML │ ├── AppDelegate.swift │ ├── Assets.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ ├── Base.lproj │ │ └── LaunchScreen.storyboard │ ├── CoreML │ │ ├── DeepLabV3.mlmodel │ │ ├── DeepLabV3FP16.mlmodel │ │ └── DeepLabV3Int8LUT.mlmodel │ ├── Info.plist │ ├── SceneDelegate.swift │ ├── SegmentationResultMLMultiArray.swift │ ├── UIView │ │ └── DrawingSegmentationView.swift │ └── ViewController.swift ├── ImageSegmentationMLTests │ ├── Info.plist │ └── imageSegmentationMLTests.swift └── ImageSegmentationMLUITests │ ├── Info.plist │ └── imageSegmentationMLUITests.swift ├── README.md └── imagesegmentationML.gif /ImageSegmentationML/ImageSegmentationML.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | F51175B82434DED60061072E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F51175B72434DED60061072E /* AppDelegate.swift */; }; 11 | F51175BA2434DED60061072E /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F51175B92434DED60061072E /* SceneDelegate.swift */; }; 12 | F51175BC2434DED60061072E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F51175BB2434DED60061072E /* ViewController.swift */; }; 13 | F51175C12434DED80061072E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F51175C02434DED80061072E /* Assets.xcassets */; }; 14 | F51175C42434DED80061072E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F51175C22434DED80061072E /* LaunchScreen.storyboard */; }; 15 | F51175CF2434DED80061072E /* imageSegmentationMLTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F51175CE2434DED80061072E /* imageSegmentationMLTests.swift */; }; 16 | F51175DA2434DED80061072E /* imageSegmentationMLUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = F51175D92434DED80061072E /* imageSegmentationMLUITests.swift */; }; 17 | F51175E92434E04F0061072E /* DeepLabV3.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = F51175E82434E04F0061072E /* DeepLabV3.mlmodel */; }; 18 | F51175EB2434E0550061072E /* DeepLabV3FP16.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = F51175EA2434E0550061072E /* DeepLabV3FP16.mlmodel */; }; 19 | F51175ED2434E05B0061072E /* DeepLabV3Int8LUT.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = F51175EC2434E05B0061072E /* DeepLabV3Int8LUT.mlmodel */; }; 20 | F51175F22434E2990061072E /* DrawingSegmentationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F51175F12434E2990061072E /* DrawingSegmentationView.swift */; }; 21 | F51175F42434E2BA0061072E /* SegmentationResultMLMultiArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = F51175F32434E2BA0061072E /* SegmentationResultMLMultiArray.swift */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXContainerItemProxy section */ 25 | F51175CB2434DED80061072E /* PBXContainerItemProxy */ = { 26 | isa = PBXContainerItemProxy; 27 | containerPortal = F51175AC2434DED60061072E /* Project object */; 28 | proxyType = 1; 29 | remoteGlobalIDString = F51175B32434DED60061072E; 30 | remoteInfo = imageSegmentationML; 31 | }; 32 | F51175D62434DED80061072E /* PBXContainerItemProxy */ = { 33 | isa = PBXContainerItemProxy; 34 | containerPortal = F51175AC2434DED60061072E /* Project object */; 35 | proxyType = 1; 36 | remoteGlobalIDString = F51175B32434DED60061072E; 37 | remoteInfo = imageSegmentationML; 38 | }; 39 | /* End PBXContainerItemProxy section */ 40 | 41 | /* Begin PBXFileReference section */ 42 | F51175B42434DED60061072E /* ImageSegmentationML.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ImageSegmentationML.app; sourceTree = BUILT_PRODUCTS_DIR; }; 43 | F51175B72434DED60061072E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 44 | F51175B92434DED60061072E /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 45 | F51175BB2434DED60061072E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 46 | F51175C02434DED80061072E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 47 | F51175C32434DED80061072E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 48 | F51175C52434DED80061072E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 49 | F51175CA2434DED80061072E /* imageSegmentationMLTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = imageSegmentationMLTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 50 | F51175CE2434DED80061072E /* imageSegmentationMLTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = imageSegmentationMLTests.swift; sourceTree = ""; }; 51 | F51175D02434DED80061072E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 52 | F51175D52434DED80061072E /* imageSegmentationMLUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = imageSegmentationMLUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | F51175D92434DED80061072E /* imageSegmentationMLUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = imageSegmentationMLUITests.swift; sourceTree = ""; }; 54 | F51175DB2434DED80061072E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 55 | F51175E82434E04F0061072E /* DeepLabV3.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; path = DeepLabV3.mlmodel; sourceTree = ""; }; 56 | F51175EA2434E0550061072E /* DeepLabV3FP16.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; path = DeepLabV3FP16.mlmodel; sourceTree = ""; }; 57 | F51175EC2434E05B0061072E /* DeepLabV3Int8LUT.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; path = DeepLabV3Int8LUT.mlmodel; sourceTree = ""; }; 58 | F51175F12434E2990061072E /* DrawingSegmentationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DrawingSegmentationView.swift; sourceTree = ""; }; 59 | F51175F32434E2BA0061072E /* SegmentationResultMLMultiArray.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SegmentationResultMLMultiArray.swift; sourceTree = ""; }; 60 | /* End PBXFileReference section */ 61 | 62 | /* Begin PBXFrameworksBuildPhase section */ 63 | F51175B12434DED60061072E /* Frameworks */ = { 64 | isa = PBXFrameworksBuildPhase; 65 | buildActionMask = 2147483647; 66 | files = ( 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | F51175C72434DED80061072E /* Frameworks */ = { 71 | isa = PBXFrameworksBuildPhase; 72 | buildActionMask = 2147483647; 73 | files = ( 74 | ); 75 | runOnlyForDeploymentPostprocessing = 0; 76 | }; 77 | F51175D22434DED80061072E /* Frameworks */ = { 78 | isa = PBXFrameworksBuildPhase; 79 | buildActionMask = 2147483647; 80 | files = ( 81 | ); 82 | runOnlyForDeploymentPostprocessing = 0; 83 | }; 84 | /* End PBXFrameworksBuildPhase section */ 85 | 86 | /* Begin PBXGroup section */ 87 | F51175AB2434DED60061072E = { 88 | isa = PBXGroup; 89 | children = ( 90 | F51175B62434DED60061072E /* imageSegmentationML */, 91 | F51175CD2434DED80061072E /* imageSegmentationMLTests */, 92 | F51175D82434DED80061072E /* imageSegmentationMLUITests */, 93 | F51175B52434DED60061072E /* Products */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | F51175B52434DED60061072E /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | F51175B42434DED60061072E /* ImageSegmentationML.app */, 101 | F51175CA2434DED80061072E /* imageSegmentationMLTests.xctest */, 102 | F51175D52434DED80061072E /* imageSegmentationMLUITests.xctest */, 103 | ); 104 | name = Products; 105 | sourceTree = ""; 106 | }; 107 | F51175B62434DED60061072E /* imageSegmentationML */ = { 108 | isa = PBXGroup; 109 | children = ( 110 | F51175EE2434E2500061072E /* UIView */, 111 | F51175E72434E0450061072E /* CoreML */, 112 | F51175B72434DED60061072E /* AppDelegate.swift */, 113 | F51175BB2434DED60061072E /* ViewController.swift */, 114 | F51175B92434DED60061072E /* SceneDelegate.swift */, 115 | F51175F32434E2BA0061072E /* SegmentationResultMLMultiArray.swift */, 116 | F51175C02434DED80061072E /* Assets.xcassets */, 117 | F51175C22434DED80061072E /* LaunchScreen.storyboard */, 118 | F51175C52434DED80061072E /* Info.plist */, 119 | ); 120 | path = imageSegmentationML; 121 | sourceTree = ""; 122 | }; 123 | F51175CD2434DED80061072E /* imageSegmentationMLTests */ = { 124 | isa = PBXGroup; 125 | children = ( 126 | F51175CE2434DED80061072E /* imageSegmentationMLTests.swift */, 127 | F51175D02434DED80061072E /* Info.plist */, 128 | ); 129 | path = imageSegmentationMLTests; 130 | sourceTree = ""; 131 | }; 132 | F51175D82434DED80061072E /* imageSegmentationMLUITests */ = { 133 | isa = PBXGroup; 134 | children = ( 135 | F51175D92434DED80061072E /* imageSegmentationMLUITests.swift */, 136 | F51175DB2434DED80061072E /* Info.plist */, 137 | ); 138 | path = imageSegmentationMLUITests; 139 | sourceTree = ""; 140 | }; 141 | F51175E72434E0450061072E /* CoreML */ = { 142 | isa = PBXGroup; 143 | children = ( 144 | F51175E82434E04F0061072E /* DeepLabV3.mlmodel */, 145 | F51175EA2434E0550061072E /* DeepLabV3FP16.mlmodel */, 146 | F51175EC2434E05B0061072E /* DeepLabV3Int8LUT.mlmodel */, 147 | ); 148 | path = CoreML; 149 | sourceTree = ""; 150 | }; 151 | F51175EE2434E2500061072E /* UIView */ = { 152 | isa = PBXGroup; 153 | children = ( 154 | F51175F12434E2990061072E /* DrawingSegmentationView.swift */, 155 | ); 156 | path = UIView; 157 | sourceTree = ""; 158 | }; 159 | /* End PBXGroup section */ 160 | 161 | /* Begin PBXNativeTarget section */ 162 | F51175B32434DED60061072E /* imageSegmentationML */ = { 163 | isa = PBXNativeTarget; 164 | buildConfigurationList = F51175DE2434DED80061072E /* Build configuration list for PBXNativeTarget "imageSegmentationML" */; 165 | buildPhases = ( 166 | F51175B02434DED60061072E /* Sources */, 167 | F51175B12434DED60061072E /* Frameworks */, 168 | F51175B22434DED60061072E /* Resources */, 169 | ); 170 | buildRules = ( 171 | ); 172 | dependencies = ( 173 | ); 174 | name = imageSegmentationML; 175 | productName = imageSegmentationML; 176 | productReference = F51175B42434DED60061072E /* ImageSegmentationML.app */; 177 | productType = "com.apple.product-type.application"; 178 | }; 179 | F51175C92434DED80061072E /* imageSegmentationMLTests */ = { 180 | isa = PBXNativeTarget; 181 | buildConfigurationList = F51175E12434DED80061072E /* Build configuration list for PBXNativeTarget "imageSegmentationMLTests" */; 182 | buildPhases = ( 183 | F51175C62434DED80061072E /* Sources */, 184 | F51175C72434DED80061072E /* Frameworks */, 185 | F51175C82434DED80061072E /* Resources */, 186 | ); 187 | buildRules = ( 188 | ); 189 | dependencies = ( 190 | F51175CC2434DED80061072E /* PBXTargetDependency */, 191 | ); 192 | name = imageSegmentationMLTests; 193 | productName = imageSegmentationMLTests; 194 | productReference = F51175CA2434DED80061072E /* imageSegmentationMLTests.xctest */; 195 | productType = "com.apple.product-type.bundle.unit-test"; 196 | }; 197 | F51175D42434DED80061072E /* imageSegmentationMLUITests */ = { 198 | isa = PBXNativeTarget; 199 | buildConfigurationList = F51175E42434DED80061072E /* Build configuration list for PBXNativeTarget "imageSegmentationMLUITests" */; 200 | buildPhases = ( 201 | F51175D12434DED80061072E /* Sources */, 202 | F51175D22434DED80061072E /* Frameworks */, 203 | F51175D32434DED80061072E /* Resources */, 204 | ); 205 | buildRules = ( 206 | ); 207 | dependencies = ( 208 | F51175D72434DED80061072E /* PBXTargetDependency */, 209 | ); 210 | name = imageSegmentationMLUITests; 211 | productName = imageSegmentationMLUITests; 212 | productReference = F51175D52434DED80061072E /* imageSegmentationMLUITests.xctest */; 213 | productType = "com.apple.product-type.bundle.ui-testing"; 214 | }; 215 | /* End PBXNativeTarget section */ 216 | 217 | /* Begin PBXProject section */ 218 | F51175AC2434DED60061072E /* Project object */ = { 219 | isa = PBXProject; 220 | attributes = { 221 | LastSwiftUpdateCheck = 1130; 222 | LastUpgradeCheck = 1130; 223 | ORGANIZATIONNAME = "Muhammad Osama Naeem"; 224 | TargetAttributes = { 225 | F51175B32434DED60061072E = { 226 | CreatedOnToolsVersion = 11.3; 227 | }; 228 | F51175C92434DED80061072E = { 229 | CreatedOnToolsVersion = 11.3; 230 | TestTargetID = F51175B32434DED60061072E; 231 | }; 232 | F51175D42434DED80061072E = { 233 | CreatedOnToolsVersion = 11.3; 234 | TestTargetID = F51175B32434DED60061072E; 235 | }; 236 | }; 237 | }; 238 | buildConfigurationList = F51175AF2434DED60061072E /* Build configuration list for PBXProject "imageSegmentationML" */; 239 | compatibilityVersion = "Xcode 9.3"; 240 | developmentRegion = en; 241 | hasScannedForEncodings = 0; 242 | knownRegions = ( 243 | en, 244 | Base, 245 | ); 246 | mainGroup = F51175AB2434DED60061072E; 247 | productRefGroup = F51175B52434DED60061072E /* Products */; 248 | projectDirPath = ""; 249 | projectRoot = ""; 250 | targets = ( 251 | F51175B32434DED60061072E /* imageSegmentationML */, 252 | F51175C92434DED80061072E /* imageSegmentationMLTests */, 253 | F51175D42434DED80061072E /* imageSegmentationMLUITests */, 254 | ); 255 | }; 256 | /* End PBXProject section */ 257 | 258 | /* Begin PBXResourcesBuildPhase section */ 259 | F51175B22434DED60061072E /* Resources */ = { 260 | isa = PBXResourcesBuildPhase; 261 | buildActionMask = 2147483647; 262 | files = ( 263 | F51175C42434DED80061072E /* LaunchScreen.storyboard in Resources */, 264 | F51175C12434DED80061072E /* Assets.xcassets in Resources */, 265 | ); 266 | runOnlyForDeploymentPostprocessing = 0; 267 | }; 268 | F51175C82434DED80061072E /* Resources */ = { 269 | isa = PBXResourcesBuildPhase; 270 | buildActionMask = 2147483647; 271 | files = ( 272 | ); 273 | runOnlyForDeploymentPostprocessing = 0; 274 | }; 275 | F51175D32434DED80061072E /* Resources */ = { 276 | isa = PBXResourcesBuildPhase; 277 | buildActionMask = 2147483647; 278 | files = ( 279 | ); 280 | runOnlyForDeploymentPostprocessing = 0; 281 | }; 282 | /* End PBXResourcesBuildPhase section */ 283 | 284 | /* Begin PBXSourcesBuildPhase section */ 285 | F51175B02434DED60061072E /* Sources */ = { 286 | isa = PBXSourcesBuildPhase; 287 | buildActionMask = 2147483647; 288 | files = ( 289 | F51175BC2434DED60061072E /* ViewController.swift in Sources */, 290 | F51175B82434DED60061072E /* AppDelegate.swift in Sources */, 291 | F51175ED2434E05B0061072E /* DeepLabV3Int8LUT.mlmodel in Sources */, 292 | F51175BA2434DED60061072E /* SceneDelegate.swift in Sources */, 293 | F51175EB2434E0550061072E /* DeepLabV3FP16.mlmodel in Sources */, 294 | F51175F22434E2990061072E /* DrawingSegmentationView.swift in Sources */, 295 | F51175E92434E04F0061072E /* DeepLabV3.mlmodel in Sources */, 296 | F51175F42434E2BA0061072E /* SegmentationResultMLMultiArray.swift in Sources */, 297 | ); 298 | runOnlyForDeploymentPostprocessing = 0; 299 | }; 300 | F51175C62434DED80061072E /* Sources */ = { 301 | isa = PBXSourcesBuildPhase; 302 | buildActionMask = 2147483647; 303 | files = ( 304 | F51175CF2434DED80061072E /* imageSegmentationMLTests.swift in Sources */, 305 | ); 306 | runOnlyForDeploymentPostprocessing = 0; 307 | }; 308 | F51175D12434DED80061072E /* Sources */ = { 309 | isa = PBXSourcesBuildPhase; 310 | buildActionMask = 2147483647; 311 | files = ( 312 | F51175DA2434DED80061072E /* imageSegmentationMLUITests.swift in Sources */, 313 | ); 314 | runOnlyForDeploymentPostprocessing = 0; 315 | }; 316 | /* End PBXSourcesBuildPhase section */ 317 | 318 | /* Begin PBXTargetDependency section */ 319 | F51175CC2434DED80061072E /* PBXTargetDependency */ = { 320 | isa = PBXTargetDependency; 321 | target = F51175B32434DED60061072E /* imageSegmentationML */; 322 | targetProxy = F51175CB2434DED80061072E /* PBXContainerItemProxy */; 323 | }; 324 | F51175D72434DED80061072E /* PBXTargetDependency */ = { 325 | isa = PBXTargetDependency; 326 | target = F51175B32434DED60061072E /* imageSegmentationML */; 327 | targetProxy = F51175D62434DED80061072E /* PBXContainerItemProxy */; 328 | }; 329 | /* End PBXTargetDependency section */ 330 | 331 | /* Begin PBXVariantGroup section */ 332 | F51175C22434DED80061072E /* LaunchScreen.storyboard */ = { 333 | isa = PBXVariantGroup; 334 | children = ( 335 | F51175C32434DED80061072E /* Base */, 336 | ); 337 | name = LaunchScreen.storyboard; 338 | sourceTree = ""; 339 | }; 340 | /* End PBXVariantGroup section */ 341 | 342 | /* Begin XCBuildConfiguration section */ 343 | F51175DC2434DED80061072E /* Debug */ = { 344 | isa = XCBuildConfiguration; 345 | buildSettings = { 346 | ALWAYS_SEARCH_USER_PATHS = NO; 347 | CLANG_ANALYZER_NONNULL = YES; 348 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 349 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 350 | CLANG_CXX_LIBRARY = "libc++"; 351 | CLANG_ENABLE_MODULES = YES; 352 | CLANG_ENABLE_OBJC_ARC = YES; 353 | CLANG_ENABLE_OBJC_WEAK = YES; 354 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 355 | CLANG_WARN_BOOL_CONVERSION = YES; 356 | CLANG_WARN_COMMA = YES; 357 | CLANG_WARN_CONSTANT_CONVERSION = YES; 358 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 359 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 360 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 361 | CLANG_WARN_EMPTY_BODY = YES; 362 | CLANG_WARN_ENUM_CONVERSION = YES; 363 | CLANG_WARN_INFINITE_RECURSION = YES; 364 | CLANG_WARN_INT_CONVERSION = YES; 365 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 366 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 367 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 368 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 369 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 370 | CLANG_WARN_STRICT_PROTOTYPES = YES; 371 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 372 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 373 | CLANG_WARN_UNREACHABLE_CODE = YES; 374 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 375 | COPY_PHASE_STRIP = NO; 376 | DEBUG_INFORMATION_FORMAT = dwarf; 377 | ENABLE_STRICT_OBJC_MSGSEND = YES; 378 | ENABLE_TESTABILITY = YES; 379 | GCC_C_LANGUAGE_STANDARD = gnu11; 380 | GCC_DYNAMIC_NO_PIC = NO; 381 | GCC_NO_COMMON_BLOCKS = YES; 382 | GCC_OPTIMIZATION_LEVEL = 0; 383 | GCC_PREPROCESSOR_DEFINITIONS = ( 384 | "DEBUG=1", 385 | "$(inherited)", 386 | ); 387 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 388 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 389 | GCC_WARN_UNDECLARED_SELECTOR = YES; 390 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 391 | GCC_WARN_UNUSED_FUNCTION = YES; 392 | GCC_WARN_UNUSED_VARIABLE = YES; 393 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 394 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 395 | MTL_FAST_MATH = YES; 396 | ONLY_ACTIVE_ARCH = YES; 397 | SDKROOT = iphoneos; 398 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 399 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 400 | }; 401 | name = Debug; 402 | }; 403 | F51175DD2434DED80061072E /* Release */ = { 404 | isa = XCBuildConfiguration; 405 | buildSettings = { 406 | ALWAYS_SEARCH_USER_PATHS = NO; 407 | CLANG_ANALYZER_NONNULL = YES; 408 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 409 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 410 | CLANG_CXX_LIBRARY = "libc++"; 411 | CLANG_ENABLE_MODULES = YES; 412 | CLANG_ENABLE_OBJC_ARC = YES; 413 | CLANG_ENABLE_OBJC_WEAK = YES; 414 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 415 | CLANG_WARN_BOOL_CONVERSION = YES; 416 | CLANG_WARN_COMMA = YES; 417 | CLANG_WARN_CONSTANT_CONVERSION = YES; 418 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 419 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 420 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 421 | CLANG_WARN_EMPTY_BODY = YES; 422 | CLANG_WARN_ENUM_CONVERSION = YES; 423 | CLANG_WARN_INFINITE_RECURSION = YES; 424 | CLANG_WARN_INT_CONVERSION = YES; 425 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 426 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 427 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 428 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 429 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 430 | CLANG_WARN_STRICT_PROTOTYPES = YES; 431 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 432 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 433 | CLANG_WARN_UNREACHABLE_CODE = YES; 434 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 435 | COPY_PHASE_STRIP = NO; 436 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 437 | ENABLE_NS_ASSERTIONS = NO; 438 | ENABLE_STRICT_OBJC_MSGSEND = YES; 439 | GCC_C_LANGUAGE_STANDARD = gnu11; 440 | GCC_NO_COMMON_BLOCKS = YES; 441 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 442 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 443 | GCC_WARN_UNDECLARED_SELECTOR = YES; 444 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 445 | GCC_WARN_UNUSED_FUNCTION = YES; 446 | GCC_WARN_UNUSED_VARIABLE = YES; 447 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 448 | MTL_ENABLE_DEBUG_INFO = NO; 449 | MTL_FAST_MATH = YES; 450 | SDKROOT = iphoneos; 451 | SWIFT_COMPILATION_MODE = wholemodule; 452 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 453 | VALIDATE_PRODUCT = YES; 454 | }; 455 | name = Release; 456 | }; 457 | F51175DF2434DED80061072E /* Debug */ = { 458 | isa = XCBuildConfiguration; 459 | buildSettings = { 460 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 461 | CODE_SIGN_STYLE = Automatic; 462 | DEVELOPMENT_TEAM = Q98J247HTL; 463 | INFOPLIST_FILE = imageSegmentationML/Info.plist; 464 | LD_RUNPATH_SEARCH_PATHS = ( 465 | "$(inherited)", 466 | "@executable_path/Frameworks", 467 | ); 468 | PRODUCT_BUNDLE_IDENTIFIER = com.exploringswift.imageSegmentationML; 469 | PRODUCT_NAME = ImageSegmentationML; 470 | SWIFT_VERSION = 5.0; 471 | TARGETED_DEVICE_FAMILY = "1,2"; 472 | }; 473 | name = Debug; 474 | }; 475 | F51175E02434DED80061072E /* Release */ = { 476 | isa = XCBuildConfiguration; 477 | buildSettings = { 478 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 479 | CODE_SIGN_STYLE = Automatic; 480 | DEVELOPMENT_TEAM = Q98J247HTL; 481 | INFOPLIST_FILE = imageSegmentationML/Info.plist; 482 | LD_RUNPATH_SEARCH_PATHS = ( 483 | "$(inherited)", 484 | "@executable_path/Frameworks", 485 | ); 486 | PRODUCT_BUNDLE_IDENTIFIER = com.exploringswift.imageSegmentationML; 487 | PRODUCT_NAME = ImageSegmentationML; 488 | SWIFT_VERSION = 5.0; 489 | TARGETED_DEVICE_FAMILY = "1,2"; 490 | }; 491 | name = Release; 492 | }; 493 | F51175E22434DED80061072E /* Debug */ = { 494 | isa = XCBuildConfiguration; 495 | buildSettings = { 496 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 497 | BUNDLE_LOADER = "$(TEST_HOST)"; 498 | CODE_SIGN_STYLE = Automatic; 499 | DEVELOPMENT_TEAM = Q98J247HTL; 500 | INFOPLIST_FILE = imageSegmentationMLTests/Info.plist; 501 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 502 | LD_RUNPATH_SEARCH_PATHS = ( 503 | "$(inherited)", 504 | "@executable_path/Frameworks", 505 | "@loader_path/Frameworks", 506 | ); 507 | PRODUCT_BUNDLE_IDENTIFIER = com.exploringswift.imageSegmentationMLTests; 508 | PRODUCT_NAME = "$(TARGET_NAME)"; 509 | SWIFT_VERSION = 5.0; 510 | TARGETED_DEVICE_FAMILY = "1,2"; 511 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/imageSegmentationML.app/imageSegmentationML"; 512 | }; 513 | name = Debug; 514 | }; 515 | F51175E32434DED80061072E /* Release */ = { 516 | isa = XCBuildConfiguration; 517 | buildSettings = { 518 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 519 | BUNDLE_LOADER = "$(TEST_HOST)"; 520 | CODE_SIGN_STYLE = Automatic; 521 | DEVELOPMENT_TEAM = Q98J247HTL; 522 | INFOPLIST_FILE = imageSegmentationMLTests/Info.plist; 523 | IPHONEOS_DEPLOYMENT_TARGET = 13.2; 524 | LD_RUNPATH_SEARCH_PATHS = ( 525 | "$(inherited)", 526 | "@executable_path/Frameworks", 527 | "@loader_path/Frameworks", 528 | ); 529 | PRODUCT_BUNDLE_IDENTIFIER = com.exploringswift.imageSegmentationMLTests; 530 | PRODUCT_NAME = "$(TARGET_NAME)"; 531 | SWIFT_VERSION = 5.0; 532 | TARGETED_DEVICE_FAMILY = "1,2"; 533 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/imageSegmentationML.app/imageSegmentationML"; 534 | }; 535 | name = Release; 536 | }; 537 | F51175E52434DED80061072E /* Debug */ = { 538 | isa = XCBuildConfiguration; 539 | buildSettings = { 540 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 541 | CODE_SIGN_STYLE = Automatic; 542 | DEVELOPMENT_TEAM = Q98J247HTL; 543 | INFOPLIST_FILE = imageSegmentationMLUITests/Info.plist; 544 | LD_RUNPATH_SEARCH_PATHS = ( 545 | "$(inherited)", 546 | "@executable_path/Frameworks", 547 | "@loader_path/Frameworks", 548 | ); 549 | PRODUCT_BUNDLE_IDENTIFIER = com.exploringswift.imageSegmentationMLUITests; 550 | PRODUCT_NAME = "$(TARGET_NAME)"; 551 | SWIFT_VERSION = 5.0; 552 | TARGETED_DEVICE_FAMILY = "1,2"; 553 | TEST_TARGET_NAME = imageSegmentationML; 554 | }; 555 | name = Debug; 556 | }; 557 | F51175E62434DED80061072E /* Release */ = { 558 | isa = XCBuildConfiguration; 559 | buildSettings = { 560 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 561 | CODE_SIGN_STYLE = Automatic; 562 | DEVELOPMENT_TEAM = Q98J247HTL; 563 | INFOPLIST_FILE = imageSegmentationMLUITests/Info.plist; 564 | LD_RUNPATH_SEARCH_PATHS = ( 565 | "$(inherited)", 566 | "@executable_path/Frameworks", 567 | "@loader_path/Frameworks", 568 | ); 569 | PRODUCT_BUNDLE_IDENTIFIER = com.exploringswift.imageSegmentationMLUITests; 570 | PRODUCT_NAME = "$(TARGET_NAME)"; 571 | SWIFT_VERSION = 5.0; 572 | TARGETED_DEVICE_FAMILY = "1,2"; 573 | TEST_TARGET_NAME = imageSegmentationML; 574 | }; 575 | name = Release; 576 | }; 577 | /* End XCBuildConfiguration section */ 578 | 579 | /* Begin XCConfigurationList section */ 580 | F51175AF2434DED60061072E /* Build configuration list for PBXProject "imageSegmentationML" */ = { 581 | isa = XCConfigurationList; 582 | buildConfigurations = ( 583 | F51175DC2434DED80061072E /* Debug */, 584 | F51175DD2434DED80061072E /* Release */, 585 | ); 586 | defaultConfigurationIsVisible = 0; 587 | defaultConfigurationName = Release; 588 | }; 589 | F51175DE2434DED80061072E /* Build configuration list for PBXNativeTarget "imageSegmentationML" */ = { 590 | isa = XCConfigurationList; 591 | buildConfigurations = ( 592 | F51175DF2434DED80061072E /* Debug */, 593 | F51175E02434DED80061072E /* Release */, 594 | ); 595 | defaultConfigurationIsVisible = 0; 596 | defaultConfigurationName = Release; 597 | }; 598 | F51175E12434DED80061072E /* Build configuration list for PBXNativeTarget "imageSegmentationMLTests" */ = { 599 | isa = XCConfigurationList; 600 | buildConfigurations = ( 601 | F51175E22434DED80061072E /* Debug */, 602 | F51175E32434DED80061072E /* Release */, 603 | ); 604 | defaultConfigurationIsVisible = 0; 605 | defaultConfigurationName = Release; 606 | }; 607 | F51175E42434DED80061072E /* Build configuration list for PBXNativeTarget "imageSegmentationMLUITests" */ = { 608 | isa = XCConfigurationList; 609 | buildConfigurations = ( 610 | F51175E52434DED80061072E /* Debug */, 611 | F51175E62434DED80061072E /* Release */, 612 | ); 613 | defaultConfigurationIsVisible = 0; 614 | defaultConfigurationName = Release; 615 | }; 616 | /* End XCConfigurationList section */ 617 | }; 618 | rootObject = F51175AC2434DED60061072E /* Project object */; 619 | } 620 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML.xcodeproj/project.xcworkspace/xcuserdata/osamanaeem.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Onaeem26/ImageSegmentationML/306f435cd39b71f69dfb7be96249260329a94a51/ImageSegmentationML/ImageSegmentationML.xcodeproj/project.xcworkspace/xcuserdata/osamanaeem.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML.xcodeproj/xcuserdata/osamanaeem.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | imageSegmentationML.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // imageSegmentationML 4 | // 5 | // Created by Muhammad Osama Naeem on 4/1/20. 6 | // Copyright © 2020 Muhammad Osama Naeem. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | @UIApplicationMain 12 | class AppDelegate: UIResponder, UIApplicationDelegate { 13 | 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | // MARK: UISceneSession Lifecycle 22 | 23 | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { 24 | // Called when a new scene session is being created. 25 | // Use this method to select a configuration to create the new scene with. 26 | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) 27 | } 28 | 29 | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set) { 30 | // Called when the user discards a scene session. 31 | // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions. 32 | // Use this method to release any resources that were specific to the discarded scenes, as they will not return. 33 | } 34 | 35 | 36 | } 37 | 38 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/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 | } -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/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 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/CoreML/DeepLabV3.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Onaeem26/ImageSegmentationML/306f435cd39b71f69dfb7be96249260329a94a51/ImageSegmentationML/ImageSegmentationML/CoreML/DeepLabV3.mlmodel -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/CoreML/DeepLabV3FP16.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Onaeem26/ImageSegmentationML/306f435cd39b71f69dfb7be96249260329a94a51/ImageSegmentationML/ImageSegmentationML/CoreML/DeepLabV3FP16.mlmodel -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/CoreML/DeepLabV3Int8LUT.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Onaeem26/ImageSegmentationML/306f435cd39b71f69dfb7be96249260329a94a51/ImageSegmentationML/ImageSegmentationML/CoreML/DeepLabV3Int8LUT.mlmodel -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UIApplicationSceneManifest 24 | 25 | UIApplicationSupportsMultipleScenes 26 | 27 | UISceneConfigurations 28 | 29 | UIWindowSceneSessionRoleApplication 30 | 31 | 32 | UISceneConfigurationName 33 | Default Configuration 34 | UISceneDelegateClassName 35 | $(PRODUCT_MODULE_NAME).SceneDelegate 36 | 37 | 38 | 39 | 40 | UILaunchStoryboardName 41 | LaunchScreen 42 | UIRequiredDeviceCapabilities 43 | 44 | armv7 45 | 46 | UISupportedInterfaceOrientations 47 | 48 | UIInterfaceOrientationPortrait 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | UISupportedInterfaceOrientations~ipad 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationPortraitUpsideDown 56 | UIInterfaceOrientationLandscapeLeft 57 | UIInterfaceOrientationLandscapeRight 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // imageSegmentationML 4 | // 5 | // Created by Muhammad Osama Naeem on 4/1/20. 6 | // Copyright © 2020 Muhammad Osama Naeem. All rights reserved. 7 | // 8 | 9 | import UIKit 10 | 11 | class SceneDelegate: UIResponder, UIWindowSceneDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { 17 | // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`. 18 | // If using a storyboard, the `window` property will automatically be initialized and attached to the scene. 19 | // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead). 20 | guard let _ = (scene as? UIWindowScene) else { return } 21 | guard let winScene = (scene as? UIWindowScene) else { return } 22 | 23 | let vc = UINavigationController(rootViewController: ViewController()) 24 | window = UIWindow(windowScene: winScene) 25 | window?.rootViewController = vc 26 | window?.makeKeyAndVisible() 27 | } 28 | 29 | func sceneDidDisconnect(_ scene: UIScene) { 30 | // Called as the scene is being released by the system. 31 | // This occurs shortly after the scene enters the background, or when its session is discarded. 32 | // Release any resources associated with this scene that can be re-created the next time the scene connects. 33 | // The scene may re-connect later, as its session was not neccessarily discarded (see `application:didDiscardSceneSessions` instead). 34 | } 35 | 36 | func sceneDidBecomeActive(_ scene: UIScene) { 37 | // Called when the scene has moved from an inactive state to an active state. 38 | // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive. 39 | } 40 | 41 | func sceneWillResignActive(_ scene: UIScene) { 42 | // Called when the scene will move from an active state to an inactive state. 43 | // This may occur due to temporary interruptions (ex. an incoming phone call). 44 | } 45 | 46 | func sceneWillEnterForeground(_ scene: UIScene) { 47 | // Called as the scene transitions from the background to the foreground. 48 | // Use this method to undo the changes made on entering the background. 49 | } 50 | 51 | func sceneDidEnterBackground(_ scene: UIScene) { 52 | // Called as the scene transitions from the foreground to the background. 53 | // Use this method to save data, release shared resources, and store enough scene-specific state information 54 | // to restore the scene back to its current state. 55 | } 56 | 57 | 58 | } 59 | 60 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/SegmentationResultMLMultiArray.swift: -------------------------------------------------------------------------------- 1 | 2 | import CoreML 3 | 4 | class SegmentationResultMLMultiArray { 5 | let mlMultiArray: MLMultiArray 6 | let segmentationmapWidthSize: Int 7 | let segmentationmapHeightSize: Int 8 | 9 | 10 | init(mlMultiArray: MLMultiArray) { 11 | self.mlMultiArray = mlMultiArray 12 | self.segmentationmapWidthSize = mlMultiArray.shape[0].intValue 13 | self.segmentationmapHeightSize = mlMultiArray.shape[1].intValue 14 | print(self.mlMultiArray.count) 15 | 16 | } 17 | 18 | subscript(colunmIndex: Int, rowIndex: Int) -> NSNumber { 19 | let index = colunmIndex*(segmentationmapHeightSize) + rowIndex 20 | return mlMultiArray[index] 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationML/UIView/DrawingSegmentationView.swift: -------------------------------------------------------------------------------- 1 | 2 | 3 | import UIKit 4 | 5 | class DrawingSegmentationView: UIView { 6 | 7 | static private var colors: [Int32: UIColor] = [:] 8 | 9 | private var blackWhiteColor: [Int32 : UIColor] = [7: UIColor(red: 0, green: 0, blue: 0, alpha: 1), 0: UIColor(red: 0, green: 0, blue: 0, alpha: 1), 15: UIColor(white: 0, alpha: 0)] 10 | 11 | func segmentationColor(with index: Int32) -> UIColor { 12 | if let color = blackWhiteColor[index] { 13 | return color 14 | } else { 15 | let color = UIColor(red: 0, green: 0, blue: 0, alpha: 1) 16 | blackWhiteColor[index] = color 17 | return color 18 | } 19 | } 20 | 21 | var segmentationmap: SegmentationResultMLMultiArray? = nil { 22 | didSet { 23 | self.setNeedsDisplay() 24 | } 25 | } 26 | 27 | override func draw(_ rect: CGRect) { 28 | 29 | if let ctx = UIGraphicsGetCurrentContext() { 30 | 31 | ctx.clear(rect); 32 | 33 | guard let segmentationmap = self.segmentationmap else { return } 34 | 35 | let size = self.bounds.size 36 | let segmentationmapWidthSize = segmentationmap.segmentationmapWidthSize 37 | let segmentationmapHeightSize = segmentationmap.segmentationmapHeightSize 38 | let w = size.width / CGFloat(segmentationmapWidthSize) 39 | let h = size.height / CGFloat(segmentationmapHeightSize) 40 | 41 | print("W:", w) 42 | 43 | for j in 0.. 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationMLTests/imageSegmentationMLTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // imageSegmentationMLTests.swift 3 | // imageSegmentationMLTests 4 | // 5 | // Created by Muhammad Osama Naeem on 4/1/20. 6 | // Copyright © 2020 Muhammad Osama Naeem. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | @testable import imageSegmentationML 11 | 12 | class imageSegmentationMLTests: XCTestCase { 13 | 14 | override func setUp() { 15 | // Put setup code here. This method is called before the invocation of each test method in the class. 16 | } 17 | 18 | override func tearDown() { 19 | // Put teardown code here. This method is called after the invocation of each test method in the class. 20 | } 21 | 22 | func testExample() { 23 | // This is an example of a functional test case. 24 | // Use XCTAssert and related functions to verify your tests produce the correct results. 25 | } 26 | 27 | func testPerformanceExample() { 28 | // This is an example of a performance test case. 29 | self.measure { 30 | // Put the code you want to measure the time of here. 31 | } 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationMLUITests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /ImageSegmentationML/ImageSegmentationMLUITests/imageSegmentationMLUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // imageSegmentationMLUITests.swift 3 | // imageSegmentationMLUITests 4 | // 5 | // Created by Muhammad Osama Naeem on 4/1/20. 6 | // Copyright © 2020 Muhammad Osama Naeem. All rights reserved. 7 | // 8 | 9 | import XCTest 10 | 11 | class imageSegmentationMLUITests: XCTestCase { 12 | 13 | override func setUp() { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | 16 | // In UI tests it is usually best to stop immediately when a failure occurs. 17 | continueAfterFailure = false 18 | 19 | // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. 20 | } 21 | 22 | override func tearDown() { 23 | // Put teardown code here. This method is called after the invocation of each test method in the class. 24 | } 25 | 26 | func testExample() { 27 | // UI tests must launch the application that they test. 28 | let app = XCUIApplication() 29 | app.launch() 30 | 31 | // Use recording to get started writing UI tests. 32 | // Use XCTAssert and related functions to verify your tests produce the correct results. 33 | } 34 | 35 | func testLaunchPerformance() { 36 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, *) { 37 | // This measures how long it takes to launch your application. 38 | measure(metrics: [XCTOSSignpostMetric.applicationLaunch]) { 39 | XCUIApplication().launch() 40 | } 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ImageSegmentationML 2 | Using CoreML and Vision to do image segmentation and change the background color of an image. 3 | 4 | 5 | -------------------------------------------------------------------------------- /imagesegmentationML.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Onaeem26/ImageSegmentationML/306f435cd39b71f69dfb7be96249260329a94a51/imagesegmentationML.gif --------------------------------------------------------------------------------