<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="https://deepdojo.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://deepdojo.com/" rel="alternate" type="text/html" /><updated>2021-04-25T22:31:40+00:00</updated><id>https://deepdojo.com/feed.xml</id><title type="html">The Deep Dojo Machine Learning Blog</title><subtitle>A Mac lover's guide to the robot apocalypse.</subtitle><author><name>Otto Schnurr</name></author><entry><title type="html">A Different Kind of Software</title><link href="https://deepdojo.com/different-kind-of-software" rel="alternate" type="text/html" title="A Different Kind of Software" /><published>2019-04-08T00:00:00+00:00</published><updated>2019-04-08T00:00:00+00:00</updated><id>https://deepdojo.com/different-kind-of-software</id><content type="html" xml:base="https://deepdojo.com/different-kind-of-software">&lt;p&gt;What makes machine learning different? What implications does it have for how software is developed?&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://youtu.be/K2oWAn76tUw&quot;&gt;&lt;img src=&quot;https://s3.amazonaws.com/assets.deepdojo.com/different-kind-of-software.jpg&quot; alt=&quot;A Different Kind of Software&quot; title=&quot;Watch the video.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We dive into these questions in Episode 2 of “&lt;a href=&quot;https://www.youtube.com/playlist?list=PLpT0j_geOltAP7WejEHZB4uUD2EeuEC0c&quot;&gt;Demystifying Machine Learning&lt;/a&gt;”. See an example in action, from training on a Mac to deployment on a mobile phone.&lt;/p&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">What makes machine learning different? What implications does it have for how software is developed? We dive into these questions in Episode 2 of “Demystifying Machine Learning”. See an example in action, from training on a Mac to deployment on a mobile phone.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://s3.amazonaws.com/assets.deepdojo.com/different-kind-of-software.jpg" /><media:content medium="image" url="https://s3.amazonaws.com/assets.deepdojo.com/different-kind-of-software.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">An Unlikely Robot Apocalypse</title><link href="https://deepdojo.com/unlikely-robot-apocalypse" rel="alternate" type="text/html" title="An Unlikely Robot Apocalypse" /><published>2019-01-18T00:00:00+00:00</published><updated>2019-01-18T00:00:00+00:00</updated><id>https://deepdojo.com/unlikely-robot-apocalypse</id><content type="html" xml:base="https://deepdojo.com/unlikely-robot-apocalypse">&lt;p&gt;Machine learning has a lot of hype these days. Some positive. Some negative. We don’t often see examples of where it fails. The mystery surrounding the technology can make it hard to understand.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://youtu.be/qf-icotKDo4&quot;&gt;&lt;img src=&quot;https://s3.amazonaws.com/assets.deepdojo.com/unlikely-robot-apocalypse.jpg&quot; alt=&quot;An Unlikely Robot Apocalypse&quot; title=&quot;Watch the video.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the first video in the “&lt;a href=&quot;https://www.youtube.com/playlist?list=PLpT0j_geOltAP7WejEHZB4uUD2EeuEC0c&quot;&gt;Demystifying Machine Learning&lt;/a&gt;” series.&lt;/p&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">Machine learning has a lot of hype these days. Some positive. Some negative. We don’t often see examples of where it fails. The mystery surrounding the technology can make it hard to understand. This is the first video in the “Demystifying Machine Learning” series.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://s3.amazonaws.com/assets.deepdojo.com/unlikely-robot-apocalypse.jpg" /><media:content medium="image" url="https://s3.amazonaws.com/assets.deepdojo.com/unlikely-robot-apocalypse.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Apple Introduces Create ML</title><link href="https://deepdojo.com/apple-introduces-create-ml" rel="alternate" type="text/html" title="Apple Introduces Create ML" /><published>2018-06-27T00:00:00+00:00</published><updated>2018-06-27T00:00:00+00:00</updated><id>https://deepdojo.com/apple-introduces-create-ml</id><content type="html" xml:base="https://deepdojo.com/apple-introduces-create-ml">&lt;p&gt;Training a machine learning model on a Mac hasn’t been easy. There are open source frameworks that run on a Mac CPU. But trying to accelerate training with a GPU meant &lt;a href=&quot;https://discuss.pytorch.org/t/using-gpu-which-does-not-support-cuda/8087&quot;&gt;using Nvidia hardware&lt;/a&gt; most likely on a &lt;a href=&quot;https://www.paperspace.com/ml&quot;&gt;Linux box&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;With &lt;a href=&quot;https://developer.apple.com/documentation/create_ml&quot;&gt;Create ML&lt;/a&gt;, Apple isn’t aiming for parity with these data science packages. Create ML takes the tangle of algorithmic detail that comes with machine learning and encapsulates it away. The result is an astonishingly simple training environment that is hardware-accelerated for the Mac.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://developer.apple.com/videos/play/wwdc2018/703/?time=685s&quot;&gt;Drag your training data in&lt;/a&gt; then &lt;a href=&quot;https://developer.apple.com/videos/play/wwdc2018/703/?time=754s&quot;&gt;drag your trained model out&lt;/a&gt; using three lines of Swift.&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CreateMLUI&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;builder&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;MLImageClassifierBuilder&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;builder&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;showInLiveView&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This reminds me of the iPod. Late to the party when it was introduced to the market in 2001, that didn’t stop it from becoming a success. Apple has a knack for targeting technology that is locked behind a “chain of pain”. Remove that pain and the technology becomes accessible to a wider group of people. It’s a strategy that runs deep in the Apple play book.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.theglobeandmail.com/technology/digital-culture/how-the-ipod-changed-everything/article556167/&quot;&gt;David Sobotta back in 2009&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“Any time you have a device that is hard to use, but has a high potential for usage, you raise just huge flags for Steve Jobs. It’s like waving a red flag in front of a bull. All of a sudden he sees something and says, wait a minute, if we do this really right, we can own it.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What do we loose when algorithmic detail disappears from a machine learning environment? For a lot of data scientists those details are where the opportunity for innovation is. In a community that lives on the bleeding edge, a few percentage points of accuracy is a big deal.&lt;/p&gt;

