{"id":2522,"date":"2018-11-15T16:04:31","date_gmt":"2018-11-15T21:04:31","guid":{"rendered":"https:\/\/blogs.mathworks.com\/iot\/?p=2522"},"modified":"2018-11-15T16:06:31","modified_gmt":"2018-11-15T21:06:31","slug":"deep-learning-and-iot-workshop-at-ghc","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/iot\/2018\/11\/15\/deep-learning-and-iot-workshop-at-ghc\/","title":{"rendered":"Deep Learning and IoT Workshop at GHC 18, Grace Hopper Celebration of Women in Computing"},"content":{"rendered":"<p>Dear friends, we: Louvere Walker-Hannon, an application engineer who assists customers doing deep learning and data analytics, Shruti Karulkar, a quality engineering lead for test and measurement, and Anoush Najarian, a performance engineer, put together this blog post on behalf of the MathWorks GHC <a title=\"https:\/\/mathworks.com\/ghc (link no longer works)\">team<\/a>.<\/p>\n<p>Our team had an awesome time at GHC 18, Grace Hopper Celebration of Women in Computing. Going to the conference helped our team members get to know each other, and brought out superpowers we didn\u2019t know existed!<\/p>\n<p>This is our first year as a sponsor of the conference.<a href=\"https:\/\/ghc.anitab.org\/\">Grace Hopper Celebration<\/a> is the world&#8217;s largest gathering of women technologists. Besides recruiting and attending key technology talks, our team delivered a hands-on MATLAB workshop on Deep Learning and IoT.<!-- Insert ghc18workshop_01.jpeg here --><\/p>\n<p><a title=\"https:\/\/mathworks.com\/ghc (link no longer works)\"><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"900\" class=\"aligncenter size-full wp-image-2536\" src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_01.jpeg\" alt=\"\" \/><\/a><\/p>\n<h3>The workshop<\/h3>\n<p>We were thrilled to have a hands-on workshop proposal accepted at GHC, an honor and a responsibility. It turned out that we were going to be running two large sessions, full in preregistration.<\/p>\n<p>We asked everyone to bring a laptop with a webcam, or share. Participants used their browser to run deep learning code in MATLAB Online, a cool framework built on top of cloud instances, and aggregated inference data to <a href=\"https:\/\/thingspeak.com\">ThingSpeak<\/a>, an open IoT (Internet of Things) platform, and analyzed that data.<\/p>\n<p><!-- Insert ghc18workshop_02.png here --><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_02.png\" \/><\/p>\n<h3>Fruit caper<\/h3>\n<p>Everyone captured images of real-world objects using webcams and used a Deep Learning network to classify them. To make things more fun, we used fruit for inference: Granny Smith apples, oranges, lemons and bananas. Our team went on a \u201cfruitcase\u201d expedition: we visited a local grocery store with a suitcase, bought a bunch of fruit for the workshop, and at the end of the day, gave it away to the many amazing GHC workers.<\/p>\n<p><!-- Insert ghc18workshop_03.jpeg here --><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_03.jpeg\" \/><\/p>\n<h3>Exercises<\/h3>\n<p>Our workshop had three exercises, and two take-home problems.<\/p>\n<p>In our first exercise, we used a webcam to capture an image, and passed it along to the AlexNet Deep Learning network for inference, generating a classification label and a confidence score.<\/p>\n<pre id=\"matlabcode\" class=\"matlab-code\" style=\"background-color: #f7f7f7; font-family: monospace; font-weight: normal; padding-top: 5px; padding-bottom: 5px; line-height: 150%; border: 1px solid #E9E9E9;\"><span style=\"color: #228b22;\">% This is code for Exercise 1 as part of the Hands on with Deep Learning<\/span>\r\n<span style=\"color: #228b22;\">% and IoT workshop presented at the Grace Hopper Celebration 2018-09-27<\/span>\r\n<span style=\"color: #228b22;\">%% Connecting to the camera<\/span>\r\ncamera = webcam(1); <span style=\"color: #228b22;\">% Connect to the camera<\/span>\r\n<span style=\"color: #228b22;\">%% Loading the neural net named: Alexnet<\/span>\r\nnnet = alexnet; <span style=\"color: #228b22;\">% Load the neural net<\/span>\r\n<span style=\"color: #228b22;\">%% Capturing and classifying image data<\/span>\r\npicture = snapshot(camera); <span style=\"color: #228b22;\">% Take a picture<\/span>\r\npicture = imresize(picture, [227, 227]); <span style=\"color: #228b22;\">% Resize the picture<\/span>\r\n[label, scores] = classify(nnet, picture); <span style=\"color: #228b22;\">% Classify the picture and <\/span>\r\n<span style=\"color: #228b22;\">% obtain confidence score<\/span>\r\n[sorted_scores, ~]=sort(scores, <span style=\"color: #a020f0;\">'descend'<\/span>); <span style=\"color: #228b22;\">% Sorting scores in <\/span>\r\n<span style=\"color: #228b22;\">% descending order<\/span>\r\nimage(picture); <span style=\"color: #228b22;\">% Show the picture<\/span>\r\ntitle([<span style=\"color: #a020f0;\">'Alexnet classification: '<\/span>, char(label), <span style=\"color: #a020f0;\">' score:'<\/span>, <span style=\"color: #0000ff;\">...<\/span>\r\n    num2str(sorted_scores(1))]); <span style=\"color: #228b22;\">% Show the label<\/span>\r\nclear <span style=\"color: #a020f0;\">camera<\/span>\r\ndrawnow;\r\n<\/pre>\n<p>In our second exercise, we repeat what we did in Exercise 1, and post inference data to an IoT channel. Note that we use the same channel to aggregate everyone\u2019s data.<\/p>\n<pre id=\"matlabcode\" class=\"matlab-code\" style=\"background-color: #f7f7f7; font-family: monospace; font-weight: normal; padding-top: 5px; padding-bottom: 5px; line-height: 150%; border: 1px solid #E9E9E9;\"><span style=\"color: #228b22;\">% This is code for Exercise 2 as part of the Hands on with Deep Learning<\/span>\r\n<span style=\"color: #228b22;\">% and IoT workshop presented at the Grace Hopper Celebration 2018-09-27<\/span>\r\n<span style=\"color: #228b22;\">%% Connecting to the camera<\/span>\r\ncamera = webcam(1); <span style=\"color: #228b22;\">% Connect to the camera<\/span>\r\n<span style=\"color: #228b22;\">%% Loading the neural net named: Alexnet<\/span>\r\nnnet = alexnet; <span style=\"color: #228b22;\">% Load the neural net<\/span>\r\n<span style=\"color: #228b22;\">%% Capturing and classifying image data<\/span>\r\npicture = snapshot(camera); <span style=\"color: #228b22;\">% Take a picture<\/span>\r\npicture = imresize(picture, [227, 227]); <span style=\"color: #228b22;\">% Resize the picture<\/span>\r\n[label, scores] = classify(nnet, picture); <span style=\"color: #228b22;\">% Classify the picture and<\/span>\r\n<span style=\"color: #228b22;\">% obtain confidence score<\/span>\r\n[sorted_scores, ~]=sort(scores, <span style=\"color: #a020f0;\">'descend'<\/span>); <span style=\"color: #228b22;\">% Sorting scores in<\/span>\r\n<span style=\"color: #228b22;\">% descending order<\/span>\r\nimage(picture); <span style=\"color: #228b22;\">% Show the picture<\/span>\r\ntitle([<span style=\"color: #a020f0;\">'Alexnet classification: '<\/span>, char(label), <span style=\"color: #a020f0;\">' score:'<\/span>, <span style=\"color: #0000ff;\">...<\/span>\r\n    num2str(sorted_scores(1))]); <span style=\"color: #228b22;\">% Show the label<\/span>\r\nclear <span style=\"color: #a020f0;\">camera<\/span>\r\ndrawnow;\r\n<span style=\"color: #228b22;\">%% Aggregating label data to open IoT platform<\/span>\r\n<span style=\"color: #0000ff;\">try<\/span>\r\n    thingSpeakWrite(123456789, string(label), <span style=\"color: #a020f0;\">'WriteKey'<\/span>, <span style=\"color: #a020f0;\">'XXXYYYZZZ'<\/span>)\r\n<span style=\"color: #0000ff;\">catch<\/span>\r\n    pause(randi(5))\r\n<span style=\"color: #0000ff;\">end<\/span>\r\n<\/pre>\n<p>In our third exercise, we grabbed the aggregated inference data from the IoT channel and visualized it. It was fun and a bit surprising to see what everyone\u2019s objects ended up getting classified as.<\/p>\n<pre id=\"matlabcode\" class=\"matlab-code\" style=\"background-color: #f7f7f7; font-family: monospace; font-weight: normal; padding-top: 5px; padding-bottom: 5px; line-height: 150%; border: 1px solid #E9E9E9;\"><span style=\"color: #228b22;\">% This is code for Exercise 3 as part of the Hands on with Deep Learning<\/span>\r\n<span style=\"color: #228b22;\">% and IoT workshop presented at the Grace Hopper Celebration 2018-09-27<\/span>\r\n<span style=\"color: #228b22;\">%% Reading aggregated label data for the last 2 hours from ThingSpeak<\/span>\r\nreadChannelID = 570969;\r\nLabelFieldID = 1;\r\nreadAPIKey = <span style=\"color: #a020f0;\">''<\/span>;\r\ndataForLastHours = thingSpeakRead(readChannelID, <span style=\"color: #0000ff;\">...<\/span>\r\n    <span style=\"color: #a020f0;\">'Fields'<\/span>, LabelFieldID, <span style=\"color: #a020f0;\">'NumMinutes'<\/span>, 5, <span style=\"color: #0000ff;\">...<\/span>\r\n    <span style=\"color: #a020f0;\">'ReadKey'<\/span>, readAPIKey, <span style=\"color: #a020f0;\">'OutputFormat'<\/span>, <span style=\"color: #a020f0;\">'table'<\/span>);\r\n<span style=\"color: #228b22;\">%% Visualizing data using a histogram<\/span>\r\n<span style=\"color: #0000ff;\">if<\/span> (not(isempty(dataForLastHours)))\r\n    labelsForLastHours = categorical(dataForLastHours.Label);\r\n    numbins = min(numel(unique(labelsForLastHours)), 20);\r\n    histogram(labelsForLastHours, <span style=\"color: #a020f0;\">'DisplayOrder'<\/span>, <span style=\"color: #a020f0;\">'descend'<\/span>, <span style=\"color: #0000ff;\">...<\/span>\r\n        <span style=\"color: #a020f0;\">'NumDisplayBins'<\/span>, numbins);\r\n    xlabel(<span style=\"color: #a020f0;\">'Objects Detected'<\/span>);\r\n    ylabel(<span style=\"color: #a020f0;\">'Number of times detected'<\/span>);\r\n    title(<span style=\"color: #a020f0;\">'Histogram: Objects Detected by Deep Learning Network'<\/span>);\r\n    set(gca, <span style=\"color: #a020f0;\">'FontSize'<\/span>, 10)\r\n<span style=\"color: #0000ff;\">end<\/span>\r\ndrawnow\r\n<\/pre>\n<p>When our participants ran this code, we saw a histogram aggregating everyone&#8217;s inference data, with all the objects detected during the workshop. This is the power of IoT! Check out the data from all our workshop sessions aggregated together on the <a href=\"https:\/\/thingspeak.com\/channels\/570969\">ThingSpeak channel<\/a>.<\/p>\n<p><!-- Insert ghc18workshop_04.png here --><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_04.png\" \/><\/p>\n<p>As take-home exercises, we challenged participants to use GoogLeNet instead of AlexNet, and to create their own IoT channel and use it to post and analyze data.<\/p>\n<h3>Feedback<\/h3>\n<p>It\u2019s an honor to have a speaking proposal accepted at GHC, and delivering large hands-on sessions is a big responsibility.<\/p>\n<p><!-- Insert ghc18workshop_05.jpeg here --><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_05.jpeg\" \/><\/p>\n<p>We loved hearing from our participants on social media:<\/p>\n<p><!-- Insert ghc18workshop_06.png here --><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_06.png\" \/><\/p>\n<p>We heard from professors and AI and Deep Learning enthusiasts who are interested in using our materials on campuses and at maker events: below are the first two, and a few others are in the works! If you\u2019d like to give our Deep Learning and IoT demo a shot, let us know in the comments.<\/p>\n<p>Hope Rubin of our GHC team led STEM Ambassadors who brought this Deep Learning and IoT demo to the Boston Mini-Maker Faire.<\/p>\n<p>Under the leadership of brave Professor Sonya Hsu and her ACM-W partners, a team ran the workshop during the Science Day at the University of Louisiana at Lafayette. Look for posts on these events on this blog!<\/p>\n<h3>Thank you<\/h3>\n<p>We couldn\u2019t have done this without our team members\u2019 extensive experience with teaching and tech, the awesome guidance by our senior leaders, and the help from hundreds of MathWorkers and Boston SWE friends.<\/p>\n<p><!-- Insert ghc18workshop_07.jpeg here --><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_07.jpeg\" \/><\/p>\n<p><a href=\"http:\/\/www.sweboston.org\/\">Boston SWE<\/a>, Society of Women Engineers, one of the oldest and largest sections in the country, has been our rock! We ran our workshop to a SWE event at MathWorks the week before GHC, getting our code and materials in front of many inquisitive, engaged participants who gave us their time, their words of encouragement, and who asked us tough questions!<\/p>\n<h3>Next steps<\/h3>\n<p>You too are welcome to use our GHC 18 Deep Learning and IoT workshop <a href=\"https:\/\/docs.google.com\/document\/d\/1kbPhH-GXJJVtXgJrR7-hF8RTuOMfchv-bGeHo7VSybw\/edit?usp=sharing\">materials<\/a>!<\/p>\n<p><!-- Insert ghc18workshop_08.png here --><img decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_08.png\" \/><\/p>\n<p>Want to learn more? Take the free <a href=\"https:\/\/www.mathworks.com\/training-schedule\/deep-learning-onramp\"><u>Deep Learning Onramp<\/u><\/a>! Learn about and build <a href=\"https:\/\/community.thingspeak.com\/\"><u>IoT projects<\/u><\/a>.<\/p>\n<p>Visit our <a title=\"http:\/\/mathworks.com\/ghc (link no longer works)\"><u>GHC<\/u><\/a> page to meet our team and learn about working at MathWorks. Take a look at the <a href=\"https:\/\/www.facebook.com\/anoush.najarian\/posts\/10218012552893540\"><u>photos<\/u><\/a> our team took, or was given by session chairs, and our <a href=\"https:\/\/twitter.com\/i\/moments\/1051586231245647878\"><u>Twitter Moment<\/u><\/a>. While you\u2019re at it, check out the work of awesome women we have been highlighting with <a href=\"https:\/\/twitter.com\/hashtag\/shelovesmatlab?src=hash\"><u>#shelovesmatlab<\/u><\/a> hashtag! Share your thoughts in the comments.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/iot\/files\/2018\/11\/ghc18workshop_01.jpeg\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div>\n<p>Dear friends, we: Louvere Walker-Hannon, an application engineer who assists customers doing deep learning and data analytics, Shruti Karulkar, a quality engineering lead for test and measurement,&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/iot\/2018\/11\/15\/deep-learning-and-iot-workshop-at-ghc\/\">read more >><\/a><\/p>\n","protected":false},"author":148,"featured_media":2536,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[210,276,274,245],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/2522"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/users\/148"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/comments?post=2522"}],"version-history":[{"count":3,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/2522\/revisions"}],"predecessor-version":[{"id":2544,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/posts\/2522\/revisions\/2544"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/media\/2536"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/media?parent=2522"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/categories?post=2522"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/iot\/wp-json\/wp\/v2\/tags?post=2522"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}