├── DeeplabOnIOS ├── Assets.xcassets │ ├── Contents.json │ ├── item1.imageset │ │ ├── dub.png │ │ └── Contents.json │ └── AppIcon.appiconset │ │ └── Contents.json ├── Model │ └── deeplabv3_257_mv_gpu.tflite ├── DeeplabOnIOS-Bridging-Header.h ├── NostalgiaCamera.h ├── ViewController.swift ├── Info.plist ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard ├── TfliteWrapper.h ├── AppDelegate.swift ├── TfliteWrapper.mm └── NostalgiaCamera.mm ├── DeeplabOnIOS.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ └── tonizsin.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcuserdata │ └── tonizsin.xcuserdatad │ │ └── xcschemes │ │ └── xcschememanagement.plist └── project.pbxproj ├── Podfile ├── LICENSE └── README.md /DeeplabOnIOS/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } -------------------------------------------------------------------------------- /DeeplabOnIOS/Model/deeplabv3_257_mv_gpu.tflite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toniz/deeplab-on-ios/HEAD/DeeplabOnIOS/Model/deeplabv3_257_mv_gpu.tflite -------------------------------------------------------------------------------- /DeeplabOnIOS/Assets.xcassets/item1.imageset/dub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toniz/deeplab-on-ios/HEAD/DeeplabOnIOS/Assets.xcassets/item1.imageset/dub.png -------------------------------------------------------------------------------- /DeeplabOnIOS/DeeplabOnIOS-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | // 2 | // Use this file to import your target's public headers that you would like to expose to Swift. 3 | // 4 | 5 | #import "NostalgiaCamera.h" 6 | -------------------------------------------------------------------------------- /DeeplabOnIOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DeeplabOnIOS.xcodeproj/project.xcworkspace/xcuserdata/tonizsin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/toniz/deeplab-on-ios/HEAD/DeeplabOnIOS.xcodeproj/project.xcworkspace/xcuserdata/tonizsin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DeeplabOnIOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'DeeplabOnIOS' do 5 | # Comment the next line if you're not using Swift and don't want to use dynamic frameworks 6 | use_frameworks! 7 | 8 | # Pods for DeeplabOnIOS 9 | pod 'TensorFlowLite', '~> 1.13.1' 10 | pod 'OpenCV2', '~> 3.4.0' 11 | end 12 | -------------------------------------------------------------------------------- /DeeplabOnIOS/Assets.xcassets/item1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "dub.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "scale" : "2x" 11 | }, 12 | { 13 | "idiom" : "universal", 14 | "scale" : "3x" 15 | } 16 | ], 17 | "info" : { 18 | "version" : 1, 19 | "author" : "xcode" 20 | } 21 | } -------------------------------------------------------------------------------- /DeeplabOnIOS.xcodeproj/xcuserdata/tonizsin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | DeeplabOnIOS.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /DeeplabOnIOS/NostalgiaCamera.h: -------------------------------------------------------------------------------- 1 | // 2 | // NostalgiaCamera.h 3 | // DeeplabOnIOS 4 | // 5 | // Created by Dwayne Forde on 2017-12-23. 6 | // 7 | 8 | #import 9 | #import 10 | 11 | // Protocol for callback action 12 | @protocol NostalgiaCameraDelegate 13 | 14 | - (void)matchedItem; 15 | 16 | @end 17 | 18 | // Public interface for camera. ViewController only needs to init, start and stop. 19 | @interface NostalgiaCamera : NSObject 20 | 21 | -(id) initWithController: (UIViewController*)c andImageView: (UIImageView*)iv; 22 | -(void)start; 23 | -(void)stop; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Dwayne Forde 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /DeeplabOnIOS/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // DeeplabOnIOS 4 | // 5 | // Created by Dwayne Forde on 2017-12-23. 6 | // 7 | 8 | import UIKit 9 | import SafariServices 10 | 11 | class ViewController: UIViewController, NostalgiaCameraDelegate { 12 | 13 | @IBOutlet var imgView: UIImageView! 14 | var camera: NostalgiaCamera! 15 | 16 | // Initialize Camera when the view loads 17 | override func viewDidLoad() { 18 | super.viewDidLoad() 19 | camera = NostalgiaCamera(controller: self, andImageView: imgView) 20 | } 21 | 22 | // Start it when it appears 23 | override func viewDidAppear(_ animated: Bool) { 24 | camera.start() 25 | } 26 | 27 | // Stop it when it disappears 28 | override func viewWillDisappear(_ animated: Bool) { 29 | camera.stop() 30 | } 31 | 32 | // Browse to a URL when a match is found 33 | func matchedItem() { 34 | let safariController = SFSafariViewController(url: URL(string: "https://www.visitdublin.com/")!) 35 | present(safariController, animated: true, completion: nil) 36 | } 37 | 38 | override func didReceiveMemoryWarning() { 39 | super.didReceiveMemoryWarning() 40 | // Dispose of any resources that can be recreated. 41 | } 42 | 43 | } 44 | 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Tensorflow-lite Deeplab RealTime 2 | 3 | ## 1. Demo 4 | ![](http://www.ibbwhat.com/optimize1.gif) 5 | ![](http://www.ibbwhat.com/optimize2.gif) 6 | 7 | ## 2. Requirements: 8 | - [Apple Developer Program Account](https://opencv.org/releases.html) (Simulator doesn’t have a camera) 9 | - [Xcode 9.2](https://developer.apple.com/xcode/) 10 | - [OpenCV 3.3.1 iOS Pack](https://opencv.org/releases.html) 11 | - [Git LFS](https://git-lfs.github.com/) 12 | - [Tensorflow-lite](https://www.tensorflow.org/lite/) 13 | - any iOS device with a decent camera 14 | 15 | 16 | ## 3. Code reference 17 | 18 | - Opencv 19 | Example application made for [this post](https://medium.com/@dwayneforde/image-recognition-on-ios-with-swift-and-opencv-b5cf0667b79). 20 | 21 | - Tensorflow 22 | Example application made for [this post](https://www.tensorflow.org/lite/models/segmentation/overview) 23 | 24 | - Model File: 25 | DeepLab segmentation [download](https://storage.googleapis.com/download.tensorflow.org/models/tflite/gpu/deeplabv3_257_mv_gpu.tflite) 26 | (image segmentation model that assigns semantic labels (e.g., dog, cat, car) to every pixel in the input image) 27 | 28 | ## 4. Installation: 29 | ``` 30 | git clone https://github.com/toniz/deeplab-on-ios.git 31 | cd deeplab-on-ios/ 32 | pod install 33 | open DeeplabOnIOS.xcworkspace 34 | ``` 35 | 36 | 37 | * DeepLabv3+: 38 | ``` 39 | @inproceedings{deeplabv3plus2018, 40 | title={Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation}, 41 | author={Liang-Chieh Chen and Yukun Zhu and George Papandreou and Florian Schroff and Hartwig Adam}, 42 | booktitle={ECCV}, 43 | year={2018} 44 | } 45 | ``` 46 | 47 | -------------------------------------------------------------------------------- /DeeplabOnIOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | NSCameraUsageDescription 24 | Allow for nostalgia 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /DeeplabOnIOS/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /DeeplabOnIOS/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | }, 88 | { 89 | "idiom" : "ios-marketing", 90 | "size" : "1024x1024", 91 | "scale" : "1x" 92 | } 93 | ], 94 | "info" : { 95 | "version" : 1, 96 | "author" : "xcode" 97 | } 98 | } -------------------------------------------------------------------------------- /DeeplabOnIOS/TfliteWrapper.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #import 16 | #import 17 | #import 18 | 19 | /** This class provides Objective C wrapper methods on top of the C++ TensorflowLite library. This 20 | * wrapper is required because currently there is no interoperability between Swift and C++. This 21 | * wrapper is exposed to Swift via bridging so that the Tensorflow Lite methods can be called from 22 | * Swift. 23 | */ 24 | @interface TfliteWrapper : NSObject 25 | 26 | /** 27 | This method initializes the TfliteWrapper with the specified model file. 28 | */ 29 | - (instancetype)initWithModelFileName:(NSString *)fileName; 30 | 31 | /** 32 | This method initializes the interpreter of TensorflowLite library with the specified model file 33 | that performs the inference. 34 | */ 35 | - (BOOL)setUpModelAndInterpreter; 36 | 37 | /** 38 | This method gets a reference to the input tensor at an index. 39 | */ 40 | - (uint8_t *)inputTensortAtIndex:(int)index; 41 | - (float_t *)inputTensortFloatAtIndex:(int)index; 42 | 43 | /** 44 | This method performs the inference by invoking the interpreter. 45 | */ 46 | - (BOOL)invokeInterpreter; 47 | 48 | /** 49 | This method gets the output tensor at a specified index. 50 | */ 51 | - (float *)outputTensorAtIndex:(int)index; 52 | 53 | /** 54 | This method sets the number of threads used by the interpreter to perform inference. 55 | */ 56 | - (void)setNumberOfThreads:(int)threadCount; 57 | 58 | @end 59 | -------------------------------------------------------------------------------- /DeeplabOnIOS/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DeeplabOnIOS 4 | // 5 | // Created by Dwayne Forde on 2017-12-23. 6 | // 7 | 8 | import UIKit 9 | 10 | @UIApplicationMain 11 | class AppDelegate: UIResponder, UIApplicationDelegate { 12 | 13 | var window: UIWindow? 14 | 15 | 16 | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 17 | // Override point for customization after application launch. 18 | return true 19 | } 20 | 21 | func applicationWillResignActive(_ application: UIApplication) { 22 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 23 | // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game. 24 | } 25 | 26 | func applicationDidEnterBackground(_ application: UIApplication) { 27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 29 | } 30 | 31 | func applicationWillEnterForeground(_ application: UIApplication) { 32 | // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background. 33 | } 34 | 35 | func applicationDidBecomeActive(_ application: UIApplication) { 36 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 37 | } 38 | 39 | func applicationWillTerminate(_ application: UIApplication) { 40 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 41 | } 42 | 43 | 44 | } 45 | 46 | -------------------------------------------------------------------------------- /DeeplabOnIOS/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /DeeplabOnIOS/TfliteWrapper.mm: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #import "TfliteWrapper.h" 16 | #import 17 | 18 | #import 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | 25 | #include "tensorflow/lite/model.h" 26 | #include "tensorflow/lite/kernels/register.h" 27 | #include "tensorflow/lite/string_util.h" 28 | 29 | NSString* modelFileName; 30 | 31 | @interface TfliteWrapper() { 32 | std::unique_ptr model; 33 | tflite::ops::builtin::BuiltinOpResolver resolver; 34 | std::unique_ptr interpreter; 35 | } 36 | 37 | @end 38 | 39 | @implementation TfliteWrapper 40 | 41 | #pragma mark - Initializer 42 | -(instancetype)initWithModelFileName:(NSString *)fileName { 43 | self = [super init]; 44 | if (self) { 45 | modelFileName = fileName; 46 | } 47 | 48 | return self; 49 | } 50 | 51 | #pragma mark - Model and Interpreter Setup Methods 52 | -(BOOL)setUpModelAndInterpreter { 53 | if (![self initializeFlatBufferModel]) { 54 | return NO; 55 | } 56 | 57 | if (![self initializeInterpreter]) { 58 | return NO; 59 | } 60 | 61 | return YES; 62 | } 63 | 64 | /** 65 | This method initializes the flat buffer model. 66 | */ 67 | -(BOOL) initializeFlatBufferModel { 68 | if (!modelFileName) { 69 | return NO; 70 | } 71 | 72 | // Obtains path to tflite model. 73 | NSString* graph_path = [TfliteWrapper filePathForResourceName:modelFileName extension:@"tflite"]; 74 | if (!graph_path) { 75 | return NO; 76 | } 77 | 78 | // Tries to load tflite model. 79 | model = tflite::FlatBufferModel::BuildFromFile([graph_path UTF8String]); 80 | if (!model) { 81 | NSLog(@"Failed to mmap model %@", graph_path); 82 | return NO; 83 | } 84 | NSLog(@"Loaded model %@", graph_path); 85 | return YES; 86 | } 87 | 88 | /** 89 | This method initializes the interpreter and allocates the tensors. 90 | */ 91 | -(BOOL) initializeInterpreter { 92 | //Tries to construct interpreter. 93 | tflite::InterpreterBuilder(*model, resolver)(&interpreter); 94 | 95 | if (!interpreter) { 96 | NSLog(@"Failed to construct interpreter"); 97 | return NO; 98 | } 99 | 100 | //Tries to allocate input and output tensors. 101 | if (interpreter->AllocateTensors() != kTfLiteOk) { 102 | NSLog(@"Failed to construct interpreter"); 103 | return NO; 104 | } 105 | 106 | return YES; 107 | } 108 | 109 | #pragma MARK - Inference Methods 110 | -(uint8_t *)inputTensortAtIndex:(int)index{ 111 | //Gets a reference to the tensor at a specified index 112 | int input = interpreter->inputs()[index]; 113 | uint8_t* output = interpreter->typed_tensor(input); 114 | 115 | return output; 116 | } 117 | 118 | -(float_t *)inputTensortFloatAtIndex:(int)index{ 119 | //Gets a reference to the tensor at a specified index 120 | int input = interpreter->inputs()[index]; 121 | float_t* output = interpreter->typed_tensor(input); 122 | 123 | return output; 124 | } 125 | 126 | -(BOOL)invokeInterpreter { 127 | //Invokes the interpreter 128 | if (interpreter->Invoke() != kTfLiteOk) { 129 | NSLog(@"Failed to invoke!"); 130 | return false; 131 | } 132 | 133 | return true; 134 | } 135 | 136 | -(float *)outputTensorAtIndex:(int) index { 137 | //Returns the output tensor. 138 | return interpreter->typed_output_tensor(index); 139 | } 140 | 141 | #pragma mark - Thread Handling Methods 142 | -(void)setNumberOfThreads:(int)threadCount { 143 | interpreter->SetNumThreads(threadCount); 144 | } 145 | 146 | #pragma mark - File Path Methods 147 | +(NSString *)filePathForResourceName: (NSString*) name extension:(NSString*) extension { 148 | NSString* filePath = [[NSBundle mainBundle] pathForResource:name ofType:extension]; 149 | if (filePath == NULL) { 150 | NSLog(@"Couldn't find \"%@.%@\" in bundle.", name, extension); 151 | } 152 | return filePath; 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /DeeplabOnIOS/NostalgiaCamera.mm: -------------------------------------------------------------------------------- 1 | // 2 | // NostalgiaCamera.m 3 | // DeeplabOnIOS 4 | // 5 | // Created by Dwayne Forde on 2017-12-23. 6 | // 7 | 8 | #import 9 | #import 10 | #import 11 | #include "NostalgiaCamera.h" 12 | #include "TfliteWrapper.h" 13 | 14 | using namespace std; 15 | using namespace cv; 16 | 17 | 18 | @interface NostalgiaCamera () 19 | @end 20 | 21 | 22 | @implementation NostalgiaCamera 23 | { 24 | UIViewController * delegate; 25 | UIImageView * imageView; 26 | CvVideoCamera * videoCamera; 27 | TfliteWrapper *tfLiteWrapper; 28 | } 29 | 30 | - (id)initWithController:(UIViewController*)c andImageView:(UIImageView*)iv 31 | { 32 | delegate = c; 33 | imageView = iv; 34 | 35 | videoCamera = [[CvVideoCamera alloc] initWithParentView:imageView]; // Init with the UIImageView from the ViewController 36 | videoCamera.defaultAVCaptureDevicePosition = AVCaptureDevicePositionBack; // Use the back camera 37 | videoCamera.defaultAVCaptureVideoOrientation = AVCaptureVideoOrientationPortrait; // Ensure proper orientation 38 | videoCamera.rotateVideo = YES; // Ensure proper orientation 39 | videoCamera.defaultFPS = 30; // How often 'processImage' is called, adjust based on the amount/complexity of images 40 | videoCamera.delegate = self; 41 | 42 | tfLiteWrapper = [[TfliteWrapper alloc]init]; 43 | tfLiteWrapper = [tfLiteWrapper initWithModelFileName:@"deeplabv3_257_mv_gpu"]; 44 | if(![tfLiteWrapper setUpModelAndInterpreter]) 45 | { 46 | NSLog(@"Failed To Load Model"); 47 | return self; 48 | } 49 | 50 | return self; 51 | } 52 | 53 | - (void)processImage:(cv::Mat &)frame { 54 | cv::Mat small; 55 | cv::resize(frame, small, cv::Size(257, 257), 0, 0, CV_INTER_LINEAR); 56 | float_t *input = [tfLiteWrapper inputTensortFloatAtIndex:0]; 57 | //NSLog(@"Input: %f", *input); 58 | 59 | //BGRA2RGB 60 | int inputCnt=0; 61 | for (int row = 0; row < small.rows; row++) 62 | { 63 | uchar* data = small.ptr(row); 64 | for (int col = 0; col < small.cols; col++) 65 | { 66 | input[inputCnt++] = (float)data[col * 4 + 2]/255.0; // Red 67 | input[inputCnt++] = (float)data[col * 4 + 1]/255.0; // Green 68 | input[inputCnt++] = (float)data[col * 4 ]/255.0; // Bule 69 | } 70 | } 71 | 72 | if([tfLiteWrapper invokeInterpreter]) 73 | { 74 | float_t *output = [tfLiteWrapper outputTensorAtIndex:0]; 75 | for (int row = 0; row < small.rows; row++) 76 | { 77 | uchar* data = small.ptr(row); 78 | int rowBegin = row * small.cols * 21; 79 | for (int col = 0; col < small.cols; col++) 80 | { 81 | int colBegin = rowBegin + col * 21; 82 | int maxIndex = 0; 83 | float maxValue = output[colBegin]; 84 | for(int chan=1; chan < 21; chan++) 85 | { 86 | if(output[colBegin+chan] > maxValue) 87 | { 88 | maxValue = output[colBegin+chan]; 89 | maxIndex = chan; 90 | } 91 | } 92 | 93 | if(maxIndex == 15) // PERSON 94 | { 95 | data[col * 4 + 3] = 0; 96 | data[col * 4 + 2] = 0; 97 | data[col * 4 + 1] = 0; 98 | data[col * 4] = 0; 99 | } 100 | else 101 | { 102 | data[col * 4 + 3] = 255; 103 | data[col * 4 + 2] = 255; 104 | data[col * 4 + 1] = 255; 105 | data[col * 4] = 255; 106 | } 107 | } 108 | } 109 | } 110 | 111 | Mat bigMask; 112 | cv::resize(small, bigMask, cv::Size(frame.cols, frame.rows), 0, 0, CV_INTER_LINEAR); 113 | 114 | // Draw Contour 115 | /* 116 | Mat grey; 117 | cvtColor(bigMask, grey, CV_BGR2GRAY); //CV_8UC1 118 | std::vector > contours; 119 | findContours(grey, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE); 120 | for( size_t i = 0; i < contours.size(); i++ ) 121 | { 122 | std::vector approx; 123 | cv::approxPolyDP(Mat(contours[i]), approx, arcLength(Mat(contours[i]), true)*0.02, true); 124 | int n = (int)approx.size(); 125 | const cv::Point* p = &approx[0]; 126 | cv::polylines(frame, &p, &n, 1, true, Scalar(0,255,0)); 127 | } 128 | */ 129 | cv::bitwise_or(frame, bigMask, frame); 130 | return; 131 | } 132 | 133 | - (void)start 134 | { 135 | [videoCamera start]; 136 | } 137 | 138 | - (void)stop 139 | { 140 | [videoCamera stop]; 141 | } 142 | 143 | @end 144 | -------------------------------------------------------------------------------- /DeeplabOnIOS.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 3D98A4812293E7D300842B2F /* NostalgiaCamera.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3D98A47F2293E7D300842B2F /* NostalgiaCamera.mm */; }; 11 | 3DD76BC5228F9EAF00533E0E /* TfliteWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3DD76BC4228F9EAF00533E0E /* TfliteWrapper.mm */; }; 12 | 3DD76BCE22901D1A00533E0E /* deeplabv3_257_mv_gpu.tflite in Resources */ = {isa = PBXBuildFile; fileRef = 3DD76BCA22901D1A00533E0E /* deeplabv3_257_mv_gpu.tflite */; }; 13 | 4E93CE445C9478035ECDC571 /* Pods_DeeplabOnIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 51E40A5A2F7F3CF95A5A39DF /* Pods_DeeplabOnIOS.framework */; }; 14 | 653E20451FEEBD5C00274F0E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653E20441FEEBD5C00274F0E /* AppDelegate.swift */; }; 15 | 653E20471FEEBD5C00274F0E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 653E20461FEEBD5C00274F0E /* ViewController.swift */; }; 16 | 653E204A1FEEBD5C00274F0E /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 653E20481FEEBD5C00274F0E /* Main.storyboard */; }; 17 | 653E204C1FEEBD5C00274F0E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 653E204B1FEEBD5C00274F0E /* Assets.xcassets */; }; 18 | 653E204F1FEEBD5C00274F0E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 653E204D1FEEBD5C00274F0E /* LaunchScreen.storyboard */; }; 19 | 65FB8E4A1FEF343900967D6E /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65FB8E491FEF343900967D6E /* CoreMedia.framework */; }; 20 | 65FB8E4C1FEF343E00967D6E /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 65FB8E4B1FEF343E00967D6E /* AVFoundation.framework */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | 3D98A47F2293E7D300842B2F /* NostalgiaCamera.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NostalgiaCamera.mm; sourceTree = ""; }; 25 | 3D98A4802293E7D300842B2F /* NostalgiaCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NostalgiaCamera.h; sourceTree = ""; }; 26 | 3DD76BC3228F9EA700533E0E /* TfliteWrapper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TfliteWrapper.h; sourceTree = ""; }; 27 | 3DD76BC4228F9EAF00533E0E /* TfliteWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TfliteWrapper.mm; sourceTree = ""; }; 28 | 3DD76BCA22901D1A00533E0E /* deeplabv3_257_mv_gpu.tflite */ = {isa = PBXFileReference; lastKnownFileType = file; path = deeplabv3_257_mv_gpu.tflite; sourceTree = ""; }; 29 | 51E40A5A2F7F3CF95A5A39DF /* Pods_DeeplabOnIOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DeeplabOnIOS.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 30 | 653E20411FEEBD5C00274F0E /* DeeplabOnIOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DeeplabOnIOS.app; sourceTree = BUILT_PRODUCTS_DIR; }; 31 | 653E20441FEEBD5C00274F0E /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 32 | 653E20461FEEBD5C00274F0E /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 33 | 653E20491FEEBD5C00274F0E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 34 | 653E204B1FEEBD5C00274F0E /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 35 | 653E204E1FEEBD5C00274F0E /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 36 | 653E20501FEEBD5C00274F0E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 37 | 65FB8E491FEF343900967D6E /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 38 | 65FB8E4B1FEF343E00967D6E /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 39 | 82EC4C9961492002F4DB2EB1 /* Pods-DeeplabOnIOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeeplabOnIOS.debug.xcconfig"; path = "Pods/Target Support Files/Pods-DeeplabOnIOS/Pods-DeeplabOnIOS.debug.xcconfig"; sourceTree = ""; }; 40 | 830CBBB78878C9AE97731E52 /* Pods-DeeplabOnIOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DeeplabOnIOS.release.xcconfig"; path = "Pods/Target Support Files/Pods-DeeplabOnIOS/Pods-DeeplabOnIOS.release.xcconfig"; sourceTree = ""; }; 41 | /* End PBXFileReference section */ 42 | 43 | /* Begin PBXFrameworksBuildPhase section */ 44 | 653E203E1FEEBD5C00274F0E /* Frameworks */ = { 45 | isa = PBXFrameworksBuildPhase; 46 | buildActionMask = 2147483647; 47 | files = ( 48 | 65FB8E4C1FEF343E00967D6E /* AVFoundation.framework in Frameworks */, 49 | 65FB8E4A1FEF343900967D6E /* CoreMedia.framework in Frameworks */, 50 | 4E93CE445C9478035ECDC571 /* Pods_DeeplabOnIOS.framework in Frameworks */, 51 | ); 52 | runOnlyForDeploymentPostprocessing = 0; 53 | }; 54 | /* End PBXFrameworksBuildPhase section */ 55 | 56 | /* Begin PBXGroup section */ 57 | 0420E0F44703C010D4753BFF /* Pods */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 82EC4C9961492002F4DB2EB1 /* Pods-DeeplabOnIOS.debug.xcconfig */, 61 | 830CBBB78878C9AE97731E52 /* Pods-DeeplabOnIOS.release.xcconfig */, 62 | ); 63 | name = Pods; 64 | sourceTree = ""; 65 | }; 66 | 3DD76BC922901D1A00533E0E /* Model */ = { 67 | isa = PBXGroup; 68 | children = ( 69 | 3DD76BCA22901D1A00533E0E /* deeplabv3_257_mv_gpu.tflite */, 70 | ); 71 | path = Model; 72 | sourceTree = ""; 73 | }; 74 | 653E20381FEEBD5C00274F0E = { 75 | isa = PBXGroup; 76 | children = ( 77 | 653E20431FEEBD5C00274F0E /* DeeplabOnIOS */, 78 | 653E20421FEEBD5C00274F0E /* Products */, 79 | 65FB8E481FEF343900967D6E /* Frameworks */, 80 | 0420E0F44703C010D4753BFF /* Pods */, 81 | ); 82 | sourceTree = ""; 83 | }; 84 | 653E20421FEEBD5C00274F0E /* Products */ = { 85 | isa = PBXGroup; 86 | children = ( 87 | 653E20411FEEBD5C00274F0E /* DeeplabOnIOS.app */, 88 | ); 89 | name = Products; 90 | sourceTree = ""; 91 | }; 92 | 653E20431FEEBD5C00274F0E /* DeeplabOnIOS */ = { 93 | isa = PBXGroup; 94 | children = ( 95 | 3D98A4802293E7D300842B2F /* NostalgiaCamera.h */, 96 | 3D98A47F2293E7D300842B2F /* NostalgiaCamera.mm */, 97 | 3DD76BC3228F9EA700533E0E /* TfliteWrapper.h */, 98 | 3DD76BC4228F9EAF00533E0E /* TfliteWrapper.mm */, 99 | 653E20441FEEBD5C00274F0E /* AppDelegate.swift */, 100 | 653E204B1FEEBD5C00274F0E /* Assets.xcassets */, 101 | 653E20501FEEBD5C00274F0E /* Info.plist */, 102 | 653E204D1FEEBD5C00274F0E /* LaunchScreen.storyboard */, 103 | 653E20481FEEBD5C00274F0E /* Main.storyboard */, 104 | 653E20461FEEBD5C00274F0E /* ViewController.swift */, 105 | 3DD76BC922901D1A00533E0E /* Model */, 106 | ); 107 | path = DeeplabOnIOS; 108 | sourceTree = ""; 109 | }; 110 | 65FB8E481FEF343900967D6E /* Frameworks */ = { 111 | isa = PBXGroup; 112 | children = ( 113 | 65FB8E4B1FEF343E00967D6E /* AVFoundation.framework */, 114 | 65FB8E491FEF343900967D6E /* CoreMedia.framework */, 115 | 51E40A5A2F7F3CF95A5A39DF /* Pods_DeeplabOnIOS.framework */, 116 | ); 117 | name = Frameworks; 118 | sourceTree = ""; 119 | }; 120 | /* End PBXGroup section */ 121 | 122 | /* Begin PBXNativeTarget section */ 123 | 653E20401FEEBD5C00274F0E /* DeeplabOnIOS */ = { 124 | isa = PBXNativeTarget; 125 | buildConfigurationList = 653E20531FEEBD5C00274F0E /* Build configuration list for PBXNativeTarget "DeeplabOnIOS" */; 126 | buildPhases = ( 127 | 72C16BF7009B0BCB3F89129E /* [CP] Check Pods Manifest.lock */, 128 | 653E203D1FEEBD5C00274F0E /* Sources */, 129 | 653E203E1FEEBD5C00274F0E /* Frameworks */, 130 | 653E203F1FEEBD5C00274F0E /* Resources */, 131 | ); 132 | buildRules = ( 133 | ); 134 | dependencies = ( 135 | ); 136 | name = DeeplabOnIOS; 137 | productName = DeeplabOnIOS; 138 | productReference = 653E20411FEEBD5C00274F0E /* DeeplabOnIOS.app */; 139 | productType = "com.apple.product-type.application"; 140 | }; 141 | /* End PBXNativeTarget section */ 142 | 143 | /* Begin PBXProject section */ 144 | 653E20391FEEBD5C00274F0E /* Project object */ = { 145 | isa = PBXProject; 146 | attributes = { 147 | LastSwiftUpdateCheck = 0920; 148 | LastUpgradeCheck = 1010; 149 | TargetAttributes = { 150 | 653E20401FEEBD5C00274F0E = { 151 | CreatedOnToolsVersion = 9.2; 152 | LastSwiftMigration = 0920; 153 | ProvisioningStyle = Automatic; 154 | }; 155 | }; 156 | }; 157 | buildConfigurationList = 653E203C1FEEBD5C00274F0E /* Build configuration list for PBXProject "DeeplabOnIOS" */; 158 | compatibilityVersion = "Xcode 8.0"; 159 | developmentRegion = en; 160 | hasScannedForEncodings = 0; 161 | knownRegions = ( 162 | en, 163 | Base, 164 | ); 165 | mainGroup = 653E20381FEEBD5C00274F0E; 166 | productRefGroup = 653E20421FEEBD5C00274F0E /* Products */; 167 | projectDirPath = ""; 168 | projectRoot = ""; 169 | targets = ( 170 | 653E20401FEEBD5C00274F0E /* DeeplabOnIOS */, 171 | ); 172 | }; 173 | /* End PBXProject section */ 174 | 175 | /* Begin PBXResourcesBuildPhase section */ 176 | 653E203F1FEEBD5C00274F0E /* Resources */ = { 177 | isa = PBXResourcesBuildPhase; 178 | buildActionMask = 2147483647; 179 | files = ( 180 | 653E204F1FEEBD5C00274F0E /* LaunchScreen.storyboard in Resources */, 181 | 3DD76BCE22901D1A00533E0E /* deeplabv3_257_mv_gpu.tflite in Resources */, 182 | 653E204C1FEEBD5C00274F0E /* Assets.xcassets in Resources */, 183 | 653E204A1FEEBD5C00274F0E /* Main.storyboard in Resources */, 184 | ); 185 | runOnlyForDeploymentPostprocessing = 0; 186 | }; 187 | /* End PBXResourcesBuildPhase section */ 188 | 189 | /* Begin PBXShellScriptBuildPhase section */ 190 | 72C16BF7009B0BCB3F89129E /* [CP] Check Pods Manifest.lock */ = { 191 | isa = PBXShellScriptBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | ); 195 | inputFileListPaths = ( 196 | ); 197 | inputPaths = ( 198 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 199 | "${PODS_ROOT}/Manifest.lock", 200 | ); 201 | name = "[CP] Check Pods Manifest.lock"; 202 | outputFileListPaths = ( 203 | ); 204 | outputPaths = ( 205 | "$(DERIVED_FILE_DIR)/Pods-DeeplabOnIOS-checkManifestLockResult.txt", 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 210 | showEnvVarsInLog = 0; 211 | }; 212 | /* End PBXShellScriptBuildPhase section */ 213 | 214 | /* Begin PBXSourcesBuildPhase section */ 215 | 653E203D1FEEBD5C00274F0E /* Sources */ = { 216 | isa = PBXSourcesBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | 3DD76BC5228F9EAF00533E0E /* TfliteWrapper.mm in Sources */, 220 | 3D98A4812293E7D300842B2F /* NostalgiaCamera.mm in Sources */, 221 | 653E20471FEEBD5C00274F0E /* ViewController.swift in Sources */, 222 | 653E20451FEEBD5C00274F0E /* AppDelegate.swift in Sources */, 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | }; 226 | /* End PBXSourcesBuildPhase section */ 227 | 228 | /* Begin PBXVariantGroup section */ 229 | 653E20481FEEBD5C00274F0E /* Main.storyboard */ = { 230 | isa = PBXVariantGroup; 231 | children = ( 232 | 653E20491FEEBD5C00274F0E /* Base */, 233 | ); 234 | name = Main.storyboard; 235 | sourceTree = ""; 236 | }; 237 | 653E204D1FEEBD5C00274F0E /* LaunchScreen.storyboard */ = { 238 | isa = PBXVariantGroup; 239 | children = ( 240 | 653E204E1FEEBD5C00274F0E /* Base */, 241 | ); 242 | name = LaunchScreen.storyboard; 243 | sourceTree = ""; 244 | }; 245 | /* End PBXVariantGroup section */ 246 | 247 | /* Begin XCBuildConfiguration section */ 248 | 653E20511FEEBD5C00274F0E /* Debug */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ALWAYS_SEARCH_USER_PATHS = NO; 252 | CLANG_ANALYZER_NONNULL = YES; 253 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 254 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 255 | CLANG_CXX_LIBRARY = "libc++"; 256 | CLANG_ENABLE_MODULES = YES; 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_COMMA = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 263 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 264 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INFINITE_RECURSION = YES; 268 | CLANG_WARN_INT_CONVERSION = YES; 269 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 271 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 272 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 273 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 274 | CLANG_WARN_STRICT_PROTOTYPES = YES; 275 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 276 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | CODE_SIGN_IDENTITY = "iPhone Developer"; 280 | COPY_PHASE_STRIP = NO; 281 | DEBUG_INFORMATION_FORMAT = dwarf; 282 | ENABLE_STRICT_OBJC_MSGSEND = YES; 283 | ENABLE_TESTABILITY = YES; 284 | GCC_C_LANGUAGE_STANDARD = gnu11; 285 | GCC_DYNAMIC_NO_PIC = NO; 286 | GCC_NO_COMMON_BLOCKS = YES; 287 | GCC_OPTIMIZATION_LEVEL = 0; 288 | GCC_PREPROCESSOR_DEFINITIONS = ( 289 | "DEBUG=1", 290 | "$(inherited)", 291 | ); 292 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 293 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 294 | GCC_WARN_UNDECLARED_SELECTOR = YES; 295 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 296 | GCC_WARN_UNUSED_FUNCTION = YES; 297 | GCC_WARN_UNUSED_VARIABLE = YES; 298 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 299 | MTL_ENABLE_DEBUG_INFO = YES; 300 | ONLY_ACTIVE_ARCH = YES; 301 | SDKROOT = iphoneos; 302 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 303 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 304 | }; 305 | name = Debug; 306 | }; 307 | 653E20521FEEBD5C00274F0E /* Release */ = { 308 | isa = XCBuildConfiguration; 309 | buildSettings = { 310 | ALWAYS_SEARCH_USER_PATHS = NO; 311 | CLANG_ANALYZER_NONNULL = YES; 312 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 313 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 314 | CLANG_CXX_LIBRARY = "libc++"; 315 | CLANG_ENABLE_MODULES = YES; 316 | CLANG_ENABLE_OBJC_ARC = YES; 317 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 318 | CLANG_WARN_BOOL_CONVERSION = YES; 319 | CLANG_WARN_COMMA = YES; 320 | CLANG_WARN_CONSTANT_CONVERSION = YES; 321 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 322 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 323 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 324 | CLANG_WARN_EMPTY_BODY = YES; 325 | CLANG_WARN_ENUM_CONVERSION = YES; 326 | CLANG_WARN_INFINITE_RECURSION = YES; 327 | CLANG_WARN_INT_CONVERSION = YES; 328 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 329 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 330 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 331 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 332 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 333 | CLANG_WARN_STRICT_PROTOTYPES = YES; 334 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 335 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 336 | CLANG_WARN_UNREACHABLE_CODE = YES; 337 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 338 | CODE_SIGN_IDENTITY = "iPhone Developer"; 339 | COPY_PHASE_STRIP = NO; 340 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 341 | ENABLE_NS_ASSERTIONS = NO; 342 | ENABLE_STRICT_OBJC_MSGSEND = YES; 343 | GCC_C_LANGUAGE_STANDARD = gnu11; 344 | GCC_NO_COMMON_BLOCKS = YES; 345 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 346 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 347 | GCC_WARN_UNDECLARED_SELECTOR = YES; 348 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 349 | GCC_WARN_UNUSED_FUNCTION = YES; 350 | GCC_WARN_UNUSED_VARIABLE = YES; 351 | IPHONEOS_DEPLOYMENT_TARGET = 10.0; 352 | MTL_ENABLE_DEBUG_INFO = NO; 353 | SDKROOT = iphoneos; 354 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 355 | VALIDATE_PRODUCT = YES; 356 | }; 357 | name = Release; 358 | }; 359 | 653E20541FEEBD5C00274F0E /* Debug */ = { 360 | isa = XCBuildConfiguration; 361 | baseConfigurationReference = 82EC4C9961492002F4DB2EB1 /* Pods-DeeplabOnIOS.debug.xcconfig */; 362 | buildSettings = { 363 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 364 | CLANG_ENABLE_MODULES = YES; 365 | CODE_SIGN_STYLE = Automatic; 366 | DEVELOPMENT_TEAM = X7ST8TQKB4; 367 | FRAMEWORK_SEARCH_PATHS = ( 368 | "$(inherited)", 369 | "$(PROJECT_DIR)", 370 | ); 371 | HEADER_SEARCH_PATHS = "$(inherited)"; 372 | INFOPLIST_FILE = DeeplabOnIOS/Info.plist; 373 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 374 | PRODUCT_BUNDLE_IDENTIFIER = bbwhat.net.toniz; 375 | PRODUCT_NAME = "$(TARGET_NAME)"; 376 | SWIFT_OBJC_BRIDGING_HEADER = "DeeplabOnIOS/DeeplabOnIOS-Bridging-Header.h"; 377 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 378 | SWIFT_VERSION = 4.0; 379 | TARGETED_DEVICE_FAMILY = "1,2"; 380 | }; 381 | name = Debug; 382 | }; 383 | 653E20551FEEBD5C00274F0E /* Release */ = { 384 | isa = XCBuildConfiguration; 385 | baseConfigurationReference = 830CBBB78878C9AE97731E52 /* Pods-DeeplabOnIOS.release.xcconfig */; 386 | buildSettings = { 387 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 388 | CLANG_ENABLE_MODULES = YES; 389 | CODE_SIGN_STYLE = Automatic; 390 | DEVELOPMENT_TEAM = X7ST8TQKB4; 391 | FRAMEWORK_SEARCH_PATHS = ( 392 | "$(inherited)", 393 | "$(PROJECT_DIR)", 394 | ); 395 | HEADER_SEARCH_PATHS = "$(inherited)"; 396 | INFOPLIST_FILE = DeeplabOnIOS/Info.plist; 397 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 398 | PRODUCT_BUNDLE_IDENTIFIER = bbwhat.net.toniz; 399 | PRODUCT_NAME = "$(TARGET_NAME)"; 400 | SWIFT_OBJC_BRIDGING_HEADER = "DeeplabOnIOS/DeeplabOnIOS-Bridging-Header.h"; 401 | SWIFT_VERSION = 4.0; 402 | TARGETED_DEVICE_FAMILY = "1,2"; 403 | }; 404 | name = Release; 405 | }; 406 | /* End XCBuildConfiguration section */ 407 | 408 | /* Begin XCConfigurationList section */ 409 | 653E203C1FEEBD5C00274F0E /* Build configuration list for PBXProject "DeeplabOnIOS" */ = { 410 | isa = XCConfigurationList; 411 | buildConfigurations = ( 412 | 653E20511FEEBD5C00274F0E /* Debug */, 413 | 653E20521FEEBD5C00274F0E /* Release */, 414 | ); 415 | defaultConfigurationIsVisible = 0; 416 | defaultConfigurationName = Release; 417 | }; 418 | 653E20531FEEBD5C00274F0E /* Build configuration list for PBXNativeTarget "DeeplabOnIOS" */ = { 419 | isa = XCConfigurationList; 420 | buildConfigurations = ( 421 | 653E20541FEEBD5C00274F0E /* Debug */, 422 | 653E20551FEEBD5C00274F0E /* Release */, 423 | ); 424 | defaultConfigurationIsVisible = 0; 425 | defaultConfigurationName = Release; 426 | }; 427 | /* End XCConfigurationList section */ 428 | }; 429 | rootObject = 653E20391FEEBD5C00274F0E /* Project object */; 430 | } 431 | --------------------------------------------------------------------------------