diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/project.pbxproj b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/project.pbxproj deleted file mode 100644 index 3a8f1ba8d25..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/project.pbxproj +++ /dev/null @@ -1,864 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 56; - objects = { - -/* Begin PBXBuildFile section */ - 031B92F72ACF2A5400D4EBE0 /* mv3_mps_float16.pte in Resources */ = {isa = PBXBuildFile; fileRef = 031B92F62ACF2A5400D4EBE0 /* mv3_mps_float16.pte */; }; - 032C01A52AC22B16002955E1 /* App.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032C018B2AC22B16002955E1 /* App.swift */; }; - 032C01A72AC22B16002955E1 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032C018D2AC22B16002955E1 /* ContentView.swift */; }; - 032C01B72AC329B6002955E1 /* CustomViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032C01B62AC329B6002955E1 /* CustomViews.swift */; }; - 032C01B92AC32ADF002955E1 /* CameraController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032C01B82AC32ADF002955E1 /* CameraController.swift */; }; - 032C01E82AC34B60002955E1 /* MobileNetClassifier.mm in Sources */ = {isa = PBXBuildFile; fileRef = 032C01902AC22B16002955E1 /* MobileNetClassifier.mm */; }; - 032C01EC2AC34CAC002955E1 /* libMobileNetClassifier.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 032C01CB2AC34632002955E1 /* libMobileNetClassifier.a */; platformFilter = ios; }; - 032C02032AC47CFB002955E1 /* mv3_xnnpack_fp32.pte in Resources */ = {isa = PBXBuildFile; fileRef = 032C01FC2AC47CFB002955E1 /* mv3_xnnpack_fp32.pte */; }; - 032C02082AC47CFB002955E1 /* imagenet_classes.txt in Resources */ = {isa = PBXBuildFile; fileRef = 032C02012AC47CFB002955E1 /* imagenet_classes.txt */; }; - 036834D52ACB710D00BA100F /* mv3.pte in Resources */ = {isa = PBXBuildFile; fileRef = 036834D42ACB710D00BA100F /* mv3.pte */; }; - 036834D62ACB710D00BA100F /* mv3.pte in Resources */ = {isa = PBXBuildFile; fileRef = 036834D42ACB710D00BA100F /* mv3.pte */; }; - 036834D82ACB893700BA100F /* mv3_coreml_all.pte in Resources */ = {isa = PBXBuildFile; fileRef = 036834D72ACB893700BA100F /* mv3_coreml_all.pte */; }; - 03C818192AC671980084CC29 /* Samoyed.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03C818182AC671980084CC29 /* Samoyed.jpg */; }; - 03C8181D2AC69C280084CC29 /* Arctic fox.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03C8181C2AC69C280084CC29 /* Arctic fox.jpg */; }; - 03C8181F2AC69DFF0084CC29 /* hot pot.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 03C8181E2AC69DFF0084CC29 /* hot pot.jpg */; }; - 03C818242AC6E3010084CC29 /* MobileNetClassifierTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C818232AC6E3010084CC29 /* MobileNetClassifierTest.swift */; }; - 03C818252AC75E580084CC29 /* MobileNetClassifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 032C018A2AC22B16002955E1 /* MobileNetClassifier.swift */; }; - 03C818282AC760650084CC29 /* libMobileNetClassifier.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 032C01CB2AC34632002955E1 /* libMobileNetClassifier.a */; }; - 03C8182A2AC7901D0084CC29 /* ClassificationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C818292AC7901D0084CC29 /* ClassificationController.swift */; }; - 03C8182C2AC790F40084CC29 /* CameraPreview.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C8182B2AC790F40084CC29 /* CameraPreview.swift */; }; - 03C818322AC79FCD0084CC29 /* ImageClassification.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03C8182D2AC796A00084CC29 /* ImageClassification.swift */; }; - 03C818472AC7A1190084CC29 /* libImageClassification.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 03C818442AC79FCD0084CC29 /* libImageClassification.a */; }; - 03C818482AC7BF470084CC29 /* imagenet_classes.txt in Resources */ = {isa = PBXBuildFile; fileRef = 032C02012AC47CFB002955E1 /* imagenet_classes.txt */; }; - 03C8184A2AC7BF470084CC29 /* mv3_xnnpack_fp32.pte in Resources */ = {isa = PBXBuildFile; fileRef = 032C01FC2AC47CFB002955E1 /* mv3_xnnpack_fp32.pte */; }; - 03C8DC7C2AE2533C0064384A /* mv3_coreml_all.pte in Resources */ = {isa = PBXBuildFile; fileRef = 036834D72ACB893700BA100F /* mv3_coreml_all.pte */; }; - 03D494E22B5B7AE900FCF524 /* mv3_mps_float16.pte in Resources */ = {isa = PBXBuildFile; fileRef = 031B92F62ACF2A5400D4EBE0 /* mv3_mps_float16.pte */; }; - 03D76BF12BAD297E0040FD82 /* backend_coreml in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76BF02BAD297E0040FD82 /* backend_coreml */; }; - 03D76BF32BAD297E0040FD82 /* executorch in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76BF22BAD297E0040FD82 /* executorch */; }; - 03D76BF52BAD297E0040FD82 /* backend_mps in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76BF42BAD297E0040FD82 /* backend_mps */; }; - 03D76BF72BAD297E0040FD82 /* kernels_portable in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76BF62BAD297E0040FD82 /* kernels_portable */; }; - 03D76BF92BAD297E0040FD82 /* backend_xnnpack in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76BF82BAD297E0040FD82 /* backend_xnnpack */; }; - 03D76BFB2BAD29B60040FD82 /* backend_coreml in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76BFA2BAD29B60040FD82 /* backend_coreml */; }; - 03D76BFD2BAD29B60040FD82 /* backend_mps in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76BFC2BAD29B60040FD82 /* backend_mps */; }; - 03D76BFF2BAD29B60040FD82 /* kernels_portable in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76BFE2BAD29B60040FD82 /* kernels_portable */; }; - 03D76C012BAD29B60040FD82 /* backend_xnnpack in Frameworks */ = {isa = PBXBuildFile; productRef = 03D76C002BAD29B60040FD82 /* backend_xnnpack */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 032C01EA2AC34CA8002955E1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 032C01672AC228E5002955E1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 032C01CA2AC34632002955E1; - remoteInfo = VisionModel; - }; - 03C818452AC7A0DB0084CC29 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 032C01672AC228E5002955E1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 03C818302AC79FCD0084CC29; - remoteInfo = ImageClassification; - }; - 84EF1FE92C7850B6005922B4 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 032C01672AC228E5002955E1 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 032C016E2AC228E6002955E1; - remoteInfo = App; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 032C01C92AC34632002955E1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 03C818402AC79FCD0084CC29 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = "include/$(PRODUCT_NAME)"; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 031B92F62ACF2A5400D4EBE0 /* mv3_mps_float16.pte */ = {isa = PBXFileReference; lastKnownFileType = file; path = mv3_mps_float16.pte; sourceTree = ""; }; - 032C016F2AC228E6002955E1 /* ExecuTorchDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ExecuTorchDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 032C018A2AC22B16002955E1 /* MobileNetClassifier.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MobileNetClassifier.swift; sourceTree = ""; }; - 032C018B2AC22B16002955E1 /* App.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = ""; }; - 032C018D2AC22B16002955E1 /* ContentView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; - 032C018E2AC22B16002955E1 /* MobileNet-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MobileNet-Bridging-Header.h"; sourceTree = ""; }; - 032C01902AC22B16002955E1 /* MobileNetClassifier.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MobileNetClassifier.mm; sourceTree = ""; }; - 032C01912AC22B16002955E1 /* MobileNetClassifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MobileNetClassifier.h; sourceTree = ""; }; - 032C01B62AC329B6002955E1 /* CustomViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomViews.swift; sourceTree = ""; }; - 032C01B82AC32ADF002955E1 /* CameraController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraController.swift; sourceTree = ""; }; - 032C01CB2AC34632002955E1 /* libMobileNetClassifier.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libMobileNetClassifier.a; sourceTree = BUILT_PRODUCTS_DIR; }; - 032C01FC2AC47CFB002955E1 /* mv3_xnnpack_fp32.pte */ = {isa = PBXFileReference; lastKnownFileType = file; path = mv3_xnnpack_fp32.pte; sourceTree = ""; }; - 032C02012AC47CFB002955E1 /* imagenet_classes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = imagenet_classes.txt; sourceTree = ""; }; - 036834D42ACB710D00BA100F /* mv3.pte */ = {isa = PBXFileReference; lastKnownFileType = file; path = mv3.pte; sourceTree = ""; }; - 036834D72ACB893700BA100F /* mv3_coreml_all.pte */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = mv3_coreml_all.pte; sourceTree = ""; }; - 03C8180A2AC66FC30084CC29 /* MobileNetClassifierTest.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = MobileNetClassifierTest.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; - 03C818182AC671980084CC29 /* Samoyed.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = Samoyed.jpg; sourceTree = ""; }; - 03C8181C2AC69C280084CC29 /* Arctic fox.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "Arctic fox.jpg"; sourceTree = ""; }; - 03C8181E2AC69DFF0084CC29 /* hot pot.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = "hot pot.jpg"; sourceTree = ""; }; - 03C818232AC6E3010084CC29 /* MobileNetClassifierTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MobileNetClassifierTest.swift; sourceTree = ""; }; - 03C818292AC7901D0084CC29 /* ClassificationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ClassificationController.swift; sourceTree = ""; }; - 03C8182B2AC790F40084CC29 /* CameraPreview.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CameraPreview.swift; sourceTree = ""; }; - 03C8182D2AC796A00084CC29 /* ImageClassification.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageClassification.swift; sourceTree = ""; }; - 03C818442AC79FCD0084CC29 /* libImageClassification.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libImageClassification.a; sourceTree = BUILT_PRODUCTS_DIR; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 032C016C2AC228E6002955E1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 03D76BF72BAD297E0040FD82 /* kernels_portable in Frameworks */, - 03D76BF52BAD297E0040FD82 /* backend_mps in Frameworks */, - 03D76BF92BAD297E0040FD82 /* backend_xnnpack in Frameworks */, - 032C01EC2AC34CAC002955E1 /* libMobileNetClassifier.a in Frameworks */, - 03D76BF12BAD297E0040FD82 /* backend_coreml in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 032C01C82AC34632002955E1 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 03D76BF32BAD297E0040FD82 /* executorch in Frameworks */, - 03C818472AC7A1190084CC29 /* libImageClassification.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 03C818072AC66FC30084CC29 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 03D76BFF2BAD29B60040FD82 /* kernels_portable in Frameworks */, - 03D76BFD2BAD29B60040FD82 /* backend_mps in Frameworks */, - 03D76C012BAD29B60040FD82 /* backend_xnnpack in Frameworks */, - 03C818282AC760650084CC29 /* libMobileNetClassifier.a in Frameworks */, - 03D76BFB2BAD29B60040FD82 /* backend_coreml in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 03C818362AC79FCD0084CC29 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 032C01662AC228E5002955E1 = { - isa = PBXGroup; - children = ( - 032C01712AC228E6002955E1 /* ExecuTorchDemo */, - 032C01702AC228E6002955E1 /* Products */, - ); - sourceTree = ""; - }; - 032C01702AC228E6002955E1 /* Products */ = { - isa = PBXGroup; - children = ( - 032C016F2AC228E6002955E1 /* ExecuTorchDemo.app */, - 032C01CB2AC34632002955E1 /* libMobileNetClassifier.a */, - 03C8180A2AC66FC30084CC29 /* MobileNetClassifierTest.xctest */, - 03C818442AC79FCD0084CC29 /* libImageClassification.a */, - ); - name = Products; - sourceTree = ""; - }; - 032C01712AC228E6002955E1 /* ExecuTorchDemo */ = { - isa = PBXGroup; - children = ( - 032C019E2AC22B16002955E1 /* Resources */, - 032C01882AC22B16002955E1 /* Sources */, - ); - path = ExecuTorchDemo; - sourceTree = ""; - }; - 032C01882AC22B16002955E1 /* Sources */ = { - isa = PBXGroup; - children = ( - 032C01892AC22B16002955E1 /* App */, - 03C8182F2AC79F500084CC29 /* ImageClassification */, - 032C018F2AC22B16002955E1 /* MobileNet */, - ); - path = Sources; - sourceTree = ""; - }; - 032C01892AC22B16002955E1 /* App */ = { - isa = PBXGroup; - children = ( - 032C018B2AC22B16002955E1 /* App.swift */, - 032C018D2AC22B16002955E1 /* ContentView.swift */, - 03C8182B2AC790F40084CC29 /* CameraPreview.swift */, - 032C01B62AC329B6002955E1 /* CustomViews.swift */, - 032C01B82AC32ADF002955E1 /* CameraController.swift */, - 03C818292AC7901D0084CC29 /* ClassificationController.swift */, - ); - path = App; - sourceTree = ""; - }; - 032C018F2AC22B16002955E1 /* MobileNet */ = { - isa = PBXGroup; - children = ( - 03C818132AC6707F0084CC29 /* Test */, - 032C018A2AC22B16002955E1 /* MobileNetClassifier.swift */, - 032C018E2AC22B16002955E1 /* MobileNet-Bridging-Header.h */, - 032C01912AC22B16002955E1 /* MobileNetClassifier.h */, - 032C01902AC22B16002955E1 /* MobileNetClassifier.mm */, - ); - path = MobileNet; - sourceTree = ""; - }; - 032C019E2AC22B16002955E1 /* Resources */ = { - isa = PBXGroup; - children = ( - 03C818172AC671980084CC29 /* Examples */, - 032C019F2AC22B16002955E1 /* Models */, - ); - path = Resources; - sourceTree = ""; - }; - 032C019F2AC22B16002955E1 /* Models */ = { - isa = PBXGroup; - children = ( - 032C01A02AC22B16002955E1 /* MobileNet */, - ); - path = Models; - sourceTree = ""; - }; - 032C01A02AC22B16002955E1 /* MobileNet */ = { - isa = PBXGroup; - children = ( - 032C02012AC47CFB002955E1 /* imagenet_classes.txt */, - 036834D72ACB893700BA100F /* mv3_coreml_all.pte */, - 031B92F62ACF2A5400D4EBE0 /* mv3_mps_float16.pte */, - 032C01FC2AC47CFB002955E1 /* mv3_xnnpack_fp32.pte */, - 036834D42ACB710D00BA100F /* mv3.pte */, - ); - path = MobileNet; - sourceTree = ""; - }; - 03C818132AC6707F0084CC29 /* Test */ = { - isa = PBXGroup; - children = ( - 03C818232AC6E3010084CC29 /* MobileNetClassifierTest.swift */, - ); - path = Test; - sourceTree = ""; - }; - 03C818172AC671980084CC29 /* Examples */ = { - isa = PBXGroup; - children = ( - 03C8181C2AC69C280084CC29 /* Arctic fox.jpg */, - 03C818182AC671980084CC29 /* Samoyed.jpg */, - 03C8181E2AC69DFF0084CC29 /* hot pot.jpg */, - ); - path = Examples; - sourceTree = ""; - }; - 03C8182F2AC79F500084CC29 /* ImageClassification */ = { - isa = PBXGroup; - children = ( - 03C8182D2AC796A00084CC29 /* ImageClassification.swift */, - ); - path = ImageClassification; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 032C016E2AC228E6002955E1 /* App */ = { - isa = PBXNativeTarget; - buildConfigurationList = 032C017D2AC228E7002955E1 /* Build configuration list for PBXNativeTarget "App" */; - buildPhases = ( - 032C016B2AC228E6002955E1 /* Sources */, - 032C016C2AC228E6002955E1 /* Frameworks */, - 032C016D2AC228E6002955E1 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 032C01EB2AC34CA8002955E1 /* PBXTargetDependency */, - ); - name = App; - packageProductDependencies = ( - 03D76BF02BAD297E0040FD82 /* backend_coreml */, - 03D76BF42BAD297E0040FD82 /* backend_mps */, - 03D76BF62BAD297E0040FD82 /* kernels_portable */, - 03D76BF82BAD297E0040FD82 /* backend_xnnpack */, - ); - productName = ExecuTorchDemo; - productReference = 032C016F2AC228E6002955E1 /* ExecuTorchDemo.app */; - productType = "com.apple.product-type.application"; - }; - 032C01CA2AC34632002955E1 /* MobileNetClassifier */ = { - isa = PBXNativeTarget; - buildConfigurationList = 032C01D12AC34632002955E1 /* Build configuration list for PBXNativeTarget "MobileNetClassifier" */; - buildPhases = ( - 032C01C72AC34632002955E1 /* Sources */, - 032C01C82AC34632002955E1 /* Frameworks */, - 032C01C92AC34632002955E1 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - 03C818462AC7A0DB0084CC29 /* PBXTargetDependency */, - ); - name = MobileNetClassifier; - packageProductDependencies = ( - 03D76BF22BAD297E0040FD82 /* executorch */, - ); - productName = TorchModule; - productReference = 032C01CB2AC34632002955E1 /* libMobileNetClassifier.a */; - productType = "com.apple.product-type.library.static"; - }; - 03C818092AC66FC30084CC29 /* MobileNetClassifierTest */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03C818102AC66FC30084CC29 /* Build configuration list for PBXNativeTarget "MobileNetClassifierTest" */; - buildPhases = ( - 03C818062AC66FC30084CC29 /* Sources */, - 03C818072AC66FC30084CC29 /* Frameworks */, - 03C818082AC66FC30084CC29 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 84EF1FEA2C7850B6005922B4 /* PBXTargetDependency */, - ); - name = MobileNetClassifierTest; - packageProductDependencies = ( - 03D76BFA2BAD29B60040FD82 /* backend_coreml */, - 03D76BFC2BAD29B60040FD82 /* backend_mps */, - 03D76BFE2BAD29B60040FD82 /* kernels_portable */, - 03D76C002BAD29B60040FD82 /* backend_xnnpack */, - ); - productName = ExecuTorchDemoTests; - productReference = 03C8180A2AC66FC30084CC29 /* MobileNetClassifierTest.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; - 03C818302AC79FCD0084CC29 /* ImageClassification */ = { - isa = PBXNativeTarget; - buildConfigurationList = 03C818412AC79FCD0084CC29 /* Build configuration list for PBXNativeTarget "ImageClassification" */; - buildPhases = ( - 03C818312AC79FCD0084CC29 /* Sources */, - 03C818362AC79FCD0084CC29 /* Frameworks */, - 03C818402AC79FCD0084CC29 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = ImageClassification; - productName = TorchModule; - productReference = 03C818442AC79FCD0084CC29 /* libImageClassification.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 032C01672AC228E5002955E1 /* Project object */ = { - isa = PBXProject; - attributes = { - BuildIndependentTargetsInParallel = 1; - LastSwiftUpdateCheck = 1500; - LastUpgradeCheck = 1500; - TargetAttributes = { - 032C016E2AC228E6002955E1 = { - CreatedOnToolsVersion = 15.0; - }; - 032C01CA2AC34632002955E1 = { - CreatedOnToolsVersion = 15.0; - }; - 03C818092AC66FC30084CC29 = { - CreatedOnToolsVersion = 15.0; - LastSwiftMigration = 1500; - TestTargetID = 032C016E2AC228E6002955E1; - }; - }; - }; - buildConfigurationList = 032C016A2AC228E5002955E1 /* Build configuration list for PBXProject "ExecuTorchDemo" */; - compatibilityVersion = "Xcode 14.0"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 032C01662AC228E5002955E1; - packageReferences = ( - 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */, - ); - productRefGroup = 032C01702AC228E6002955E1 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 032C016E2AC228E6002955E1 /* App */, - 03C818302AC79FCD0084CC29 /* ImageClassification */, - 032C01CA2AC34632002955E1 /* MobileNetClassifier */, - 03C818092AC66FC30084CC29 /* MobileNetClassifierTest */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 032C016D2AC228E6002955E1 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 031B92F72ACF2A5400D4EBE0 /* mv3_mps_float16.pte in Resources */, - 036834D82ACB893700BA100F /* mv3_coreml_all.pte in Resources */, - 036834D52ACB710D00BA100F /* mv3.pte in Resources */, - 032C02082AC47CFB002955E1 /* imagenet_classes.txt in Resources */, - 032C02032AC47CFB002955E1 /* mv3_xnnpack_fp32.pte in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 03C818082AC66FC30084CC29 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 036834D62ACB710D00BA100F /* mv3.pte in Resources */, - 03C818482AC7BF470084CC29 /* imagenet_classes.txt in Resources */, - 03C8184A2AC7BF470084CC29 /* mv3_xnnpack_fp32.pte in Resources */, - 03C8181D2AC69C280084CC29 /* Arctic fox.jpg in Resources */, - 03C818192AC671980084CC29 /* Samoyed.jpg in Resources */, - 03C8181F2AC69DFF0084CC29 /* hot pot.jpg in Resources */, - 03C8DC7C2AE2533C0064384A /* mv3_coreml_all.pte in Resources */, - 03D494E22B5B7AE900FCF524 /* mv3_mps_float16.pte in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 032C016B2AC228E6002955E1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 032C01A52AC22B16002955E1 /* App.swift in Sources */, - 032C01A72AC22B16002955E1 /* ContentView.swift in Sources */, - 03C8182A2AC7901D0084CC29 /* ClassificationController.swift in Sources */, - 03C8182C2AC790F40084CC29 /* CameraPreview.swift in Sources */, - 032C01B72AC329B6002955E1 /* CustomViews.swift in Sources */, - 032C01B92AC32ADF002955E1 /* CameraController.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 032C01C72AC34632002955E1 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03C818252AC75E580084CC29 /* MobileNetClassifier.swift in Sources */, - 032C01E82AC34B60002955E1 /* MobileNetClassifier.mm in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 03C818062AC66FC30084CC29 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03C818242AC6E3010084CC29 /* MobileNetClassifierTest.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 03C818312AC79FCD0084CC29 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 03C818322AC79FCD0084CC29 /* ImageClassification.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 032C01EB2AC34CA8002955E1 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - platformFilter = ios; - target = 032C01CA2AC34632002955E1 /* MobileNetClassifier */; - targetProxy = 032C01EA2AC34CA8002955E1 /* PBXContainerItemProxy */; - }; - 03C818462AC7A0DB0084CC29 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 03C818302AC79FCD0084CC29 /* ImageClassification */; - targetProxy = 03C818452AC7A0DB0084CC29 /* PBXContainerItemProxy */; - }; - 84EF1FEA2C7850B6005922B4 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 032C016E2AC228E6002955E1 /* App */; - targetProxy = 84EF1FE92C7850B6005922B4 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 032C017B2AC228E7002955E1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "c++17"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = x86_64; - GCC_C_LANGUAGE_STANDARD = c17; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "-lc++", - "-all_load", - ); - SDKROOT = iphoneos; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)"; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - }; - name = Debug; - }; - 032C017C2AC228E7002955E1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "c++17"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_USER_SCRIPT_SANDBOXING = YES; - "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = x86_64; - GCC_C_LANGUAGE_STANDARD = c17; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 17.0; - LOCALIZATION_PREFERS_STRING_CATALOGS = YES; - OTHER_LDFLAGS = ( - "-lc++", - "-all_load", - ); - SDKROOT = iphoneos; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_VERSION = 5.0; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - 032C017E2AC228E7002955E1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = ""; - ENABLE_PREVIEWS = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSCameraUsageDescription = ""; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UIRequiresFullScreen = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.demo.test; - PRODUCT_NAME = "$(PROJECT_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; - SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_EMIT_LOC_STRINGS = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - 032C017F2AC228E7002955E1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = ""; - ENABLE_PREVIEWS = YES; - GENERATE_INFOPLIST_FILE = YES; - INFOPLIST_KEY_NSCameraUsageDescription = ""; - INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; - INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; - INFOPLIST_KEY_UILaunchScreen_Generation = YES; - INFOPLIST_KEY_UIRequiresFullScreen = YES; - INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.demo.test; - PRODUCT_NAME = "$(PROJECT_NAME)"; - PROVISIONING_PROFILE_SPECIFIER = ""; - SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; - SUPPORTS_MACCATALYST = NO; - SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_EMIT_LOC_STRINGS = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - 032C01D22AC34632002955E1 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_OBJC_BRIDGING_HEADER = "ExecuTorchDemo/Sources/MobileNet/MobileNet-Bridging-Header.h"; - }; - name = Debug; - }; - 032C01D32AC34632002955E1 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - SWIFT_OBJC_BRIDGING_HEADER = "ExecuTorchDemo/Sources/MobileNet/MobileNet-Bridging-Header.h"; - }; - name = Release; - }; - 03C818112AC66FC30084CC29 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.demo.test; - PRODUCT_NAME = "$(TARGET_NAME)"; - SUPPORTS_MACCATALYST = NO; - SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ExecuTorchDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ExecuTorchDemo"; - }; - name = Debug; - }; - 03C818122AC66FC30084CC29 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_MODULES = YES; - CURRENT_PROJECT_VERSION = 1; - GENERATE_INFOPLIST_FILE = YES; - MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = org.pytorch.executorch.demo.test; - PRODUCT_NAME = "$(TARGET_NAME)"; - SUPPORTS_MACCATALYST = NO; - SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ExecuTorchDemo.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/ExecuTorchDemo"; - }; - name = Release; - }; - 03C818422AC79FCD0084CC29 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 03C818432AC79FCD0084CC29 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 032C016A2AC228E5002955E1 /* Build configuration list for PBXProject "ExecuTorchDemo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 032C017B2AC228E7002955E1 /* Debug */, - 032C017C2AC228E7002955E1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 032C017D2AC228E7002955E1 /* Build configuration list for PBXNativeTarget "App" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 032C017E2AC228E7002955E1 /* Debug */, - 032C017F2AC228E7002955E1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 032C01D12AC34632002955E1 /* Build configuration list for PBXNativeTarget "MobileNetClassifier" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 032C01D22AC34632002955E1 /* Debug */, - 032C01D32AC34632002955E1 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03C818102AC66FC30084CC29 /* Build configuration list for PBXNativeTarget "MobileNetClassifierTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03C818112AC66FC30084CC29 /* Debug */, - 03C818122AC66FC30084CC29 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 03C818412AC79FCD0084CC29 /* Build configuration list for PBXNativeTarget "ImageClassification" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 03C818422AC79FCD0084CC29 /* Debug */, - 03C818432AC79FCD0084CC29 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - -/* Begin XCRemoteSwiftPackageReference section */ - 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */ = { - isa = XCRemoteSwiftPackageReference; - repositoryURL = "https://github.com/pytorch/executorch"; - requirement = { - branch = "swiftpm-0.7.0.20250401"; - kind = branch; - }; - }; -/* End XCRemoteSwiftPackageReference section */ - -/* Begin XCSwiftPackageProductDependency section */ - 03D76BF02BAD297E0040FD82 /* backend_coreml */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_coreml; - }; - 03D76BF22BAD297E0040FD82 /* executorch */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = executorch; - }; - 03D76BF42BAD297E0040FD82 /* backend_mps */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_mps; - }; - 03D76BF62BAD297E0040FD82 /* kernels_portable */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_portable; - }; - 03D76BF82BAD297E0040FD82 /* backend_xnnpack */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_xnnpack; - }; - 03D76BFA2BAD29B60040FD82 /* backend_coreml */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_coreml; - }; - 03D76BFC2BAD29B60040FD82 /* backend_mps */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_mps; - }; - 03D76BFE2BAD29B60040FD82 /* kernels_portable */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = kernels_portable; - }; - 03D76C002BAD29B60040FD82 /* backend_xnnpack */ = { - isa = XCSwiftPackageProductDependency; - package = 03D76BEF2BAD297E0040FD82 /* XCRemoteSwiftPackageReference "executorch" */; - productName = backend_xnnpack; - }; -/* End XCSwiftPackageProductDependency section */ - }; - rootObject = 032C01672AC228E5002955E1 /* Project object */; -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/xcshareddata/xcschemes/App.xcscheme b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/xcshareddata/xcschemes/App.xcscheme deleted file mode 100644 index e451ec338d6..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/xcshareddata/xcschemes/App.xcscheme +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/xcshareddata/xcschemes/MobileNetClassifierTest.xcscheme b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/xcshareddata/xcschemes/MobileNetClassifierTest.xcscheme deleted file mode 100644 index f042036feb9..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj/xcshareddata/xcschemes/MobileNetClassifierTest.xcscheme +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/Arctic fox.jpg b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/Arctic fox.jpg deleted file mode 100644 index ea1a5df91c4..00000000000 Binary files a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/Arctic fox.jpg and /dev/null differ diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/Samoyed.jpg b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/Samoyed.jpg deleted file mode 100644 index 12f0e0dd116..00000000000 Binary files a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/Samoyed.jpg and /dev/null differ diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/hot pot.jpg b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/hot pot.jpg deleted file mode 100644 index 8cde5eb752c..00000000000 Binary files a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Examples/hot pot.jpg and /dev/null differ diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/App.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/App.swift deleted file mode 100644 index ceddbde1e61..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/App.swift +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import SwiftUI - -@main -struct App: SwiftUI.App { - var body: some Scene { - WindowGroup { - ContentView() - } - } -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CameraController.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CameraController.swift deleted file mode 100644 index c4b58ee78ab..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CameraController.swift +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import AVFoundation -import SwiftUI - -enum CameraControllerError: Error { - case authorization(String) - case capture(String) - case setup(String) -} - -class CameraController: NSObject, ObservableObject, AVCapturePhotoCaptureDelegate { - let captureSession = AVCaptureSession() - private var photoOutput = AVCapturePhotoOutput() - private var timer: Timer? - private var callback: ((Result) -> Void)? - - func startCapturing(withTimeInterval interval: TimeInterval, - callback: @escaping (Result) -> Void) { - authorize { error in - if let error { - DispatchQueue.main.async { - callback(.failure(error)) - } - return - } - self.setup { error in - if let error { - DispatchQueue.main.async { - callback(.failure(error)) - } - return - } - self.captureSession.startRunning() - DispatchQueue.main.async { - self.callback = callback - self.timer = Timer.scheduledTimer(withTimeInterval: interval, repeats: true) { _ in - self.photoOutput.capturePhoto(with: AVCapturePhotoSettings(), delegate: self) - } - } - } - } - } - - private func authorize(_ completion: @escaping (Error?) -> Void) { - switch AVCaptureDevice.authorizationStatus(for: .video) { - case .authorized: - DispatchQueue.global(qos: .userInitiated).async { - completion(nil) - } - case .notDetermined: - AVCaptureDevice.requestAccess(for: .video) { granted in - DispatchQueue.global(qos: .userInitiated).async { - if granted { - completion(nil) - } else { - completion(CameraControllerError.authorization("Camera access denied")) - } - } - } - default: - DispatchQueue.global(qos: .userInitiated).async { - completion(CameraControllerError.authorization("Camera access denied")) - } - } - } - - private func setup(_ callback: (Error?) -> Void) { - guard let videoCaptureDevice = AVCaptureDevice.default(for: .video) - else { - callback(CameraControllerError.setup("Cannot get video capture device")) - return - } - let videoInput: AVCaptureDeviceInput - do { - videoInput = try AVCaptureDeviceInput(device: videoCaptureDevice) - } catch { - callback(CameraControllerError.setup("Cannot set up video input: \(error)")) - return - } - if captureSession.canAddInput(videoInput) { - captureSession.addInput(videoInput) - } else { - callback(CameraControllerError.setup("Cannot add video input")) - return - } - if captureSession.canAddOutput(photoOutput) { - captureSession.addOutput(photoOutput) - } else { - callback(CameraControllerError.setup("Cannot add photo output")) - return - } - callback(nil) - } - - func photoOutput(_ output: AVCapturePhotoOutput, didFinishProcessingPhoto photo: AVCapturePhoto, error: Error?) { - guard let callback = self.callback else { - print("No image capturing callback set") - return - } - if let error { - callback(.failure(CameraControllerError.capture("Image capture error: \(error)"))) - } - guard let imageData = photo.fileDataRepresentation(), - let image = UIImage(data: imageData), - let cgImage = image.cgImage - else { - callback(.failure(CameraControllerError.capture("Couldn't get image data"))) - return - } - var orientation = UIImage.Orientation.up - switch UIDevice.current.orientation { - case .portrait: - orientation = .right - case .portraitUpsideDown: - orientation = .left - case .landscapeRight: - orientation = .down - default: - break - } - callback(.success(UIImage(cgImage: cgImage, scale: image.scale, orientation: orientation))) - } -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CameraPreview.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CameraPreview.swift deleted file mode 100644 index 0a7d9f8b5af..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CameraPreview.swift +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import AVFoundation -import SwiftUI - -struct CameraPreview: UIViewRepresentable { - let captureSession: AVCaptureSession - - func makeUIView(context: Context) -> UIView { - let view = CameraView(frame: UIScreen.main.bounds) - view.videoPreviewLayer?.session = captureSession - return view - } - - func updateUIView(_ uiView: UIView, context: Context) { - if let view = uiView as? CameraView { - view.videoPreviewLayer?.frame = uiView.bounds - } - } -} - -final class CameraView: UIView { - override class var layerClass: AnyClass { - return AVCaptureVideoPreviewLayer.self - } - - var videoPreviewLayer: AVCaptureVideoPreviewLayer? { - return layer as? AVCaptureVideoPreviewLayer - } -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/ClassificationController.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/ClassificationController.swift deleted file mode 100644 index 5a50da9c22d..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/ClassificationController.swift +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import ImageClassification -import MobileNetClassifier -import SwiftUI - -enum Mode: String, CaseIterable { - case xnnpack = "XNNPACK" - case coreML = "Core ML" - case mps = "MPS" -} - -class ClassificationController: ObservableObject { - @AppStorage("mode") var mode: Mode = .xnnpack - @Published var classifications: [Classification] = [] - @Published var elapsedTime: TimeInterval = 0.0 - @Published var isRunning = false - - private let queue = DispatchQueue(label: "org.pytorch.executorch.demo", qos: .userInitiated) - private var classifier: ImageClassification? - private var currentMode: Mode = .xnnpack - - func classify(_ image: UIImage) { - guard !isRunning else { - print("Dropping frame") - return - } - isRunning = true - - if currentMode != mode { - currentMode = mode - classifier = nil - } - queue.async { - var classifications: [Classification] = [] - var elapsedTime: TimeInterval = -1 - do { - if self.classifier == nil { - self.classifier = try self.createClassifier(for: self.currentMode) - } - let startTime = CFAbsoluteTimeGetCurrent() - classifications = try self.classifier?.classify(image: image) ?? [] - elapsedTime = (CFAbsoluteTimeGetCurrent() - startTime) * 1000 - } catch { - print("Error classifying image: \(error)") - } - DispatchQueue.main.async { - self.classifications = classifications - self.elapsedTime = elapsedTime - self.isRunning = false - } - } - } - - private func createClassifier(for mode: Mode) throws -> ImageClassification? { - let modelFileName: String - switch mode { - case .coreML: - modelFileName = "mv3_coreml_all" - case .mps: - modelFileName = "mv3_mps_float16" - case .xnnpack: - modelFileName = "mv3_xnnpack_fp32" - } - guard let modelFilePath = Bundle.main.path(forResource: modelFileName, ofType: "pte"), - let labelsFilePath = Bundle.main.path(forResource: "imagenet_classes", ofType: "txt") - else { return nil } - return try MobileNetClassifier(modelFilePath: modelFilePath, labelsFilePath: labelsFilePath) - } -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/ContentView.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/ContentView.swift deleted file mode 100644 index 9005a20d1af..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/ContentView.swift +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import AVFoundation -import SwiftUI - -struct ContentView: View { - @StateObject private var cameraController = CameraController() - @StateObject private var classificationController = ClassificationController() - - var body: some View { - ZStack { - cameraPreview - controlPanel - } - } - - private var cameraPreview: some View { - CameraPreview(captureSession: cameraController.captureSession) - .aspectRatio(contentMode: .fill) - .edgesIgnoringSafeArea(.all) - .onAppear(perform: startCapturing) - .onDisappear(perform: stopCapturing) - } - - private var controlPanel: some View { - VStack(spacing: 0) { - TopBar(title: "ExecuTorch Demo") - ClassificationLabelView(controller: classificationController) - Spacer() - ClassificationTimeView(controller: classificationController) - ModeSelector(controller: classificationController) - } - } - - private func startCapturing() { - UIApplication.shared.isIdleTimerDisabled = true - cameraController.startCapturing(withTimeInterval: 1.0) { result in - switch result { - case .success(let image): - self.classificationController.classify(image) - case .failure(let error): - self.handleError(error) - } - } - } - - private func stopCapturing() { - UIApplication.shared.isIdleTimerDisabled = false - } - - private func handleError(_ error: Error) { - stopCapturing() - print(error) - } -} - -struct ContentView_Previews: PreviewProvider { - static var previews: some View { - ContentView() - } -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CustomViews.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CustomViews.swift deleted file mode 100644 index d00fefdb514..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/App/CustomViews.swift +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import AVFoundation -import ImageClassification -import SwiftUI - -struct TopBar: View { - let title: String - - var body: some View { - Text(title) - .font(.title) - .foregroundColor(.white) - .frame(maxWidth: .infinity) - .background(Color.black.opacity(0.5)) - } -} - -struct ClassificationLabelView: View { - @ObservedObject var controller: ClassificationController - - var body: some View { - VStack(alignment: .leading) { - ForEach(controller.classifications.prefix(3), id: \.label) { classification in - Text("\(classification.label) \(Int(classification.confidence * 100))%") - .font(.footnote) - .foregroundColor(.white) - } - } - .padding() - .frame(maxWidth: .infinity) - .background(Color.black.opacity(0.5)) - } -} - -struct ClassificationTimeView: View { - @ObservedObject var controller: ClassificationController - - var body: some View { - VStack { - if controller.isRunning { - ProgressView() - .progressViewStyle(CircularProgressViewStyle(tint: .white)) - .frame(width: nil, height: 34, alignment: .center) - } else { - Text("\n\(controller.elapsedTime, specifier: "%.2f") ms") - .font(.footnote) - .foregroundColor(.white) - } - } - .frame(maxWidth: .infinity) - .background(Color.black.opacity(0.5)) - } -} - -struct ModeSelector: View { - @ObservedObject var controller: ClassificationController - - var body: some View { - HStack { - ForEach(Mode.allCases, id: \.self) { mode in - ModeButton(mode: mode, controller: controller) - } - } - .padding() - .frame(maxWidth: .infinity) - .background(Color.black.opacity(0.5)) - } -} - -struct ModeButton: View { - var mode: Mode - @ObservedObject var controller: ClassificationController - - var body: some View { - Button(action: { controller.mode = mode }) { - Text(mode.rawValue) - .fontWeight(.semibold) - .foregroundColor(.white) - .padding(.horizontal, 10) - .padding(.vertical, 5) - .background(controller.mode == mode ? Color.red : Color.clear) - .cornerRadius(15) - } - } -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/ImageClassification/ImageClassification.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/ImageClassification/ImageClassification.swift deleted file mode 100644 index 1c515e98a62..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/ImageClassification/ImageClassification.swift +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import UIKit - -public struct Classification { - public let label: String - public let confidence: Float - - public init(label: String, confidence: Float) { - self.label = label - self.confidence = confidence - } -} - -public protocol ImageClassification { - func classify(image: UIImage) throws -> [Classification] -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNet-Bridging-Header.h b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNet-Bridging-Header.h deleted file mode 100644 index 6d1eb27932b..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNet-Bridging-Header.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "MobileNetClassifier.h" diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.h b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.h deleted file mode 100644 index 74051909a36..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -FOUNDATION_EXPORT NSErrorDomain const ETMobileNetClassifierErrorDomain; - -@interface ETMobileNetClassifier : NSObject - -- (instancetype)initWithFilePath:(NSString*)filePath; -- (BOOL)classifyWithInput:(float*)input - output:(float*)output - outputSize:(NSInteger)predictionBufferSize - error:(NSError**)error; - -@end - -NS_ASSUME_NONNULL_END diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.mm b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.mm deleted file mode 100644 index 59b66e510bd..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.mm +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "MobileNetClassifier.h" - -#import -#import - -using namespace ::executorch::extension; - -NSErrorDomain const ETMobileNetClassifierErrorDomain = - @"MobileNetClassifierErrorDomain"; -const int32_t kSize = 224; -const int32_t kChannels = 3; - -@implementation ETMobileNetClassifier { - std::unique_ptr _module; -} - -- (instancetype)initWithFilePath:(NSString*)filePath { - self = [super init]; - if (self) { - _module = std::make_unique(filePath.UTF8String); - } - return self; -} - -- (BOOL)classifyWithInput:(float*)input - output:(float*)output - outputSize:(NSInteger)outputSize - error:(NSError**)error { - const auto result = - _module->forward(from_blob(input, {1, kChannels, kSize, kSize})); - - if (!result.ok()) { - if (error) { - *error = [NSError - errorWithDomain:ETMobileNetClassifierErrorDomain - code:NSInteger(result.error()) - userInfo:@{ - NSLocalizedDescriptionKey : [NSString - stringWithFormat: - @"Failed to run forward on the torch module, error code: %i", - result.error()] - }]; - } - return NO; - } - const auto outputData = result->at(0).toTensor().const_data_ptr(); - std::copy(outputData, outputData + outputSize, output); - - return YES; -} - -@end diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.swift deleted file mode 100644 index b7a6e30a285..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/MobileNetClassifier.swift +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import ExecuTorch -import ImageClassification -import UIKit - -import os.log - -public enum MobileNetClassifierError: Error { - case inputPointer - case rawData - case transform - - var localizedDescription: String { - switch self { - case .inputPointer: - return "Cannot get the input pointer base address" - case .rawData: - return "Cannot get the pixel data from the image" - case .transform: - return "Cannot transform the image" - } - } -} - -// See https://pytorch.org/vision/main/models/generated/torchvision.models.mobilenet_v3_small.html -// on model input/output spec. -public class MobileNetClassifier: ImageClassification { - private static let resizeSize: CGFloat = 256 - private static let cropSize: CGFloat = 224 - - private var mobileNetClassifier: ETMobileNetClassifier - private var labels: [String] = [] - private var rawDataBuffer: [UInt8] - private var normalizedBuffer: [Float] - - public init?(modelFilePath: String, labelsFilePath: String) throws { - labels = try String(contentsOfFile: labelsFilePath, encoding: .utf8) - .components(separatedBy: .newlines) - mobileNetClassifier = ETMobileNetClassifier(filePath: modelFilePath) - rawDataBuffer = [UInt8](repeating: 0, count: Int(Self.cropSize * Self.cropSize) * 4) - normalizedBuffer = [Float](repeating: 0, count: rawDataBuffer.count / 4 * 3) - - #if DEBUG - Log.shared.add(sink: self) - #endif - } - - deinit { - #if DEBUG - Log.shared.remove(sink: self) - #endif - } - - public func classify(image: UIImage) throws -> [Classification] { - var input = try normalize(rawData(from: transformed(image))) - var output = [Float](repeating: 0, count: labels.count) - - try input.withUnsafeMutableBufferPointer { inputPointer in - guard let inputPointerBaseAddress = inputPointer.baseAddress else { - throw MobileNetClassifierError.inputPointer - } - try mobileNetClassifier.classify( - withInput: inputPointerBaseAddress, - output: &output, - outputSize: labels.count) - } - return softmax(output).enumerated().sorted(by: { $0.element > $1.element }) - .compactMap { (index, probability) -> Classification? in - guard index < labels.count else { return nil } - return Classification(label: labels[index], confidence: probability) - } - } - - private func transformed(_ image: UIImage) throws -> UIImage { - let aspectRatio = image.size.width / image.size.height - let targetSize = - aspectRatio > 1 - ? CGSize(width: Self.resizeSize * aspectRatio, height: Self.resizeSize) - : CGSize(width: Self.resizeSize, height: Self.resizeSize / aspectRatio) - let cropRect = CGRect( - x: (targetSize.width - Self.cropSize) / 2, - y: (targetSize.height - Self.cropSize) / 2, - width: Self.cropSize, - height: Self.cropSize) - - UIGraphicsBeginImageContextWithOptions(cropRect.size, false, 1) - defer { UIGraphicsEndImageContext() } - image.draw( - in: CGRect( - x: -cropRect.origin.x, - y: -cropRect.origin.y, - width: targetSize.width, - height: targetSize.height)) - guard let resizedAndCroppedImage = UIGraphicsGetImageFromCurrentImageContext() - else { - throw MobileNetClassifierError.transform - } - return resizedAndCroppedImage - } - - private func rawData(from image: UIImage) throws -> [UInt8] { - guard let cgImage = image.cgImage else { - throw MobileNetClassifierError.rawData - } - let context = CGContext( - data: &rawDataBuffer, - width: cgImage.width, - height: cgImage.height, - bitsPerComponent: 8, - bytesPerRow: cgImage.width * 4, - space: CGColorSpaceCreateDeviceRGB(), - bitmapInfo: CGImageAlphaInfo.premultipliedLast.rawValue | CGBitmapInfo.byteOrder32Big.rawValue - ) - context?.draw( - cgImage, - in: CGRect( - origin: CGPoint.zero, - size: CGSize(width: cgImage.width, height: cgImage.height))) - return rawDataBuffer - } - - private func normalize(_ rawData: [UInt8]) -> [Float] { - let mean: [Float] = [0.485, 0.456, 0.406] - let std: [Float] = [0.229, 0.224, 0.225] - let pixelCount = rawData.count / 4 - - for i in 0.. [Float] { - let maxInput = input.max() ?? 0 - let expInput = input.map { exp($0 - maxInput) } - let sumExpInput = expInput.reduce(0, +) - return expInput.map { $0 / sumExpInput } - } -} - -#if DEBUG -extension MobileNetClassifier: LogSink { - public func log(level: LogLevel, timestamp: TimeInterval, filename: String, line: UInt, message: String) { - let logMessage = "executorch:\(filename):\(line) \(message)" - - switch level { - case .debug: - os_log(.debug, "%{public}@", logMessage) - case .info: - os_log(.info, "%{public}@", logMessage) - case .error: - os_log(.error, "%{public}@", logMessage) - case .fatal: - os_log(.fault, "%{public}@", logMessage) - default: - os_log("%{public}@", logMessage) - } - } -} -#endif diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/Test/MobileNetClassifierTest.swift b/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/Test/MobileNetClassifierTest.swift deleted file mode 100644 index 7936699bb9b..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Sources/MobileNet/Test/MobileNetClassifierTest.swift +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -import ImageClassification -import XCTest - -@testable import MobileNetClassifier - -final class MobileNetClassifierTest: XCTestCase { - - func testV3WithPortableBackend() throws { - try run(model: "mv3") - } - - func testV3WithCoreMLBackend() throws { - try run(model: "mv3_coreml_all") - } - - func testV3WithMPSBackend() throws { - try run(model: "mv3_mps_float16") - } - - func testV3WithXNNPACKBackend() throws { - try run(model: "mv3_xnnpack_fp32") - } - - private func run(model modelName: String) throws { - guard - let modelFilePath = Bundle(for: type(of: self)) - .path(forResource: modelName, ofType: "pte") - else { - XCTFail("Failed to get model path") - return - } - guard - let labelsFilePath = Bundle(for: type(of: self)) - .path(forResource: "imagenet_classes", ofType: "txt") - else { - XCTFail("Failed to get labels path") - return - } - let classifier = try MobileNetClassifier( - modelFilePath: modelFilePath, - labelsFilePath: labelsFilePath) - for expectedClassification in [ - Classification(label: "Arctic fox", confidence: 0.9), - Classification(label: "Samoyed", confidence: 0.7), - Classification(label: "hot pot", confidence: 0.8), - ] { - guard - let imagePath = Bundle(for: type(of: self)) - .path(forResource: expectedClassification.label, ofType: "jpg"), - let image = UIImage(contentsOfFile: imagePath) - else { - XCTFail("Failed to get image path or image") - return - } - guard let classification = try classifier?.classify(image: image).first - else { - XCTFail("Failed to run the model") - return - } - XCTAssertEqual(classification.label, expectedClassification.label) - XCTAssertGreaterThan(classification.confidence, expectedClassification.confidence) - } - } -} diff --git a/examples/demo-apps/apple_ios/ExecuTorchDemo/README.md b/examples/demo-apps/apple_ios/ExecuTorchDemo/README.md deleted file mode 100644 index a66a1f75954..00000000000 --- a/examples/demo-apps/apple_ios/ExecuTorchDemo/README.md +++ /dev/null @@ -1,136 +0,0 @@ -# Building an ExecuTorch iOS Demo App - -Welcome to the tutorial on setting up the ExecuTorch iOS Demo App! - -This app uses the -[MobileNet v3](https://pytorch.org/vision/main/models/mobilenetv3.html) model to -process live camera images leveraging three different backends: -[XNNPACK](https://github.com/google/XNNPACK), -[Core ML](https://developer.apple.com/documentation/coreml) and -[Metal Performance Shaders (MPS)](https://developer.apple.com/documentation/metalperformanceshaders) -(Xcode 15+ and iOS 17+ only). - -![](_static/img/demo_ios_app.jpg) - -## Prerequisites - -Before we start, make sure you have the following tools installed: - -### 1. Xcode 15 and Command Line Tools - -Install Xcode 15 from the -[Mac App Store](https://apps.apple.com/app/xcode/id497799835) and then install -the Command Line Tools using the terminal: - -```bash -xcode-select --install -``` - -### 2. Python 3.10+ - -Python 3.10 or above, along with `pip`, should be pre-installed on MacOS 13.5+. -If needed, [download Python](https://www.python.org/downloads/macos/) and -install it. Verify the Python and pip versions using these commands: - -```bash -which python3 pip -python3 --version -pip --version -``` - -### 3. Getting Started Tutorial - -Follow the [Setting Up ExecuTorch](https://pytorch.org/executorch/stable/getting-started-setup) -tutorial to configure the basic environment: - -```bash -git clone -b viable/strict https://github.com/pytorch/executorch.git && cd executorch - -python3 -m venv .venv && source .venv/bin/activate - -pip install --upgrade cmake pip setuptools wheel - -./install_executorch.sh --pybind coreml mps xnnpack -``` - -### 4. Backend Dependencies - -Also, follow the corresponding sections from [Core ML](https://pytorch.org/executorch/stable/build-run-coreml) and -[MPS](https://pytorch.org/executorch/stable/build-run-mps) tutorials to install additional dependencies for those -backends: - -```bash -./backends/apple/coreml/scripts/install_requirements.sh - -./backends/apple/mps/install_requirements.sh -``` - -## Models and Labels - -Now, let's move on to exporting and bundling the MobileNet v3 model. - -### 1. Export Model - -Export the MobileNet v3 model with Core ML, MPS and XNNPACK backends, and move -the exported model to a specific location where the Demo App will pick them up: - -```bash -MODEL_NAME="mv3" - -python3 -m examples.portable.scripts.export --model_name="$MODEL_NAME" -python3 -m examples.apple.coreml.scripts.export --model_name="$MODEL_NAME" -python3 -m examples.apple.mps.scripts.mps_example --model_name="$MODEL_NAME" -python3 -m examples.xnnpack.aot_compiler --model_name="$MODEL_NAME" --delegate - -mkdir -p examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Models/MobileNet/ -mv "$MODEL_NAME*.pte" examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Models/MobileNet/ -``` - -### 2. Download Labels - -Download the MobileNet model labels required for image classification: - -```bash -curl https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt \ - -o examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo/Resources/Models/MobileNet/imagenet_classes.txt -``` - -## Final Steps - -We're almost done! Now, we just need to open the project in Xcode, run the -tests, and finally run the app. - -### 1. Open Project in Xcode - -Double-click on the project file under -`examples/demo-apps/apple_ios/ExecuTorchDemo` or run the command: - -```bash -open examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj -``` - -### 2. Run Tests - -You can run tests on Simulaltor directly in Xcode with `Cmd + U` or use the -command line: - -```bash -xcrun simctl create executorch "iPhone 15" -xcodebuild clean test \ - -project examples/demo-apps/apple_ios/ExecuTorchDemo/ExecuTorchDemo.xcodeproj \ - -scheme App \ - -destination name=executorch -xcrun simctl delete executorch -``` - -### 3. Run App - -Finally, connect the device, set up Code Signing in Xcode, and then run the app -using `Cmd + R`. Try installing a Release build for better performance. - -Congratulations! You've successfully set up the ExecuTorch iOS Demo App. Now, -you can explore and enjoy the power of ExecuTorch on your iOS device! - -Learn more about integrating and running [ExecuTorch on Apple](https://pytorch.org/executorch/stable/apple-runtime) platforms. - -![](_static/img/demo_ios_xcode.jpg)