{"id":21088,"date":"2018-07-18T11:33:25","date_gmt":"2018-07-18T09:33:25","guid":{"rendered":"http:\/\/www.inovex.de\/blog\/?p=12979"},"modified":"2022-11-29T08:02:06","modified_gmt":"2022-11-29T07:02:06","slug":"tensorflow-models-with-core-ml","status":"publish","type":"post","link":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/","title":{"rendered":"Using TensorFlow Models with Core ML on iOS"},"content":{"rendered":"<p>Machine learning and more precisely convolutional neural networks are an interesting approach for image classification on mobile devices. In the recent past it wasn&#8217;t that easy to use a pre-trained TensorFlow CNN on an iOS device. To use such a network, the developer was forced to work with the <code>Tensorflow-experimental<\/code> <a href=\"https:\/\/cocoapods.org\/pods\/TensorFlow-experimental\">Cocoapod<\/a>\u00a0or build the TensorFlow library from source for a size-optimized binary. It was a messy and complicated way for developers. In iOS 11 Apple introduced\u00a0<em>Core ML,<\/em> its own framework to integrate machine learning models into custom iOS apps. It is also the fundament for Apple products like Siri, Camera or QuickType. The framework gives the developer an easy and clear abstraction layer to use the machine learning algorithms, without worrying about any calculation or hardware access.<!--more--><\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_79_2 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\"><p class=\"ez-toc-title\" style=\"cursor:inherit\"><\/p>\n<\/div><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#Previously-on-this-blog%E2%80%A6\" >Previously on this blog\u2026<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#How-Core-ML-works\" >How Core ML works<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#Creating-Core-ML-models\" >Creating Core ML models<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#Transform-the-plant-neural-network\" >Transform the plant neural network<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#Using-the-model\" >Using the model<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 data-fontsize=\"32\" data-lineheight=\"48\"><span class=\"ez-toc-section\" id=\"Previously-on-this-blog%E2%80%A6\"><\/span>Previously on this blog\u2026<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In the first blog post of this series we demonstrated how to <a href=\"https:\/\/www.inovex.de\/blog\/tensorflow-mobile-training-and-deploying-a-neural-network\/\">train and deploy a model<\/a>.\u00a0This model is trained to recognize houseplants based on a provided image. Subsequently, we explained the integration of such a model into an <a href=\"https:\/\/www.inovex.de\/blog\/tensorflow-mobile-android-app\/\">Android app<\/a>. The goal of this part is to use our TensorFlow MobileNet plant identification model with <em>Core ML<\/em> in an iOS app.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"How-Core-ML-works\"><\/span>How Core ML works<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With Core ML Apple specifies an open format to save pre-trained neural networks, the mlmodel files. Each of these files contains:<\/p>\n<ul>\n<li>Layers of the model,<\/li>\n<li>Inputs,<\/li>\n<li>Outputs,<\/li>\n<li>Functional description based on the training data.<\/li>\n<\/ul>\n<p>This is similar to the file format of TensorFlow or Keras, with their <code>.pb<\/code> and <code>.h5<\/code> files. One difference to these formats is, however, that the Core ML model files can be directly executed with the <em>Core ML<\/em> framework on an iOS device running iOS 11 or later. You only need to add the <code>Core ML<\/code> framework to your project as dependency\u2014no more mess with the TensorFlow Cocoapod. Core ML also gives you, as a developer, an easy-to-use API to execute the prediction and it manages the execution swap between CPU and GPU.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Creating-Core-ML-models\"><\/span>Creating Core ML models<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Most data scientists work with TensorFlow, Caffe or Keras to create their neural networks. These machine learning frameworks don&#8217;t export\u00a0<code>mlmodel<\/code> files to use with <em>Core ML, <\/em>so\u00a0 Apple introduced an open source Python package, <a href=\"https:\/\/pypi.python.org\/pypi\/coremltools\">coremltools<\/a>, to convert trained networks to the <em>Core ML<\/em> model file format. Apple&#8217;s package supports Keras, Caffe and scikit-learn by default. Other than the package by Apple, there are third party tools like the <a href=\"https:\/\/github.com\/tf-coreml\/tf-coreml\">TensorFlow converter<\/a>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Transform-the-plant-neural-network\"><\/span>Transform the plant neural network<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>To transform the Tensorflow-trained plant identification model to a Core ML model we use the <a href=\"https:\/\/github.com\/tf-coreml\/tf-coreml\">Tensoflow converter<\/a>. The method <code>tfcoreml.convert\u00a0<\/code>\u00a0converts a frozen Tensorflow graph, a <code>.pb<\/code> file, to a Core ML model.<\/p>\n<p>A converter Python file looks like this:<\/p>\n<pre><code># converter.py\r\n\r\nimport tfcoreml\r\n\r\n# Supply a dictionary of input tensors' name and shape (with batch axis)\r\n\r\ninput_tensor_shapes = {\"input:0\": [1, 224, 224, 3]} # batch size is 1\r\n\r\n# TF graph definition\r\n\r\ntf_model_path = '.\/HousePlantIdentifier.pb'\r\n\r\n# Output CoreML model path\r\n\r\ncoreml_model_file = '.\/HousePlantIdentifier.mlmodel'\r\n\r\n# The TF model's ouput tensor name\r\n\r\noutput_tensor_names = ['final_result:0']\r\n\r\n# Call the converter. This may take a while\r\n\r\ncoreml_model = tfcoreml.convert (\r\n\r\ntf_model_path=tf_model_path,\r\n\r\nmlmodel_path=coreml_model_file,\r\n\r\ninput_name_shape_dict=input_tensor_shapes,\r\n\r\noutput_feature_names=output_tensor_names,\r\n\r\nimage_input_names = ['input:0'],\r\n\r\nred_bias = -1,\r\n\r\ngreen_bias = -1,\r\n\r\nblue_bias = -1,\r\n\r\nimage_scale = 2.0\/255.0)\r\n\r\n<\/code><\/pre>\n<p>You have to specify the input value with the input layer name of the TensorFlow graph, <em>input<\/em>:<\/p>\n<pre><code>input_tensor_shapes = {\"input:0\": [1, 224, 224, 3]} # batch size is 1\r\n\r\n<\/code><\/pre>\n<p>The input value is a 224 by 224 pixel image with the 3 rgb channels.<\/p>\n<p>The output has to be defined by the output layer of the frozen graph, <em>final_result<\/em>:<\/p>\n<pre><code>output_tensor_names = ['final_result:0']\r\n\r\n<\/code><\/pre>\n<p>For the conversion we also configure how the model expects the pixel values of a plant image. In our model we expect values between -1 and 1 with an image scale of 2\/255, therefore the value looks like this:<\/p>\n<pre><code>red_bias = -1,\r\n\r\ngreen_bias = -1,\r\n\r\nblue_bias = -1,\r\n\r\nimage_scale = 2.0\/255.0\r\n\r\n<\/code><\/pre>\n<p>After executing the conversion you get a Core ML model file, which can be used directly in an iOS app. Conversion is necessary every time the underlying TensorFlow graph is updated.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Using-the-model\"><\/span>Using the model<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The created Core ML model file can be imported into the Xcode project. Xcode will parse it and display the input\/output parameters of the model and an auto-created Swift class.<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-12980 size-full\" src=\"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/04\/DraggedImage.png\" alt=\"Importing the Core ML model into Xcode.\" width=\"540\" height=\"450\" \/><\/figure>\n<p>For every imported Core ML model 3 classes are created: a class for interaction with the model, a class for wrapping the input and a class for wrapping the output. The class for the interaction with the model has a <code>prediction<\/code> method, which expects an instance of the input class and returns the output class. We will use this method to run our prediction as shown in this example:<\/p>\n<pre class=\"\"><code>let model = HousePlantIdentifierModel()\r\n\r\nlet prediction = try? model.prediction(input__0: pixelBuffer)\r\n\r\nlet result = prediction?.final_result__0\r\n\r\n<\/code><\/pre>\n<p>We instantiate the class for the Core ML model and hand over a pixel buffer to the\u00a0<code>prediction<\/code> method. The pixel buffer has the Type <code>CVPixelBuffer<\/code> and contains a 224 by 224 pixels image as required in the TensorFlow input layer. To use a <code>UImage <\/code>or <code>CGImage<\/code> instance, it has to be converted to a <code>CVPixelBuffer<\/code> instance.<\/p>\n<p>The result type of the prediction has an instance variable which is named after the output layer of the model. In our model it is a <code>Double<\/code> named <code>final_result__0<\/code>, representing 26 different values as shown in the screenshot. These are the 26 different plants our convolutional neural network can detect.<\/p>\n<p>It&#8217;s as easy as that. We developed a plant detection in only 3 lines of code. To display a result to the user, you only have to match the value against the list of plant names.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>With Core ML Apple supports a very easy way to integrate neural networks in an iOS app without knowledge of the underlying functionality. The open source file format and the provided converters make it possible that no data scientist needs to know how exactly Core ML works.<\/p>\n<p>Of course there some disadvantages, too: Core ML only supports supervised machine learning and the file format and the converters don\u2019t support all layer types and all training tools. Furthermore, you don\u2019t have the possibility to train your model on the device.\u00a0However, it is an interesting framework that greatly simplifies the use of machine learning on iOS.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Machine learning and more precisely convolutional neural networks are an interesting approach for image classification on mobile devices. In the recent past it wasn&#8217;t that easy to use a pre-trained TensorFlow CNN on an iOS device. To use such a network, the developer was forced to work with the Tensorflow-experimental Cocoapod\u00a0or build the TensorFlow library [&hellip;]<\/p>\n","protected":false},"author":68,"featured_media":13534,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"ep_exclude_from_search":false,"footnotes":""},"tags":[509,510,151,218],"service":[420,76],"coauthors":[{"id":68,"display_name":"Sebastian Me\u00dfingfeld","user_nicename":"smessingfeld"}],"class_list":["post-21088","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-ai-2","tag-apps-2","tag-deep-learning","tag-model-deployment","service-apps","service-artificial-intelligence"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using TensorFlow Models with Core ML on iOS - inovex GmbH<\/title>\n<meta name=\"description\" content=\"In iOS 11 Apple introduced\u00a0Core ML, its own framework for Machine Learning on iPhone and iPad. In this article we show how to convert a trained TensorFlow Model and integrate it with an iOS app.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using TensorFlow Models with Core ML on iOS - inovex GmbH\" \/>\n<meta property=\"og:description\" content=\"In iOS 11 Apple introduced\u00a0Core ML, its own framework for Machine Learning on iPhone and iPad. In this article we show how to convert a trained TensorFlow Model and integrate it with an iOS app.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/\" \/>\n<meta property=\"og:site_name\" content=\"inovex GmbH\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inovexde\" \/>\n<meta property=\"article:published_time\" content=\"2018-07-18T09:33:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-29T07:02:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Sebastian Me\u00dfingfeld\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core-1024x576.png\" \/>\n<meta name=\"twitter:creator\" content=\"@inovexgmbh\" \/>\n<meta name=\"twitter:site\" content=\"@inovexgmbh\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sebastian Me\u00dfingfeld\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\u00a0Minuten\" \/>\n\t<meta name=\"twitter:label3\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data3\" content=\"Sebastian Me\u00dfingfeld\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/\"},\"author\":{\"name\":\"Sebastian Me\u00dfingfeld\",\"@id\":\"https:\/\/www.inovex.de\/de\/#\/schema\/person\/98fff9f09e7abd0bca8f6dd8c3cbaa02\"},\"headline\":\"Using TensorFlow Models with Core ML on iOS\",\"datePublished\":\"2018-07-18T09:33:25+00:00\",\"dateModified\":\"2022-11-29T07:02:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/\"},\"wordCount\":902,\"commentCount\":5,\"publisher\":{\"@id\":\"https:\/\/www.inovex.de\/de\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png\",\"keywords\":[\"Ai\",\"Apps\",\"Deep Learning\",\"Model Deployment\"],\"articleSection\":[\"Analytics\",\"Applications\",\"English Content\",\"General\"],\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/\",\"url\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/\",\"name\":\"Using TensorFlow Models with Core ML on iOS - inovex GmbH\",\"isPartOf\":{\"@id\":\"https:\/\/www.inovex.de\/de\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png\",\"datePublished\":\"2018-07-18T09:33:25+00:00\",\"dateModified\":\"2022-11-29T07:02:06+00:00\",\"description\":\"In iOS 11 Apple introduced\u00a0Core ML, its own framework for Machine Learning on iPhone and iPad. In this article we show how to convert a trained TensorFlow Model and integrate it with an iOS app.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#primaryimage\",\"url\":\"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png\",\"contentUrl\":\"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png\",\"width\":1280,\"height\":720,\"caption\":\"Tenserflow to ML Core\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inovex.de\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using TensorFlow Models with Core ML on iOS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inovex.de\/de\/#website\",\"url\":\"https:\/\/www.inovex.de\/de\/\",\"name\":\"inovex GmbH\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.inovex.de\/de\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inovex.de\/de\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inovex.de\/de\/#organization\",\"name\":\"inovex GmbH\",\"url\":\"https:\/\/www.inovex.de\/de\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.inovex.de\/de\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inovex.de\/wp-content\/uploads\/2021\/03\/inovex-logo-16-9-1.png\",\"contentUrl\":\"https:\/\/www.inovex.de\/wp-content\/uploads\/2021\/03\/inovex-logo-16-9-1.png\",\"width\":1921,\"height\":1081,\"caption\":\"inovex GmbH\"},\"image\":{\"@id\":\"https:\/\/www.inovex.de\/de\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inovexde\",\"https:\/\/x.com\/inovexgmbh\",\"https:\/\/www.instagram.com\/inovexlife\/\",\"https:\/\/www.linkedin.com\/company\/inovex\",\"https:\/\/www.youtube.com\/channel\/UC7r66GT14hROB_RQsQBAQUQ\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inovex.de\/de\/#\/schema\/person\/98fff9f09e7abd0bca8f6dd8c3cbaa02\",\"name\":\"Sebastian Me\u00dfingfeld\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/www.inovex.de\/de\/#\/schema\/person\/image\/e27735ac8b505ec9595a8fd52f8fc959\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bb75713104b82a7c2057688c4099e94bb8bb332d973101bd4ff36ef89146824e?s=96&d=retro&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bb75713104b82a7c2057688c4099e94bb8bb332d973101bd4ff36ef89146824e?s=96&d=retro&r=g\",\"caption\":\"Sebastian Me\u00dfingfeld\"},\"url\":\"https:\/\/www.inovex.de\/de\/blog\/author\/smessingfeld\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using TensorFlow Models with Core ML on iOS - inovex GmbH","description":"In iOS 11 Apple introduced\u00a0Core ML, its own framework for Machine Learning on iPhone and iPad. In this article we show how to convert a trained TensorFlow Model and integrate it with an iOS app.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/","og_locale":"de_DE","og_type":"article","og_title":"Using TensorFlow Models with Core ML on iOS - inovex GmbH","og_description":"In iOS 11 Apple introduced\u00a0Core ML, its own framework for Machine Learning on iPhone and iPad. In this article we show how to convert a trained TensorFlow Model and integrate it with an iOS app.","og_url":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/","og_site_name":"inovex GmbH","article_publisher":"https:\/\/www.facebook.com\/inovexde","article_published_time":"2018-07-18T09:33:25+00:00","article_modified_time":"2022-11-29T07:02:06+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png","type":"image\/png"}],"author":"Sebastian Me\u00dfingfeld","twitter_card":"summary_large_image","twitter_image":"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core-1024x576.png","twitter_creator":"@inovexgmbh","twitter_site":"@inovexgmbh","twitter_misc":{"Verfasst von":"Sebastian Me\u00dfingfeld","Gesch\u00e4tzte Lesezeit":"5\u00a0Minuten","Written by":"Sebastian Me\u00dfingfeld"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#article","isPartOf":{"@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/"},"author":{"name":"Sebastian Me\u00dfingfeld","@id":"https:\/\/www.inovex.de\/de\/#\/schema\/person\/98fff9f09e7abd0bca8f6dd8c3cbaa02"},"headline":"Using TensorFlow Models with Core ML on iOS","datePublished":"2018-07-18T09:33:25+00:00","dateModified":"2022-11-29T07:02:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/"},"wordCount":902,"commentCount":5,"publisher":{"@id":"https:\/\/www.inovex.de\/de\/#organization"},"image":{"@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png","keywords":["Ai","Apps","Deep Learning","Model Deployment"],"articleSection":["Analytics","Applications","English Content","General"],"inLanguage":"de","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/","url":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/","name":"Using TensorFlow Models with Core ML on iOS - inovex GmbH","isPartOf":{"@id":"https:\/\/www.inovex.de\/de\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#primaryimage"},"image":{"@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png","datePublished":"2018-07-18T09:33:25+00:00","dateModified":"2022-11-29T07:02:06+00:00","description":"In iOS 11 Apple introduced\u00a0Core ML, its own framework for Machine Learning on iPhone and iPad. In this article we show how to convert a trained TensorFlow Model and integrate it with an iOS app.","breadcrumb":{"@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#primaryimage","url":"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png","contentUrl":"https:\/\/www.inovex.de\/wp-content\/uploads\/2018\/07\/tensorflow-to-ml-core.png","width":1280,"height":720,"caption":"Tenserflow to ML Core"},{"@type":"BreadcrumbList","@id":"https:\/\/www.inovex.de\/de\/blog\/tensorflow-models-with-core-ml\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inovex.de\/de\/"},{"@type":"ListItem","position":2,"name":"Using TensorFlow Models with Core ML on iOS"}]},{"@type":"WebSite","@id":"https:\/\/www.inovex.de\/de\/#website","url":"https:\/\/www.inovex.de\/de\/","name":"inovex GmbH","description":"","publisher":{"@id":"https:\/\/www.inovex.de\/de\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inovex.de\/de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":"Organization","@id":"https:\/\/www.inovex.de\/de\/#organization","name":"inovex GmbH","url":"https:\/\/www.inovex.de\/de\/","logo":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.inovex.de\/de\/#\/schema\/logo\/image\/","url":"https:\/\/www.inovex.de\/wp-content\/uploads\/2021\/03\/inovex-logo-16-9-1.png","contentUrl":"https:\/\/www.inovex.de\/wp-content\/uploads\/2021\/03\/inovex-logo-16-9-1.png","width":1921,"height":1081,"caption":"inovex GmbH"},"image":{"@id":"https:\/\/www.inovex.de\/de\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inovexde","https:\/\/x.com\/inovexgmbh","https:\/\/www.instagram.com\/inovexlife\/","https:\/\/www.linkedin.com\/company\/inovex","https:\/\/www.youtube.com\/channel\/UC7r66GT14hROB_RQsQBAQUQ"]},{"@type":"Person","@id":"https:\/\/www.inovex.de\/de\/#\/schema\/person\/98fff9f09e7abd0bca8f6dd8c3cbaa02","name":"Sebastian Me\u00dfingfeld","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/www.inovex.de\/de\/#\/schema\/person\/image\/e27735ac8b505ec9595a8fd52f8fc959","url":"https:\/\/secure.gravatar.com\/avatar\/bb75713104b82a7c2057688c4099e94bb8bb332d973101bd4ff36ef89146824e?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bb75713104b82a7c2057688c4099e94bb8bb332d973101bd4ff36ef89146824e?s=96&d=retro&r=g","caption":"Sebastian Me\u00dfingfeld"},"url":"https:\/\/www.inovex.de\/de\/blog\/author\/smessingfeld\/"}]}},"_links":{"self":[{"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/posts\/21088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/users\/68"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/comments?post=21088"}],"version-history":[{"count":1,"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/posts\/21088\/revisions"}],"predecessor-version":[{"id":33822,"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/posts\/21088\/revisions\/33822"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/media\/13534"}],"wp:attachment":[{"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/media?parent=21088"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/tags?post=21088"},{"taxonomy":"service","embeddable":true,"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/service?post=21088"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.inovex.de\/de\/wp-json\/wp\/v2\/coauthors?post=21088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}