&lt;p&gt;To be clear, Metal Performance Shaders also &lt;a href=&quot;https://developer.apple.com/videos/play/wwdc2018/609/?time=287s&quot;&gt;offer training capabilities&lt;/a&gt;. There is customization and gradients galore at that level of detail if that’s your cup of tea. Core ML is &lt;a href=&quot;/apple-introduces-core-ml&quot;&gt;Apple’s deployment engine for machine learning&lt;/a&gt; and also &lt;a href=&quot;https://developer.apple.com/documentation/coreml/mlcustommodel&quot;&gt;offers customization&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For many developers though, bleeding-edge accuracy is not the goal. Just being able take my own data and easily go from zero to any kind of accuracy in the ninety percent range is an astonishing development. For many applications, developing a custom model is now reduced to an exercise of gathering and grooming training data. The machine learning technology itself is no longer a barrier.&lt;/p&gt;

&lt;p&gt;Less training detail in Create ML also means more room for Apple to experiment under the hood. It’s a separation of concerns between applications and machine learning that will likely prove useful - particularly when you consider Apple’s ability to innovate and optimize its lineup of hardware.&lt;/p&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">Training a machine learning model on a Mac hasn’t been easy. There are open source frameworks that run on a Mac CPU. But trying to accelerate training with a GPU meant using Nvidia hardware most likely on a Linux box. With Create ML, Apple isn’t aiming for parity with these data science packages. Create ML takes the tangle of algorithmic detail that comes with machine learning and encapsulates it away. The result is an astonishingly simple training environment that is hardware-accelerated for the Mac.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://s3.amazonaws.com/assets.deepdojo.com/createml-live-view.png" /><media:content medium="image" url="https://s3.amazonaws.com/assets.deepdojo.com/createml-live-view.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Machine Learning Reproducibility Crisis</title><link href="https://deepdojo.com/machine-learning-reproducibility" rel="alternate" type="text/html" title="Machine Learning Reproducibility Crisis" /><published>2018-05-06T00:00:00+00:00</published><updated>2018-05-06T00:00:00+00:00</updated><id>https://deepdojo.com/machine-learning-reproducibility</id><content type="html" xml:base="https://deepdojo.com/machine-learning-reproducibility">&lt;p&gt;Pete Warden discusses code, data and software process. When mixed with machine learning, it can be tricky to iterate on results.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“I’m no shrinking violet when it comes to version control. I’ve toughed my way through some terrible systems, and I can still monkey together a solution using rsync and chicken wire if I have to. Even with all that behind me, I can say with my hand on my heart, that machine learning is by far the worst environment I’ve ever found for collaborating and keeping track of changes.”&lt;/p&gt;
&lt;/blockquote&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">Pete Warden discusses code, data and software process. When mixed with machine learning, it can be tricky to iterate on results. “I’m no shrinking violet when it comes to version control. I’ve toughed my way through some terrible systems, and I can still monkey together a solution using rsync and chicken wire if I have to. Even with all that behind me, I can say with my hand on my heart, that machine learning is by far the worst environment I’ve ever found for collaborating and keeping track of changes.”</summary></entry><entry><title type="html">Creator of Swift Working on TensorFlow</title><link href="https://deepdojo.com/chris-lattner-at-google-brain" rel="alternate" type="text/html" title="Creator of Swift Working on TensorFlow" /><published>2018-03-15T00:00:00+00:00</published><updated>2018-03-15T00:00:00+00:00</updated><id>https://deepdojo.com/chris-lattner-at-google-brain</id><content type="html" xml:base="https://deepdojo.com/chris-lattner-at-google-brain">&lt;p&gt;Chris Lattner joined Google &lt;a href=&quot;https://techcrunch.com/2017/08/14/swift-creator-chris-lattner-joins-google-brain-after-tesla-autopilot-stint/&quot;&gt;back in August&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://twitter.com/clattner_llvm/status/963056348878462976&quot;&gt;&lt;img src=&quot;https://s3.amazonaws.com/assets.deepdojo.com/lattner-google-tweet.png&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&lt;/p&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">Chris Lattner joined Google back in August.</summary></entry><entry><title type="html">Machine Learning Glossary</title><link href="https://deepdojo.com/machine-learning-glossary" rel="alternate" type="text/html" title="Machine Learning Glossary" /><published>2017-12-12T00:00:00+00:00</published><updated>2017-12-12T00:00:00+00:00</updated><id>https://deepdojo.com/machine-learning-glossary</id><content type="html" xml:base="https://deepdojo.com/machine-learning-glossary">&lt;p&gt;A list of over 150 machine learning terms, sorted alphabetically.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://developers.google.com/machine-learning/glossary/#mini-batch&quot;&gt;mini-batch&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

  &lt;p&gt;A small, randomly selected subset of the entire batch of &lt;a href=&quot;https://developers.google.com/machine-learning/glossary/#example&quot;&gt;examples&lt;/a&gt; run together in a single iteration of training or inference. The &lt;a href=&quot;https://developers.google.com/machine-learning/glossary/#batch_size&quot;&gt;batch size&lt;/a&gt; of a mini-batch is usually between 10 and 1,000. It is much more efficient to calculate the loss on a mini-batch than on the full training data.&lt;/p&gt;
