├── Background removal.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcuserdata │ └── amir.lahav.xcuserdatad │ ├── xcdebugger │ └── Breakpoints_v2.xcbkptlist │ └── xcschemes │ └── xcschememanagement.plist ├── Background removal ├── AppDelegate.swift ├── Assets.xcassets │ ├── AccentColor.colorset │ │ └── Contents.json │ ├── AppIcon.appiconset │ │ └── Contents.json │ ├── Contents.json │ ├── child.imageset │ │ ├── Contents.json │ │ └── child.png │ ├── kid.imageset │ │ ├── Contents.json │ │ └── kid.png │ └── women.imageset │ │ ├── Contents.json │ │ └── women.jpg ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── Info.plist ├── LaLabsu2netp.mlmodel ├── SceneDelegate.swift ├── ViewController.swift ├── u2netp-2.mlmodel ├── u2netp-5.mlmodel ├── u2netp-6.mlmodel ├── u2netp-7.mlmodel ├── u2netp-8.mlmodel └── u2netpconv.mlmodel ├── Background removalTests ├── Background_removalTests.swift └── Info.plist ├── Background removalUITests ├── Background_removalUITests.swift └── Info.plist ├── LICENSE └── README.md /Background removal.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 54E648602676023A00C53107 /* LaLabsu2netp.mlmodel in Sources */ = {isa = PBXBuildFile; fileRef = 54E6485F2676023A00C53107 /* LaLabsu2netp.mlmodel */; }; 11 | 54E91C25267100FD00076F20 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E91C24267100FD00076F20 /* AppDelegate.swift */; }; 12 | 54E91C27267100FD00076F20 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E91C26267100FD00076F20 /* SceneDelegate.swift */; }; 13 | 54E91C29267100FD00076F20 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E91C28267100FD00076F20 /* ViewController.swift */; }; 14 | 54E91C2C267100FD00076F20 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 54E91C2A267100FD00076F20 /* Main.storyboard */; }; 15 | 54E91C2E267100FE00076F20 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 54E91C2D267100FE00076F20 /* Assets.xcassets */; }; 16 | 54E91C31267100FE00076F20 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 54E91C2F267100FE00076F20 /* LaunchScreen.storyboard */; }; 17 | 54E91C3C267100FF00076F20 /* Background_removalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E91C3B267100FF00076F20 /* Background_removalTests.swift */; }; 18 | 54E91C47267100FF00076F20 /* Background_removalUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54E91C46267100FF00076F20 /* Background_removalUITests.swift */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXContainerItemProxy section */ 22 | 54E91C38267100FF00076F20 /* PBXContainerItemProxy */ = { 23 | isa = PBXContainerItemProxy; 24 | containerPortal = 54E91C19267100FD00076F20 /* Project object */; 25 | proxyType = 1; 26 | remoteGlobalIDString = 54E91C20267100FD00076F20; 27 | remoteInfo = "Background removal"; 28 | }; 29 | 54E91C43267100FF00076F20 /* PBXContainerItemProxy */ = { 30 | isa = PBXContainerItemProxy; 31 | containerPortal = 54E91C19267100FD00076F20 /* Project object */; 32 | proxyType = 1; 33 | remoteGlobalIDString = 54E91C20267100FD00076F20; 34 | remoteInfo = "Background removal"; 35 | }; 36 | /* End PBXContainerItemProxy section */ 37 | 38 | /* Begin PBXFileReference section */ 39 | 54E6485F2676023A00C53107 /* LaLabsu2netp.mlmodel */ = {isa = PBXFileReference; lastKnownFileType = file.mlmodel; path = LaLabsu2netp.mlmodel; sourceTree = ""; }; 40 | 54E91C21267100FD00076F20 /* Background removal.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Background removal.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 54E91C24267100FD00076F20 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 42 | 54E91C26267100FD00076F20 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; 43 | 54E91C28267100FD00076F20 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 44 | 54E91C2B267100FD00076F20 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 54E91C2D267100FE00076F20 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | 54E91C30267100FE00076F20 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | 54E91C32267100FE00076F20 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | 54E91C37267100FF00076F20 /* Background removalTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Background removalTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 49 | 54E91C3B267100FF00076F20 /* Background_removalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Background_removalTests.swift; sourceTree = ""; }; 50 | 54E91C3D267100FF00076F20 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 51 | 54E91C42267100FF00076F20 /* Background removalUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Background removalUITests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; 52 | 54E91C46267100FF00076F20 /* Background_removalUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Background_removalUITests.swift; sourceTree = ""; }; 53 | 54E91C48267100FF00076F20 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 54 | /* End PBXFileReference section */ 55 | 56 | /* Begin PBXFrameworksBuildPhase section */ 57 | 54E91C1E267100FD00076F20 /* Frameworks */ = { 58 | isa = PBXFrameworksBuildPhase; 59 | buildActionMask = 2147483647; 60 | files = ( 61 | ); 62 | runOnlyForDeploymentPostprocessing = 0; 63 | }; 64 | 54E91C34267100FF00076F20 /* Frameworks */ = { 65 | isa = PBXFrameworksBuildPhase; 66 | buildActionMask = 2147483647; 67 | files = ( 68 | ); 69 | runOnlyForDeploymentPostprocessing = 0; 70 | }; 71 | 54E91C3F267100FF00076F20 /* Frameworks */ = { 72 | isa = PBXFrameworksBuildPhase; 73 | buildActionMask = 2147483647; 74 | files = ( 75 | ); 76 | runOnlyForDeploymentPostprocessing = 0; 77 | }; 78 | /* End PBXFrameworksBuildPhase section */ 79 | 80 | /* Begin PBXGroup section */ 81 | 54E91C18267100FD00076F20 = { 82 | isa = PBXGroup; 83 | children = ( 84 | 54E91C23267100FD00076F20 /* Background removal */, 85 | 54E91C3A267100FF00076F20 /* Background removalTests */, 86 | 54E91C45267100FF00076F20 /* Background removalUITests */, 87 | 54E91C22267100FD00076F20 /* Products */, 88 | ); 89 | sourceTree = ""; 90 | }; 91 | 54E91C22267100FD00076F20 /* Products */ = { 92 | isa = PBXGroup; 93 | children = ( 94 | 54E91C21267100FD00076F20 /* Background removal.app */, 95 | 54E91C37267100FF00076F20 /* Background removalTests.xctest */, 96 | 54E91C42267100FF00076F20 /* Background removalUITests.xctest */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 54E91C23267100FD00076F20 /* Background removal */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 54E91C24267100FD00076F20 /* AppDelegate.swift */, 105 | 54E91C26267100FD00076F20 /* SceneDelegate.swift */, 106 | 54E91C28267100FD00076F20 /* ViewController.swift */, 107 | 54E6485F2676023A00C53107 /* LaLabsu2netp.mlmodel */, 108 | 54E91C2A267100FD00076F20 /* Main.storyboard */, 109 | 54E91C2D267100FE00076F20 /* Assets.xcassets */, 110 | 54E91C2F267100FE00076F20 /* LaunchScreen.storyboard */, 111 | 54E91C32267100FE00076F20 /* Info.plist */, 112 | ); 113 | path = "Background removal"; 114 | sourceTree = ""; 115 | }; 116 | 54E91C3A267100FF00076F20 /* Background removalTests */ = { 117 | isa = PBXGroup; 118 | children = ( 119 | 54E91C3B267100FF00076F20 /* Background_removalTests.swift */, 120 | 54E91C3D267100FF00076F20 /* Info.plist */, 121 | ); 122 | path = "Background removalTests"; 123 | sourceTree = ""; 124 | }; 125 | 54E91C45267100FF00076F20 /* Background removalUITests */ = { 126 | isa = PBXGroup; 127 | children = ( 128 | 54E91C46267100FF00076F20 /* Background_removalUITests.swift */, 129 | 54E91C48267100FF00076F20 /* Info.plist */, 130 | ); 131 | path = "Background removalUITests"; 132 | sourceTree = ""; 133 | }; 134 | /* End PBXGroup section */ 135 | 136 | /* Begin PBXNativeTarget section */ 137 | 54E91C20267100FD00076F20 /* Background removal */ = { 138 | isa = PBXNativeTarget; 139 | buildConfigurationList = 54E91C4B267100FF00076F20 /* Build configuration list for PBXNativeTarget "Background removal" */; 140 | buildPhases = ( 141 | 54E91C1D267100FD00076F20 /* Sources */, 142 | 54E91C1E267100FD00076F20 /* Frameworks */, 143 | 54E91C1F267100FD00076F20 /* Resources */, 144 | ); 145 | buildRules = ( 146 | ); 147 | dependencies = ( 148 | ); 149 | name = "Background removal"; 150 | productName = "Background removal"; 151 | productReference = 54E91C21267100FD00076F20 /* Background removal.app */; 152 | productType = "com.apple.product-type.application"; 153 | }; 154 | 54E91C36267100FF00076F20 /* Background removalTests */ = { 155 | isa = PBXNativeTarget; 156 | buildConfigurationList = 54E91C4E267100FF00076F20 /* Build configuration list for PBXNativeTarget "Background removalTests" */; 157 | buildPhases = ( 158 | 54E91C33267100FF00076F20 /* Sources */, 159 | 54E91C34267100FF00076F20 /* Frameworks */, 160 | 54E91C35267100FF00076F20 /* Resources */, 161 | ); 162 | buildRules = ( 163 | ); 164 | dependencies = ( 165 | 54E91C39267100FF00076F20 /* PBXTargetDependency */, 166 | ); 167 | name = "Background removalTests"; 168 | productName = "Background removalTests"; 169 | productReference = 54E91C37267100FF00076F20 /* Background removalTests.xctest */; 170 | productType = "com.apple.product-type.bundle.unit-test"; 171 | }; 172 | 54E91C41267100FF00076F20 /* Background removalUITests */ = { 173 | isa = PBXNativeTarget; 174 | buildConfigurationList = 54E91C51267100FF00076F20 /* Build configuration list for PBXNativeTarget "Background removalUITests" */; 175 | buildPhases = ( 176 | 54E91C3E267100FF00076F20 /* Sources */, 177 | 54E91C3F267100FF00076F20 /* Frameworks */, 178 | 54E91C40267100FF00076F20 /* Resources */, 179 | ); 180 | buildRules = ( 181 | ); 182 | dependencies = ( 183 | 54E91C44267100FF00076F20 /* PBXTargetDependency */, 184 | ); 185 | name = "Background removalUITests"; 186 | productName = "Background removalUITests"; 187 | productReference = 54E91C42267100FF00076F20 /* Background removalUITests.xctest */; 188 | productType = "com.apple.product-type.bundle.ui-testing"; 189 | }; 190 | /* End PBXNativeTarget section */ 191 | 192 | /* Begin PBXProject section */ 193 | 54E91C19267100FD00076F20 /* Project object */ = { 194 | isa = PBXProject; 195 | attributes = { 196 | LastSwiftUpdateCheck = 1250; 197 | LastUpgradeCheck = 1250; 198 | TargetAttributes = { 199 | 54E91C20267100FD00076F20 = { 200 | CreatedOnToolsVersion = 12.5; 201 | }; 202 | 54E91C36267100FF00076F20 = { 203 | CreatedOnToolsVersion = 12.5; 204 | TestTargetID = 54E91C20267100FD00076F20; 205 | }; 206 | 54E91C41267100FF00076F20 = { 207 | CreatedOnToolsVersion = 12.5; 208 | TestTargetID = 54E91C20267100FD00076F20; 209 | }; 210 | }; 211 | }; 212 | buildConfigurationList = 54E91C1C267100FD00076F20 /* Build configuration list for PBXProject "Background removal" */; 213 | compatibilityVersion = "Xcode 9.3"; 214 | developmentRegion = en; 215 | hasScannedForEncodings = 0; 216 | knownRegions = ( 217 | en, 218 | Base, 219 | ); 220 | mainGroup = 54E91C18267100FD00076F20; 221 | productRefGroup = 54E91C22267100FD00076F20 /* Products */; 222 | projectDirPath = ""; 223 | projectRoot = ""; 224 | targets = ( 225 | 54E91C20267100FD00076F20 /* Background removal */, 226 | 54E91C36267100FF00076F20 /* Background removalTests */, 227 | 54E91C41267100FF00076F20 /* Background removalUITests */, 228 | ); 229 | }; 230 | /* End PBXProject section */ 231 | 232 | /* Begin PBXResourcesBuildPhase section */ 233 | 54E91C1F267100FD00076F20 /* Resources */ = { 234 | isa = PBXResourcesBuildPhase; 235 | buildActionMask = 2147483647; 236 | files = ( 237 | 54E91C31267100FE00076F20 /* LaunchScreen.storyboard in Resources */, 238 | 54E91C2E267100FE00076F20 /* Assets.xcassets in Resources */, 239 | 54E91C2C267100FD00076F20 /* Main.storyboard in Resources */, 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | }; 243 | 54E91C35267100FF00076F20 /* Resources */ = { 244 | isa = PBXResourcesBuildPhase; 245 | buildActionMask = 2147483647; 246 | files = ( 247 | ); 248 | runOnlyForDeploymentPostprocessing = 0; 249 | }; 250 | 54E91C40267100FF00076F20 /* Resources */ = { 251 | isa = PBXResourcesBuildPhase; 252 | buildActionMask = 2147483647; 253 | files = ( 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | /* End PBXResourcesBuildPhase section */ 258 | 259 | /* Begin PBXSourcesBuildPhase section */ 260 | 54E91C1D267100FD00076F20 /* Sources */ = { 261 | isa = PBXSourcesBuildPhase; 262 | buildActionMask = 2147483647; 263 | files = ( 264 | 54E91C29267100FD00076F20 /* ViewController.swift in Sources */, 265 | 54E648602676023A00C53107 /* LaLabsu2netp.mlmodel in Sources */, 266 | 54E91C25267100FD00076F20 /* AppDelegate.swift in Sources */, 267 | 54E91C27267100FD00076F20 /* SceneDelegate.swift in Sources */, 268 | ); 269 | runOnlyForDeploymentPostprocessing = 0; 270 | }; 271 | 54E91C33267100FF00076F20 /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | 54E91C3C267100FF00076F20 /* Background_removalTests.swift in Sources */, 276 | ); 277 | runOnlyForDeploymentPostprocessing = 0; 278 | }; 279 | 54E91C3E267100FF00076F20 /* Sources */ = { 280 | isa = PBXSourcesBuildPhase; 281 | buildActionMask = 2147483647; 282 | files = ( 283 | 54E91C47267100FF00076F20 /* Background_removalUITests.swift in Sources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | /* End PBXSourcesBuildPhase section */ 288 | 289 | /* Begin PBXTargetDependency section */ 290 | 54E91C39267100FF00076F20 /* PBXTargetDependency */ = { 291 | isa = PBXTargetDependency; 292 | target = 54E91C20267100FD00076F20 /* Background removal */; 293 | targetProxy = 54E91C38267100FF00076F20 /* PBXContainerItemProxy */; 294 | }; 295 | 54E91C44267100FF00076F20 /* PBXTargetDependency */ = { 296 | isa = PBXTargetDependency; 297 | target = 54E91C20267100FD00076F20 /* Background removal */; 298 | targetProxy = 54E91C43267100FF00076F20 /* PBXContainerItemProxy */; 299 | }; 300 | /* End PBXTargetDependency section */ 301 | 302 | /* Begin PBXVariantGroup section */ 303 | 54E91C2A267100FD00076F20 /* Main.storyboard */ = { 304 | isa = PBXVariantGroup; 305 | children = ( 306 | 54E91C2B267100FD00076F20 /* Base */, 307 | ); 308 | name = Main.storyboard; 309 | sourceTree = ""; 310 | }; 311 | 54E91C2F267100FE00076F20 /* LaunchScreen.storyboard */ = { 312 | isa = PBXVariantGroup; 313 | children = ( 314 | 54E91C30267100FE00076F20 /* Base */, 315 | ); 316 | name = LaunchScreen.storyboard; 317 | sourceTree = ""; 318 | }; 319 | /* End PBXVariantGroup section */ 320 | 321 | /* Begin XCBuildConfiguration section */ 322 | 54E91C49267100FF00076F20 /* Debug */ = { 323 | isa = XCBuildConfiguration; 324 | buildSettings = { 325 | ALWAYS_SEARCH_USER_PATHS = NO; 326 | CLANG_ANALYZER_NONNULL = YES; 327 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 329 | CLANG_CXX_LIBRARY = "libc++"; 330 | CLANG_ENABLE_MODULES = YES; 331 | CLANG_ENABLE_OBJC_ARC = YES; 332 | CLANG_ENABLE_OBJC_WEAK = YES; 333 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 334 | CLANG_WARN_BOOL_CONVERSION = YES; 335 | CLANG_WARN_COMMA = YES; 336 | CLANG_WARN_CONSTANT_CONVERSION = YES; 337 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 338 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 339 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 340 | CLANG_WARN_EMPTY_BODY = YES; 341 | CLANG_WARN_ENUM_CONVERSION = YES; 342 | CLANG_WARN_INFINITE_RECURSION = YES; 343 | CLANG_WARN_INT_CONVERSION = YES; 344 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 345 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 346 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 347 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 348 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 349 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 350 | CLANG_WARN_STRICT_PROTOTYPES = YES; 351 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 352 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 353 | CLANG_WARN_UNREACHABLE_CODE = YES; 354 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 355 | COPY_PHASE_STRIP = NO; 356 | DEBUG_INFORMATION_FORMAT = dwarf; 357 | ENABLE_STRICT_OBJC_MSGSEND = YES; 358 | ENABLE_TESTABILITY = YES; 359 | GCC_C_LANGUAGE_STANDARD = gnu11; 360 | GCC_DYNAMIC_NO_PIC = NO; 361 | GCC_NO_COMMON_BLOCKS = YES; 362 | GCC_OPTIMIZATION_LEVEL = 0; 363 | GCC_PREPROCESSOR_DEFINITIONS = ( 364 | "DEBUG=1", 365 | "$(inherited)", 366 | ); 367 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 368 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 369 | GCC_WARN_UNDECLARED_SELECTOR = YES; 370 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 371 | GCC_WARN_UNUSED_FUNCTION = YES; 372 | GCC_WARN_UNUSED_VARIABLE = YES; 373 | IPHONEOS_DEPLOYMENT_TARGET = 14.5; 374 | MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; 375 | MTL_FAST_MATH = YES; 376 | ONLY_ACTIVE_ARCH = YES; 377 | SDKROOT = iphoneos; 378 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 379 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 380 | }; 381 | name = Debug; 382 | }; 383 | 54E91C4A267100FF00076F20 /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | buildSettings = { 386 | ALWAYS_SEARCH_USER_PATHS = NO; 387 | CLANG_ANALYZER_NONNULL = YES; 388 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 389 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 390 | CLANG_CXX_LIBRARY = "libc++"; 391 | CLANG_ENABLE_MODULES = YES; 392 | CLANG_ENABLE_OBJC_ARC = YES; 393 | CLANG_ENABLE_OBJC_WEAK = YES; 394 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_COMMA = YES; 397 | CLANG_WARN_CONSTANT_CONVERSION = YES; 398 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 399 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 400 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 407 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 408 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 409 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 410 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 411 | CLANG_WARN_STRICT_PROTOTYPES = YES; 412 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 413 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 414 | CLANG_WARN_UNREACHABLE_CODE = YES; 415 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 416 | COPY_PHASE_STRIP = NO; 417 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 418 | ENABLE_NS_ASSERTIONS = NO; 419 | ENABLE_STRICT_OBJC_MSGSEND = YES; 420 | GCC_C_LANGUAGE_STANDARD = gnu11; 421 | GCC_NO_COMMON_BLOCKS = YES; 422 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 423 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 424 | GCC_WARN_UNDECLARED_SELECTOR = YES; 425 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 426 | GCC_WARN_UNUSED_FUNCTION = YES; 427 | GCC_WARN_UNUSED_VARIABLE = YES; 428 | IPHONEOS_DEPLOYMENT_TARGET = 14.5; 429 | MTL_ENABLE_DEBUG_INFO = NO; 430 | MTL_FAST_MATH = YES; 431 | SDKROOT = iphoneos; 432 | SWIFT_COMPILATION_MODE = wholemodule; 433 | SWIFT_OPTIMIZATION_LEVEL = "-O"; 434 | VALIDATE_PRODUCT = YES; 435 | }; 436 | name = Release; 437 | }; 438 | 54E91C4C267100FF00076F20 /* Debug */ = { 439 | isa = XCBuildConfiguration; 440 | buildSettings = { 441 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 442 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 443 | CODE_SIGN_STYLE = Automatic; 444 | INFOPLIST_FILE = "Background removal/Info.plist"; 445 | LD_RUNPATH_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "@executable_path/Frameworks", 448 | ); 449 | PRODUCT_BUNDLE_IDENTIFIER = "la-labs.Background-removal"; 450 | PRODUCT_NAME = "$(TARGET_NAME)"; 451 | SWIFT_VERSION = 5.0; 452 | TARGETED_DEVICE_FAMILY = "1,2"; 453 | }; 454 | name = Debug; 455 | }; 456 | 54E91C4D267100FF00076F20 /* Release */ = { 457 | isa = XCBuildConfiguration; 458 | buildSettings = { 459 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 460 | ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; 461 | CODE_SIGN_STYLE = Automatic; 462 | INFOPLIST_FILE = "Background removal/Info.plist"; 463 | LD_RUNPATH_SEARCH_PATHS = ( 464 | "$(inherited)", 465 | "@executable_path/Frameworks", 466 | ); 467 | PRODUCT_BUNDLE_IDENTIFIER = "la-labs.Background-removal"; 468 | PRODUCT_NAME = "$(TARGET_NAME)"; 469 | SWIFT_VERSION = 5.0; 470 | TARGETED_DEVICE_FAMILY = "1,2"; 471 | }; 472 | name = Release; 473 | }; 474 | 54E91C4F267100FF00076F20 /* Debug */ = { 475 | isa = XCBuildConfiguration; 476 | buildSettings = { 477 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 478 | BUNDLE_LOADER = "$(TEST_HOST)"; 479 | CODE_SIGN_STYLE = Automatic; 480 | INFOPLIST_FILE = "Background removalTests/Info.plist"; 481 | IPHONEOS_DEPLOYMENT_TARGET = 14.5; 482 | LD_RUNPATH_SEARCH_PATHS = ( 483 | "$(inherited)", 484 | "@executable_path/Frameworks", 485 | "@loader_path/Frameworks", 486 | ); 487 | PRODUCT_BUNDLE_IDENTIFIER = "la-labs.Background-removalTests"; 488 | PRODUCT_NAME = "$(TARGET_NAME)"; 489 | SWIFT_VERSION = 5.0; 490 | TARGETED_DEVICE_FAMILY = "1,2"; 491 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Background removal.app/Background removal"; 492 | }; 493 | name = Debug; 494 | }; 495 | 54E91C50267100FF00076F20 /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | buildSettings = { 498 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 499 | BUNDLE_LOADER = "$(TEST_HOST)"; 500 | CODE_SIGN_STYLE = Automatic; 501 | INFOPLIST_FILE = "Background removalTests/Info.plist"; 502 | IPHONEOS_DEPLOYMENT_TARGET = 14.5; 503 | LD_RUNPATH_SEARCH_PATHS = ( 504 | "$(inherited)", 505 | "@executable_path/Frameworks", 506 | "@loader_path/Frameworks", 507 | ); 508 | PRODUCT_BUNDLE_IDENTIFIER = "la-labs.Background-removalTests"; 509 | PRODUCT_NAME = "$(TARGET_NAME)"; 510 | SWIFT_VERSION = 5.0; 511 | TARGETED_DEVICE_FAMILY = "1,2"; 512 | TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Background removal.app/Background removal"; 513 | }; 514 | name = Release; 515 | }; 516 | 54E91C52267100FF00076F20 /* Debug */ = { 517 | isa = XCBuildConfiguration; 518 | buildSettings = { 519 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 520 | CODE_SIGN_STYLE = Automatic; 521 | INFOPLIST_FILE = "Background removalUITests/Info.plist"; 522 | LD_RUNPATH_SEARCH_PATHS = ( 523 | "$(inherited)", 524 | "@executable_path/Frameworks", 525 | "@loader_path/Frameworks", 526 | ); 527 | PRODUCT_BUNDLE_IDENTIFIER = "la-labs.Background-removalUITests"; 528 | PRODUCT_NAME = "$(TARGET_NAME)"; 529 | SWIFT_VERSION = 5.0; 530 | TARGETED_DEVICE_FAMILY = "1,2"; 531 | TEST_TARGET_NAME = "Background removal"; 532 | }; 533 | name = Debug; 534 | }; 535 | 54E91C53267100FF00076F20 /* Release */ = { 536 | isa = XCBuildConfiguration; 537 | buildSettings = { 538 | ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; 539 | CODE_SIGN_STYLE = Automatic; 540 | INFOPLIST_FILE = "Background removalUITests/Info.plist"; 541 | LD_RUNPATH_SEARCH_PATHS = ( 542 | "$(inherited)", 543 | "@executable_path/Frameworks", 544 | "@loader_path/Frameworks", 545 | ); 546 | PRODUCT_BUNDLE_IDENTIFIER = "la-labs.Background-removalUITests"; 547 | PRODUCT_NAME = "$(TARGET_NAME)"; 548 | SWIFT_VERSION = 5.0; 549 | TARGETED_DEVICE_FAMILY = "1,2"; 550 | TEST_TARGET_NAME = "Background removal"; 551 | }; 552 | name = Release; 553 | }; 554 | /* End XCBuildConfiguration section */ 555 | 556 | /* Begin XCConfigurationList section */ 557 | 54E91C1C267100FD00076F20 /* Build configuration list for PBXProject "Background removal" */ = { 558 | isa = XCConfigurationList; 559 | buildConfigurations = ( 560 | 54E91C49267100FF00076F20 /* Debug */, 561 | 54E91C4A267100FF00076F20 /* Release */, 562 | ); 563 | defaultConfigurationIsVisible = 0; 564 | defaultConfigurationName = Release; 565 | }; 566 | 54E91C4B267100FF00076F20 /* Build configuration list for PBXNativeTarget "Background removal" */ = { 567 | isa = XCConfigurationList; 568 | buildConfigurations = ( 569 | 54E91C4C267100FF00076F20 /* Debug */, 570 | 54E91C4D267100FF00076F20 /* Release */, 571 | ); 572 | defaultConfigurationIsVisible = 0; 573 | defaultConfigurationName = Release; 574 | }; 575 | 54E91C4E267100FF00076F20 /* Build configuration list for PBXNativeTarget "Background removalTests" */ = { 576 | isa = XCConfigurationList; 577 | buildConfigurations = ( 578 | 54E91C4F267100FF00076F20 /* Debug */, 579 | 54E91C50267100FF00076F20 /* Release */, 580 | ); 581 | defaultConfigurationIsVisible = 0; 582 | defaultConfigurationName = Release; 583 | }; 584 | 54E91C51267100FF00076F20 /* Build configuration list for PBXNativeTarget "Background removalUITests" */ = { 585 | isa = XCConfigurationList; 586 | buildConfigurations = ( 587 | 54E91C52267100FF00076F20 /* Debug */, 588 | 54E91C53267100FF00076F20 /* Release */, 589 | ); 590 | defaultConfigurationIsVisible = 0; 591 | defaultConfigurationName = Release; 592 | }; 593 | /* End XCConfigurationList section */ 594 | }; 595 | rootObject = 54E91C19267100FD00076F20 /* Project object */; 596 | } 597 | -------------------------------------------------------------------------------- /Background removal.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Background removal.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Background removal.xcodeproj/xcuserdata/amir.lahav.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | -------------------------------------------------------------------------------- /Background removal.xcodeproj/xcuserdata/amir.lahav.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Background removal.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Background removal/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // Background removal 4 | // 5 | // Created by Amir Lahav on 09/06/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 | -------------------------------------------------------------------------------- /Background removal/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 | -------------------------------------------------------------------------------- /Background removal/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 | -------------------------------------------------------------------------------- /Background removal/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "author" : "xcode", 4 | "version" : 1 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /Background removal/Assets.xcassets/child.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "child.png", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Background removal/Assets.xcassets/child.imageset/child.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/Assets.xcassets/child.imageset/child.png -------------------------------------------------------------------------------- /Background removal/Assets.xcassets/kid.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "filename" : "kid.png", 5 | "idiom" : "universal", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Background removal/Assets.xcassets/kid.imageset/kid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/Assets.xcassets/kid.imageset/kid.png -------------------------------------------------------------------------------- /Background removal/Assets.xcassets/women.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "filename" : "women.jpg", 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "author" : "xcode", 19 | "version" : 1 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Background removal/Assets.xcassets/women.imageset/women.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/Assets.xcassets/women.imageset/women.jpg -------------------------------------------------------------------------------- /Background removal/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 | -------------------------------------------------------------------------------- /Background removal/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 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /Background removal/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 | UISceneStoryboardFile 37 | Main 38 | 39 | 40 | 41 | 42 | UIApplicationSupportsIndirectInputEvents 43 | 44 | UILaunchStoryboardName 45 | LaunchScreen 46 | UIMainStoryboardFile 47 | Main 48 | UIRequiredDeviceCapabilities 49 | 50 | armv7 51 | 52 | UISupportedInterfaceOrientations 53 | 54 | UIInterfaceOrientationPortrait 55 | UIInterfaceOrientationLandscapeLeft 56 | UIInterfaceOrientationLandscapeRight 57 | 58 | UISupportedInterfaceOrientations~ipad 59 | 60 | UIInterfaceOrientationPortrait 61 | UIInterfaceOrientationPortraitUpsideDown 62 | UIInterfaceOrientationLandscapeLeft 63 | UIInterfaceOrientationLandscapeRight 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /Background removal/LaLabsu2netp.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/LaLabsu2netp.mlmodel -------------------------------------------------------------------------------- /Background removal/SceneDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // SceneDelegate.swift 3 | // Background removal 4 | // 5 | // Created by Amir Lahav on 09/06/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 | -------------------------------------------------------------------------------- /Background removal/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // Background removal 4 | // 5 | // Created by Amir Lahav on 09/06/2021. 6 | // 7 | 8 | import UIKit 9 | import CoreML 10 | import Vision 11 | import VideoToolbox 12 | 13 | class ViewController: UIViewController { 14 | 15 | @IBOutlet weak var inputImage: UIImageView! 16 | @IBOutlet weak var segmentedImage: UIImageView! 17 | 18 | override func viewDidLoad() { 19 | super.viewDidLoad() 20 | 21 | let image = UIImage(named: "child.jpg") 22 | 23 | let resize = (image?.cropImage(toRect: CGRect(x: 0, y: 0, width: 320, height: 320)))! 24 | inputImage.image = image 25 | let model = try? LaLabsu2netp.init() 26 | 27 | let result = try? model?.prediction(in_0: buffer(from: resize)!) 28 | 29 | let out = UIImage(pixelBuffer: result!.out_p1) 30 | segmentedImage.image = out 31 | // Do any additional setup after loading the view. 32 | } 33 | 34 | func buffer(from image: UIImage) -> CVPixelBuffer? { 35 | let attrs = [kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue, kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue] as CFDictionary 36 | var pixelBuffer : CVPixelBuffer? 37 | let status = CVPixelBufferCreate(kCFAllocatorDefault, Int(image.size.width), Int(image.size.height), kCVPixelFormatType_32ARGB, attrs, &pixelBuffer) 38 | guard (status == kCVReturnSuccess) else { 39 | return nil 40 | } 41 | 42 | CVPixelBufferLockBaseAddress(pixelBuffer!, CVPixelBufferLockFlags(rawValue: 0)) 43 | let pixelData = CVPixelBufferGetBaseAddress(pixelBuffer!) 44 | 45 | let rgbColorSpace = CGColorSpaceCreateDeviceRGB() 46 | let context = CGContext(data: pixelData, width: Int(image.size.width), height: Int(image.size.height), bitsPerComponent: 8, bytesPerRow: CVPixelBufferGetBytesPerRow(pixelBuffer!), space: rgbColorSpace, bitmapInfo: CGImageAlphaInfo.noneSkipFirst.rawValue) 47 | 48 | context?.translateBy(x: 0, y: image.size.height) 49 | context?.scaleBy(x: 1.0, y: -1.0) 50 | 51 | UIGraphicsPushContext(context!) 52 | image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) 53 | UIGraphicsPopContext() 54 | CVPixelBufferUnlockBaseAddress(pixelBuffer!, CVPixelBufferLockFlags(rawValue: 0)) 55 | 56 | return pixelBuffer 57 | } 58 | } 59 | 60 | extension UIImage { 61 | func cropImage(toRect rect: CGRect) -> UIImage? { 62 | if let imageRef = self.cgImage?.cropping(to: rect) { 63 | return UIImage(cgImage: imageRef) 64 | } 65 | return nil 66 | } 67 | } 68 | 69 | extension UIImage { 70 | public convenience init?(pixelBuffer: CVPixelBuffer) { 71 | var cgImage: CGImage? 72 | VTCreateCGImageFromCVPixelBuffer(pixelBuffer, options: nil, imageOut: &cgImage) 73 | 74 | guard let cgImage = cgImage else { 75 | return nil 76 | } 77 | 78 | self.init(cgImage: cgImage) 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /Background removal/u2netp-2.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/u2netp-2.mlmodel -------------------------------------------------------------------------------- /Background removal/u2netp-5.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/u2netp-5.mlmodel -------------------------------------------------------------------------------- /Background removal/u2netp-6.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/u2netp-6.mlmodel -------------------------------------------------------------------------------- /Background removal/u2netp-7.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/u2netp-7.mlmodel -------------------------------------------------------------------------------- /Background removal/u2netp-8.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/u2netp-8.mlmodel -------------------------------------------------------------------------------- /Background removal/u2netpconv.mlmodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SmartyToe/Image-segmentation/5b1616ddc61571e99ffa4c28a56edcc4b26edfc2/Background removal/u2netpconv.mlmodel -------------------------------------------------------------------------------- /Background removalTests/Background_removalTests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Background_removalTests.swift 3 | // Background removalTests 4 | // 5 | // Created by Amir Lahav on 09/06/2021. 6 | // 7 | 8 | import XCTest 9 | @testable import Background_removal 10 | 11 | class Background_removalTests: XCTestCase { 12 | 13 | override func setUpWithError() throws { 14 | // Put setup code here. This method is called before the invocation of each test method in the class. 15 | } 16 | 17 | override func tearDownWithError() throws { 18 | // Put teardown code here. This method is called after the invocation of each test method in the class. 19 | } 20 | 21 | func testExample() throws { 22 | // This is an example of a functional test case. 23 | // Use XCTAssert and related functions to verify your tests produce the correct results. 24 | } 25 | 26 | func testPerformanceExample() throws { 27 | // This is an example of a performance test case. 28 | self.measure { 29 | // Put the code you want to measure the time of here. 30 | } 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /Background removalTests/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 | -------------------------------------------------------------------------------- /Background removalUITests/Background_removalUITests.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Background_removalUITests.swift 3 | // Background removalUITests 4 | // 5 | // Created by Amir Lahav on 09/06/2021. 6 | // 7 | 8 | import XCTest 9 | 10 | class Background_removalUITests: XCTestCase { 11 | 12 | override func setUpWithError() throws { 13 | // Put setup code here. This method is called before the invocation of each test method in the class. 14 | 15 | // In UI tests it is usually best to stop immediately when a failure occurs. 16 | continueAfterFailure = false 17 | 18 | // 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. 19 | } 20 | 21 | override func tearDownWithError() throws { 22 | // Put teardown code here. This method is called after the invocation of each test method in the class. 23 | } 24 | 25 | func testExample() throws { 26 | // UI tests must launch the application that they test. 27 | let app = XCUIApplication() 28 | app.launch() 29 | 30 | // Use recording to get started writing UI tests. 31 | // Use XCTAssert and related functions to verify your tests produce the correct results. 32 | } 33 | 34 | func testLaunchPerformance() throws { 35 | if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { 36 | // This measures how long it takes to launch your application. 37 | measure(metrics: [XCTApplicationLaunchMetric()]) { 38 | XCUIApplication().launch() 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Background removalUITests/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 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 SmartyToe 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Image-segmentation 2 | Image segmentation 3 | --------------------------------------------------------------------------------