From b0961c7eabe9d01131a6614f02416ed5bc957c0f Mon Sep 17 00:00:00 2001 From: Rodrigo Dutra de Oliveira Date: Mon, 5 Sep 2022 23:55:38 -0300 Subject: [PATCH 1/3] Add SPM --- .github/workflows/swift.yml | 19 + .gitignore | 3 + .../contents.xcworkspacedata | 7 + Demo/CoreMLHelpers/CoreMLHelpers.h | 11 - Demo/CoreMLHelpers/Info.plist | 24 - Demo/Demo.xcodeproj/project.pbxproj | 608 ++---------------- Package.swift | 45 ++ .../CoreMLHelpers}/Array+Extensions.swift | 0 .../CGImage+CVPixelBuffer.swift | 2 + .../CoreMLHelpers}/CGImage+RawBytes.swift | 0 .../CGImagePropertyOrientation.swift | 2 +- .../CoreMLHelpers}/CVPixelBuffer+Create.swift | 16 +- .../CoreMLHelpers}/CVPixelBuffer+Resize.swift | 2 + .../CoreMLHelpers}/CVPixelBuffer+Rotate.swift | 3 +- .../CoreMLHelpers}/CoreML+Combine.swift | 0 .../CoreMLHelpers}/MLModel+Images.swift | 0 .../CoreMLHelpers}/MLMultiArray+Helpers.swift | 0 .../CoreMLHelpers}/MLMultiArray+Image.swift | 0 .../CoreMLHelpers}/Math.swift | 0 .../CoreMLHelpers}/NonMaxSuppression.swift | 0 .../CoreMLHelpers}/Predictions.swift | 3 +- .../UIImage+CVPixelBuffer.swift | 2 +- .../CoreMLHelpers}/UIImage+Extensions.swift | 2 +- .../CoreMLHelpers}/UIImage+RawBytes.swift | 0 .../Experimental}/MultiArray.swift | 2 +- .../CoreMLHelpersTests.swift | 11 + .../CoreMLHelpersTests/MultiArrayTests.swift | 130 ++++ 27 files changed, 299 insertions(+), 593 deletions(-) create mode 100644 .github/workflows/swift.yml create mode 100644 .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata delete mode 100644 Demo/CoreMLHelpers/CoreMLHelpers.h delete mode 100644 Demo/CoreMLHelpers/Info.plist create mode 100644 Package.swift rename {CoreMLHelpers => Sources/CoreMLHelpers}/Array+Extensions.swift (100%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/CGImage+CVPixelBuffer.swift (99%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/CGImage+RawBytes.swift (100%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/CGImagePropertyOrientation.swift (98%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/CVPixelBuffer+Create.swift (92%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/CVPixelBuffer+Resize.swift (99%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/CVPixelBuffer+Rotate.swift (99%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/CoreML+Combine.swift (100%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/MLModel+Images.swift (100%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/MLMultiArray+Helpers.swift (100%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/MLMultiArray+Image.swift (100%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/Math.swift (100%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/NonMaxSuppression.swift (100%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/Predictions.swift (98%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/UIImage+CVPixelBuffer.swift (99%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/UIImage+Extensions.swift (98%) rename {CoreMLHelpers => Sources/CoreMLHelpers}/UIImage+RawBytes.swift (100%) rename {Experimental => Sources/Experimental}/MultiArray.swift (99%) create mode 100644 Tests/CoreMLHelpersTests/CoreMLHelpersTests.swift create mode 100644 Tests/CoreMLHelpersTests/MultiArrayTests.swift diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml new file mode 100644 index 0000000..49c6852 --- /dev/null +++ b/.github/workflows/swift.yml @@ -0,0 +1,19 @@ +name: Swift + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: macos-latest + + steps: + - uses: actions/checkout@v3 + - name: Build + run: swift build -v + - name: Test + run: swift test -v diff --git a/.gitignore b/.gitignore index af5e335..2f4807e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ Pods/ .Spotlight-V100 *.swp *.lock + +swiftpm/xcode +.build/ diff --git a/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Demo/CoreMLHelpers/CoreMLHelpers.h b/Demo/CoreMLHelpers/CoreMLHelpers.h deleted file mode 100644 index 7186021..0000000 --- a/Demo/CoreMLHelpers/CoreMLHelpers.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -//! Project version number for CoreMLHelpers. -FOUNDATION_EXPORT double CoreMLHelpersVersionNumber; - -//! Project version string for CoreMLHelpers. -FOUNDATION_EXPORT const unsigned char CoreMLHelpersVersionString[]; - -// In this header, you should import all the public headers of your framework using statements like #import - - diff --git a/Demo/CoreMLHelpers/Info.plist b/Demo/CoreMLHelpers/Info.plist deleted file mode 100644 index 1007fd9..0000000 --- a/Demo/CoreMLHelpers/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - NSPrincipalClass - - - diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj index 50992c9..7ba119b 100644 --- a/Demo/Demo.xcodeproj/project.pbxproj +++ b/Demo/Demo.xcodeproj/project.pbxproj @@ -3,19 +3,13 @@ archiveVersion = 1; classes = { }; - objectVersion = 48; + objectVersion = 52; objects = { /* Begin PBXBuildFile section */ - 7B30A79B25AF29CB0092647B /* CVPixelBuffer+Rotate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79825AF29CB0092647B /* CVPixelBuffer+Rotate.swift */; }; - 7B30A79C25AF29CB0092647B /* CVPixelBuffer+Rotate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79825AF29CB0092647B /* CVPixelBuffer+Rotate.swift */; }; - 7B30A79D25AF29CB0092647B /* CVPixelBuffer+Rotate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79825AF29CB0092647B /* CVPixelBuffer+Rotate.swift */; }; - 7B30A79E25AF29CB0092647B /* CVPixelBuffer+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79925AF29CB0092647B /* CVPixelBuffer+Create.swift */; }; - 7B30A79F25AF29CB0092647B /* CVPixelBuffer+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79925AF29CB0092647B /* CVPixelBuffer+Create.swift */; }; - 7B30A7A025AF29CB0092647B /* CVPixelBuffer+Create.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79925AF29CB0092647B /* CVPixelBuffer+Create.swift */; }; - 7B30A7A125AF29CB0092647B /* CVPixelBuffer+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79A25AF29CB0092647B /* CVPixelBuffer+Resize.swift */; }; - 7B30A7A225AF29CB0092647B /* CVPixelBuffer+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79A25AF29CB0092647B /* CVPixelBuffer+Resize.swift */; }; - 7B30A7A325AF29CB0092647B /* CVPixelBuffer+Resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B30A79A25AF29CB0092647B /* CVPixelBuffer+Resize.swift */; }; + 3D6A419828C6ECBF00DC2EA9 /* CoreMLHelpers in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A419628C6EC9400DC2EA9 /* CoreMLHelpers */; }; + 3D6A419928C6ECD200DC2EA9 /* CoreMLHelpers in Resources */ = {isa = PBXBuildFile; fileRef = 3D6A419628C6EC9400DC2EA9 /* CoreMLHelpers */; }; + 3D6A419C28C6ED0A00DC2EA9 /* CoreMLHelpers in Frameworks */ = {isa = PBXBuildFile; productRef = 3D6A419B28C6ED0A00DC2EA9 /* CoreMLHelpers */; }; 7B4A36111F35E6FA009A6364 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A36101F35E6FA009A6364 /* AppDelegate.swift */; }; 7B4A36131F35E6FA009A6364 /* ImageViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A36121F35E6FA009A6364 /* ImageViewController.swift */; }; 7B4A36161F35E6FA009A6364 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B4A36141F35E6FA009A6364 /* Main.storyboard */; }; @@ -23,59 +17,10 @@ 7B4A361B1F35E6FA009A6364 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7B4A36191F35E6FA009A6364 /* LaunchScreen.storyboard */; }; 7B4A36281F35EA6E009A6364 /* cat.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 7B4A36271F35EA6E009A6364 /* cat.jpg */; }; 7B4AFF7F1F40863100AF62F3 /* MultiArrayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4AFF7E1F40863100AF62F3 /* MultiArrayTests.swift */; }; - 7B4AFF8F1F40874000AF62F3 /* CoreMLHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4AFF8D1F40874000AF62F3 /* CoreMLHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7B4AFF921F40874000AF62F3 /* CoreMLHelpers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7B4AFF8B1F40873F00AF62F3 /* CoreMLHelpers.framework */; }; - 7B4AFF931F40874000AF62F3 /* CoreMLHelpers.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 7B4AFF8B1F40873F00AF62F3 /* CoreMLHelpers.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 7B4AFF9E1F408A1400AF62F3 /* UIImage+CVPixelBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A36231F35E760009A6364 /* UIImage+CVPixelBuffer.swift */; }; - 7B4AFFA11F408AFD00AF62F3 /* Array+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A36241F35E760009A6364 /* Array+Extensions.swift */; }; - 7B4AFFA31F408B0400AF62F3 /* Predictions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B43E9B11F361DBF0034B9BA /* Predictions.swift */; }; 7B4AFFA51F408CD000AF62F3 /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4AFFA41F408CD000AF62F3 /* MenuViewController.swift */; }; 7B4AFFA71F408E4500AF62F3 /* NMSViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4AFFA61F408E4500AF62F3 /* NMSViewController.swift */; }; 7B4AFFA91F408FAB00AF62F3 /* BoundingBoxView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4AFFA81F408FAB00AF62F3 /* BoundingBoxView.swift */; }; - 7B4AFFAA1F4095B200AF62F3 /* NonMaxSuppression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A362F1F35F10C009A6364 /* NonMaxSuppression.swift */; }; 7B5603661F470A1D004635EE /* cat.bin in Resources */ = {isa = PBXBuildFile; fileRef = 7B5603651F470A1D004635EE /* cat.bin */; }; - 7B5603681F470C60004635EE /* MLMultiArray+Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5603671F470C60004635EE /* MLMultiArray+Image.swift */; }; - 7B56036C1F47659C004635EE /* Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B56036B1F47659C004635EE /* Math.swift */; }; - 7B6B4F2122983987002D95D0 /* Array+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A36241F35E760009A6364 /* Array+Extensions.swift */; }; - 7B6B4F2222983987002D95D0 /* CGImage+CVPixelBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898D421AC452D00A37D3E /* CGImage+CVPixelBuffer.swift */; }; - 7B6B4F2322983987002D95D0 /* CGImage+RawBytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898D221AC429900A37D3E /* CGImage+RawBytes.swift */; }; - 7B6B4F2422983987002D95D0 /* CGImagePropertyOrientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898A821A49BFF00A37D3E /* CGImagePropertyOrientation.swift */; }; - 7B6B4F2622983987002D95D0 /* Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B56036B1F47659C004635EE /* Math.swift */; }; - 7B6B4F2722983987002D95D0 /* MLMultiArray+Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5603671F470C60004635EE /* MLMultiArray+Image.swift */; }; - 7B6B4F2822983987002D95D0 /* MLMultiArray+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898CC21A5832800A37D3E /* MLMultiArray+Helpers.swift */; }; - 7B6B4F2922983987002D95D0 /* NonMaxSuppression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A362F1F35F10C009A6364 /* NonMaxSuppression.swift */; }; - 7B6B4F2A22983987002D95D0 /* Predictions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B43E9B11F361DBF0034B9BA /* Predictions.swift */; }; - 7B6B4F2B22983987002D95D0 /* UIImage+CVPixelBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A36231F35E760009A6364 /* UIImage+CVPixelBuffer.swift */; }; - 7B6B4F2C22983987002D95D0 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898BF21A49D7300A37D3E /* UIImage+Extensions.swift */; }; - 7B6B4F2D22983987002D95D0 /* UIImage+RawBytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898A621A47FEB00A37D3E /* UIImage+RawBytes.swift */; }; - 7B6B4F2E22983987002D95D0 /* MultiArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898C221A4A95C00A37D3E /* MultiArray.swift */; }; - 7B6B4F2F22983A2C002D95D0 /* CoreMLHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4AFF8D1F40874000AF62F3 /* CoreMLHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7B6B4F3D22983A80002D95D0 /* Array+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A36241F35E760009A6364 /* Array+Extensions.swift */; }; - 7B6B4F3E22983A80002D95D0 /* CGImage+CVPixelBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898D421AC452D00A37D3E /* CGImage+CVPixelBuffer.swift */; }; - 7B6B4F3F22983A80002D95D0 /* CGImage+RawBytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898D221AC429900A37D3E /* CGImage+RawBytes.swift */; }; - 7B6B4F4022983A80002D95D0 /* CGImagePropertyOrientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898A821A49BFF00A37D3E /* CGImagePropertyOrientation.swift */; }; - 7B6B4F4222983A80002D95D0 /* Math.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B56036B1F47659C004635EE /* Math.swift */; }; - 7B6B4F4322983A80002D95D0 /* MLMultiArray+Image.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B5603671F470C60004635EE /* MLMultiArray+Image.swift */; }; - 7B6B4F4422983A80002D95D0 /* MLMultiArray+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898CC21A5832800A37D3E /* MLMultiArray+Helpers.swift */; }; - 7B6B4F4522983A80002D95D0 /* NonMaxSuppression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A362F1F35F10C009A6364 /* NonMaxSuppression.swift */; }; - 7B6B4F4622983A80002D95D0 /* Predictions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B43E9B11F361DBF0034B9BA /* Predictions.swift */; }; - 7B6B4F4722983A80002D95D0 /* UIImage+CVPixelBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B4A36231F35E760009A6364 /* UIImage+CVPixelBuffer.swift */; }; - 7B6B4F4822983A80002D95D0 /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898BF21A49D7300A37D3E /* UIImage+Extensions.swift */; }; - 7B6B4F4922983A80002D95D0 /* UIImage+RawBytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898A621A47FEB00A37D3E /* UIImage+RawBytes.swift */; }; - 7B6B4F4A22983A82002D95D0 /* CoreMLHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 7B4AFF8D1F40874000AF62F3 /* CoreMLHelpers.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 7BD898A721A47FEB00A37D3E /* UIImage+RawBytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898A621A47FEB00A37D3E /* UIImage+RawBytes.swift */; }; - 7BD898A921A49BFF00A37D3E /* CGImagePropertyOrientation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898A821A49BFF00A37D3E /* CGImagePropertyOrientation.swift */; }; - 7BD898C021A49D7300A37D3E /* UIImage+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898BF21A49D7300A37D3E /* UIImage+Extensions.swift */; }; - 7BD898CA21A4BAA400A37D3E /* MultiArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898C221A4A95C00A37D3E /* MultiArray.swift */; }; - 7BD898CD21A5832800A37D3E /* MLMultiArray+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898CC21A5832800A37D3E /* MLMultiArray+Helpers.swift */; }; - 7BD898D321AC429900A37D3E /* CGImage+RawBytes.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898D221AC429900A37D3E /* CGImage+RawBytes.swift */; }; - 7BD898D521AC452D00A37D3E /* CGImage+CVPixelBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BD898D421AC452D00A37D3E /* CGImage+CVPixelBuffer.swift */; }; - 7BFDE994237CA020004FAFAA /* CoreML+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFDE992237CA020004FAFAA /* CoreML+Combine.swift */; }; - 7BFDE995237CA020004FAFAA /* MLModel+Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFDE993237CA020004FAFAA /* MLModel+Images.swift */; }; - 7BFDE996237CA05E004FAFAA /* CoreML+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFDE992237CA020004FAFAA /* CoreML+Combine.swift */; }; - 7BFDE997237CA05E004FAFAA /* MLModel+Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFDE993237CA020004FAFAA /* MLModel+Images.swift */; }; - 7BFDE998237CA05E004FAFAA /* CoreML+Combine.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFDE992237CA020004FAFAA /* CoreML+Combine.swift */; }; - 7BFDE999237CA05E004FAFAA /* MLModel+Images.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7BFDE993237CA020004FAFAA /* MLModel+Images.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -86,13 +31,6 @@ remoteGlobalIDString = 7B4A360C1F35E6FA009A6364; remoteInfo = Demo; }; - 7B4AFF901F40874000AF62F3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 7B4A36051F35E6FA009A6364 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 7B4AFF8A1F40873F00AF62F3; - remoteInfo = CoreMLHelpers; - }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -102,7 +40,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 7B4AFF931F40874000AF62F3 /* CoreMLHelpers.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -110,10 +47,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 7B30A79825AF29CB0092647B /* CVPixelBuffer+Rotate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "CVPixelBuffer+Rotate.swift"; path = "../../CoreMLHelpers/CVPixelBuffer+Rotate.swift"; sourceTree = ""; }; - 7B30A79925AF29CB0092647B /* CVPixelBuffer+Create.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "CVPixelBuffer+Create.swift"; path = "../../CoreMLHelpers/CVPixelBuffer+Create.swift"; sourceTree = ""; }; - 7B30A79A25AF29CB0092647B /* CVPixelBuffer+Resize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "CVPixelBuffer+Resize.swift"; path = "../../CoreMLHelpers/CVPixelBuffer+Resize.swift"; sourceTree = ""; }; - 7B43E9B11F361DBF0034B9BA /* Predictions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Predictions.swift; path = ../../CoreMLHelpers/Predictions.swift; sourceTree = ""; }; + 3D6A419628C6EC9400DC2EA9 /* CoreMLHelpers */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = CoreMLHelpers; path = ..; sourceTree = ""; }; 7B4A360D1F35E6FA009A6364 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7B4A36101F35E6FA009A6364 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7B4A36121F35E6FA009A6364 /* ImageViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageViewController.swift; sourceTree = ""; }; @@ -121,33 +55,14 @@ 7B4A36171F35E6FA009A6364 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 7B4A361A1F35E6FA009A6364 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 7B4A361C1F35E6FA009A6364 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 7B4A36231F35E760009A6364 /* UIImage+CVPixelBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "UIImage+CVPixelBuffer.swift"; path = "../../CoreMLHelpers/UIImage+CVPixelBuffer.swift"; sourceTree = ""; }; - 7B4A36241F35E760009A6364 /* Array+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "Array+Extensions.swift"; path = "../../CoreMLHelpers/Array+Extensions.swift"; sourceTree = ""; }; 7B4A36271F35EA6E009A6364 /* cat.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = cat.jpg; path = ../Images/cat.jpg; sourceTree = SOURCE_ROOT; }; - 7B4A362F1F35F10C009A6364 /* NonMaxSuppression.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = NonMaxSuppression.swift; path = ../../CoreMLHelpers/NonMaxSuppression.swift; sourceTree = ""; }; 7B4AFF7C1F40863100AF62F3 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 7B4AFF7E1F40863100AF62F3 /* MultiArrayTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiArrayTests.swift; sourceTree = ""; }; 7B4AFF801F40863100AF62F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 7B4AFF8B1F40873F00AF62F3 /* CoreMLHelpers.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreMLHelpers.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 7B4AFF8D1F40874000AF62F3 /* CoreMLHelpers.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreMLHelpers.h; sourceTree = ""; }; - 7B4AFF8E1F40874000AF62F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 7B4AFFA41F408CD000AF62F3 /* MenuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = ""; }; 7B4AFFA61F408E4500AF62F3 /* NMSViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NMSViewController.swift; sourceTree = ""; }; 7B4AFFA81F408FAB00AF62F3 /* BoundingBoxView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BoundingBoxView.swift; sourceTree = ""; }; 7B5603651F470A1D004635EE /* cat.bin */ = {isa = PBXFileReference; lastKnownFileType = archive.macbinary; name = cat.bin; path = ../../Images/cat.bin; sourceTree = ""; }; - 7B5603671F470C60004635EE /* MLMultiArray+Image.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "MLMultiArray+Image.swift"; path = "../../CoreMLHelpers/MLMultiArray+Image.swift"; sourceTree = ""; }; - 7B56036B1F47659C004635EE /* Math.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Math.swift; path = ../../CoreMLHelpers/Math.swift; sourceTree = ""; }; - 7B6B4F1722983906002D95D0 /* CoreMLHelpers_macOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreMLHelpers_macOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 7B6B4F3522983A52002D95D0 /* CoreMLHelpers_tvOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreMLHelpers_tvOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 7BD898A621A47FEB00A37D3E /* UIImage+RawBytes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "UIImage+RawBytes.swift"; path = "../../CoreMLHelpers/UIImage+RawBytes.swift"; sourceTree = ""; }; - 7BD898A821A49BFF00A37D3E /* CGImagePropertyOrientation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CGImagePropertyOrientation.swift; path = ../../CoreMLHelpers/CGImagePropertyOrientation.swift; sourceTree = ""; }; - 7BD898BF21A49D7300A37D3E /* UIImage+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "UIImage+Extensions.swift"; path = "../../CoreMLHelpers/UIImage+Extensions.swift"; sourceTree = ""; }; - 7BD898C221A4A95C00A37D3E /* MultiArray.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MultiArray.swift; sourceTree = ""; }; - 7BD898CC21A5832800A37D3E /* MLMultiArray+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = "MLMultiArray+Helpers.swift"; path = "../../CoreMLHelpers/MLMultiArray+Helpers.swift"; sourceTree = ""; }; - 7BD898D221AC429900A37D3E /* CGImage+RawBytes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "CGImage+RawBytes.swift"; path = "../../CoreMLHelpers/CGImage+RawBytes.swift"; sourceTree = ""; }; - 7BD898D421AC452D00A37D3E /* CGImage+CVPixelBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "CGImage+CVPixelBuffer.swift"; path = "../../CoreMLHelpers/CGImage+CVPixelBuffer.swift"; sourceTree = ""; }; - 7BFDE992237CA020004FAFAA /* CoreML+Combine.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "CoreML+Combine.swift"; path = "../../CoreMLHelpers/CoreML+Combine.swift"; sourceTree = ""; }; - 7BFDE993237CA020004FAFAA /* MLModel+Images.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "MLModel+Images.swift"; path = "../../CoreMLHelpers/MLModel+Images.swift"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -155,7 +70,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 7B4AFF921F40874000AF62F3 /* CoreMLHelpers.framework in Frameworks */, + 3D6A419C28C6ED0A00DC2EA9 /* CoreMLHelpers in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -166,37 +81,32 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 7B4AFF871F40873F00AF62F3 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7B6B4F1422983906002D95D0 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 3D6A419528C6EC9400DC2EA9 /* Packages */ = { + isa = PBXGroup; + children = ( + 3D6A419628C6EC9400DC2EA9 /* CoreMLHelpers */, ); - runOnlyForDeploymentPostprocessing = 0; + name = Packages; + sourceTree = ""; }; - 7B6B4F3222983A52002D95D0 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( + 3D6A419A28C6ED0500DC2EA9 /* Frameworks */ = { + isa = PBXGroup; + children = ( ); - runOnlyForDeploymentPostprocessing = 0; + name = Frameworks; + sourceTree = ""; }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ 7B4A36041F35E6FA009A6364 = { isa = PBXGroup; children = ( + 3D6A419528C6EC9400DC2EA9 /* Packages */, 7B4A360F1F35E6FA009A6364 /* Demo */, 7B4AFF7D1F40863100AF62F3 /* Tests */, - 7B4AFF8C1F40874000AF62F3 /* CoreMLHelpers */, 7B4A360E1F35E6FA009A6364 /* Products */, + 3D6A419A28C6ED0500DC2EA9 /* Frameworks */, ); sourceTree = ""; }; @@ -205,9 +115,6 @@ children = ( 7B4A360D1F35E6FA009A6364 /* Demo.app */, 7B4AFF7C1F40863100AF62F3 /* Tests.xctest */, - 7B4AFF8B1F40873F00AF62F3 /* CoreMLHelpers.framework */, - 7B6B4F1722983906002D95D0 /* CoreMLHelpers_macOS.framework */, - 7B6B4F3522983A52002D95D0 /* CoreMLHelpers_tvOS.framework */, ); name = Products; sourceTree = ""; @@ -255,71 +162,8 @@ path = Tests; sourceTree = ""; }; - 7B4AFF8C1F40874000AF62F3 /* CoreMLHelpers */ = { - isa = PBXGroup; - children = ( - 7B4A36241F35E760009A6364 /* Array+Extensions.swift */, - 7BD898D421AC452D00A37D3E /* CGImage+CVPixelBuffer.swift */, - 7BD898D221AC429900A37D3E /* CGImage+RawBytes.swift */, - 7BD898A821A49BFF00A37D3E /* CGImagePropertyOrientation.swift */, - 7BFDE992237CA020004FAFAA /* CoreML+Combine.swift */, - 7B4AFF8D1F40874000AF62F3 /* CoreMLHelpers.h */, - 7B30A79925AF29CB0092647B /* CVPixelBuffer+Create.swift */, - 7B30A79A25AF29CB0092647B /* CVPixelBuffer+Resize.swift */, - 7B30A79825AF29CB0092647B /* CVPixelBuffer+Rotate.swift */, - 7B4AFF8E1F40874000AF62F3 /* Info.plist */, - 7B56036B1F47659C004635EE /* Math.swift */, - 7BFDE993237CA020004FAFAA /* MLModel+Images.swift */, - 7BD898CC21A5832800A37D3E /* MLMultiArray+Helpers.swift */, - 7B5603671F470C60004635EE /* MLMultiArray+Image.swift */, - 7B4A362F1F35F10C009A6364 /* NonMaxSuppression.swift */, - 7B43E9B11F361DBF0034B9BA /* Predictions.swift */, - 7B4A36231F35E760009A6364 /* UIImage+CVPixelBuffer.swift */, - 7BD898BF21A49D7300A37D3E /* UIImage+Extensions.swift */, - 7BD898A621A47FEB00A37D3E /* UIImage+RawBytes.swift */, - 7BD898C121A4A95C00A37D3E /* Experimental */, - ); - path = CoreMLHelpers; - sourceTree = ""; - }; - 7BD898C121A4A95C00A37D3E /* Experimental */ = { - isa = PBXGroup; - children = ( - 7BD898C221A4A95C00A37D3E /* MultiArray.swift */, - ); - name = Experimental; - path = ../../Experimental; - sourceTree = ""; - }; /* End PBXGroup section */ -/* Begin PBXHeadersBuildPhase section */ - 7B4AFF881F40873F00AF62F3 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 7B4AFF8F1F40874000AF62F3 /* CoreMLHelpers.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7B6B4F1222983906002D95D0 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 7B6B4F2F22983A2C002D95D0 /* CoreMLHelpers.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7B6B4F3022983A52002D95D0 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 7B6B4F4A22983A82002D95D0 /* CoreMLHelpers.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - /* Begin PBXNativeTarget section */ 7B4A360C1F35E6FA009A6364 /* Demo */ = { isa = PBXNativeTarget; @@ -333,9 +177,11 @@ buildRules = ( ); dependencies = ( - 7B4AFF911F40874000AF62F3 /* PBXTargetDependency */, ); name = Demo; + packageProductDependencies = ( + 3D6A419B28C6ED0A00DC2EA9 /* CoreMLHelpers */, + ); productName = Demo; productReference = 7B4A360D1F35E6FA009A6364 /* Demo.app */; productType = "com.apple.product-type.application"; @@ -358,60 +204,6 @@ productReference = 7B4AFF7C1F40863100AF62F3 /* Tests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - 7B4AFF8A1F40873F00AF62F3 /* CoreMLHelpers */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7B4AFF941F40874000AF62F3 /* Build configuration list for PBXNativeTarget "CoreMLHelpers" */; - buildPhases = ( - 7B4AFF861F40873F00AF62F3 /* Sources */, - 7B4AFF871F40873F00AF62F3 /* Frameworks */, - 7B4AFF881F40873F00AF62F3 /* Headers */, - 7B4AFF891F40873F00AF62F3 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = CoreMLHelpers; - productName = CoreMLHelpers; - productReference = 7B4AFF8B1F40873F00AF62F3 /* CoreMLHelpers.framework */; - productType = "com.apple.product-type.framework"; - }; - 7B6B4F1622983906002D95D0 /* CoreMLHelpers macOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7B6B4F1C22983906002D95D0 /* Build configuration list for PBXNativeTarget "CoreMLHelpers macOS" */; - buildPhases = ( - 7B6B4F1222983906002D95D0 /* Headers */, - 7B6B4F1322983906002D95D0 /* Sources */, - 7B6B4F1422983906002D95D0 /* Frameworks */, - 7B6B4F1522983906002D95D0 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "CoreMLHelpers macOS"; - productName = "CoreMLHelpers macOS"; - productReference = 7B6B4F1722983906002D95D0 /* CoreMLHelpers_macOS.framework */; - productType = "com.apple.product-type.framework"; - }; - 7B6B4F3422983A52002D95D0 /* CoreMLHelpers tvOS */ = { - isa = PBXNativeTarget; - buildConfigurationList = 7B6B4F3A22983A52002D95D0 /* Build configuration list for PBXNativeTarget "CoreMLHelpers tvOS" */; - buildPhases = ( - 7B6B4F3022983A52002D95D0 /* Headers */, - 7B6B4F3122983A52002D95D0 /* Sources */, - 7B6B4F3222983A52002D95D0 /* Frameworks */, - 7B6B4F3322983A52002D95D0 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "CoreMLHelpers tvOS"; - productName = "CoreMLHelpers tvOS"; - productReference = 7B6B4F3522983A52002D95D0 /* CoreMLHelpers_tvOS.framework */; - productType = "com.apple.product-type.framework"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -431,18 +223,6 @@ LastSwiftMigration = 1020; TestTargetID = 7B4A360C1F35E6FA009A6364; }; - 7B4AFF8A1F40873F00AF62F3 = { - CreatedOnToolsVersion = 9.0; - LastSwiftMigration = 1020; - }; - 7B6B4F1622983906002D95D0 = { - CreatedOnToolsVersion = 10.2; - ProvisioningStyle = Automatic; - }; - 7B6B4F3422983A52002D95D0 = { - CreatedOnToolsVersion = 10.2; - ProvisioningStyle = Automatic; - }; }; }; buildConfigurationList = 7B4A36081F35E6FA009A6364 /* Build configuration list for PBXProject "Demo" */; @@ -460,9 +240,6 @@ targets = ( 7B4A360C1F35E6FA009A6364 /* Demo */, 7B4AFF7B1F40863100AF62F3 /* Tests */, - 7B4AFF8A1F40873F00AF62F3 /* CoreMLHelpers */, - 7B6B4F1622983906002D95D0 /* CoreMLHelpers macOS */, - 7B6B4F3422983A52002D95D0 /* CoreMLHelpers tvOS */, ); }; /* End PBXProject section */ @@ -476,6 +253,7 @@ 7B4A36181F35E6FA009A6364 /* Assets.xcassets in Resources */, 7B4A36281F35EA6E009A6364 /* cat.jpg in Resources */, 7B4A36161F35E6FA009A6364 /* Main.storyboard in Resources */, + 3D6A419828C6ECBF00DC2EA9 /* CoreMLHelpers in Resources */, 7B5603661F470A1D004635EE /* cat.bin in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -484,27 +262,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7B4AFF891F40873F00AF62F3 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7B6B4F1522983906002D95D0 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7B6B4F3322983A52002D95D0 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( + 3D6A419928C6ECD200DC2EA9 /* CoreMLHelpers in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -531,80 +289,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - 7B4AFF861F40873F00AF62F3 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 7B4AFF9E1F408A1400AF62F3 /* UIImage+CVPixelBuffer.swift in Sources */, - 7B30A79E25AF29CB0092647B /* CVPixelBuffer+Create.swift in Sources */, - 7B4AFFA11F408AFD00AF62F3 /* Array+Extensions.swift in Sources */, - 7B5603681F470C60004635EE /* MLMultiArray+Image.swift in Sources */, - 7BD898D321AC429900A37D3E /* CGImage+RawBytes.swift in Sources */, - 7B30A79B25AF29CB0092647B /* CVPixelBuffer+Rotate.swift in Sources */, - 7BD898C021A49D7300A37D3E /* UIImage+Extensions.swift in Sources */, - 7BD898CA21A4BAA400A37D3E /* MultiArray.swift in Sources */, - 7B4AFFA31F408B0400AF62F3 /* Predictions.swift in Sources */, - 7BFDE994237CA020004FAFAA /* CoreML+Combine.swift in Sources */, - 7BD898D521AC452D00A37D3E /* CGImage+CVPixelBuffer.swift in Sources */, - 7B30A7A125AF29CB0092647B /* CVPixelBuffer+Resize.swift in Sources */, - 7B4AFFAA1F4095B200AF62F3 /* NonMaxSuppression.swift in Sources */, - 7BFDE995237CA020004FAFAA /* MLModel+Images.swift in Sources */, - 7BD898A921A49BFF00A37D3E /* CGImagePropertyOrientation.swift in Sources */, - 7BD898A721A47FEB00A37D3E /* UIImage+RawBytes.swift in Sources */, - 7BD898CD21A5832800A37D3E /* MLMultiArray+Helpers.swift in Sources */, - 7B56036C1F47659C004635EE /* Math.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7B6B4F1322983906002D95D0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 7B6B4F2D22983987002D95D0 /* UIImage+RawBytes.swift in Sources */, - 7B30A79F25AF29CB0092647B /* CVPixelBuffer+Create.swift in Sources */, - 7B6B4F2A22983987002D95D0 /* Predictions.swift in Sources */, - 7B6B4F2122983987002D95D0 /* Array+Extensions.swift in Sources */, - 7B6B4F2E22983987002D95D0 /* MultiArray.swift in Sources */, - 7B30A79C25AF29CB0092647B /* CVPixelBuffer+Rotate.swift in Sources */, - 7B6B4F2C22983987002D95D0 /* UIImage+Extensions.swift in Sources */, - 7B6B4F2222983987002D95D0 /* CGImage+CVPixelBuffer.swift in Sources */, - 7BFDE996237CA05E004FAFAA /* CoreML+Combine.swift in Sources */, - 7B6B4F2B22983987002D95D0 /* UIImage+CVPixelBuffer.swift in Sources */, - 7B6B4F2722983987002D95D0 /* MLMultiArray+Image.swift in Sources */, - 7B30A7A225AF29CB0092647B /* CVPixelBuffer+Resize.swift in Sources */, - 7BFDE997237CA05E004FAFAA /* MLModel+Images.swift in Sources */, - 7B6B4F2422983987002D95D0 /* CGImagePropertyOrientation.swift in Sources */, - 7B6B4F2322983987002D95D0 /* CGImage+RawBytes.swift in Sources */, - 7B6B4F2822983987002D95D0 /* MLMultiArray+Helpers.swift in Sources */, - 7B6B4F2922983987002D95D0 /* NonMaxSuppression.swift in Sources */, - 7B6B4F2622983987002D95D0 /* Math.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 7B6B4F3122983A52002D95D0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 7B6B4F4922983A80002D95D0 /* UIImage+RawBytes.swift in Sources */, - 7B6B4F4622983A80002D95D0 /* Predictions.swift in Sources */, - 7B6B4F3D22983A80002D95D0 /* Array+Extensions.swift in Sources */, - 7B6B4F4822983A80002D95D0 /* UIImage+Extensions.swift in Sources */, - 7B6B4F3E22983A80002D95D0 /* CGImage+CVPixelBuffer.swift in Sources */, - 7B6B4F4722983A80002D95D0 /* UIImage+CVPixelBuffer.swift in Sources */, - 7B6B4F4322983A80002D95D0 /* MLMultiArray+Image.swift in Sources */, - 7B6B4F4022983A80002D95D0 /* CGImagePropertyOrientation.swift in Sources */, - 7B30A79D25AF29CB0092647B /* CVPixelBuffer+Rotate.swift in Sources */, - 7B30A7A025AF29CB0092647B /* CVPixelBuffer+Create.swift in Sources */, - 7B6B4F3F22983A80002D95D0 /* CGImage+RawBytes.swift in Sources */, - 7BFDE999237CA05E004FAFAA /* MLModel+Images.swift in Sources */, - 7B6B4F4422983A80002D95D0 /* MLMultiArray+Helpers.swift in Sources */, - 7BFDE998237CA05E004FAFAA /* CoreML+Combine.swift in Sources */, - 7B30A7A325AF29CB0092647B /* CVPixelBuffer+Resize.swift in Sources */, - 7B6B4F4522983A80002D95D0 /* NonMaxSuppression.swift in Sources */, - 7B6B4F4222983A80002D95D0 /* Math.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -613,11 +297,6 @@ target = 7B4A360C1F35E6FA009A6364 /* Demo */; targetProxy = 7B4AFF811F40863100AF62F3 /* PBXContainerItemProxy */; }; - 7B4AFF911F40874000AF62F3 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 7B4AFF8A1F40873F00AF62F3 /* CoreMLHelpers */; - targetProxy = 7B4AFF901F40874000AF62F3 /* PBXContainerItemProxy */; - }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ @@ -748,7 +427,8 @@ IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; VALIDATE_PRODUCT = YES; }; name = Release; @@ -756,11 +436,13 @@ 7B4A36201F35E6FA009A6364 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = MGCEKGP4Y4; + DEVELOPMENT_TEAM = D854RS5QS7; INFOPLIST_FILE = Demo/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = net.machinethink.Demo; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -771,11 +453,13 @@ 7B4A36211F35E6FA009A6364 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - DEVELOPMENT_TEAM = MGCEKGP4Y4; + DEVELOPMENT_TEAM = D854RS5QS7; INFOPLIST_FILE = Demo/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = net.machinethink.Demo; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -787,9 +471,13 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - DEVELOPMENT_TEAM = MGCEKGP4Y4; + DEVELOPMENT_TEAM = D854RS5QS7; INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = net.machinethink.CoreMLHelpersTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -802,9 +490,13 @@ isa = XCBuildConfiguration; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; - DEVELOPMENT_TEAM = MGCEKGP4Y4; + DEVELOPMENT_TEAM = D854RS5QS7; INFOPLIST_FILE = Tests/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = net.machinethink.CoreMLHelpersTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; @@ -813,170 +505,6 @@ }; name = Release; }; - 7B4AFF951F40874000AF62F3 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = MGCEKGP4Y4; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = CoreMLHelpers/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = net.machinethink.CoreMLHelpers; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 7B4AFF961F40874000AF62F3 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = MGCEKGP4Y4; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = CoreMLHelpers/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = net.machinethink.CoreMLHelpers; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 7B6B4F1D22983906002D95D0 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = MGCEKGP4Y4; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = CoreMLHelpers/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "net.machinethink.CoreMLHelpers-macOS"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 7B6B4F1E22983906002D95D0 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = MGCEKGP4Y4; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - FRAMEWORK_VERSION = A; - INFOPLIST_FILE = CoreMLHelpers/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.14; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "net.machinethink.CoreMLHelpers-macOS"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = macosx; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 7B6B4F3B22983A52002D95D0 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = MGCEKGP4Y4; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = CoreMLHelpers/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "net.machinethink.CoreMLHelpers-tvOS"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 12.2; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - 7B6B4F3C22983A52002D95D0 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ENABLE_OBJC_WEAK = YES; - CODE_SIGN_IDENTITY = ""; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = MGCEKGP4Y4; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = CoreMLHelpers/Info.plist; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; - MTL_FAST_MATH = YES; - PRODUCT_BUNDLE_IDENTIFIER = "net.machinethink.CoreMLHelpers-tvOS"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = appletvos; - SKIP_INSTALL = YES; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 12.2; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1007,34 +535,14 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 7B4AFF941F40874000AF62F3 /* Build configuration list for PBXNativeTarget "CoreMLHelpers" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7B4AFF951F40874000AF62F3 /* Debug */, - 7B4AFF961F40874000AF62F3 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 7B6B4F1C22983906002D95D0 /* Build configuration list for PBXNativeTarget "CoreMLHelpers macOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7B6B4F1D22983906002D95D0 /* Debug */, - 7B6B4F1E22983906002D95D0 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 7B6B4F3A22983A52002D95D0 /* Build configuration list for PBXNativeTarget "CoreMLHelpers tvOS" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 7B6B4F3B22983A52002D95D0 /* Debug */, - 7B6B4F3C22983A52002D95D0 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + 3D6A419B28C6ED0A00DC2EA9 /* CoreMLHelpers */ = { + isa = XCSwiftPackageProductDependency; + productName = CoreMLHelpers; + }; +/* End XCSwiftPackageProductDependency section */ }; rootObject = 7B4A36051F35E6FA009A6364 /* Project object */; } diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..a2193a1 --- /dev/null +++ b/Package.swift @@ -0,0 +1,45 @@ +// swift-tools-version: 5.6 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "CoreMLHelpers", + platforms: [ + .iOS(.v11), + .macOS(.v12), + .tvOS(.v11), + .watchOS(.v6) + ], + products: [ + .library( + name: "CoreMLHelpers", + targets: [ + "CoreMLHelpers", + ] + ), + ], + dependencies: [ + + ], + targets: [ + .target( + name: "CoreMLHelpers", + dependencies: [ + + ] + ), + .target( + name: "Experimental", + dependencies: [ + "CoreMLHelpers" + ] + ), + .testTarget( + name: "CoreMLHelpersTests", + dependencies: [ + "CoreMLHelpers", + ] + ), + ] +) diff --git a/CoreMLHelpers/Array+Extensions.swift b/Sources/CoreMLHelpers/Array+Extensions.swift similarity index 100% rename from CoreMLHelpers/Array+Extensions.swift rename to Sources/CoreMLHelpers/Array+Extensions.swift diff --git a/CoreMLHelpers/CGImage+CVPixelBuffer.swift b/Sources/CoreMLHelpers/CGImage+CVPixelBuffer.swift similarity index 99% rename from CoreMLHelpers/CGImage+CVPixelBuffer.swift rename to Sources/CoreMLHelpers/CGImage+CVPixelBuffer.swift index 7ed82bb..7f8cac4 100755 --- a/CoreMLHelpers/CGImage+CVPixelBuffer.swift +++ b/Sources/CoreMLHelpers/CGImage+CVPixelBuffer.swift @@ -20,6 +20,7 @@ IN THE SOFTWARE. */ +#if canImport(CoreImage) && !os(watchOS) import CoreGraphics import CoreImage import VideoToolbox @@ -166,3 +167,4 @@ extension CGImage { return context.createCGImage(ciImage, from: rect) } } +#endif diff --git a/CoreMLHelpers/CGImage+RawBytes.swift b/Sources/CoreMLHelpers/CGImage+RawBytes.swift similarity index 100% rename from CoreMLHelpers/CGImage+RawBytes.swift rename to Sources/CoreMLHelpers/CGImage+RawBytes.swift diff --git a/CoreMLHelpers/CGImagePropertyOrientation.swift b/Sources/CoreMLHelpers/CGImagePropertyOrientation.swift similarity index 98% rename from CoreMLHelpers/CGImagePropertyOrientation.swift rename to Sources/CoreMLHelpers/CGImagePropertyOrientation.swift index 5832c3e..7fb71a2 100644 --- a/CoreMLHelpers/CGImagePropertyOrientation.swift +++ b/Sources/CoreMLHelpers/CGImagePropertyOrientation.swift @@ -20,7 +20,7 @@ IN THE SOFTWARE. */ -#if canImport(UIKit) +#if canImport(UIKit) && !os(watchOS) import UIKit diff --git a/CoreMLHelpers/CVPixelBuffer+Create.swift b/Sources/CoreMLHelpers/CVPixelBuffer+Create.swift similarity index 92% rename from CoreMLHelpers/CVPixelBuffer+Create.swift rename to Sources/CoreMLHelpers/CVPixelBuffer+Create.swift index cc8c343..3405e14 100644 --- a/CoreMLHelpers/CVPixelBuffer+Create.swift +++ b/Sources/CoreMLHelpers/CVPixelBuffer+Create.swift @@ -20,19 +20,30 @@ IN THE SOFTWARE. */ +#if !os(watchOS) import Foundation import Accelerate fileprivate func metalCompatiblityAttributes() -> [String: Any] { + #if os(macOS) let attributes: [String: Any] = [ String(kCVPixelBufferMetalCompatibilityKey): true, String(kCVPixelBufferOpenGLCompatibilityKey): true, String(kCVPixelBufferIOSurfacePropertiesKey): [ - String(kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey): true, - String(kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey): true, String(kCVPixelBufferIOSurfaceCoreAnimationCompatibilityKey): true ] ] + #else + let attributes: [String: Any] = [ + String(kCVPixelBufferMetalCompatibilityKey): true, + String(kCVPixelBufferOpenGLCompatibilityKey): true, + String(kCVPixelBufferIOSurfacePropertiesKey): [ + String(kCVPixelBufferIOSurfaceOpenGLESTextureCompatibilityKey): true, + String(kCVPixelBufferIOSurfaceOpenGLESFBOCompatibilityKey): true, + String(kCVPixelBufferIOSurfaceCoreAnimationCompatibilityKey): true + ] + ] + #endif return attributes } @@ -168,3 +179,4 @@ public extension CVPixelBuffer { return dstPixelBuffer } } +#endif diff --git a/CoreMLHelpers/CVPixelBuffer+Resize.swift b/Sources/CoreMLHelpers/CVPixelBuffer+Resize.swift similarity index 99% rename from CoreMLHelpers/CVPixelBuffer+Resize.swift rename to Sources/CoreMLHelpers/CVPixelBuffer+Resize.swift index 132c18a..518a4d4 100644 --- a/CoreMLHelpers/CVPixelBuffer+Resize.swift +++ b/Sources/CoreMLHelpers/CVPixelBuffer+Resize.swift @@ -20,6 +20,7 @@ IN THE SOFTWARE. */ +#if canImport(CoreImage) && !os(watchOS) import Foundation import Accelerate import CoreImage @@ -155,3 +156,4 @@ public func resizePixelBuffer(_ pixelBuffer: CVPixelBuffer, let scaledImage = ciImage.transformed(by: scaleTransform) context.render(scaledImage, to: output) } +#endif diff --git a/CoreMLHelpers/CVPixelBuffer+Rotate.swift b/Sources/CoreMLHelpers/CVPixelBuffer+Rotate.swift similarity index 99% rename from CoreMLHelpers/CVPixelBuffer+Rotate.swift rename to Sources/CoreMLHelpers/CVPixelBuffer+Rotate.swift index 0604877..4645f09 100644 --- a/CoreMLHelpers/CVPixelBuffer+Rotate.swift +++ b/Sources/CoreMLHelpers/CVPixelBuffer+Rotate.swift @@ -19,7 +19,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - +#if !os(watchOS) import Foundation import Accelerate @@ -99,3 +99,4 @@ public func rotate90PixelBuffer(_ srcPixelBuffer: CVPixelBuffer, factor: UInt8) } return dstPixelBuffer } +#endif diff --git a/CoreMLHelpers/CoreML+Combine.swift b/Sources/CoreMLHelpers/CoreML+Combine.swift similarity index 100% rename from CoreMLHelpers/CoreML+Combine.swift rename to Sources/CoreMLHelpers/CoreML+Combine.swift diff --git a/CoreMLHelpers/MLModel+Images.swift b/Sources/CoreMLHelpers/MLModel+Images.swift similarity index 100% rename from CoreMLHelpers/MLModel+Images.swift rename to Sources/CoreMLHelpers/MLModel+Images.swift diff --git a/CoreMLHelpers/MLMultiArray+Helpers.swift b/Sources/CoreMLHelpers/MLMultiArray+Helpers.swift similarity index 100% rename from CoreMLHelpers/MLMultiArray+Helpers.swift rename to Sources/CoreMLHelpers/MLMultiArray+Helpers.swift diff --git a/CoreMLHelpers/MLMultiArray+Image.swift b/Sources/CoreMLHelpers/MLMultiArray+Image.swift similarity index 100% rename from CoreMLHelpers/MLMultiArray+Image.swift rename to Sources/CoreMLHelpers/MLMultiArray+Image.swift diff --git a/CoreMLHelpers/Math.swift b/Sources/CoreMLHelpers/Math.swift similarity index 100% rename from CoreMLHelpers/Math.swift rename to Sources/CoreMLHelpers/Math.swift diff --git a/CoreMLHelpers/NonMaxSuppression.swift b/Sources/CoreMLHelpers/NonMaxSuppression.swift similarity index 100% rename from CoreMLHelpers/NonMaxSuppression.swift rename to Sources/CoreMLHelpers/NonMaxSuppression.swift diff --git a/CoreMLHelpers/Predictions.swift b/Sources/CoreMLHelpers/Predictions.swift similarity index 98% rename from CoreMLHelpers/Predictions.swift rename to Sources/CoreMLHelpers/Predictions.swift index 7cec42a..792acc6 100644 --- a/CoreMLHelpers/Predictions.swift +++ b/Sources/CoreMLHelpers/Predictions.swift @@ -19,7 +19,7 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - +#if canImport(Vision) import Vision /** @@ -41,3 +41,4 @@ public func top(_ k: Int, _ observations: [VNClassificationObservation]) -> [(St return observations.prefix(through: min(k, observations.count) - 1) .map { ($0.identifier, Double($0.confidence)) } } +#endif diff --git a/CoreMLHelpers/UIImage+CVPixelBuffer.swift b/Sources/CoreMLHelpers/UIImage+CVPixelBuffer.swift similarity index 99% rename from CoreMLHelpers/UIImage+CVPixelBuffer.swift rename to Sources/CoreMLHelpers/UIImage+CVPixelBuffer.swift index 6c9a780..36cbfb5 100644 --- a/CoreMLHelpers/UIImage+CVPixelBuffer.swift +++ b/Sources/CoreMLHelpers/UIImage+CVPixelBuffer.swift @@ -20,7 +20,7 @@ IN THE SOFTWARE. */ -#if canImport(UIKit) +#if canImport(UIKit) && canImport(VideoToolbox) import UIKit import VideoToolbox diff --git a/CoreMLHelpers/UIImage+Extensions.swift b/Sources/CoreMLHelpers/UIImage+Extensions.swift similarity index 98% rename from CoreMLHelpers/UIImage+Extensions.swift rename to Sources/CoreMLHelpers/UIImage+Extensions.swift index 91805fc..5c920bd 100644 --- a/CoreMLHelpers/UIImage+Extensions.swift +++ b/Sources/CoreMLHelpers/UIImage+Extensions.swift @@ -20,7 +20,7 @@ IN THE SOFTWARE. */ -#if canImport(UIKit) +#if canImport(UIKit) && !os(watchOS) import UIKit diff --git a/CoreMLHelpers/UIImage+RawBytes.swift b/Sources/CoreMLHelpers/UIImage+RawBytes.swift similarity index 100% rename from CoreMLHelpers/UIImage+RawBytes.swift rename to Sources/CoreMLHelpers/UIImage+RawBytes.swift diff --git a/Experimental/MultiArray.swift b/Sources/Experimental/MultiArray.swift similarity index 99% rename from Experimental/MultiArray.swift rename to Sources/Experimental/MultiArray.swift index c0e946d..4ae7ce7 100644 --- a/Experimental/MultiArray.swift +++ b/Sources/Experimental/MultiArray.swift @@ -23,7 +23,7 @@ import Foundation import CoreML import Swift - +import CoreMLHelpers /** Wrapper around MLMultiArray to make it more Swifty. */ diff --git a/Tests/CoreMLHelpersTests/CoreMLHelpersTests.swift b/Tests/CoreMLHelpersTests/CoreMLHelpersTests.swift new file mode 100644 index 0000000..aee8bf1 --- /dev/null +++ b/Tests/CoreMLHelpersTests/CoreMLHelpersTests.swift @@ -0,0 +1,11 @@ +import XCTest +@testable import CoreMLHelpers + +final class CoreMLHelpersTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + + } +} diff --git a/Tests/CoreMLHelpersTests/MultiArrayTests.swift b/Tests/CoreMLHelpersTests/MultiArrayTests.swift new file mode 100644 index 0000000..4fa9fcd --- /dev/null +++ b/Tests/CoreMLHelpersTests/MultiArrayTests.swift @@ -0,0 +1,130 @@ +// +// MultiArrayTests.swift +// +// +// Created by Rodrigo Dutra de Oliveira on 05/09/22. +// + +import XCTest +import CoreML +@testable import CoreMLHelpers +@testable import Experimental + +//class MultiArrayTests: XCTestCase { +// func testMultiArrayFromCoreMLArray() { +// let coreMLArray = try! MLMultiArray(shape: [3, 4, 2], dataType: .double) +// coreMLArray[[1, 2, 0] as [NSNumber]] = NSNumber(value: 3.14159) +// print(coreMLArray) +// +// var m = MultiArray(coreMLArray) +// XCTAssertEqual(m.shape.count, 3) +// XCTAssertEqual(m.shape[0], 3) +// XCTAssertEqual(m.shape[1], 4) +// XCTAssertEqual(m.shape[2], 2) +// +// XCTAssertEqual(m[1, 2, 0], 3.14159) +// +// m[1, 2, 0] = 2.71828 +// XCTAssertEqual(m[1, 2, 0], 2.71828) +// } +// +// func testMultiArray() { +// var m = MultiArray(shape: [3, 4, 2]) +// print(m.shape) +// +// for i in 0..(OpaquePointer(coreMLArray.dataPointer)) +// for i in 0..<1*1*48*17*27 { +// ptr.advanced(by: i).pointee = Double(i) +// } +// +// let a = MultiArray(coreMLArray) +// XCTAssertEqual(a.shape, [1, 1, 48, 17, 27]) +// XCTAssertEqual(a.strides, [22032, 22032, 459, 27, 1]) +// +// let expected_a: [[Double]] = [[ 0, 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]] +// for j in 0..<2 { +// for i in 0..<27 { +// XCTAssertEqual(a[0, 0, 0, j, i], expected_a[j][i]) +// } +// } +// +// let b = a.transposed([0, 1, 3, 4, 2]) +// XCTAssertEqual(b.shape, [1, 1, 17, 27, 48]) +// XCTAssertEqual(b.strides, [22032, 22032, 27, 1, 459]) +// +// let expected_b: [[Double]] = [[ 0, 459, 918, 1377, 1836, 2295, 2754, 3213, 3672, +// 4131, 4590, 5049, 5508, 5967, 6426, 6885, 7344, 7803, +// 8262, 8721, 9180, 9639, 10098, 10557, 11016, 11475, 11934, +// 12393, 12852, 13311, 13770, 14229, 14688, 15147, 15606, 16065, +// 16524, 16983, 17442, 17901, 18360, 18819, 19278, 19737, 20196, +// 20655, 21114, 21573 ], +// [ 1, 460, 919, 1378, 1837, 2296, 2755, 3214, 3673, +// 4132, 4591, 5050, 5509, 5968, 6427, 6886, 7345, 7804, +// 8263, 8722, 9181, 9640, 10099, 10558, 11017, 11476, 11935, +// 12394, 12853, 13312, 13771, 14230, 14689, 15148, 15607, 16066, +// 16525, 16984, 17443, 17902, 18361, 18820, 19279, 19738, 20197, +// 20656, 21115, 21574 ]] +// for j in 0..<2 { +// for i in 0..<48 { +// XCTAssertEqual(b[0, 0, 0, j, i], expected_b[j][i]) +// } +// } +// +// let expected_b_end: [[Double]] = [[ 26, 485, 944, 1403, 1862, 2321, 2780, 3239, 3698, +// 4157, 4616, 5075, 5534, 5993, 6452, 6911, 7370, 7829, +// 8288, 8747, 9206, 9665, 10124, 10583, 11042, 11501, 11960, +// 12419, 12878, 13337, 13796, 14255, 14714, 15173, 15632, 16091, +// 16550, 17009, 17468, 17927, 18386, 18845, 19304, 19763, 20222, +// 20681, 21140, 21599 ]] +// +// for j in 0..<1 { +// for i in 0..<48 { +// XCTAssertEqual(b[0, 0, 0, j + 26, i], expected_b_end[j][i]) +// } +// } +// +// let c = b.reshaped([5508, 4]) +// XCTAssertEqual(c.shape, [5508, 4]) +// XCTAssertEqual(c.strides, [4, 1]) +// +// let expected_c: [[Double]] = [[ 0, 459, 918, 1377 ], +// [ 1836, 2295, 2754, 3213 ]] +// for j in 0..<2 { +// for i in 0..<4 { +// XCTAssertEqual(c[j, i], expected_c[j][i]) +// } +// } +// +// let expected_c_end: [[Double]] = [[20654, 21113, 21572, 22031]] +// +// for j in 0..<1 { +// for i in 0..<4 { +// print(c[j + 5507, i]) +// XCTAssertEqual(c[j + 5507, i], expected_c_end[j][i]) +// } +// } +// +// //print(c) +// } +//} From af13fc4c620c5a67655b4fa496653e69fcd2ad33 Mon Sep 17 00:00:00 2001 From: Rodrigo Dutra de Oliveira Date: Mon, 5 Sep 2022 23:58:19 -0300 Subject: [PATCH 2/3] Configure git actions --- .github/workflows/swift.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index 49c6852..03662ae 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -2,9 +2,9 @@ name: Swift on: push: - branches: [ "main" ] + branches: [ "master" ] pull_request: - branches: [ "main" ] + branches: [ "master" ] jobs: build: From 5b12b2c44332e4061a6a818cca178120c502e787 Mon Sep 17 00:00:00 2001 From: Rodrigo Dutra de Oliveira Date: Tue, 6 Sep 2022 00:02:25 -0300 Subject: [PATCH 3/3] Fix for watchOS test error --- Package.swift | 4 ++-- Sources/Experimental/MultiArray.swift | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Package.swift b/Package.swift index a2193a1..4b963ab 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version: 5.6 +// swift-tools-version: 5.5 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -9,7 +9,7 @@ let package = Package( .iOS(.v11), .macOS(.v12), .tvOS(.v11), - .watchOS(.v6) + .watchOS(.v7) ], products: [ .library( diff --git a/Sources/Experimental/MultiArray.swift b/Sources/Experimental/MultiArray.swift index 4ae7ce7..82893a1 100644 --- a/Sources/Experimental/MultiArray.swift +++ b/Sources/Experimental/MultiArray.swift @@ -20,6 +20,7 @@ IN THE SOFTWARE. */ +#if !os(watchOS) import Foundation import CoreML import Swift @@ -336,3 +337,4 @@ extension MultiArray { } #endif +#endif