&lt;/blockquote&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">A list of over 150 machine learning terms, sorted alphabetically. mini-batch A small, randomly selected subset of the entire batch of examples run together in a single iteration of training or inference. The batch size of a mini-batch is usually between 10 and 1,000. It is much more efficient to calculate the loss on a mini-batch than on the full training data.</summary></entry><entry><title type="html">Climbing Out of Uncanny Valley</title><link href="https://deepdojo.com/climbing-out-of-uncanny-valley" rel="alternate" type="text/html" title="Climbing Out of Uncanny Valley" /><published>2017-11-28T00:00:00+00:00</published><updated>2017-11-28T00:00:00+00:00</updated><id>https://deepdojo.com/climbing-out-of-uncanny-valley</id><content type="html" xml:base="https://deepdojo.com/climbing-out-of-uncanny-valley">&lt;p&gt;People, it seems, have an emotional reaction to things that look almost &lt;em&gt;but not quite&lt;/em&gt; human. There are &lt;a href=&quot;https://en.wikipedia.org/wiki/Uncanny_valley&quot;&gt;theories as to why&lt;/a&gt; but regardless of the reasons, it’s been a  challenging barrier to using photo-realistic computer-generated humans. Something the entertainment industry has been chipping away at &lt;a href=&quot;https://en.wikipedia.org/wiki/Final_Fantasy:_The_Spirits_Within&quot;&gt;for a while&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The makers of &lt;a href=&quot;https://www.muglife.com&quot;&gt;Mug Life&lt;/a&gt; have released an iOS app that can look at a 2D image of a face and then animate it in three dimensions. The results are eye-opening.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://youtu.be/yYQUERN87Tg&quot;&gt;&lt;img src=&quot;https://s3.amazonaws.com/assets.deepdojo.com/muglife-trailer.jpg&quot; alt=&quot;Mug Life Trailer&quot; title=&quot;Watch the video.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“This innovative technology featuring deep neural networks marries decades of video game expertise with the latest advances in computer vision.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Technical advancements in this area are accelerating.&lt;/p&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">People, it seems, have an emotional reaction to things that look almost but not quite human. There are theories as to why but regardless of the reasons, it’s been a challenging barrier to using photo-realistic computer-generated humans. Something the entertainment industry has been chipping away at for a while. The makers of Mug Life have released an iOS app that can look at a 2D image of a face and then animate it in three dimensions. The results are eye-opening. “This innovative technology featuring deep neural networks marries decades of video game expertise with the latest advances in computer vision.” Technical advancements in this area are accelerating.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://s3.amazonaws.com/assets.deepdojo.com/muglife-head-rightFull.jpg" /><media:content medium="image" url="https://s3.amazonaws.com/assets.deepdojo.com/muglife-head-rightFull.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">MLModel API</title><link href="https://deepdojo.com/mlmodel-api" rel="alternate" type="text/html" title="MLModel API" /><published>2017-10-23T00:00:00+00:00</published><updated>2017-10-23T00:00:00+00:00</updated><id>https://deepdojo.com/mlmodel-api</id><content type="html" xml:base="https://deepdojo.com/mlmodel-api">&lt;h2 id=&quot;generated-code&quot;&gt;Generated Code&lt;/h2&gt;

