diff --git a/mobile/README.md b/mobile/README.md index abb04e567..e9b81339c 100644 --- a/mobile/README.md +++ b/mobile/README.md @@ -59,4 +59,4 @@ The [Xamarin.Forms](https://dotnet.microsoft.com/apps/xamarin/xamarin-forms) exa The example application accomplishes the task of recovering a high resolution (HR) image from its low resolution counterpart with Ort-Extensions support for pre/post processing. Currently supports on platform Android and iOS. - [Android Super Resolution](examples/super_resolution/android) -- [iOS Super Resolution](examples/speech_recognition/ios) +- [iOS Super Resolution](examples/super_resolution/ios) diff --git a/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution.xcodeproj/project.pbxproj b/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution.xcodeproj/project.pbxproj index 48d005b33..74f6e28a4 100644 --- a/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution.xcodeproj/project.pbxproj +++ b/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution.xcodeproj/project.pbxproj @@ -7,12 +7,13 @@ objects = { /* Begin PBXBuildFile section */ - 510A53D6296DE390000DB268 /* pt_super_resolution_with_pre_post_processing_opset16.onnx in Resources */ = {isa = PBXBuildFile; fileRef = 510A53D5296DE390000DB268 /* pt_super_resolution_with_pre_post_processing_opset16.onnx */; }; 510A53E8296FE46F000DB268 /* cat_224x224.png in Resources */ = {isa = PBXBuildFile; fileRef = 510A53E7296FE46F000DB268 /* cat_224x224.png */; }; 5130D9BC2968B93A009B4B88 /* ORTSuperResolutionApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5130D9BB2968B93A009B4B88 /* ORTSuperResolutionApp.swift */; }; 5130D9BE2968B93A009B4B88 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5130D9BD2968B93A009B4B88 /* ContentView.swift */; }; 5130D9C02968B93C009B4B88 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5130D9BF2968B93C009B4B88 /* Assets.xcassets */; }; 5130D9C32968B93C009B4B88 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 5130D9C22968B93C009B4B88 /* Preview Assets.xcassets */; }; + 5197BEA129A0492D004B83DE /* pytorch_superresolution_with_pre_post_processing_opset18.onnx in Resources */ = {isa = PBXBuildFile; fileRef = 5197BEA029A0492D004B83DE /* pytorch_superresolution_with_pre_post_processing_opset18.onnx */; }; + 5197BEA229A0492D004B83DE /* pytorch_superresolution_with_pre_post_processing_opset18.onnx in Resources */ = {isa = PBXBuildFile; fileRef = 5197BEA029A0492D004B83DE /* pytorch_superresolution_with_pre_post_processing_opset18.onnx */; }; 51AB38AF2981FA5E004E33B0 /* ORTSuperResolutionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 51AB38AE2981FA5E004E33B0 /* ORTSuperResolutionTests.swift */; }; 51D5968B2968DE9900F1CD43 /* ORTSuperResolutionPerformer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51D5968A2968DE9900F1CD43 /* ORTSuperResolutionPerformer.mm */; }; /* End PBXBuildFile section */ @@ -28,13 +29,13 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - 510A53D5296DE390000DB268 /* pt_super_resolution_with_pre_post_processing_opset16.onnx */ = {isa = PBXFileReference; lastKnownFileType = file; path = pt_super_resolution_with_pre_post_processing_opset16.onnx; sourceTree = ""; }; 510A53E7296FE46F000DB268 /* cat_224x224.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = cat_224x224.png; sourceTree = ""; }; 5130D9B82968B93A009B4B88 /* ORTSuperResolution.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ORTSuperResolution.app; sourceTree = BUILT_PRODUCTS_DIR; }; 5130D9BB2968B93A009B4B88 /* ORTSuperResolutionApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORTSuperResolutionApp.swift; sourceTree = ""; }; 5130D9BD2968B93A009B4B88 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; 5130D9BF2968B93C009B4B88 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 5130D9C22968B93C009B4B88 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = ""; }; + 5197BEA029A0492D004B83DE /* pytorch_superresolution_with_pre_post_processing_opset18.onnx */ = {isa = PBXFileReference; lastKnownFileType = file; path = pytorch_superresolution_with_pre_post_processing_opset18.onnx; sourceTree = ""; }; 51AB38AC2981FA5E004E33B0 /* ORTSuperResolutionTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = ORTSuperResolutionTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 51AB38AE2981FA5E004E33B0 /* ORTSuperResolutionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ORTSuperResolutionTests.swift; sourceTree = ""; }; 51D596892968DE9900F1CD43 /* ORTSuperResolutionPerformer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ORTSuperResolutionPerformer.h; sourceTree = ""; }; @@ -82,8 +83,8 @@ 5130D9BA2968B93A009B4B88 /* ORTSuperResolution */ = { isa = PBXGroup; children = ( - 510A53D5296DE390000DB268 /* pt_super_resolution_with_pre_post_processing_opset16.onnx */, 510A53E7296FE46F000DB268 /* cat_224x224.png */, + 5197BEA029A0492D004B83DE /* pytorch_superresolution_with_pre_post_processing_opset18.onnx */, 51D5968A2968DE9900F1CD43 /* ORTSuperResolutionPerformer.mm */, 51D596892968DE9900F1CD43 /* ORTSuperResolutionPerformer.h */, 5130D9BB2968B93A009B4B88 /* ORTSuperResolutionApp.swift */, @@ -200,10 +201,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 510A53D6296DE390000DB268 /* pt_super_resolution_with_pre_post_processing_opset16.onnx in Resources */, 5130D9C32968B93C009B4B88 /* Preview Assets.xcassets in Resources */, 5130D9C02968B93C009B4B88 /* Assets.xcassets in Resources */, 510A53E8296FE46F000DB268 /* cat_224x224.png in Resources */, + 5197BEA129A0492D004B83DE /* pytorch_superresolution_with_pre_post_processing_opset18.onnx in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -211,6 +212,7 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( + 5197BEA229A0492D004B83DE /* pytorch_superresolution_with_pre_post_processing_opset18.onnx in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/ContentView.swift b/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/ContentView.swift index 6296f5dc9..0799d75b8 100644 --- a/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/ContentView.swift +++ b/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/ContentView.swift @@ -26,19 +26,21 @@ struct ContentView: View { .border(Color.purple, width: 4) .background(Color.purple) - Text("Input low resolution image: ").frame(width: 350, height: 40, alignment:.leading) + Text("Low resolution image: ").frame(width: 350, height: 40, alignment:.leading) - Image("cat_224x224").frame(width: 250, height: 250) + Image("cat_224x224").resizable().aspectRatio(1, contentMode: .fit).frame(width: 250, height: 250) Button("Perform Super Resolution") { performSuperRes.toggle() } if performSuperRes { - Text("Output high resolution image: ").frame(width: 350, height: 40, alignment:.leading) + Text("Higher resolution image: ").frame(width: 350, height: 40, alignment:.leading) if let outputImage = runOrtSuperResolution() { - Image(uiImage: outputImage) + Image(uiImage: outputImage).resizable() + .aspectRatio(1, contentMode: .fit).frame(width: 250, height: 250) + } else { Text("Unable to perform super resolution. ").frame(width: 350, height: 40, alignment:.leading) } diff --git a/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/ORTSuperResolutionPerformer.mm b/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/ORTSuperResolutionPerformer.mm index 7df286de7..e2266d8c5 100644 --- a/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/ORTSuperResolutionPerformer.mm +++ b/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/ORTSuperResolutionPerformer.mm @@ -35,7 +35,7 @@ + (nullable UIImage*)performSuperResolutionWithError:(NSError **)error { // Step 1: Load model - NSString *model_path = [NSBundle.mainBundle pathForResource:@"pt_super_resolution_with_pre_post_processing_opset16" + NSString *model_path = [NSBundle.mainBundle pathForResource:@"pytorch_superresolution_with_pre_post_processing_opset18" ofType:@"onnx"]; if (model_path == nullptr) { throw std::runtime_error("Failed to get model path"); diff --git a/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/pt_super_resolution_with_pre_post_processing_opset16.onnx b/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/pytorch_superresolution_with_pre_post_processing_opset18.onnx similarity index 99% rename from mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/pt_super_resolution_with_pre_post_processing_opset16.onnx rename to mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/pytorch_superresolution_with_pre_post_processing_opset18.onnx index 3dd63126e..61c8b4294 100644 Binary files a/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/pt_super_resolution_with_pre_post_processing_opset16.onnx and b/mobile/examples/super_resolution/ios/ORTSuperResolution/ORTSuperResolution/pytorch_superresolution_with_pre_post_processing_opset18.onnx differ diff --git a/mobile/examples/super_resolution/ios/ORTSuperResolution/Podfile b/mobile/examples/super_resolution/ios/ORTSuperResolution/Podfile index 558bb869c..b51f5e1b2 100644 --- a/mobile/examples/super_resolution/ios/ORTSuperResolution/Podfile +++ b/mobile/examples/super_resolution/ios/ORTSuperResolution/Podfile @@ -7,8 +7,7 @@ target 'ORTSuperResolution' do # Pods for OrtSuperResolution pod 'onnxruntime-c' - # Pre-release version pods - pod 'onnxruntime-extensions-c', '0.5.0-dev+261962.e3663fb' + pod 'onnxruntime-extensions-c' end diff --git a/mobile/examples/super_resolution/ios/README.md b/mobile/examples/super_resolution/ios/README.md index 36f9eabf9..41ab81220 100644 --- a/mobile/examples/super_resolution/ios/README.md +++ b/mobile/examples/super_resolution/ios/README.md @@ -28,5 +28,4 @@ The model used here is from source: [Pytorch Super Resolution](https://pytorch.o # Here's an example screenshot of the app: -App Screenshot -App Screenshot \ No newline at end of file +App Screenshot \ No newline at end of file diff --git a/mobile/examples/super_resolution/ios/images/Sample_Screenshot_1.png b/mobile/examples/super_resolution/ios/images/Sample_Screenshot_1.png new file mode 100644 index 000000000..68ffb6f68 Binary files /dev/null and b/mobile/examples/super_resolution/ios/images/Sample_Screenshot_1.png differ diff --git a/mobile/examples/super_resolution/ios/images/Screenshot1.png b/mobile/examples/super_resolution/ios/images/Screenshot1.png deleted file mode 100644 index 58715a499..000000000 Binary files a/mobile/examples/super_resolution/ios/images/Screenshot1.png and /dev/null differ diff --git a/mobile/examples/super_resolution/ios/images/Screenshot2.png b/mobile/examples/super_resolution/ios/images/Screenshot2.png deleted file mode 100644 index cc2a119a6..000000000 Binary files a/mobile/examples/super_resolution/ios/images/Screenshot2.png and /dev/null differ