&lt;p&gt;When you take a small Core ML model like &lt;a href=&quot;https://github.com/mdering/CoreMLZoo&quot;&gt;Squeeze Net&lt;/a&gt; and &lt;a href=&quot;/apple-introduces-core-ml&quot;&gt;drop it into Xcode&lt;/a&gt;, you get a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SqueezeNet&lt;/code&gt; implementation. Without comments, the class itself is a only a few dozen lines in length.&lt;/p&gt;

&lt;div class=&quot;language-swift highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SqueezeNet&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;MLModel&lt;/span&gt;

    &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;contentsOf&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;model&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;MLModel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;contentsOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;convenience&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;bundle&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Bundle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SqueezeNet&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;assetPath&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bundle&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;forResource&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;SqueezeNet&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;withExtension&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;mlmodelc&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;try!&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;init&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;contentsOf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;assetPath&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;prediction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SqueezeNetInput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SqueezeNetOutput&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;outFeatures&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;model&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;prediction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;from&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SqueezeNetOutput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;classLabelProbs&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;outFeatures&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;featureValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;classLabelProbs&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;dictionaryValue&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;as!&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;Double&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;classLabel&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;outFeatures&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;featureValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;for&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;classLabel&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;!.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;stringValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;result&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

    &lt;span class=&quot;kd&quot;&gt;func&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;prediction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;CVPixelBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;throws&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&amp;gt;&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SqueezeNetOutput&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;input_&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;SqueezeNetInput&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;image&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;try&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;self&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;prediction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input_&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SqueezeNet&lt;/code&gt; is not a subclass of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MLModel&lt;/code&gt;. It’s a wrapper with methods for loading and driving a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;model&lt;/code&gt; property. Xcode generates input and output classes for the model as well.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://s3.amazonaws.com/assets.deepdojo.com/squeeze-net-api.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;feature-introspection&quot;&gt;Feature Introspection&lt;/h2&gt;

&lt;p&gt;In the end, a class like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SqueezeNet&lt;/code&gt; is a high-level, type-safe convenience. At a lower level, it’s possible to drive the model directly and generically. This is how a framework like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Vision&lt;/code&gt; is able to inspect and &lt;a href=&quot;https://developer.apple.com/documentation/vision/vncoremlrequest&quot;&gt;use an arbitrary model at runtime&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://developer.apple.com/documentation/coreml/mlmodel&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MLModel&lt;/code&gt;&lt;/a&gt; sits at the heart of Core ML. It’s an abstraction that’s focused on input and output features. &lt;a href=&quot;https://developer.apple.com/documentation/coreml/mlmodeldescription&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MLModelDescription&lt;/code&gt;&lt;/a&gt; indicates how these features are structured. An &lt;a href=&quot;https://developer.apple.com/documentation/coreml/mlfeatureprovider&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MLFeatureProvider&lt;/code&gt;&lt;/a&gt; delivers input into the model. A corresponding &lt;a href=&quot;https://developer.apple.com/documentation/coreml/mlfeatureprovider&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MLFeatureProvider&lt;/code&gt;&lt;/a&gt; contains output.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://s3.amazonaws.com/assets.deepdojo.com/mlmodel-api.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;image-processing-and-classification&quot;&gt;Image Processing and Classification&lt;/h2&gt;

&lt;p&gt;Using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Vision&lt;/code&gt; framework, a &lt;a href=&quot;https://developer.apple.com/documentation/vision/vnimagebasedrequest&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VNImageBasedRequest&lt;/code&gt;&lt;/a&gt; turns an image into observations.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://developer.apple.com/documentation/vision/vncoremlrequest&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;VNCoreMLRequest&lt;/code&gt;&lt;/a&gt; is a type of image-based request that uses a Core ML model. Depending on the output description of the model, the request will automatically produce either classifications, pixel buffers or feature values.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://s3.amazonaws.com/assets.deepdojo.com/vision-api.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;As Matthijs Hollemans &lt;a href=&quot;https://machinethink.net/blog/help-core-ml-gives-wrong-output/&quot;&gt;mentions in his post&lt;/a&gt;, it’s important to match image input to the preprocessing that a model expects. Much of this can be addressed when the model is &lt;a href=&quot;https://apple.github.io/coremltools/generated/coremltools.converters.keras.convert.html#coremltools.converters.keras.convert&quot;&gt;converted to Core ML&lt;/a&gt;. From the &lt;a href=&quot;https://developer.apple.com/documentation/coreml/mlmodel/2879179-modeldescription&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;modelDescription&lt;/code&gt;&lt;/a&gt;, the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Vision&lt;/code&gt; framework is able to convert most images into the &lt;a href=&quot;https://developer.apple.com/documentation/coreml/mlimageconstraint/2921267-pixelformattype&quot;&gt;pixel format that a model wants&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Another kind of compatibility to be aware of is image orientation. This is particularly true for iOS where &lt;a href=&quot;https://developer.apple.com/library/content/qa/qa1744/_index.html&quot;&gt;captured images typically align with the camera sensor&lt;/a&gt; instead of aligning to the orientation of the device. Request handlers in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Vision&lt;/code&gt; framework offer a way to &lt;a href=&quot;https://developer.apple.com/documentation/vision/vnimagerequesthandler/2880303-init&quot;&gt;specify orientation&lt;/a&gt; when applying Core ML requests to camera images.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;“A successful book is not made of what is in it, but of what is left out of it.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p class=&quot;quote-source&quot;&gt;— Mark Twain&lt;/p&gt;

&lt;p&gt;When using an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MLModel&lt;/code&gt;, an app is free to focus on input and output. Model implementation is set aside as optimization detail to be navigated by the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.mlmodel&lt;/code&gt; creator who knows the model and Apple engineers who know their lineup of hardware.&lt;/p&gt;

&lt;p&gt;Core ML can generate code for a model that is convenient and easy to use. However if your solution involves plugging in a range potential models, any &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MLModel&lt;/code&gt; can be inspected at runtime to query how its input and output features are structured.&lt;/p&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">MLModel sits at the heart of Core ML. It's an abstraction that's focused on input and output features. MLModelDescription indicates how these features are structured.</summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://s3.amazonaws.com/assets.deepdojo.com/mlmodel-api.png" /><media:content medium="image" url="https://s3.amazonaws.com/assets.deepdojo.com/mlmodel-api.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Core ML Store</title><link href="https://deepdojo.com/core-ml-store" rel="alternate" type="text/html" title="Core ML Store" /><published>2017-10-08T00:00:00+00:00</published><updated>2017-10-08T00:00:00+00:00</updated><id>https://deepdojo.com/core-ml-store</id><content type="html" xml:base="https://deepdojo.com/core-ml-store">&lt;p&gt;A list of free Core ML models with associated sample code and reference. Curated by &lt;a href=&quot;https://twitter.com/kedan_li&quot;&gt;Kedan Li&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“Download and use per license. Remember to acknowledge.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The site currently has eight image filters and roughly twenty classifiers.&lt;/p&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">A list of free Core ML models with associated sample code and reference. Curated by Kedan Li. “Download and use per license. Remember to acknowledge.” The site currently has eight image filters and roughly twenty classifiers.</summary></entry><entry><title type="html">NVIDIA Drivers for macOS High Sierra</title><link href="https://deepdojo.com/nvidia-drivers-for-high-sierra" rel="alternate" type="text/html" title="NVIDIA Drivers for macOS High Sierra" /><published>2017-09-28T00:00:00+00:00</published><updated>2017-09-28T00:00:00+00:00</updated><id>https://deepdojo.com/nvidia-drivers-for-high-sierra</id><content type="html" xml:base="https://deepdojo.com/nvidia-drivers-for-high-sierra">&lt;p&gt;CUDA is an NVIDIA hardware toolkit. Many deep learning frameworks use it to &lt;a href=&quot;https://www.nvidia.com/en-us/data-center/gpu-accelerated-applications/tensorflow/&quot;&gt;accelerate training&lt;/a&gt;. Apple last offered an NVIDIA GPU in its MacBook Pro in 2014. A GeForce GT 750M, which provided a &lt;a href=&quot;https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#compute-capabilities&quot;&gt;CUDA compute capability of 3.0&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;At WWDC, Apple announced &lt;a href=&quot;https://developer.apple.com/development-kit/external-graphics/&quot;&gt;official support for external GPU enclosures&lt;/a&gt; in macOS High Sierra. This week NVIDIA followed suit.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“After skipping the assorted High Sierra betas, NVIDIA has rolled out drivers for its line of PCI-E graphics cards.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This gives any Mac with Thunderbolt 3 connectivity the ability to &lt;a href=&quot;https://www.nvidia.com/object/macosx-cuda-9.0.197-driver.html&quot;&gt;power up CUDA 9.0&lt;/a&gt; with a &lt;a href=&quot;https://developer.nvidia.com/cuda-gpus&quot;&gt;compute capability of 6.1&lt;/a&gt;.&lt;/p&gt;</content><author><name>Otto Schnurr</name></author><summary type="html">CUDA is an NVIDIA hardware toolkit. Many deep learning frameworks use it to accelerate training. Apple last offered an NVIDIA GPU in its MacBook Pro in 2014. A GeForce GT 750M, which provided a CUDA compute capability of 3.0. At WWDC, Apple announced official support for external GPU enclosures in macOS High Sierra. This week NVIDIA followed suit. “After skipping the assorted High Sierra betas, NVIDIA has rolled out drivers for its line of PCI-E graphics cards.” This gives any Mac with Thunderbolt 3 connectivity the ability to power up CUDA 9.0 with a compute capability of 6.1.</summary></entry></feed>