<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel rdf:about="https://community.wolfram.com">
    <title>Community RSS Feed</title>
    <link>https://community.wolfram.com</link>
    <description>RSS Feed for Wolfram Community showing any discussions tagged with Image Processing with no replies sorted by most likes.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1893009" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1137429" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2144200" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1661864" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2934668" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1606199" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1383429" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1137055" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/908790" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/749947" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/509162" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1018424" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2960096" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1729892" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1379517" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1379392" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1137218" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3217332" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1784061" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1731520" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1893009">
    <title>How to build a mammuthus with your kids</title>
    <link>https://community.wolfram.com/groups/-/m/t/1893009</link>
    <description>According to the [official announcement][1]:&#xD;
&#xD;
&amp;gt; For the first time in its 174-year history, the Smithsonian has released 2.8 million high-resolution two- and three-dimensional images from across its collections onto an open access online platform for patrons to peruse and download free of charge. Featuring data and material from all 19 Smithsonian museums, nine research centers, libraries, archives and the National Zoo, the new digital depot encourages the public to not just view its contents, but use, reuse and transform them into just about anything they choose&amp;#x2014;be it a postcard, a beer koozie or a pair of bootie shorts.&#xD;
&#xD;
*COLLECTION is HERE*: https://www.si.edu/openaccess&#xD;
&#xD;
There are a lot of interesting and images and 3D models from very diverse corners of life, - here are a few samples: &#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
One of coolest thing is that some of 3D models are given in parts that can be 3D printed separately and then assembled together, thus making cool DIY project. Here is an example you can try with a 3D model of [Mammuthus primigenius / Blumbach][3]. Below the model find and copy the download link:&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
&#xD;
Import data from the collection (I shortened the URL with `URLShorten`):&#xD;
&#xD;
    data = Import[&amp;#034;https://wolfr.am/KQ6NWYff&amp;#034;, &amp;#034;*&amp;#034;]&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
You can see these are the pieces that should make up a whole object:&#xD;
&#xD;
    Show[data]&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
It is easy to make 3D printouts with the Wolfram Language -- the parts &#xD;
&#xD;
    Printout3D /@ data&#xD;
&#xD;
or whole thing:&#xD;
&#xD;
    Printout3D[RegionUnion @@ data]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
It is a really neat toy and reminds me of 3D puzzles: you get the parts and have to figure out what the whole is by building it. Could be a fun time with kids :-) If you can get your hands on 3D printer it might be better than a toy store. There are very different types too. Here is, for instance for space-dreamers, the [Apollo 11 Command Module][8] -- apart and together.&#xD;
&#xD;
    apollo = Import[&amp;#034;https://wolfr.am/KQLE0LOx&amp;#034;, &amp;#034;*.obj&amp;#034;]&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
    Show[apollo]&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
&#xD;
  [1]: https://www.smithsonianmag.com/smithsonian-institution/smithsonian-releases-28-million-images-public-domain-180974263/&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2020-03-06at9.47.27AM.png&amp;amp;userId=11733&#xD;
  [3]: https://3d.si.edu/object/3d/mammuthus-primigenius-blumbach:341c96cd-f967-4540-8ed1-d3fc56d31f12&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2020-03-06at10.37.24AM.png&amp;amp;userId=11733&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=esgasd4q3Untitled.png&amp;amp;userId=11733&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=fdsfsdfsdfs.png&amp;amp;userId=11733&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=gfxgfdtey35Untitled.png&amp;amp;userId=11733&#xD;
  [8]: https://3d.si.edu/object/3d/command-module-apollo-11:d8c6457e-4ebc-11ea-b77f-2e728ce88125&#xD;
  [9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2020-03-06at10.14.41AM.png&amp;amp;userId=11733&#xD;
  [10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2020-03-06at10.25.19AM.png&amp;amp;userId=11733</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2020-03-06T05:56:34Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1137429">
    <title>[WSS17] DeepLaetitia: Deep Reinforcement Learning that makes you smile</title>
    <link>https://community.wolfram.com/groups/-/m/t/1137429</link>
    <description>![Main picture][1]&#xD;
&#xD;
# Introduction&#xD;
&#xD;
The aim of this project is to train a Deep Reinforcement Learning agent to bring a smile to your face.  &#xD;
The first part of the project was to train a Deep Convoluted Neural Network to predict one of five (happy, neutral, sad, angry, surprised) facial emotions.&#xD;
The input to this classifier is taken directly from the user&amp;#039;s camera.   &#xD;
Then, using this prediction as an input, a reinforcement learning agent was trained to make you smile. To do that a customizable emoticon was used. &#xD;
&#xD;
## Why Laetitia?&#xD;
&#xD;
Laetitia is the Roman Goddess of joy, gaiety, and celebration, and is especially linked with holidays and festivals. &#xD;
&#xD;
&#xD;
# Phase one: facial emotion detector&#xD;
The first phase of the project was to implement the facial emotion detector. &#xD;
&#xD;
## Dataset &#xD;
The very first part of this phase was dataset selection. I based my study on the Fe.r2013 database.  &#xD;
It is free and available online on [Kaggle platform][2]. The reason standing behind my choice were small size of training example (pictures 48x48 pixels), huge number of labeled training O(20k) and test O(7k)  examples. Each of database element belongs to one of following classes happy, neutral, sad, angry and surprised.   &#xD;
Unfortunately, the database is contaminated by noised images or animated faces. It needed lot of afford to manually remove all the useless examples.  &#xD;
&#xD;
![training examples][3]    &#xD;
&#xD;
## Model training&#xD;
&#xD;
At the beginning of my study I trained classical Machine Learning models, such as Supported Vector Machine, Random Forest, k Nearest Neighborhood. These models were used as a performance baseline for further studies based on Deep Convoluted Neural Networks. &#xD;
My analysis shows that models that contain two hidden convoluted layers are the best classifiers. A selected model achieved a performance of 91% in happiness recognition, measured as area under Receiver Operating Characteristic curve.  &#xD;
&#xD;
As mentioned before, the best facial emotion detector is a Deep Convolution Neural Network.  &#xD;
Above cell presents architecture (upper right plot) of selected network and training progress related plots. &#xD;
&#xD;
![CNN training][4]&#xD;
&#xD;
##  Convoluted Neural Network performance&#xD;
Classifier performance measurement was performed on O(7k) testing images. &#xD;
At first  I present a confusion matrix which is a specific table layout that allows visualization of the performance of an algorithm. Each column of the matrix represents the instances in a predicted class while each row represents the instances in an actual class. The name stems from the fact that it makes it easy to see if the system is confusing two classes (i.e. commonly mislabelling one as another).&#xD;
![cm][5]&#xD;
&#xD;
Another widely used classifier performance measuring metrics is the area under the Receiver Operating Characteristic curve, which can be interpreted as equal to the probability that a classifier will rank a randomly chosen positive instance higher than a randomly chosen negative one.  &#xD;
The obtained results for particular classes:&#xD;
 ![rocs][6]&#xD;
## Classifier evaluation&#xD;
&#xD;
The crucial project constraint is classifier evaluation time. The classifier need to be able to return response in real time. Here you find sample. The delays are caused by gif segmentation.  &#xD;
&#xD;
![sample][7]&#xD;
&#xD;
## Transfer learning approach&#xD;
I also tried to use idea of transfer learning. Roughly speaking, we take pre-trained  model such as [VGG16](http://www.robots.ox.ac.uk/~vgg/research/very_deep/) or [Inception](https://arxiv.org/abs/1512.00567) and then replace two last layers. &#xD;
&#xD;
    emotionTypes = {&amp;#034;happy&amp;#034;, &amp;#034;neutral&amp;#034;, &amp;#034;sad&amp;#034;, &amp;#034;angry&amp;#034;, &amp;#034;surprise&amp;#034;}&#xD;
    deepCNN = NetModel[&amp;#034;Wolfram ImageIdentify Net for WL 11.1&amp;#034;]&#xD;
    truncatedNetwork = Take[deepCNN, {1, -3}];&#xD;
    deepCNNInceptionV3 = &#xD;
     NetInitialize @&#xD;
      NetChain[{truncatedNetwork, LinearLayer[Length[emotionTypes]], &#xD;
        SoftmaxLayer[]},&#xD;
       &amp;#034;Output&amp;#034; -&amp;gt; NetDecoder[{&amp;#034;Class&amp;#034;, emotionTypes}]&#xD;
      ]&#xD;
&#xD;
Unfortunately, due to technical limitation of my notebook (no GPU unit) I was not able to finish training that kind of model. It probably will perform better than shallow version. This idea will be implemented in the future release of the project.  &#xD;
&#xD;
# Phase Two: Reinforcement Learning&#xD;
In this phase, based on chosen model prediction, the policy to find the funniest emoticon was obtained. To do it the Monte Carlo based searching method was applied. &#xD;
At first I would like to present tunable emoticon that was used to make you smile. The animation was taken from [Wolfram Demonstration Project site](http://demonstrations.wolfram.com/SmileyChanger/).&#xD;
&#xD;
 ![emoticon][8] &#xD;
&#xD;
This element will be replaced into auto generated pictures or jokes in the future release. &#xD;
## Monte Carlo optimization &#xD;
&#xD;
Monte Carlo methods (or Monte Carlo experiments) are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. Their essential idea is using randomness to solve problems that might be deterministic in principle.&#xD;
&#xD;
From the point of view this work I am using numerical simulation to find the &amp;#034;funniest&amp;#034; emoticon configuration. Please take a look at the simulation sudo code. &#xD;
&#xD;
    nFrames = 10;&#xD;
    currentHappines = 0.;&#xD;
    previousHappines = 0.; &#xD;
    happinessesList = {{r, t , s, a , b, c , ey , er, currentHappines}};&#xD;
    ResetParameters[];&#xD;
    &#xD;
    Dynamic[&#xD;
     parameter = SelectParameter[];&#xD;
     previousParamValue = KeepPreviousParameterValue[parameter];&#xD;
     update =  CalculateParameterUpdate[parameter, step];&#xD;
     UpdateParmeter[parameter, update];&#xD;
     &#xD;
     frame = 0;&#xD;
     currentHappines = 0.;&#xD;
     Column[{ animation,&#xD;
       While[frame &amp;lt; nFrames,&#xD;
        image = CurrentImage[];&#xD;
        greyFace = ExtractFaceFromImage[image];&#xD;
        currentHappines += PredictHappinessProbability[greyFace];&#xD;
        frame++;&#xD;
        ];&#xD;
       currentHappines /= nFrames; image, greyFace, currentHappines, &#xD;
       If[currentHappines &amp;gt; previousHappines , &#xD;
        previousHappines =  currentHappines, &#xD;
        ReloadParameterValue[parameter, previousParamValue]];&#xD;
       happinessesList = &#xD;
        Join [happinessesList, {{r, t , s, a , b, c , ey , er, &#xD;
           currentHappines}}];}&#xD;
      ]&#xD;
     &#xD;
     ]&#xD;
     &#xD;
 This simulation allows to obtain learning curve like plot and the from them funniest emoticon configuration.&#xD;
  &#xD;
 ![learningCurveMC][9]&#xD;
&#xD;
#Future goals &#xD;
From the future perspective the Q-Learning approach will be implemented. A starting point of the further studies will be Monte Carlo tuned policy mentioned before.&#xD;
&#xD;
&#xD;
&#xD;
The second idea is to replaced shallow version of CNN into pre-trained model. &#xD;
# Github&#xD;
Please take a look at the project source code on [github](https://github.com/adendek/DeepLaetitia). &#xD;
&#xD;
&#xD;
####Stay tuned for further improvements!&#xD;
####Im happy about any kind of feedback. Please upvote if you like it ;-)&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Classifier.gif&amp;amp;userId=1075716&#xD;
  [2]: https://www.kaggle.com/c/challenges-in-representation-learning-facial-expression-recognition-challenge &amp;#034;Kaggle&amp;#034;&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=images.png&amp;amp;userId=1075716&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=trainingResult.png&amp;amp;userId=1075716&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=CM.png&amp;amp;userId=1075716&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Rocs.png&amp;amp;userId=1075716&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Reaction.gif&amp;amp;userId=1075716&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Emoticon.png&amp;amp;userId=1075716&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=MonteCarlo.png&amp;amp;userId=1075716</description>
    <dc:creator>Adam Dendek</dc:creator>
    <dc:date>2017-07-05T22:32:13Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2144200">
    <title>[WELP20] Acoustic Modeling with Generated Depth Maps</title>
    <link>https://community.wolfram.com/groups/-/m/t/2144200</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/d34dbf01-6652-4598-9cff-6aad9b015495</description>
    <dc:creator>Wolfram Education Programs</dc:creator>
    <dc:date>2020-12-21T18:20:08Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1661864">
    <title>Mathematica 12 Launch</title>
    <link>https://community.wolfram.com/groups/-/m/t/1661864</link>
    <description>[![enter image description here][1]][46]&#xD;
&#xD;
We&amp;#039;re glad to announce that Version 12.0 of Mathematica and the Wolfram Language is hereand it&amp;#039;s a big one. This major update introduces several hundred new functions in a range of areas, including mathematics and geometry, visualization, audio and image processing, machine learning, and more, as well as provides a major overhaul to the Mac and Linux notebook interfaces and numerous systemwide performance enhancements. Some key new features include:&#xD;
&#xD;
Mathematics and Geometry&#xD;
-------------------------------------&#xD;
 - Convex optimization solvers such as [LinearOptimization][2],&#xD;
   [QuadraticOptimization][3] and [SemidefiniteOptimization][4], with vector&#xD;
   inequalities such as [VectorGreater][5] for modeling vector-valued&#xD;
   variables&#xD;
 - Improved [NDSolve][6] support for nonlinear PDEs using FEM and automated&#xD;
   idealized *n*-body interaction using [NBodySimulation][7]&#xD;
 - Use [Around][8] to describe uncertainty in measured values, with built-in&#xD;
   support in visualization functions&#xD;
 - A host of new functions for generating, analyzing and manipulating&#xD;
   polygons and polyhedra ([RandomPolygon][9], [RandomPolyhedron][10],&#xD;
   [PolygonDecomposition][11], etc.), with added support for holes/voids&#xD;
 - Access built-in axiomatic theories for use in symbolic proofs with&#xD;
   [AxiomaticTheory][12]&#xD;
&#xD;
Visualization&#xD;
----------------&#xD;
 - [GeometricScene][13] and [GeometricAssertion][14] for visualizing Euclidean&#xD;
   geometry and its theorems&#xD;
 - Visualize different components and properties of complex-valued data&#xD;
   and functions with [ComplexListPlot][15], [ReImPlot][16] and [AbsArgPlot][17]&#xD;
 - Represent geodetic vectors with [GeoVector][18] and visualize geodetic&#xD;
   vector fields using [GeoVectorPlot][19] and [GeoStreamPlot][20]&#xD;
 - Updated default appearance for [GraphPlot][21] visualizations, as well as&#xD;
   new plot themes and updated properties&#xD;
 - Create, analyze and modify chemical species with [Molecule][22] and&#xD;
   visualize their 2D and 3D structures with [MoleculePlot][23] and&#xD;
   [MoleculePlot3D][24]&#xD;
&#xD;
Audio and Image Processing&#xD;
---------------------------------------&#xD;
 - Color-processing functions such as [FindMatchingColor][25], [ImageRecolor][26]&#xD;
   and [ColorDetect][27], all powered by the new [ColorsNear][28] wrapper to&#xD;
   represent a color neighborhood&#xD;
 - Multi-language support for [SpeechSynthesize][29], as well as improved&#xD;
   discovery and searching of available voices through [VoiceStyleData][30]&#xD;
 - [AudioAnnotate][31] framework for annotating audio objects&#xD;
 - [ShortTimeFourier][32] for computing and storing properties of short-time&#xD;
   Fourier transforms and [InverseSpectrogram][33] for approximating a signal&#xD;
   from a magnitude spectrogram&#xD;
&#xD;
Machine Learning and Neural Networks&#xD;
------------------------------------&#xD;
 - High-level recognition functions such as [ImageCases][34], [FacialFeatures][35],&#xD;
   [AudioIdentify][36] and [SpeechRecognize][37]&#xD;
 - Additional pre-trained models, new layers, new encoders and decoders,&#xD;
   and multi-GPU support for the neural network framework&#xD;
 - Learn a generalized probability distribution from arbitrary data&#xD;
   using [LearnDistribution][38]&#xD;
 - Replace missing values in data by generated values using&#xD;
   [SynthesizeMissingValues][39] and find anomalous examples in data using&#xD;
   [FindAnomalies][40]&#xD;
&#xD;
These are just a few of the highlights from this release, which also includes an experimental [Wolfram Compiler][41], a comprehensive new [Microcontroller Kit][42], a bidirectional [Unity][43] game engine interface and expanded knowledge and functionality for [Entity][44] and [EntityStore][45].&#xD;
&#xD;
You can find out more about these and other Version 12 additions by reading through [Stephen Wolfram&amp;#039;s launch-day blog post][46] and looking at the [Summary of New Features in 12][47].&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=12-0-wordcloud-hero.png&amp;amp;userId=11733&#xD;
  [2]: http://reference.wolfram.com/language/ref/LinearOptimization&#xD;
  [3]: http://reference.wolfram.com/language/ref/QuadraticOptimization&#xD;
  [4]: http://reference.wolfram.com/language/ref/SemidefiniteOptimization&#xD;
  [5]: http://reference.wolfram.com/language/ref/VectorGreater&#xD;
  [6]: http://reference.wolfram.com/language/ref/NDSolve&#xD;
  [7]: http://reference.wolfram.com/language/ref/NBodySimulation&#xD;
  [8]: http://reference.wolfram.com/language/ref/Around&#xD;
  [9]: http://reference.wolfram.com/language/ref/RandomPolygon&#xD;
  [10]: http://reference.wolfram.com/language/ref/RandomPolyhedron&#xD;
  [11]: http://reference.wolfram.com/language/ref/PolygonDecomposition&#xD;
  [12]: http://reference.wolfram.com/language/ref/AxiomaticTheory&#xD;
  [13]: http://reference.wolfram.com/language/ref/GeometricScene&#xD;
  [14]: http://reference.wolfram.com/language/ref/GeometricAssertion&#xD;
  [15]: http://reference.wolfram.com/language/ref/ComplexListPlot&#xD;
  [16]: http://reference.wolfram.com/language/ref/ReImPlot&#xD;
  [17]: http://reference.wolfram.com/language/ref/AbsArgPlot&#xD;
  [18]: http://reference.wolfram.com/language/ref/GeoVector&#xD;
  [19]: http://reference.wolfram.com/language/ref/GeoVectorPlot&#xD;
  [20]: http://reference.wolfram.com/language/ref/GeoStreamPlot&#xD;
  [21]: http://reference.wolfram.com/language/ref/GraphPlot&#xD;
  [22]: http://reference.wolfram.com/language/ref/Molecule&#xD;
  [23]: http://reference.wolfram.com/language/ref/MoleculePlot&#xD;
  [24]: http://reference.wolfram.com/language/ref/MoleculePlot3D&#xD;
  [25]: http://reference.wolfram.com/language/ref/FindMatchingColor&#xD;
  [26]: http://reference.wolfram.com/language/ref/ImageRecolor&#xD;
  [27]: http://reference.wolfram.com/language/ref/ColorDetect&#xD;
  [28]: http://reference.wolfram.com/language/ref/ColorsNear&#xD;
  [29]: http://reference.wolfram.com/language/ref/SpeechSynthesize&#xD;
  [30]: http://reference.wolfram.com/language/ref/VoiceStyleData&#xD;
  [31]: http://reference.wolfram.com/language/ref/AudioAnnotate&#xD;
  [32]: http://reference.wolfram.com/language/ref/ShortTimeFourier&#xD;
  [33]: http://reference.wolfram.com/language/ref/InverseSpectrogram&#xD;
  [34]: http://reference.wolfram.com/language/ref/ImageCases&#xD;
  [35]: http://reference.wolfram.com/language/ref/FacialFeatures&#xD;
  [36]: http://reference.wolfram.com/language/ref/AudioIdentify&#xD;
  [37]: http://reference.wolfram.com/language/ref/SpeechRecognize&#xD;
  [38]: http://reference.wolfram.com/language/ref/LearnDistribution&#xD;
  [39]: http://reference.wolfram.com/language/ref/SynthesizeMissingValues&#xD;
  [40]: http://reference.wolfram.com/language/ref/FindAnomalies&#xD;
  [41]: http://reference.wolfram.com/language/guide/CodeCompilation&#xD;
  [42]: http://reference.wolfram.com/language/MicrocontrollerKit/guide/MicrocontrollerKit&#xD;
  [43]: http://reference.wolfram.com/language/UnityLink/guide/UnityLink&#xD;
  [44]: http://reference.wolfram.com/language/ref/Entity&#xD;
  [45]: http://reference.wolfram.com/language/ref/EntityStore&#xD;
  [46]: http://wolfr.am/launching-12&#xD;
  [47]: http://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn12.html</description>
    <dc:creator>Brian Wood</dc:creator>
    <dc:date>2019-04-16T16:11:50Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2934668">
    <title>Animating artworks - interpolating between static images for smooth-transitions slideshow</title>
    <link>https://community.wolfram.com/groups/-/m/t/2934668</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=_0confeelezgif.gif&amp;amp;userId=11733&#xD;
  [2]: https://www.wolframcloud.com/obj/e403aedf-46c7-494c-976a-69eb4d5567c5</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2023-06-12T05:51:27Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1606199">
    <title>Random Fonts &amp;amp; Similarities in Deformed Shapes</title>
    <link>https://community.wolfram.com/groups/-/m/t/1606199</link>
    <description>**[Open code in Cloud][1] | Download code to Desktop via Attachments Below**&#xD;
&#xD;
--------------------------------------&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
[@Marco Thiel][at0] pointed me to an interesting project called [The Venice Time Machine][4] (see also a review [video][5] and a [TED talk][6]). The project aims to digitize and algorithmically process a wealth of data packed in ancient manuscripts. Some steps include the following:&#xD;
&#xD;
&amp;gt; **SCANNING**. Paper documents are turned into high-resolution digital images with the help of scanning machines. &#xD;
&#xD;
&amp;gt; **TRANSCRIPTION**. The graphical complexity and diversity of hand-written documents make transcription a daunting task. For the Venice Time Machine, scientists are currently developing novel algorithms that can transform images into probable words. The images are automatically broken down into sub-images that potentially represent words. Each sub-image is compared to other sub-images, and classified according to the shape of word it features. Each time a new word is transcribed, it allows millions of other word transcripts to be recognized in the database. &#xD;
&#xD;
&amp;gt; **TEXT PROCESSING**. The strings of probable words are then turned into possible sentences by a text processor. This step is accomplished by using, among other tools, algorithms inspired by protein structure analysis that can identify recurring patterns.&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
Because words in the manuscripts are mutually compared to identify similar features and ultimately same words - it reminded me of unsupervised learning. I wanted to play a bit with tech built in in Wolfram Language to see some toy examples at work. (Note, a supervised learning version of this was developed by Marco in a cool project [Classifying Japanese characters from the Edo period][8]). &#xD;
&#xD;
To avoid hunting and cleaning real datasets, lets &amp;#034;simulate handwriting&amp;#034; reflecting on randomness of the character shapes. I also like it because it touches upon some art sides of things, relevant to generation of beautiful random fonts. And actually due to ancient writers&amp;#039; (for example monks) skills and attitudes often handwritten characters will differ less than the typed ones we distort here artificially (see image above). It&amp;#039;s a different story of course if we to compare between handwritings of different authors, which is a challenge and what the Venice project envisions ultimately. This becomes even harder if the letters of a handwritten word are seamlessly connected.&#xD;
&#xD;
I deal with single characters, not words. Let&amp;#039;s define a function that makes an image from a letter:&#xD;
&#xD;
    raster[s_]:=ImagePad[ImageCrop[Rasterize[s,ImageSize-&amp;gt;150]],50,White]&#xD;
&#xD;
I padded it to give enough room for random distortions we will apply. Next function looks convoluted, but it is just a transformation formula that sends sin and cos waves over the letters to distort the shapes (think of your reflection in the water of a pond when you drop a stone there).&#xD;
&#xD;
    transf[rn_,amp_,fre_]:= #+{&#xD;
    	amp Sin[rn[[1]]+fre(#[[1]]+#[[2]])]+amp Cos[rn[[2]]+fre(#[[1]]-#[[2]])],&#xD;
    	amp Cos[rn[[1]]-fre(#[[1]]-#[[2]])]-amp Sin[rn[[2]]-fre(#[[1]]+#[[2]])]}&amp;amp;&#xD;
&#xD;
The next function actually applies a random transformation to a letter image:&#xD;
&#xD;
    randTransf[amp_,fre_][i_]:=&#xD;
        With[{rn=RandomInteger[99,2]},ImageTransformation[i,transf[rn,amp,fre]]]&#xD;
&#xD;
Trying this in action for the letters of the word WOLFRAM and &amp;#034;Felipa&amp;#034; font:&#xD;
&#xD;
    set:=ImagePad[#,-50,Red]&amp;amp;/@randTransf[.02,20]/@raster/@&#xD;
    	(Style[#,FontFamily-&amp;gt;&amp;#034;Felipa&amp;#034;]&amp;amp;/@Characters[&amp;#034;WOLFRAM&amp;#034;])&#xD;
    &#xD;
    set//ConformImages//ImageAssemble&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
Trying this twice and finding the difference reveals that different random samples differ quite strongly:&#xD;
&#xD;
    ImageSubtract[set//ConformImages//ImageAssemble,set//ConformImages//ImageAssemble&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
Lets generate 6 different random versions (each per a CPU core of my machine for parallel processing):&#xD;
&#xD;
    data=Flatten[ParallelTable[set,6]];&#xD;
    Thumbnail[#,50,Padding-&amp;gt;None]&amp;amp;/@data&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
While letters look the same, if you pay attention to the details, the smaller features are different, - that reminds me of ink and hands effects on real paper. Now, to the machine learning. Here is Wolfram Language &amp;#034;out of the box&amp;#034; function, FeatureSpacePlot, that uses machine learning to deduce most relevant features of objects and find similar ones demonstrating the similarity in 2D space. Here the closer objects are more similar. It picks the similarity, correctly gathering letters into 7 different groups - each group for each letter in WOLFRAM:&#xD;
&#xD;
    FeatureSpacePlot[data,PlotTheme-&amp;gt;&amp;#034;Frame&amp;#034;]&#xD;
&#xD;
![enter image description here][12]&#xD;
&#xD;
Let&amp;#039;s try now another effect. I will increase the frequency of distortion making letters &amp;#034;fuzzy&amp;#034; (I cannot ignore the artistry of the visual :-) ). Repeated generations will give different small-scale features:&#xD;
&#xD;
    set:=ImagePad[#,-50,Red]&amp;amp;/@randTransf[.05,100]/@raster/@(Characters[&amp;#034;WOLFRAM&amp;#034;])&#xD;
    set&#xD;
&#xD;
![enter image description here][13]&#xD;
&#xD;
While general shape is the same internal details are very different and noisy. Again generating 6 different sets and applying FeatureSpacePlot we are able to group properly:&#xD;
&#xD;
    data=Flatten[ParallelTable[set,6]];&#xD;
    Thumbnail[#,50,Padding-&amp;gt;None]&amp;amp;/@data&#xD;
&#xD;
    FeatureSpacePlot[data, PlotTheme -&amp;gt; &amp;#034;Frame&amp;#034;, PerformanceGoal -&amp;gt; &amp;#034;Quality&amp;#034;]&#xD;
&#xD;
![enter image description here][14]&#xD;
&#xD;
Of course, with more distortion we would need more sophisticated processing to find clusters of similarity. But this was fun to play with. It would be interesting to come up with something that could cluster same letters even between the 2 fonts shown at the top image in this post.&#xD;
&#xD;
 [at0]: https://community.wolfram.com/web/mthiel&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/objects/wolfram-community/Random-Fonts-&amp;amp;-Similarities-in-Deformed-Shapes-by-Vitaliy-Kaurov&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=34qtregadsf.png&amp;amp;userId=11733&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=weraw4qtergafdv.png&amp;amp;userId=11733&#xD;
  [4]: http://timemachine.eu/&#xD;
  [5]: https://vtm.epfl.ch/page-110486-en-html/&#xD;
  [6]: https://www.youtube.com/watch?v=b6nfoE9ly90&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-02-05at4.59.26AM.jpg&amp;amp;userId=11733&#xD;
  [8]: https://community.wolfram.com/groups/-/m/t/1221098&#xD;
  [9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=34qtregadsf.png&amp;amp;userId=11733&#xD;
  [10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ert43q5etrsbdvzs.png&amp;amp;userId=11733&#xD;
  [11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=sfaawereg.png&amp;amp;userId=11733&#xD;
  [12]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ertgf34.png&amp;amp;userId=11733&#xD;
  [13]: https://community.wolfram.com//c/portal/getImageAttachment?filename=weraw4qtergafdv.png&amp;amp;userId=11733&#xD;
  [14]: https://community.wolfram.com//c/portal/getImageAttachment?filename=sdf3q4tergafsdhng.png&amp;amp;userId=11733</description>
    <dc:creator>Vitaliy Kaurov</dc:creator>
    <dc:date>2019-02-05T12:24:26Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1383429">
    <title>[WSC18] Using Machine Learning to Diagnose Pneumonia from Chest X Rays</title>
    <link>https://community.wolfram.com/groups/-/m/t/1383429</link>
    <description>![*Add Cool Image][1]&#xD;
#Microsite#&#xD;
https://one.wolframcloud.com/objects/rohit.panse8/pneumoniadiagnosis&#xD;
#Introduction#&#xD;
  Pneumonia is an infection that causes inflammation in one or both of the lungs; it is induced by a variety of organisms: bacteria, viruses, and fungus. Bacterial pneumonia, the more common type,  is caused by bacteria that multiplies in the lungs;  Viral Pneumonia is caused by an array of viruses, the most common one being Influenza.  Although the severity of pneumonia can vary, young children, seniors, and people with a weakened immune system are the most vulnerable.The CDC reports that of the close to 540,000 cases of pneumonia each year, 50,000 people die. Early and proper diagnosis can tremendously decrease  mortality rate. Conventional diagnosis methods like examining patient medical history and symptoms have their shortcomings.  Dutch researchers, who published their findings in the European Respiratory Journal, found that of 140 patients who had their pneumonia diagnosed by x-ray, doctors initially thought only 41 of them had the severe lung infection. Chest X-rays have long been reliable diagnostic tools for pneumonia. Since pneumonia, is an airspace disease, patients&amp;#039; air spaces are filled with bacteria, viruses, pus, and other microorganisms. A diagnosis is determined by infiltrates,  or white spots, present in a chest X-ray. My project uses a convolutional neural network to diagnose the type of pneumonia that a patient has and. Thank you to Daniel Kermany, Daniel Zhang, and Michael Goldbaum for creating and labeling the dataset. Thanks to Paul Timothy Mooney for making the dataset available on Kaggle.&#xD;
        &amp;lt;br /&amp;gt;&#xD;
&amp;lt;br /&amp;gt;&#xD;
        Below is an example of an infiltrate present in a chest X-ray.&#xD;
&#xD;
![enter image description here][2]&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below is an example of how chest X-rays of the three classifications  generally look. Chest X-rays of pneumonia patients are characterized by loss of diaphramatic shadows, and evidence of pulmonary consolidation(an area of the lung that has filled with liquid instead of air).&#xD;
&#xD;
![enter image description here][3]&#xD;
#Diagnosing pneumonia#&#xD;
&#xD;
##Neural Network&#xD;
&#xD;
I used transfer learning to create my neural network. Transfer learning is the process of using a pre-trained model as a starting point as a model for a second task. &#xD;
&#xD;
&amp;gt; &amp;#034;Transfer learning and domain adaptation refer to the situation where&#xD;
&amp;gt; what has been learned in one setting \[Ellipsis] is exploited to&#xD;
&amp;gt; improve generalization in another setting&amp;#034;-(Page 526, Deep Learning,&#xD;
&amp;gt; 2016)&#xD;
&#xD;
I used ResNet 50, an architecture released in 2015 by Microsoft Research Asia; this network was originally trained on 1.2 million images with 1000 classes.  The immense computing power, time resources, and knowledge dedicated to perfect this network made it a great neural network to use for transfer learning. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below is an example of the ResNet 50 in action. It correctly predicts that the image is a golden retriever. In addition, I set the program to output the top 10 probabilities of what it thought the image was. &#xD;
&#xD;
   ![enter image description here][4]&#xD;
&#xD;
There are two notable layers in this network: linear layer and softmax layer. First, the Linear Layer maps the features processed by the other layers to the classifications given. Classifications(classes) are the different objects the neural network is trained to recognize. In the standard ResNet&amp;#039;s case the classes are the 1000 different objects that it is trained to recognize. In the case of my project, the classes are a normal, bacterial pneumonia, and viral pneumonia chest X-rays.  Second, the Softmax layer determines the probabilities of what the image is. Above the probabilities of the image are displayed; the class with the highest probabilities is what the Neural Net outputs. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below, I remove the Linear and the Softmax layer. These layers are currently configured to recognize 1000 classes; I only need them to recognize 3 classes of images(normal, bacterial pneumonia, viral pneumonia). I will add these two layers later on. &#xD;
![enter image description here][5]&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below, I replaced the &amp;#034;Input&amp;#034; layer to recieve an input of an image of dimensions 512 by 512. I will configure my training images to  be of this size. &#xD;
![enter image description here][6]&#xD;
&amp;lt;br /&amp;gt;&#xD;
I added 3 layers to a new neural net. The above resizedNet will extract features from the dataset. This new neural net that I created will be used to interpret the features and output what it thinks the input image was. The 3 layers that will do this are the &amp;#034;DropoutLayer&amp;#034;, &amp;#034;LinearLayer&amp;#034;,  and &amp;#034;SoftmaxLayer&amp;#034;. The &amp;#034;DropoutLayer&amp;#034; is used to reduce overfitting; this is the tendency of a neural network to become extremely specialized to a limited set of data points. Overfitting is not desirable because it makes the neural network very ineffective on data points outside of the training set. The Linear layer maps the features from the above layers to the 3 classes, and the softmax layer determines the probabilities of the features. Additionally, the output, determining what class the chest X-ray is, is specified. 0 means a normal chest X-ray, 1 means virus pneumonia, 2 means bacterial pneumonia. &#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][7]&#xD;
&amp;lt;br /&amp;gt;&#xD;
##Data Importing and Formatting&#xD;
I imported the files from their respective folders. The virus and bacterial pneumonia files were in the same formula, so I used a simple separating sort tool organize only images of a certain class to their corresponding variables. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
    normalImg = &#xD;
      Import /@ &#xD;
       FileNames[&amp;#034;*.jpeg&amp;#034;, NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;train\\NORMAL&amp;#034;];&#xD;
    virusImg = &#xD;
      Import /@ &#xD;
       FileNames[&amp;#034;*_virus_*.jpeg&amp;#034;, &#xD;
        NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;train\\PNEUMONIA&amp;#034;];&#xD;
    bacImg = Import /@ &#xD;
       FileNames[&amp;#034;*_bacteria_*.jpeg&amp;#034;, &#xD;
        NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;train\\PNEUMONIA&amp;#034;];&#xD;
&amp;lt;br /&amp;gt;&#xD;
I conformed the images to have dimensions of 512 by 512. I did this because I specified the Input layer to take images of only those dimensions. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
    normNorm = ConformImages[Import /@ normalFiles, {512, 512}];&#xD;
    virusNorm = ConformImages[Import /@ virusFiles, {512, 512}];&#xD;
    bacNorm = ConformImages[Import /@ bacFiles, {512, 512}];&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below is how conformed images look.&#xD;
&amp;lt;br /&amp;gt;&#xD;
Before:&#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][8]&#xD;
&amp;lt;br /&amp;gt;&#xD;
After:&#xD;
&amp;lt;br/&amp;gt;&#xD;
![enter image description here][9]&#xD;
&amp;lt;br /&amp;gt;&#xD;
Later, I adjusted the way I conformed my images. I augmented my data set to improve my neural net. By altering the data set, my neural net would become adapted to a greater variety of images. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
    normNorm = &#xD;
      ConformImages[&#xD;
       Table[If[RandomReal[] &amp;gt; .8, &#xD;
         If[RandomReal[] &amp;gt; .5, rotateImage[i], shearImage[i]], i], {i, &#xD;
         Import /@ normalFiles}], {512, 512}];&#xD;
    virusNorm = &#xD;
      ConformImages[&#xD;
       Table[If[RandomReal[] &amp;gt; .8, &#xD;
         If[RandomReal[] &amp;gt; .5, rotateImage[i], shearImage[i]], i], {i, &#xD;
         Import /@ virusFiles}], {512, 512}];&#xD;
    bacNorm = &#xD;
      ConformImages[&#xD;
       Table[If[RandomReal[] &amp;gt; .8, &#xD;
         If[RandomReal[] &amp;gt; .5, rotateImage[i], shearImage[i]], i], {i, &#xD;
         Import /@ bacFiles}], {512, 512}];&#xD;
&amp;lt;br /&amp;gt;&#xD;
I made 40% of the images  undergo a rotation via rotateImage, and I made another 40% of the images undergo a perspective transformation via shearImage.&#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
    rotateImage[i_] := ImageRotate[i, RandomReal[{-Pi/27, Pi/27}]];&#xD;
    shearImage[i_] := &#xD;
      ImagePerspectiveTransformation[&#xD;
       i, {{1, RandomReal[{-.25, .25}], 0}, {0, 1, 0}, {0, 0, 1}}];&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below are the images before a rotate and perspective change respectively.&#xD;
![enter image description here][10]&#xD;
&amp;lt;br /&amp;gt;&#xD;
##Preparing Images&#xD;
Above,  two separate neural networks were created. One, the resizedNet, extracts features. The other, the learnNet, would interpret the features and determine the output. By creating two separate neural networks we can preprocess the data instead of having to process the data repeatedly as we would have to in a prematurely combined network. Below, I process the  images to extract features using the resizedNet, a neural network that uses the ResNet 50 framework. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
    normalFeats = resizedNet[normNorm, TargetDevice -&amp;gt; &amp;#034;GPU&amp;#034;];&#xD;
    virusFeats = resizedNet[virusNorm, TargetDevice -&amp;gt; &amp;#034;GPU&amp;#034;];&#xD;
    bacFeats = resizedNet[bacNorm, TargetDevice -&amp;gt; &amp;#034;GPU&amp;#034;];&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below, the feature extracted images undergo two processes. First, the images are mapped to certain numerical codes. The normal chest X-rays are mapped to the code 0, the virus chest X-rays are mapped to the code 1, and the bacteria chest X-rays are mapped to the code 2. The images are mapped to codes, so the neural network knows the identity of the images when training the network. In addition, the codes are outputted when the trained network interprets an image to be a certain class. For example if the trained network is given a normal chest X-ray, then it should output the code 0. Second, the processed images are joined into one massive list. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
    feats = RandomSample[&#xD;
       Join[Map[# -&amp;gt; 0 &amp;amp;, resizedNet[normNorm, TargetDevice -&amp;gt; &amp;#034;GPU&amp;#034;]], &#xD;
        Map[# -&amp;gt; 1 &amp;amp;, resizedNet[virusNorm, TargetDevice -&amp;gt; &amp;#034;GPU&amp;#034;]], &#xD;
        Map[# -&amp;gt; 2 &amp;amp;, resizedNet[bacNorm, TargetDevice -&amp;gt; &amp;#034;GPU&amp;#034;]]]];&#xD;
&amp;lt;br /&amp;gt;&#xD;
The massive list of processed images are  partitioned into a training set and a test set. The training set will train the network and determine the proper weights needed to recognize the images properly. The test set will be used to check the true progress of the neural network. Since, the neural network is never trained on the test set, it would serve as an objective  indicator of progress when training. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
    trainFeat = feats[[1 ;; 5000]];&#xD;
    testFeat = feats[[5000 ;; 5200]];&#xD;
##Training the Neural Net#&#xD;
&amp;lt;br /&amp;gt;&#xD;
The below script was used to train the learnNet with the training data set, trainFeat, and the testing data set. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
    trainedNet = &#xD;
     NetTrain[learnNet, trainFeat, ValidationSet -&amp;gt; testFeat, &#xD;
      MaxTrainingRounds -&amp;gt; 35, TargetDevice -&amp;gt; &amp;#034;GPU&amp;#034;]&#xD;
&amp;lt;br /&amp;gt;&#xD;
I trained the neural network 4 separate times each with different settings:&#xD;
&#xD;
 1. Regular data set 35 rounds of training&#xD;
 2. Regular data set 70 rounds of training&#xD;
 3. Augmented data set 35 rounds of training&#xD;
 4. Augmented data set 70 rounds of training&#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
The accuracy results of the neural network are below &#xD;
&#xD;
 1. Regular 35 rounds: about 24.9% error&#xD;
 2. Regular 70 rounds: about 19.9% error&#xD;
 3. Augmented 35 rounds: about 20.9% error&#xD;
 4. Augmented 70 rounds: about 17.4% error&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below is an image loss function and error rate of the Augmented 70 rounds neural net. I used this neural net in the final product. &#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][11]&#xD;
&amp;lt;br /&amp;gt;&#xD;
The trained neural network was exported for use on the microsite. &#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
        Export[&amp;#034;/pnemonia.wlnet&amp;#034;, combinedNet]&#xD;
&amp;lt;br /&amp;gt;&#xD;
#Determining Location of Pneumonia#&#xD;
&amp;lt;br /&amp;gt;&#xD;
4 separate neural networks were created to determine the location of the pneumonia: leftVirus, rightVirus, leftBacteria, rightBacteria. The left lob images were evaluated in a separate neural network because an image of the left side of the chest when compared to the right side of the chest may appear to have pneumonia; the heart appears very white much like a pulmonary consolidation, a key evidence of pneumonia. Evaluating the lobes separately for each type of pneumonia helped ensure accuracy in location recognition.&#xD;
&amp;lt;br /&amp;gt;&#xD;
##Importing Images&#xD;
&amp;lt;br /&amp;gt;&#xD;
For the pneumonia location detection part of this project a subset of data was created. The right and left lungs are often referred to as lobes. 100 images of left lob normal and right lobe normal each and 100 images of  left lobe virus, right lobe virus, left lobe bacteria, right lobe bacteria pneumonia each were selected to train 4 separate neural nets to help determine location of the pneumonia. &#xD;
&amp;lt;br /&amp;gt;&#xD;
Below are the  statements to import the unedited chest X-rays. &#xD;
&#xD;
        halfNormalImg = &#xD;
          Import /@ &#xD;
           FileNames[Except[&amp;#034;.&amp;#034;] ~~ &amp;#034;*.jpeg&amp;#034;, &#xD;
            NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;HalfData/NORMAL&amp;#034;];&#xD;
        leftVirusImg = &#xD;
          Import /@ &#xD;
           FileNames[Except[&amp;#034;.&amp;#034;] ~~ &amp;#034;*.jpeg&amp;#034;, &#xD;
            NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;HalfData/VIRUS/Left_Real&amp;#034;];&#xD;
        rightVirusImg = &#xD;
          Import /@ &#xD;
           FileNames[Except[&amp;#034;.&amp;#034;] ~~ &amp;#034;*.jpeg&amp;#034;, &#xD;
            NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;HalfData/VIRUS/Right_Real&amp;#034;];&#xD;
        leftBacImg = &#xD;
          Import /@ &#xD;
           FileNames[Except[&amp;#034;.&amp;#034;] ~~ &amp;#034;*.jpeg&amp;#034;, &#xD;
            NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;HalfData/BACTERIA/Left_Real&amp;#034;];&#xD;
        rightBacImg = &#xD;
          Import /@ &#xD;
           FileNames[Except[&amp;#034;.&amp;#034;] ~~ &amp;#034;*.jpeg&amp;#034;, &#xD;
            NotebookDirectory[] &amp;lt;&amp;gt; &amp;#034;HalfData/BACTERIA/Right_Real&amp;#034;];&#xD;
&amp;lt;br /&amp;gt;&#xD;
##Image Editing Functions#&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below are the functions which were used to edit the images. &amp;#034;widthResize&amp;#034; and &amp;#034;cropFinder&amp;#034; both are used in conjunction to crop the image. The number of black pixels on both sides of an image are found at 5 separate places. The greatest amount of pixels for both side are used to crop the image. This function was useful because it almost always placed the spinal chord in the center, and as a result the images could be correctly separated. &#xD;
&#xD;
       &#xD;
        cropFinder[x_, img_] := &#xD;
         Module[{mid, flatValues, cropLeft, cropRight},&#xD;
          mid = Ceiling[Last[ImageDimensions[img]]/(x)];&#xD;
          flatValues = &#xD;
           Flatten@ImageData[&#xD;
             ImageTake[ColorConvert[img, &amp;#034;Grayscale&amp;#034;], {mid, mid}]];&#xD;
          cropLeft = LengthWhile[flatValues, # &amp;lt; 0.2 &amp;amp;];&#xD;
          cropRight = LengthWhile[Reverse[flatValues], # &amp;lt; 0.2 &amp;amp;];&#xD;
          List[cropLeft, cropRight]&#xD;
          ]&#xD;
     &#xD;
        widthResize[img_] := &#xD;
         Block[{ flatValues, cropLeft, cropRight, meanLeft, meanRight, list1, &#xD;
           list2, list3, list4, list5, resizedImage},&#xD;
          list1 = cropFinder[10, img];&#xD;
          list2 = cropFinder[2, img];&#xD;
          list3 = cropFinder[4, img];&#xD;
          list4 = cropFinder[1.5, img];&#xD;
          list5 = cropFinder[1, img];&#xD;
          meanLeft = meanLeft /. x_ /; x &amp;gt; 300 :&amp;gt; 0;&#xD;
          meanLeft = -(Max[{list1[[1]], list2[[1]], list3[[1]], list4[[1]], &#xD;
               list5[[1]]}]);&#xD;
          meanRight = meanRight /. x_ /; x &amp;gt; 300 :&amp;gt; 0;&#xD;
          meanRight = -((Max[{list1[[2]], list2[[2]], list3[[2]], list4[[2]], &#xD;
                list5[[2]]}]));&#xD;
          resizedImage = ImagePad[img, {{meanLeft, meanRight}, {0, 0}}];&#xD;
          ImageResize[resizedImage, {512, 512}]&#xD;
          ]&#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][12]&#xD;
&amp;lt;br /&amp;gt;&#xD;
##Image Editing Functions cont.#&#xD;
&amp;lt;br /&amp;gt;&#xD;
The below functions were used to separate the images into halves. If a certain image was in the left lobe virus data set, only the left side was extracted. The respective operations were performed on all of the groups of data. (Note: The chest X-rays display the right side of the chest on the left and the left side of the chest on the right. When I crop the image for the left section it will extract the right side of the image.)&#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
        halfFormat[x_, y_] := &#xD;
          Block[{i} , &#xD;
           Table[ImageCrop[widthResize[x[[i]]], {256, 512}, y], {i, &#xD;
             Length[x]}]];&#xD;
        singleHalfFormat[x_, y_] := ImageCrop[widthResize[x], {256, 512}, y];&#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][13]&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below was the script that was used to edit the images&#xD;
&amp;lt;br /&amp;gt;&#xD;
        leftNormalNorm = halfFormat[widthResize[halfNormalImg], Left];&#xD;
        rightNormalNorm = halfFormat[widthResize[halfNormalImg], Right];&#xD;
        leftVirusNorm = halfFormat[widthResize[leftVirusImg], Left];&#xD;
        rightVirusNorm = halfFormat[widthResize[rightVirusImg], Right];&#xD;
        leftBacNorm = halfFormat[widthResize[leftBacImg], Left];&#xD;
        rightBacNorm = halfFormat[widthResize[rightBacImg], Right];&#xD;
&amp;lt;br /&amp;gt;&#xD;
##Neural Network&#xD;
&amp;lt;br /&amp;gt;&#xD;
The ResNet 50 was used for transfer learning with a similar set up as the neural network created above. &#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][14]&#xD;
&amp;lt;br /&amp;gt;&#xD;
A &amp;#034;halfLearnNet&amp;#034; was created with a &amp;#034;DropoutLayer&amp;#034;, &amp;#034;LinearLayer&amp;#034;, &amp;#034;SoftmaxLayer&amp;#034;, and an &amp;#034;Output&amp;#034; of two classes. The outputs  were 0 and 1; 0 means that the chest X-ray given is a normal image(no pneumonia); 1 means that the lung had pneumonia. &#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][15]&#xD;
&amp;lt;br /&amp;gt;&#xD;
##Preparing Images/Training the Neural Net#&#xD;
&amp;lt;br /&amp;gt;&#xD;
The below sequence of steps were used for the other neural nets (right lobe virus, left lobe bacteria, right lobe bacteria). The trained files were exported for use on the microsite.&#xD;
&#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][16]&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below are error rates of the location detecting neural networks.&#xD;
&amp;lt;br /&amp;gt;&#xD;
 - Virus Left : about 5% error&#xD;
&amp;lt;br /&amp;gt;&#xD;
 - Virus Right : about 5% error &#xD;
&amp;lt;br /&amp;gt;&#xD;
 - Bacteria Left: about 0% error&#xD;
&amp;lt;br /&amp;gt;&#xD;
 - Bacteria Right: about 15% error&#xD;
&amp;lt;br /&amp;gt;&#xD;
#Creating a MicroSite#&#xD;
&amp;lt;br /&amp;gt;&#xD;
Due to the immense size of my trained neural nets, I needed to create a cloud objects for them.&#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
        bacLeftNet = CloudImport[CloudObject[&amp;#034;bacLeftNet.wlnet&amp;#034;]]&#xD;
        bacRightNet = CloudImport[CloudObject[&amp;#034;bacRightNet.wlnet&amp;#034;]]&#xD;
        virusLeftNet = CloudImport[CloudObject[&amp;#034;virusLeftNet.wlnet&amp;#034;]]&#xD;
        virusRightNet = CloudImport[CloudObject[&amp;#034;virusRightNet.wlnet&amp;#034;]]&#xD;
        CloudImport[CloudObject[&amp;#034;pneumonia.wlnet&amp;#034;]]&#xD;
&amp;lt;br /&amp;gt;&#xD;
I created a function which performed my desired tasks: Determine if the given chest X-ray is normal, bacterial, or virus. If the chest X-ray appeared to have pneumonia, the function outputted an the probability that the pneumonia was in the right lung and the left lung. In addition, the given image was returned  so the user could view. it. &#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][17]&#xD;
&amp;lt;br /&amp;gt;&#xD;
Below was the code for my microsite.&#xD;
&amp;lt;br /&amp;gt;&#xD;
&#xD;
        CloudDeploy[Delayed@FormPage[{&amp;#034;image&amp;#034; -&amp;gt; &amp;#034;Image&amp;#034;},&#xD;
           tesla[#image] &amp;amp;,&#xD;
           AppearanceRules -&amp;gt; &amp;lt;|&#xD;
             &amp;#034;Title&amp;#034; -&amp;gt; &amp;#034;Machine Learning Pneumonia Diagnosis&amp;#034;, &#xD;
             &amp;#034;Description&amp;#034; -&amp;gt; &#xD;
              &amp;#034;&amp;lt;style&amp;gt;.wolfram-branding&amp;gt;.wolfram-branding-cloud:after{\&#xD;
        background-image: url(http://i.imgur.com/hFuh1YT.png)}&amp;lt;/style&amp;gt;Upload \&#xD;
        a Chest X-Ray to recieve a diagnosis&amp;#034;, &amp;#034;SubmitLabel&amp;#034; -&amp;gt; &amp;#034;Classify&amp;#034;, &#xD;
             &amp;#034;PageTheme&amp;#034; -&amp;gt; &amp;#034;Red&amp;#034;|&amp;gt;], &amp;#034;test3&amp;#034;, Permissions -&amp;gt; &amp;#034;Public&amp;#034;]&#xD;
&amp;lt;br /&amp;gt;&#xD;
If an image is given to the microsite the following is outputted. &#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][18]&#xD;
#Real World Testing#&#xD;
&amp;lt;br /&amp;gt;&#xD;
Real world testing was performed to simulate a real use case. I took a picture of the screen, like someone would take a picture of an chest X-ray. &#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][19]&#xD;
&amp;lt;br /&amp;gt;&#xD;
The neural network correctly guessed that the image was an instance of viral pneumonia.&#xD;
&amp;lt;br /&amp;gt;&#xD;
![enter image description here][20]&#xD;
&amp;lt;br /&amp;gt;&#xD;
#Conclusion and Acknowledgement&#xD;
&amp;lt;br /&amp;gt;&#xD;
I created a transfer learning neural networks which successful diagnosed pneumonia with an accuracy of about 83% and accurately detected the location of the pneumonia with an average accuracy of about 93%. Data editing and augmentation procedures and increasing the amount of training rounds helped increase accuracy of diagnoses. I would like to thank my mentor, Michael Kaminsky, for helping guide me. In addition, I would like to thank other mentors including Rick Harrigan, Andrea Griffin, Douglas Smith, and Greg Hurst for helping me. Finally, I would like to thank my parents for encouraging me to pursue my passions and keep learning. &#xD;
#Future Improvements#&#xD;
&#xD;
 - Improving image formatting function to make the current program more compatible with poor quality chest X-Rays. &#xD;
 - Using a similar Neural Network set up except with thermal images to efficiently diagnose pneumonia.&#xD;
 - Further augmenting data to improve accuracy of the neural network. &#xD;
#Citations&#xD;
&#xD;
        https://www.mayoclinic.org/diseases-conditions/pneumonia/symptoms-causes/syc-20354204&#xD;
        https://my.clevelandclinic.org/health/diseases/4471-pneumonia&#xD;
        https://www.hopkinsmedicine.org/healthlibrary/conditions/respiratory_disorders/pneumonia_85,P01321&#xD;
        https://www.kaggle.com/paultimothymooney/chest-xray-pneumonia&#xD;
        https://www.med-ed.virginia.edu/courses/rad/cxr/pathology3chest.html&#xD;
        https://machinelearningmastery.com/transfer-learning-for-deep-learning/&#xD;
        https://www.amazon.com/Deep-Learning-Adaptive-Computation-Machine/dp/0262035618/ref=as_li_ss_tl?ie=UTF8&amp;amp;qid=1505772822&amp;amp;sr=8-1&amp;amp;keywords=deep+learning&amp;amp;linkCode=sl1&amp;amp;tag=inspiredalgor-20&amp;amp;linkId=e16a8bbb28ecba154d225ca5f7efcbed&#xD;
        http://www.cell.com/cell/fulltext/S0092-8674(18)30154-5&#xD;
        https://data.mendeley.com/datasets/rscbjbr9sj/2&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-07-13at10.32.21PM.png&amp;amp;userId=1372752&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Unt1.jpeg&amp;amp;userId=1372752&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Unt2.jpeg&amp;amp;userId=1372752&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Unt4.jpeg&amp;amp;userId=1372752&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Unt5.jpeg&amp;amp;userId=1372752&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Unt6.jpeg&amp;amp;userId=1372752&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Unt7.jpeg&amp;amp;userId=1372752&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Unt8.jpeg&amp;amp;userId=1372752&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Unt9.jpeg&amp;amp;userId=1372752&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=arg2.jpeg&amp;amp;userId=1372752&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=arg3.jpeg&amp;amp;userId=1372752&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=arg4.jpeg&amp;amp;userId=1372752&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=arg5.jpeg&amp;amp;userId=1372752&#xD;
  [14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=arg6.jpeg&amp;amp;userId=1372752&#xD;
  [15]: http://community.wolfram.com//c/portal/getImageAttachment?filename=arg7.jpeg&amp;amp;userId=1372752&#xD;
  [16]: http://community.wolfram.com//c/portal/getImageAttachment?filename=arg8.jpeg&amp;amp;userId=1372752&#xD;
  [17]: http://community.wolfram.com//c/portal/getImageAttachment?filename=arg9.jpeg&amp;amp;userId=1372752&#xD;
  [18]: http://community.wolfram.com//c/portal/getImageAttachment?filename=lol1.jpeg&amp;amp;userId=1372752&#xD;
  [19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=lol2.jpeg&amp;amp;userId=1372752&#xD;
  [20]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2018-07-13at11.11.17PM.png&amp;amp;userId=1372752</description>
    <dc:creator>Rohit Panse</dc:creator>
    <dc:date>2018-07-14T03:48:35Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1137055">
    <title>[WSS17] Instance Segmentation Using Neural Network</title>
    <link>https://community.wolfram.com/groups/-/m/t/1137055</link>
    <description>## Introduction&#xD;
**Instance Segmentation** is one of many interesting computer vision tasks that combines **object detection** and **semantic segmentation**. It detects the object, and at the same time, generates a segmentation mask, which you can think as classifying each pixel - whether it belongs to an object or not. &#xD;
&#xD;
Therefore, solving object detection and semantic segmentation together is a good approach to solve instance segmentation. In the summer school, we borrowed the framework of Mask R-CNN, to combine object detection and semantic segmentation in one pipeline, and produced some promising results.&#xD;
&#xD;
Mask R-CNN is developed like this: R-CNN -&amp;gt; Fast R-CNN -&amp;gt; Faster R-CNN -&amp;gt; Mask RCNN. In each stage, researchers solved some bottleneck problems to get faster and better performance. R stands for the region based, so R-CNN a region based convolutional neural network. Mask R-CNN has two stages, the first stage is trying to produce valid bounding box, you can think it as &amp;#034;blobby&amp;#034; image regions because &amp;#034;blobby&amp;#034; regions are likely to contain objects. In the early stage, researchers feed these warped image regions into a convolutional network, and in the output, they put two head, one regression head to produce the bounding-box, another head like SVM to do classify. And peoples kept working on it and make the network more efficient using some tricks like switch the proposal layer and convolutional layer to avoid unnecessary computations. &#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
There is a Github repo [FastMaskRCNN][2], several machine learning enthusiasts are trying to reproduce this paper in Tensorflow. I already obtained &amp;gt;400k epoch weights, but haven&amp;#039;t tested yet, I will keep working on it after summer school. This Mask R-CNN model a too big to finish within 2 weeks, especially since I am new to the TensorFlow framework. Here is the graph visualization from TensorBoard, which looks really complicated and I haven&amp;#039;t figure out the pipeline yet. &#xD;
![enter image description here][3]&#xD;
&#xD;
## My Project&#xD;
Because building Mask R-CNN network in Mathematica side turned out to be too complicated to finish before the deadline. So in the last two days of summer school, I did something simpler, but it&amp;#039;s inspired by Mask R-CNN&amp;#039;s framework, which uses the bounding-box region and corresponding mask to train a network to produce a binary mask (pixel-to-pixel). And this process is like semantic segmentation. In order to get this &amp;#034;pixel-to-pixel&amp;#034; trianing dataset, I wrote a script to process 24k [COCO][4] train2014 dataset and to crop the bounding box region based on the annotation `json` file. Here is how information encoded for object instance annotations:&#xD;
&#xD;
    annotation{&#xD;
    &amp;#034;id&amp;#034; : int,&#xD;
    &amp;#034;image_id&amp;#034; : int,&#xD;
    &amp;#034;category_id&amp;#034; : int,&#xD;
    &amp;#034;segmentation&amp;#034; : RLE or [polygon],&#xD;
    &amp;#034;area&amp;#034; : float,&#xD;
    &amp;#034;bbox&amp;#034; : [x,y,width,height],&#xD;
    &amp;#034;iscrowd&amp;#034; : 0 or 1,&#xD;
    }&#xD;
&#xD;
The original annotation `json` data looks like this: &#xD;
&#xD;
    {&amp;#034;area&amp;#034; -&amp;gt; 54653., &#xD;
     &amp;#034;segmentation&amp;#034; -&amp;gt; {{312.29, 562.89, 402.25, 511.49, 400.96, 425.38, &#xD;
        398.39, 372.69, 388.11, 332.85, 318.71, 325.14, 295.58, 305.86, &#xD;
        269.88, 314.86, 258.31, 337.99, 217.19, 321.29, 182.49, 343.13, &#xD;
        141.37, 348.27, 132.37, 358.55, 159.36, 377.83, 116.95, 421.53, &#xD;
        167.07, 499.92, 232.61, 560.32, 300.72, 571.89}}, &amp;#034;iscrowd&amp;#034; -&amp;gt; 0, &#xD;
     &amp;#034;bbox&amp;#034; -&amp;gt; {116.95, 305.86, 285.3, 266.03}, &amp;#034;image_id&amp;#034; -&amp;gt; 480023, &#xD;
     &amp;#034;category_id&amp;#034; -&amp;gt; 58, &amp;#034;id&amp;#034; -&amp;gt; 86}&#xD;
&#xD;
The code is very simple, we just need to do the following things: &#xD;
&#xD;
 - Use the bounding-box  `{{x, y}, {dw, dh}` to trim the image into bounding-box region image.&#xD;
 - Use the list of points (vertices of the polygon (encoding ground truth segmentation mask) ) and bounding-box image dimensions to produce the corresponding mask for the region image.&#xD;
&#xD;
        convertAnnotationBBoxIntoImageCoord[bbox_List, h_]:= Module[&#xD;
        	{x1, y1, dw, dh},&#xD;
        	{x1, y1, dw, dh} = bbox;&#xD;
        	Transpose[{0, h} + {1, -1} Transpose[Partition[{x1, y1, x1 + dw, y1 + dh}, 2]]]&#xD;
        ]&#xD;
        getMask[pts_List, w_, h_]:= Module[&#xD;
        	{vtx},&#xD;
        	vtx = convertAnnotationMask[pts, h];&#xD;
        	Binarize @ Rasterize[Graphics[{White, Polygon@@vtx}, PlotRange-&amp;gt;{{0, w}, {0, h}}, &#xD;
        	Background-&amp;gt;Black],&amp;#034;Image&amp;#034;, ImageSize-&amp;gt;{w, h}]&#xD;
        ]&#xD;
        extractBBoxAndMask[img_, bbox_, segPts_List]:= Module[&#xD;
        	{bboxLocal, w, h, boxRegion, maskRegion},&#xD;
        	{w, h} = ImageDimensions[img];&#xD;
        	bboxLocal = convertAnnotationBBoxIntoImageCoord[bbox, h];&#xD;
        	boxRegion = ImageTrim[img, bboxLocal];&#xD;
        	maskRegion = ImageTrim[getMask[segPts, w, h], bboxLocal];&#xD;
        	{boxRegion, maskRegion}&#xD;
        ]&#xD;
        imgsAndMasks = &#xD;
         extractBBox[imgs[[#]], bboxes[[#]], maskCoord[[#]]] &amp;amp; /@ Range[10]&#xD;
![enter image description here][5]&#xD;
&#xD;
&#xD;
For the network I used to train, I used ENet, which is a very fast and an efficient network. The Mask R-CNN paper used FCN, which is known as standard network to perform semantic segmentation. I also construct this network in Mathematica and I will try it later as well. &#xD;
The ENet architecture is as followings: &#xD;
&#xD;
![enter image description here][6]&#xD;
![enter image description here][7]&#xD;
&#xD;
The output is a 256 * 256 * 2 tensor produced by a softmax layer, so it encoded the mask as the Pr[ this pixel belongs to object]. Therefore, I also need to convert the mask image from {0,1} binary into {1,2} as the class label and save it as `.dat` as training labels. Because I was running out of the time, I just trained with this simple input and output. A better way Etienne suggested is to extract the output from the final convolutional layer of yolo as an input feature to feed in near the output, which I will definitely try soon. &#xD;
&#xD;
I trained my network only for 9 hours on a single Tesla K80 GPU, and already got very promising results.&#xD;
&#xD;
The way my `instanceSegmentation[image, net, detectionThreshold, overlapThreshold]` work is as followings: &#xD;
&#xD;
 1. Use YOLO network as detector to produce labels, bounding-boxes, and probabilities&#xD;
&#xD;
 2. Use bounding-boxes to crop the image object region and feed it to our trained network&#xD;
&#xD;
 3. Take the output tensor, convert it to binaryImages, resize it back to bounding box dimensions by using `ImagePad`.&#xD;
&#xD;
        padRegionMask[trimmedMask_, bboxLocal_, w_, h_]:= Block[&#xD;
        	{x1,y1,x2,y2},&#xD;
        	{{x1,y1},{x2,y2}} = bboxLocal;&#xD;
        	ImagePad[trimmedMask, &#xD;
        		{{x1, w - x2},&#xD;
        		 {y1, h - y2}}]&#xD;
        ]&#xD;
        &#xD;
        instanceSegmentation[img_, ennet_, detectionThreshold_, overlapThreshold_]:= Module[&#xD;
        	{labels, bboxes, probs, masks, coloredMasks, yoloVis, yoloRes, rectangles, centers},&#xD;
        	yoloRes = detection[img, detectionThreshold, overlapThreshold];&#xD;
        	rectangles =  Transpose[yoloRes][[2]];&#xD;
        	{labels, bboxes, probs} = convertYoloResult[yoloRes];&#xD;
        	centers = Mean/@ bboxes;&#xD;
        	masks = produceMask[ennet, img, bboxes];&#xD;
        	coloredMasks = Flatten[{RandomColor[], Opacity[.45], #}&amp;amp;/@ masks];&#xD;
        	yoloVis = Transpose @ MapThread[&#xD;
        		{&#xD;
        			{Darker @ Green,Opacity[0],#2},&#xD;
        			Style[&#xD;
        				Inset[#1&amp;lt;&amp;gt;&amp;#034; \n(&amp;#034;&amp;lt;&amp;gt;ToString@Round[#3, .01]&amp;lt;&amp;gt;&amp;#034;)&amp;#034;, #4, {Center, Center} ],&#xD;
        				FontSize -&amp;gt; Scaled[.03], FontColor -&amp;gt; White, GrayLevel[0,1], Background -&amp;gt; GrayLevel[1,0]&#xD;
        			]&#xD;
        		}&amp;amp;, {labels, rectangles, probs, centers}];&#xD;
        	HighlightImage[img, Join[{coloredMasks,yoloVis}], ImagePadding -&amp;gt; Scaled[.02]]	&#xD;
        ]&#xD;
&#xD;
Ok, here are some results, I only started training today&#xD;
&#xD;
Many cute dogs &#xD;
&#xD;
![dogs][8]&#xD;
&#xD;
Me and my mentor &#xD;
&#xD;
![Me with my mentor ][9]&#xD;
&#xD;
&#xD;
Me and my phone&#xD;
&#xD;
![Me with my phone][10]&#xD;
&#xD;
&#xD;
Me and my coffee&#xD;
&#xD;
![Me with my coffee][11]&#xD;
&#xD;
Me and my handbag&#xD;
&#xD;
![Me with my handbag][12]&#xD;
&#xD;
&#xD;
Me and my classmates and his phone&#xD;
&#xD;
![Me with my classmates with his phone][13]&#xD;
&#xD;
&#xD;
&#xD;
## Some personal reflection&#xD;
I enjoyed the summer school overall. I have been hoping to explore the Tensorflow framework and watch Stanford CS231n class for few months, but I was always very occupied with school&amp;#039;s classes, other projects, lab&amp;#039;s assignments, coding interviews, etc. I finally find some peaceful time to sit down and learn things I had always to learn. And in the process, I am also very amazed by the neural network framework Wolfram people developed. This is a very powerful and user-friendly framework that inherits Wolfram Language&amp;#039;s elegant syntax and interactive property. I still have some questions about this framework and plan to learn more about it. &#xD;
&#xD;
## Future Direction&#xD;
 1. Use FCN to do mask semantic segmentation&#xD;
 2. After obtained Mask R-CNN trained network, deploy it on a server and build an interesting iOS application. &#xD;
 3. Collaborate with Medical school people and apply Mask R-CNN to some medical imaging problems.&#xD;
&#xD;
&#xD;
## Reference&#xD;
&#xD;
 1. Mask R-CNN  &#xD;
     Paper: https://arxiv.org/abs/1703.06870   &#xD;
     Code (under testing): https://github.com/CharlesShang/FastMaskRCNN&#xD;
 2. ENet: https://arxiv.org/abs/1606.02147&#xD;
 3. YOLO2: https://arxiv.org/abs/1506.02640&#xD;
 4. Fully Convolutional Network (FCN): https://people.eecs.berkeley.edu/~jonlong/long_shelhamer_fcn.pdf&#xD;
 5. Project repo: https://github.com/zhuwenzhen/InstanceSegmentation&#xD;
&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Framework.png&amp;amp;userId=524853&#xD;
  [2]: https://github.com/CharlesShang/FastMaskRCNN&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=png.png&amp;amp;userId=524853&#xD;
  [4]: http://mscoco.org/dataset/#download&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2017-07-0515.14.08.png&amp;amp;userId=524853&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Enet.png&amp;amp;userId=524853&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2017-07-0515.22.14.png&amp;amp;userId=524853&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2017-07-0516.02.58.png&amp;amp;userId=524853&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2017-07-0516.20.56.png&amp;amp;userId=524853&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2017-07-0516.20.47.png&amp;amp;userId=524853&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2017-07-0516.21.35.png&amp;amp;userId=524853&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2017-07-0516.25.30.png&amp;amp;userId=524853&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Screenshot2017-07-0516.25.38.png&amp;amp;userId=524853</description>
    <dc:creator>Wenzhen Zhu</dc:creator>
    <dc:date>2017-07-05T21:17:23Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/908790">
    <title>[WSSA16] Creating Mosaic Images</title>
    <link>https://community.wolfram.com/groups/-/m/t/908790</link>
    <description>Introduction&#xD;
============&#xD;
&#xD;
In the 21st century with great advancement in technology, photo editing has become a form of art itself. Mosaic Image tool is a great way to create unique and expressive art. Image Mosaic is a simple application that will allow you to simply upload an image and create a mosaic out of a large database of pictures. The aim of my project was to implement image-processing based image mosaic tool within the Wolfram Language. The project consists of three parts:&#xD;
&#xD;
 - Equal Size Image Mosaic&#xD;
 - Unequal Size Image Mosaic&#xD;
 - Interactive web pages &#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
Algorithm &amp;amp; Code&#xD;
================&#xD;
The project consists of two options. The first one is creating  mosaic images which will be constructed from equal sized images. Whereas the second one considers the color distribution of the original image and based on the result divides it into different sized parts.&#xD;
&#xD;
Datasets&#xD;
--------&#xD;
&#xD;
Datasets are the set of images that are being used for image colorization. You can set/provide your preferable dataset for creating beautiful images.&#xD;
&#xD;
    flagList = &#xD;
      ConformImages[&#xD;
       Image /@ &#xD;
        Cases[DeleteDuplicates[&#xD;
          EntityValue[EntityList[&amp;#034;Country&amp;#034;], &amp;#034;Flag&amp;#034;]], _Graphics]];&#xD;
    flagListMean = ImageMeasurements[#, &amp;#034;Mean&amp;#034;] &amp;amp; /@ flagList;&#xD;
&#xD;
Equal Size Mosaic&#xD;
-----------------&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
For creating equal size mosaic, first of we will use the function ImagePartition to divide the original image into equal sized parts. Afterwards, we will consider the mean value of each element and compare it with the mean values of the images of the database. Then the program creates a list which contains the images from the database which are the nearest to each part of the original image. Finally, I used the function ImageAssemble to assemble the images of the newly created list mentioned above.&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
The function **imagePartition** takes two parameters and partitions an image into the list of partitionSize x partitionSize subimages.&#xD;
&#xD;
    imagePartition[image_?ImageQ, partitionSize_?IntegerQ]:=&#xD;
    Flatten[ImagePartition[image, partitionSize]];&#xD;
&#xD;
**PiecewiseMatching** is finding and resizing the element of the dataset which is the nearest to the current image part considering their mean values.&#xD;
&#xD;
    piecewiseMatching[imgPart_?ImageQ, dataSet_?ListQ, dataSetMean_?ListQ]:= &#xD;
    Module[&#xD;
    {curImgMean =ImageMeasurements[imgPart, &amp;#034;Mean&amp;#034;], &#xD;
    nearestMean, nearestMeanPos},&#xD;
    nearestMean =First[ Nearest[dataSetMean, curImgMean]];&#xD;
    nearestMeanPos = First[Flatten@Position[dataSetMean,nearestMean]];&#xD;
    ImageResize[dataSet[[nearestMeanPos]], ImageDimensions[imgPart]]&#xD;
    ]&#xD;
&#xD;
**imageAssemble** assembles an image from the list of the already matched images which are the nearest to the original image parts. &#xD;
&#xD;
    imageAssemble[imgPieces_?ListQ, inputImageDims_?ListQ, partitionSize_?IntegerQ]:=&#xD;
    Module[&#xD;
    {nestedImagePieces,&#xD;
    conformImg= ConformImages[imgPieces]},&#xD;
    &#xD;
    nestedImagePieces =&#xD;
    Partition[conformImg, IntegerPart[First[inputImageDims]/partitionSize]];&#xD;
    &#xD;
    ImageAssemble[nestedImagePieces]&#xD;
    ]&#xD;
&#xD;
**imageMosaic** uses all the functions mentioned above to create the mosaicImage. &#xD;
&#xD;
    imageMosaic[image_?ImageQ, partSmallestSize_?IntegerQ, dataSet_?ListQ] :=&#xD;
    Module[&#xD;
    {orgImgDim = ImageDimensions[image],&#xD;
    orgImgPieces = imagePartition[image, partSmallestSize],&#xD;
    dataSetMean = ImageMeasurements[#,&amp;#034;Mean&amp;#034;]&amp;amp;/@dataSet,&#xD;
    imgPieces, finalImg},&#xD;
    &#xD;
    imgPieces = piecewiseMatching[#, dataSet, dataSetMean]&amp;amp;/@orgImgPieces; &#xD;
    &#xD;
    finalImg = imageAssemble[imgPieces, orgImgDim, partSmallestSize]&#xD;
    ]&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
Unequal Size Mosaic&#xD;
-------------------&#xD;
![enter image description here][5]&#xD;
&#xD;
For creating a mosaic image with unequal parts first we divide the image into already defined equal parts. At the same time, another function computes the exact coordinates of the generated pieces on the main image. Afterwards, the function creates an association from coordinates and corresponding image pieces. The next function compares the mean values of the images from the database to the mean values of the generated pieces. If the difference between those two number is higher than a constant the function divides that piece into other four equal sized parts in other case it transfers the association into new list. This function is repeated over and over again until in the main list is fully transformed. At the end using the function **ImageCompose** the program places each piece on the blank image considering its coordinates.&#xD;
&#xD;
The function **fourCords** computes the exact coordinates of newly generated pieces and **fourImgs** divides the given image into four equal parts. After all this, the **getAssoc** function creates an association from the coordinates and the corresponding images. **imageDivide** function breaks the image into equal parts as long as they are bigger than the given maximum size of the part.&#xD;
&#xD;
        fourImgs[img_?ImageQ]:= Flatten[ImagePartition[img, ImageDimensions[img]/2]];&#xD;
        &#xD;
        getAssoc[list_,image_]:=AssociationThread[fourCords[list] ,fourImgs[image]];&#xD;
        &#xD;
        fourCords[cord_List]:=Module[&#xD;
        {res=Flatten@cord, midX, midY},&#xD;
        midX = res[[1]] + (res[[3]]-res[[1]])/2;&#xD;
         midY = res[[2]] + (res[[4]]-res[[2]])/2;&#xD;
        N@{&#xD;
        {{res[[1]],midY},{midX,res[[4]]}},&#xD;
        {{midX,midY},{res[[3]],res[[4]]}},&#xD;
        {{res[[1]],res[[2]]},{midX,midY}},&#xD;
        {{midX,res[[2]]},{res[[3]],midY}}&#xD;
        }&#xD;
        ];&#xD;
        &#xD;
        imageDivide[image_?ImageQ, max_?IntegerQ] :=Module[&#xD;
        {imgAssoc},&#xD;
        &#xD;
        imgAssoc = Association[{{1,1},ImageDimensions@image}-&amp;gt;image];&#xD;
        &#xD;
        While[First[ImageDimensions[First[Flatten[Values[imgAssoc]]]]]*Last[ImageDimensions[First[Flatten[Values[imgAssoc]]]]]&amp;gt;max,&#xD;
        &#xD;
        imgAssoc=Association@MapThread[getAssoc[#1,#2]&amp;amp;,{Keys[imgAssoc],Values[imgAssoc]}]&#xD;
        &#xD;
        ];&#xD;
        &#xD;
        imgAssoc&#xD;
        ];&#xD;
&#xD;
The function **imageMatching** compares the generated pieces to the ones from the database and after finding a match replaces it with the image from the database.&#xD;
&#xD;
    imageMatching[imgAssoc_?AssociationQ, smallImages_?ListQ, min_?IntegerQ, allowedDistance_] := Module[&#xD;
    &#xD;
    {inList = imgAssoc, dist =(First@#)&amp;amp;/@smallImages, nearestMean,curImg,nearestMeanPos, curItem,curImgMean, finalAssoc = &amp;lt;||&amp;gt;},&#xD;
    &#xD;
    While&#xD;
    [&#xD;
    Length[inList]&amp;gt;0,&#xD;
    &#xD;
    curItem = First@Normal[inList];&#xD;
    curImg = Last@curItem;&#xD;
    curImgMean = ImageMeasurements[curImg,&amp;#034;Mean&amp;#034;];&#xD;
    inList =DeleteCases[inList, curImg];&#xD;
    &#xD;
    nearestMean = First@Nearest[dist,curImgMean ];&#xD;
    nearestMeanPos = First[Flatten@Position[dist,nearestMean]];&#xD;
    If[&#xD;
    Norm[curImgMean -nearestMean]&amp;lt;=allowedDistance || First[ImageDimensions[curImg]]* Last[ImageDimensions[curImg]]&amp;lt;=min,&#xD;
    &#xD;
    curItem = Rule[First[curItem],ImageResize[Last[smallImages[[nearestMeanPos]]], ImageDimensions[curImg]]];&#xD;
    AppendTo[finalAssoc,curItem];,&#xD;
    &#xD;
    inList = Join[inList,getAssoc[First[curItem],Last[curItem]]];&#xD;
    ]&#xD;
    ];&#xD;
    finalAssoc&#xD;
    ]&#xD;
&#xD;
**mosiacCompose** mainly uses the function **ImageCompose** to overlay each newly generated piece onto a blank image for creating the mosaic.&#xD;
&#xD;
    mosaicCompose[associmage_?AssociationQ, blankImage_?ImageQ] := Module[&#xD;
    {coords,imgs, midCoords, mosaic,i},&#xD;
    imgs = Flatten[Values[associmage]];&#xD;
    coords = Keys[associmage];&#xD;
    midCoords = {#[[1,1]]+(#[[2,1]]-#[[1,1]])/2,#[[1,2]]+ (#[[2,2]] - #[[1,2]])/2}&amp;amp;/@coords;&#xD;
    mosaic = blankImage;&#xD;
    For[i=1,i&amp;lt;=Length@associmage,i++,&#xD;
    mosaic=ImageCompose[mosaic,imgs[[i]],midCoords[[i]]]&#xD;
    ];&#xD;
    &#xD;
    mosaic&#xD;
    ]&#xD;
&#xD;
**imageMosaic** combines all the functions mentioned above to create the mosaic image.&#xD;
&#xD;
    imageMosaic[image_?ImageQ, max_?IntegerQ, dataSet_?ListQ, min_?IntegerQ, allowedDistance_]:=Module[&#xD;
    {imgPart= imageDivide[img,max], &#xD;
    orgImgDim = ImageDimensions[image],&#xD;
    assoc, blankImage, list},&#xD;
    &#xD;
    list = Rule[ImageMeasurements[#,&amp;#034;Mean&amp;#034;],#]&amp;amp;/@dataSet;&#xD;
    assoc  =imageMatching[imgPart,list, min, allowedDistance];&#xD;
    &#xD;
    blankImage = ConstantImage[0, orgImgDim];&#xD;
    mosaicCompose[assoc, blankImage]&#xD;
    ]&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
Cloud Deploy&#xD;
============&#xD;
&#xD;
Equal Size Mosaic Webpage&#xD;
-------------------------&#xD;
To make a mosaic image of your image out of flags you can upload your picture to the web form, which can be found [here][7].&#xD;
![enter image description here][8]&#xD;
&#xD;
Unequal Size Mosaic Webpage&#xD;
---------------------------&#xD;
To make an unequal mosaic image of your image out of flags you can upload your picture to the web form, which can be found [here][9]&#xD;
&#xD;
*In case the picture turns out the same as in the case of equal size try changing the specifications/input.*&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=HQ.jpg&amp;amp;userId=900643&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=qq.jpg&amp;amp;userId=900643&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=gfd.jpg&amp;amp;userId=900643&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=asda.jpg&amp;amp;userId=900643&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=cha.PNG&amp;amp;userId=900643&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=czxc.jpg&amp;amp;userId=900643&#xD;
  [7]: https://www.wolframcloud.com/objects/1ba74267-8300-4935-a3d4-88082eff0b09&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Untitled-1.png&amp;amp;userId=900643&#xD;
  [9]: https://www.wolframcloud.com/objects/32b1be17-501d-46b3-9b08-fcb7dd231fcb&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Untitled-2.png&amp;amp;userId=900643</description>
    <dc:creator>Yeva Gabrielyan</dc:creator>
    <dc:date>2016-08-19T14:58:13Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/749947">
    <title>Reading and solving Garam puzzles</title>
    <link>https://community.wolfram.com/groups/-/m/t/749947</link>
    <description>The Reddit math forum [turned up][1] this [nice site][2] of sudokuish Garam puzzles yesterday. Fill in the blanks.&#xD;
&#xD;
![A Garam puzzle][3]&#xD;
&#xD;
Someone was quick to post [their Mathematica reduction][4]:&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
They had to enter the whole puzzle manually, a tedious task.&#xD;
&#xD;
The regular format and clean composition make these puzzles a tempting target for automation.&#xD;
&#xD;
Using colour frequency, I pick out the tiles of the puzzle with morphological tools.&#xD;
&#xD;
![Said puzzles tiles][6]&#xD;
&#xD;
By checking tile adjacency, I compile lists of &amp;#039;equations&amp;#039; reading down or across. Then the dark pixels in these tiles are extracted to collect the equation data. &#xD;
&#xD;
![Some equation imagery][7]&#xD;
&#xD;
A classifier turns the images into equations.&#xD;
&#xD;
![Some equations][8]&#xD;
&#xD;
Reduce solves all the equations for us, and churns out the answers left to right!&#xD;
&#xD;
![Solutions][9]&#xD;
&#xD;
Notebook attached for all your Garam cheating needs.&#xD;
&#xD;
&#xD;
  [1]: https://www.reddit.com/r/math/comments/3v9ik1/an_interesting_japanese_equation_puzzle_it_took/&#xD;
  [2]: https://www.garamgame.com/&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PuzzlePaste.png&amp;amp;userId=445606&#xD;
  [4]: http://i.snag.gy/8cmhp.jpg&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=8cmhp.jpg&amp;amp;userId=11733&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PuzzleTiles.png&amp;amp;userId=445606&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Someequationimagery.PNG&amp;amp;userId=445606&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Someequations.PNG&amp;amp;userId=445606&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Solutions.PNG&amp;amp;userId=445606</description>
    <dc:creator>David Gathercole</dc:creator>
    <dc:date>2015-12-04T09:04:41Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/509162">
    <title>[Project] Human Cerebral Cortex with Real Data [MCIScreen]</title>
    <link>https://community.wolfram.com/groups/-/m/t/509162</link>
    <description>By the number of related disciplines, you may appreciate that this is a multidisciplinary problem of significant interest.&#xD;
I will start with the bottom line and then provide brief background.&#xD;
&#xD;
1. The Fundamental Problem: To Construct a 3-D Model of the 3 mm shell of the Human Cerebral Cortex so that microscopic neuroanatomic data specific to the six layers of 50 different cortical areas can be mapped onto it to show how the human cortex develops during the first six years of life.&#xD;
&#xD;
2. The Background: We have the largest, quantitative database available on the microscopic, neuroanatomic features of the developing human cerebral cortex.  In 1998, these data led to the overturning of the 100 year old dogma of no new neuron formation after birth, and ushered in the era of stem cell research.  The data were described by the NY Times as the most important scientific finding of the last decade of the 20th century.  Specifically, there are 8 age points of children who died of normal causes, at 0, 1, 3, 6, 15, 24, 48 and 72 months after birth.  At each age point, for each layer of 50 cortical areas, there are measures of the numbers of neurons, their size, the numbers of inputs (large dendrites) and outputs (axons), the thickness of each cortical layer, the surface area of each cortical area.  We have published that the signal-noise ratio of these data is extremely high, and that there is a common (undiscovered yet) pattern that characterizes the development of each cortical area.&#xD;
&#xD;
3. The Challenge: To build a 3-D model that can take the values of these microscopic, neuroanatomic features at each age point, layer, and cortical locus, so that these changes can be visualized and analyzed with more complex mathematical methods to discover the underlying rules governing the development of the human cerebral cortex.  These rules are likely to govern the structure of development of the cortex of other mammals.&#xD;
&#xD;
4. An Additional Challenge: We also have camera lucida drawings of the cortical columns of each of these 50 cortical areas for each of the 8 age points.  These camera lucida drawings are tracings of representative neurons in each layer of each cortical area.  By quantifying these 2-D images and making some assumptions about their 3-D representation, one could incorporate these data into the above model to learn even more.  Such research and development should lead to programs and algorithms of extraordinary power that will have use in many different disciplines.  I can see how different disciplines would approach this problem in different ways, which is why I posted so many fields of interest.&#xD;
&#xD;
If anyone would like to know more, or has suggestions for developing this project, I have the database, am a statistician and cognitive scientist by training and experience, and am one of the clinical authorities on Alzheimer&amp;#039;s disease and other dementing disorders, which is essentially the reverse of development.  &#xD;
&#xD;
I would appreciate input from anyone with a creative streak and a taste for a challenging problem.&#xD;
&#xD;
Thanks very much&#xD;
&#xD;
Rod Shankle, MS MD FACP&#xD;
&#xD;
PS: I have attached a PNAS article giving a nice brief summary of the data.</description>
    <dc:creator>William Shankle</dc:creator>
    <dc:date>2015-06-04T05:57:54Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1018424">
    <title>[WSSA16] Semantic image distance for a general purpose suggestion bot</title>
    <link>https://community.wolfram.com/groups/-/m/t/1018424</link>
    <description>Suggestion algorithms trained on passed personal preferences are extensively used by various automated assistants. Their purpose could be, for example, marketing of the best possible product choices based on previous purchases, suggestion of new places to visit, semantically organizing photo albums, and many other similar tasks. One of the cornerstones of such algorithms is semantic image distance. The project goal will be building such a measure with help of Wolfram Language neural network tools and dictionary labels with hierarchical semantic structure.&#xD;
&#xD;
High level operation of the application is the following. &#xD;
&#xD;
1. Recognize produced images and get the probability of each recognized result.&#xD;
2. Get the leaf vertices of the knowledge graph which corresponds to recognized image results.&#xD;
3. Pick the top 10 most probable result vertices of each image and calculate the distance of each vertex of the first image with vertices of the second image.&#xD;
4. Multiply the distance result of the step 3 with their corresponding probabilities.&#xD;
5. Sum all the results from step 4 to get overall distance between images.&#xD;
	&#xD;
For the knowledge graph a subset of WorldNet graph database has been used. The following code is responsible to fetch and prune the WorldNet graph database.&#xD;
&#xD;
        createWordnetGraph[parents_]:= Module[{edges},&#xD;
        	edges = (First@# -&amp;gt; Last@#)&amp;amp; /@parents;&#xD;
        	edges = DeleteCases[edges, Null];&#xD;
        	Graph[edges]&#xD;
        ];&#xD;
        generateGraph[]:=Module[&#xD;
        	{wordnetParents,wordnetgraph,networkGraph,ids,currentSynset,extendedGraph},&#xD;
        	wordnetParents=Import[&amp;#034;http://www.image-net.org/archive/wordnet.is_a.txt&amp;#034;,&amp;#034;Data&amp;#034;];&#xD;
        	wordnetgraph=createWordnetGraph[wordnetParents]&#xD;
        &#xD;
        (*This graph has been further pruned using the list of synsets known to ImageIdentify.&#xD;
        The code to do that is internal and cannot be published here. *)&#xD;
        &#xD;
        ];&#xD;
        &#xD;
        $networkGraph=generateGraph[];&#xD;
        $undirectedNetworkGraph=Graph[VertexList[$networkGraph],EdgeList[$networkGraph]/.DirectedEdge-&amp;gt;UndirectedEdge];&#xD;
&#xD;
At the bottom you can see the diagram of graph that is being used to find out the distances between images.&#xD;
&#xD;
    SetProperty[$undirectedNetworkGraph,&#xD;
    	{EdgeStyle-&amp;gt;Directive[White,Opacity[.8]],&#xD;
    	Background-&amp;gt;Black,&#xD;
    	VertexStyle-&amp;gt;Directive[Red,Opacity[.5]],&#xD;
    	VertexSize-&amp;gt;.001}]&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
The following code is responsible to calculate the distance between two vertices of the graph. First it finds the common ancestor of two vertices, then it sums the distance between first vertex and common ancestor to the second vertex and common ancestor to get the distance between two vertices.&#xD;
&#xD;
    calculateDistance[vertex1_, vertex2_]:=Module[{id1,id2,formatedVertex1,formatedVertex2,in1,in2,commanVertices,firstCommanVertex,commonToVertex1Distance,commonToVertex2Distance,distance},&#xD;
    &#xD;
    in1=VertexInComponent[$networkGraph,vertex1];&#xD;
    in2=VertexInComponent[$networkGraph,vertex2];&#xD;
    commanVertices=Cases[in1,x_/;MemberQ[in2,x]];&#xD;
    If[Length[commanVertices]&amp;gt;0,(&#xD;
    	firstCommanVertex=First[MaximalBy[commanVertices,Length@VertexInComponent[$networkGraph,#]&amp;amp;]];&#xD;
    	commonToVertex1Distance=GraphDistance[$undirectedNetworkGraph,vertex1, firstCommanVertex];&#xD;
    	commonToVertex2Distance=GraphDistance[$undirectedNetworkGraph,vertex2, firstCommanVertex];&#xD;
    	distance=commonToVertex1Distance+commonToVertex2Distance;&#xD;
    	distance&#xD;
    	),&#xD;
    Infinity]&#xD;
    &#xD;
    ];&#xD;
&#xD;
The picDistance function is the main function of the application. It returns the distance between two images. The smaller the return value the more similar the images are. It uses the above calculateDistance function to calculate the distances between vertices. Then it multiplies the distances with the probabilities.&#xD;
&#xD;
    picDistance[p1_,p2_]:=Module[{result1,result2,result1Keys,result2Keys,result1Values,result2Values,distance},&#xD;
    &#xD;
    (*result1 and result2 contain associations of vertices and their correspondent probabilities for a given image.&#xD;
    Internal tools has been used to obtain theses values.*)&#xD;
    &#xD;
    result1=Sort[result1,Greater];&#xD;
    result2=Sort[result2,Greater];&#xD;
    result1=result1[[1;;10]];&#xD;
    result2=result2[[1;;10]];&#xD;
    result1Keys=Keys[result1];&#xD;
    result2Keys=Keys[result2];&#xD;
    result1Values=Values[result1];&#xD;
    result2Values=Values[result2];&#xD;
    &#xD;
    distance=0;&#xD;
    itterFunc[result1Item_,result1ItemIndex_]:=MapIndexed[&#xD;
    Set[distance,distance+calculateDistance[result1Item, #1]*result1Values[[result1ItemIndex]]*result2Values[[First[#2]]]]&#xD;
    &amp;amp;,result2Keys];&#xD;
    &#xD;
    MapIndexed[itterFunc[#1,First[#2]]&amp;amp;,result1Keys];&#xD;
    &#xD;
    If[distance==0,Infinity,distance]&#xD;
    ];&#xD;
&#xD;
The following code is a simple test case for picDisttance function. Notice the distance between pictures of the dog and the cat is much higher than the pictures of two cats.&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
Here is simple demonstration of application. It compares picture of a wolf with 5 random images.&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=afer45w6yjthr.png&amp;amp;userId=11733&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-02-21at10.10.15AM.png&amp;amp;userId=11733&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-02-21at10.11.56AM.png&amp;amp;userId=11733</description>
    <dc:creator>Ara Yeressian</dc:creator>
    <dc:date>2017-02-21T16:15:42Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2960096">
    <title>[WSS23] Atmospheric data retrieval from Calipso satellite</title>
    <link>https://community.wolfram.com/groups/-/m/t/2960096</link>
    <description>![enter image description here][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=lidar_hero_image.png&amp;amp;userId=2955757&#xD;
  [2]: https://www.wolframcloud.com/obj/6a3e49a9-281b-4732-9598-0bbf87e7419b</description>
    <dc:creator>Richard Medina</dc:creator>
    <dc:date>2023-07-13T01:56:13Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1729892">
    <title>[WSS19] Emoji Generation From Singular 2D Images</title>
    <link>https://community.wolfram.com/groups/-/m/t/1729892</link>
    <description>Introduction&#xD;
=======&#xD;
The aim of this project is to create an algorithm for generating semantically and chromatically similar looking Emojis [avatars] from faces of human beings. This has been achieved by a combination of deep learning and heuristic analysis to produce appropriate results.  The data sets used in this project are available for public use and have been referenced below. This report has been divided into two major sections, namely - human analysis and emoji segmentation. Finally, a mapping function is presented to generate the final results.  The key principle involved in achieving the goal is cross-domain semantic preservation for effective results.&#xD;
&#xD;
Human Domain&#xD;
=======&#xD;
&#xD;
Face/Hair Segmentation mask generation&#xD;
-------&#xD;
One of the key features of a human face to keep in mind is the shape of the hair. For effectively extracting the hair out of a given picture, an edited version of the Dilated ResNet-105 has been trained on a dataset containing face/hair masks of faces from the CelebA dataset. The changes made in the network are for incorporating the training of appropriate dimensions of input and target vectors. &#xD;
&#xD;
    net = NetModel[&amp;#034;Dilated ResNet-105 Trained on Cityscapes Data&amp;#034;];&#xD;
    netReplaced = &#xD;
      NetReplacePart[net, &#xD;
       &amp;#034;input_0&amp;#034; -&amp;gt; NetEncoder[{&amp;#034;Image&amp;#034;, {178, 218}}]];&#xD;
    netPart = NetTake[netReplaced, {All, &amp;#034;broadcast_add0&amp;#034;}];&#xD;
    newNet = NetGraph[{netPart, &#xD;
       DeconvolutionLayer[3, {24, 28}, &amp;#034;Stride&amp;#034; -&amp;gt; {6, 9}, &#xD;
        &amp;#034;PaddingSize&amp;#034; -&amp;gt; {{4, 4}, {4, 4}}, &amp;#034;Input&amp;#034; -&amp;gt; {19, 28, 23}], &#xD;
       TransposeLayer[{1 &amp;lt;-&amp;gt; 3, 1 &amp;lt;-&amp;gt; 2}], SoftmaxLayer[]}, {1 -&amp;gt; 2, &#xD;
       2 -&amp;gt; 3, 3 -&amp;gt; 4}]&#xD;
This network is trained to classify every pixel of any input image into one of three classes, each of those classes corresponding to one colour of the segmentation mask [face, hair or background]. The loss function utilised is the &amp;#034;**CrossEntropyLossLayer**&amp;#034; function.  It has been trained on the 3500 pictures using  cross validation techniques over 10 epochs with a batch size of 4 images, due to the relatively small number of training samples available for the task.&#xD;
![Input/Output for the trained network][1]&#xD;
&#xD;
Colour Preservation for translation to Emoji&#xD;
-------&#xD;
For colour extraction of the various facial features for a given input image, the approach adopted is face-point based analysis predicted using the &amp;#034;2D Face Alignment&amp;#034; network from the Wolfram Neural Network Repository. With some simple rules established with respect to the morphological components of the face, we are easily able to extract the skin, hair and iris colours of an arbitrary input. &#xD;
&#xD;
    PickSkinColorPerson[img_] := &#xD;
     Module[{image = img, landmarks, splits, vals, mean},&#xD;
      landmarks = netevaluation[image];&#xD;
      splits = landmarks[[#]] &amp;amp; /@ groupings;&#xD;
      vals = PixelValue[image, #] &amp;amp; /@ &#xD;
        ScalingTransform[ImageDimensions[image]]@splits[[4]];&#xD;
      mean = Mean[vals[[1 ;; 4]]];&#xD;
      RGBColor[mean]]&#xD;
&#xD;
    PickHairColorPerson[img_] := &#xD;
     Module[{image = img, net, i, m}, &#xD;
      net = Import[&amp;#034;/home/kashikar/trained.mx&amp;#034;];&#xD;
      i = ImageResize[image, {178, 218}];&#xD;
      image = net[i];&#xD;
      m = ColorNegate[&#xD;
        Binarize[&#xD;
         ColorDistance[ImageResize[Image[Round[image]], {178, 218}], &#xD;
          Red]]];&#xD;
      DominantColors[i, Masking -&amp;gt; m][[1]]]&#xD;
&#xD;
![Color preservation][2]&#xD;
Emoji Domain&#xD;
=======&#xD;
## Structural Extraction and Analysis ##&#xD;
The dataset we use for the making avatars is the Cartoon Set compilation of images wherein a certain number of hairstyles, jawline types, and eye variations have been procedurally combined to create 100k avatars. It should be noted here that the nose and mouth of every emoji are in them same coordinates, with variance in jawlines and appropriate hairstyles. &#xD;
&#xD;
![Emojis][3]&#xD;
&#xD;
Considering we have hair masks for faces, a heuristic can be setup based on masking specific regions of any arbitrary emoji, taking advantage of the common positions in the dataset, to extract hair, and corresponding jawline/ear combinations for the input.&#xD;
&#xD;
    ExtractHairEmoji[img_] := &#xD;
     Module[{image = img, image1, poly, skin, cols, haircolor},&#xD;
      image1 = RemoveAlphaChannel[image, White];&#xD;
      poly = Polygon[{{132.72727272727275`, 410.90909090909093`}, {&#xD;
        372.7272727272727, 407.27272727272725`}, {363.6363636363636, &#xD;
        290.90909090909093`}, {133.63636363636363`, 291.8181818181818}}];&#xD;
      skin = RGBColor[ PixelValue[image, {{247, 197}}][[1]]];&#xD;
      cols = DominantColors[image1, Masking -&amp;gt; poly];&#xD;
      haircolor = &#xD;
       SelectFirst[cols, &#xD;
        ColorDistance[#, White] &amp;gt; 0.001 &amp;amp;&amp;amp; &#xD;
          ColorDistance[#, skin] &amp;gt; 0.001 &amp;amp;];&#xD;
      FillingTransform[&#xD;
       SelectComponents[&#xD;
        Binarize[ImageAdjust[ColorDistance[image, haircolor]], {0, 0.1}], &#xD;
        &amp;#034;Count&amp;#034;, -1]]]&#xD;
&#xD;
![Emoji Hairmask][4]&#xD;
&#xD;
Similarly, we can also extract jawlines and ear combinations, which could be potentially used for better fitting of face to emoji contours. It must be noted that this works on region based colour distance mapping, and hence doesn&amp;#039;t necessarily return the required outputs. Some helper functions for the colour extraction of face features of emojis have also been created.&#xD;
&#xD;
![Typical compilation sample][5]&#xD;
&#xD;
Data Processing&#xD;
-------&#xD;
The next steps involved are to create chunks of associations labelling emoji segmentation masks with their names, and more importantly, generating a final list with unique hairstyles that conform to the heuristics involved in the generating process. This has been followed by a manual intervention over the remaining 423 images to remove edge cases such as beards, spectacles and other similar outlier combinations. The data processing steps and outputs can be viewed in the full project notebook provided in the links below.&#xD;
&#xD;
Mapping&#xD;
=======&#xD;
Now that we have extracted all the required data for mapping, we utilise Wolfram Language&amp;#039;s  **ImageCrop** function to create a function to calculate the percentage overlap mapped over the curated unique emoji list and return the filename of the emoji with the best fitting skeleton.&#xD;
&#xD;
    SelectFitter[Image_] := &#xD;
     Module[{image = Image, nf, hairmask, emojifile, pics, l1, num},&#xD;
      hairmask = GetHairMaskPerson[image];&#xD;
      pics = ImageResize[#, {178, 218}] &amp;amp; /@ hairlist[[All, 2, 3]];&#xD;
      l1 = Divide[&#xD;
          Total[Flatten[&#xD;
            ImageData[&#xD;
             Abs[ImageCrop[#] - &#xD;
               ImageResize[ImageCrop[Binarize[ImageAlign[#, hairmask]]], &#xD;
                ImageCrop[#] // ImageDimensions]]]]], &#xD;
          2*Times @@ ImageDimensions@ImageCrop@#] &amp;amp; /@ pics;&#xD;
      num = Position[l1, Min[l1]][[1]];&#xD;
      hairlist[[num, 1]]]&#xD;
&#xD;
![Best Fit Emoji][6]&#xD;
&#xD;
And finally, we colorize this skeleton emoji appropriately!&#xD;
&#xD;
    Emoji[Image_] := &#xD;
     Module[{img = Image, eyecolperson, haircolperson, skincolperson, &#xD;
       emojistd, skincolemoji, eyecolemoji, emojichanged, hairmask},&#xD;
      eyecolperson = PickIrisColorPerson[img];&#xD;
      haircolperson = PickHairColorPerson[img];&#xD;
      skincolperson = PickSkinColorPerson[img];&#xD;
      emojistd = Import[SelectFitter[img][[1]]];&#xD;
      skincolemoji = SkinColorEmoji[emojistd];&#xD;
      eyecolemoji = &#xD;
       DominantColors[emojistd, &#xD;
         Masking -&amp;gt; &#xD;
          Polygon[{{280.0224466891134, 251.96408529741862`}, {&#xD;
           306.3973063973064, 253.64758698092032`}, {306.9584736251403, &#xD;
           228.39506172839504`}, {281.1447811447812, &#xD;
           226.71156004489336`}}]][[1]];&#xD;
      emojichanged = &#xD;
       ColorReplace[&#xD;
        emojistd, {skincolemoji -&amp;gt; skincolperson, &#xD;
         eyecolemoji -&amp;gt; eyecolperson}, {0.1, 0.1}];&#xD;
      hairmask = ExtractHairEmoji[emojistd];&#xD;
      emojichanged = &#xD;
       ImageResize[&#xD;
        ImageApply[# - # + {haircolperson[[1]], haircolperson[[2]], &#xD;
            haircolperson[[3]], 1} &amp;amp;, emojichanged, Masking -&amp;gt; hairmask], &#xD;
        300]]&#xD;
![Emojify][7]&#xD;
&#xD;
Some more results...&#xD;
&#xD;
![Emojify][8]&#xD;
&#xD;
![Emojify][9]&#xD;
&#xD;
![Emojify][10]&#xD;
&#xD;
A visual representation of the fitting process is as follows:&#xD;
&#xD;
![Fitting procedure][11]&#xD;
Future Improvements&#xD;
=======&#xD;
&#xD;
 -  Integration of some functions to map hairstyles and jawlines together, varying the hairstyle according to the jawline chosen.&#xD;
 - Spectacle detection and improvement of the hair/face segmentation dataset for inclusion of a wider variety of hair.&#xD;
 - Improving upon the **SelectFitter** function for a better metric of contour-shape similarity.&#xD;
 - Curating a dataset with pre-decided anchor points of the graphics to manipulate the required semantic features, and clearer colouring. &#xD;
&#xD;
Relevant Links&#xD;
=======&#xD;
&#xD;
 - [Full project notebook][12]&#xD;
 - [Cartoon Set Dataset][13]&#xD;
 - [CelebA Face-Hair Segmentation Dataset][14]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=hairmaskpic.bmp&amp;amp;userId=1729371&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=colors-people.bmp&amp;amp;userId=1729371&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=emojis.bmp&amp;amp;userId=1729371&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=gethairmask.bmp&amp;amp;userId=1729371&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=jawlinemoji.bmp&amp;amp;userId=1729371&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=selectfitterpic.bmp&amp;amp;userId=1729371&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=emojify.bmp&amp;amp;userId=1729371&#xD;
  [8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=emojify2.bmp&amp;amp;userId=1729371&#xD;
  [9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=2.bmp&amp;amp;userId=1729371&#xD;
  [10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=3.bmp&amp;amp;userId=1729371&#xD;
  [11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=final.bmp&amp;amp;userId=1729371&#xD;
  [12]: http://ttps://github.com/kashikarparth/WSS-Template/blob/master/Final%20Project/Final%20Submission/FinalProjectNBTemplate.nb&#xD;
  [13]: https://google.github.io/cartoonset/&#xD;
  [14]: http://www.cs.ubbcluj.ro/~dadi/face-hair-segm-database.html</description>
    <dc:creator>Parth Kashikar</dc:creator>
    <dc:date>2019-07-10T19:31:26Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1379517">
    <title>[WSS18] Rooftop Recognition for Solar Energy Potential</title>
    <link>https://community.wolfram.com/groups/-/m/t/1379517</link>
    <description>![enter image description here][1]&#xD;
&#xD;
#Rooftop Recognition for Solar Energy Potential&#xD;
&#xD;
The aim of this project is to detect the rooftop of buildings to determine the available area at different locations and to identify the most suitable ones for solar energy application such as solar PV using Neural Networks and satellite imagery.&#xD;
&#xD;
Github link for files and notebooks: https://github.com/enricocg/Project&#xD;
&#xD;
The Dataset&#xD;
===========&#xD;
&#xD;
The Inria Aerial Image Labeling addresses a core topic in remote sensing: the automatic pixelwise labeling of aerial imagery. Dataset features:&#xD;
&#xD;
- Coverage of 810 km (405 km for training and 405 km for testing)&#xD;
- Aerial orthorectified color imagery with a spatial resolution of 0.3 m&#xD;
- Ground truth data for two semantic classes : building and not building (publicly disclosed only for the training subset)&#xD;
&#xD;
[https : // project.inria.fr/aerialimagelabeling/][2]&#xD;
&#xD;
Select the images for the input and those for the results:&#xD;
&#xD;
    trainFilesInput = &#xD;
    Select[FileNames[&#xD;
    &amp;#034;image/*.tif&amp;#034;], ! StringMatchQ[#, ___ ~~ &amp;#034;._&amp;#034; ~~ ___] &amp;amp;];&#xD;
    trainFilesResult = &#xD;
    StringReplace[#, &amp;#034;image/&amp;#034; -&amp;gt; &amp;#034;mask/&amp;#034;] &amp;amp; /@ trainFilesInput;&#xD;
&#xD;
Import an image to test:&#xD;
&#xD;
    imgInput = Import[trainFilesInput[[1]]];&#xD;
    imgResult = Import[trainFilesResult[[1]]];&#xD;
&#xD;
Partition of the images in 100 from a 5000x5000 to images 500x500 :&#xD;
&#xD;
    splicesInput = Join @@ ImagePartition[imgInput, 500];&#xD;
    splicesResults = Join @@ ImagePartition[imgResult, 500];&#xD;
&#xD;
Assemble Images&#xD;
---------------&#xD;
&#xD;
Assemble images in sets of ten to verify:&#xD;
&#xD;
    assambleImage = ImageAssemble[splicesInput[[41 ;; 50]]]&#xD;
&#xD;
![Image assembly for row 4][3]&#xD;
&#xD;
Assemble mask images in sets of ten to verify:&#xD;
&#xD;
    assambleMask = &#xD;
     ImageAssemble[&#xD;
      Image /@ Round[ImageData /@ splicesResults[[41 ;; 50]]]]&#xD;
&#xD;
![Mask assembly for row 4][4]&#xD;
&#xD;
Compose&#xD;
-------&#xD;
&#xD;
Compose the images to verify image matching:&#xD;
&#xD;
    ImageCompose[assambleImage, {assambleMask, 0.5}]&#xD;
&#xD;
![Image composition of row 4 with mask][5]&#xD;
&#xD;
    rand = RandomInteger[{1, 100}];&#xD;
    ImageCompose[splicesInput[[rand]], {splicesResults[[rand]], 0.5}]&#xD;
&#xD;
![Image composition of a random image][6]&#xD;
&#xD;
Association&#xD;
-----------&#xD;
&#xD;
    mxTrain = Thread[splicesInput -&amp;gt; splicesResults];&#xD;
&#xD;
    ImageCompose[Keys[mxTrain[[rand]]], {Values[mxTrain[[rand]]], 0.4}]&#xD;
&#xD;
![Image association][7]&#xD;
&#xD;
Export the MX file&#xD;
&#xD;
    Export[&amp;#034;File.mx&amp;#034;, mxTrain]&#xD;
&#xD;
Export&#xD;
------&#xD;
**mxFileCreator**&#xD;
&#xD;
The first approach to organize the data was to make MX files, one per image, each file contain the 100 images with their respective mask. In order to do that a function mxFileCreator was build.&#xD;
&#xD;
Function that creates a MX file per each 5000x5000 image:&#xD;
&#xD;
    mxFileCreator[trainFilesInput_,trainFilesResult_,i_]:=Block[&#xD;
    	{Flag,imgInput,imgResult,splicesInput,splicesResults,mxTrain},&#xD;
    &#xD;
    	Flag=TextString[i];&#xD;
    &#xD;
    	imgInput=Import[trainFilesInput];&#xD;
    	imgResult=Import[trainFilesResult];&#xD;
    &#xD;
    	splicesInput=Join@@ImagePartition[imgInput,500];&#xD;
    	splicesResults=Round[ImageData/@(Join@@ImagePartition[imgResult,500])];&#xD;
    &#xD;
    	mxTrain=Thread[splicesInput-&amp;gt; splicesResults];&#xD;
    &#xD;
    	Export[&amp;#034;MXFiles/File&amp;#034;&amp;lt;&amp;gt;Flag&amp;lt;&amp;gt;&amp;#034;.mx&amp;#034;,mxTrain]&#xD;
    ]&#xD;
&#xD;
Test the function&#xD;
&#xD;
    mxFileCreator[trainFilesInput[[1]], trainFilesResult[[1]], 1]&#xD;
    &amp;#034;MXFiles/File1.mx&amp;#034;&#xD;
&#xD;
    file = Import[&amp;#034;MXFiles/File1.mx&amp;#034;];&#xD;
    file[[RandomInteger[{1, 100}]]]&#xD;
&#xD;
    ImageCompose[Keys[file[[rand]]], {Image[Values[file[[rand]]]], 0.5}]&#xD;
&#xD;
![mxFileCreator test][8]&#xD;
&#xD;
To Map all the images and convert them into association in a MX files : &#xD;
&#xD;
    MapIndexed[mxFileCreator[#[[1]], #[[2]], Echo[#2[[1]]]] &amp;amp;, &#xD;
     Transpose[{trainFilesInput, trainFilesResult}]]&#xD;
&#xD;
The net&#xD;
=======&#xD;
&#xD;
The net selected for this project was at Wolfram Neural Net Repository for Semantic Segmentation. Released in 2016 by the University of Adelaide, Ademxapp Model A1 Trained on PASCAL VOC2012 and MS-COCO Data was modify to identify two classes instead of 21.&#xD;
&#xD;
Take the net model for Semantic Segmentation from the repositories:&#xD;
&#xD;
    netModel = &#xD;
     NetModel[&amp;#034;Ademxapp Model A1 Trained on PASCAL VOC2012 and MS-COCO \&#xD;
    Data&amp;#034;]&#xD;
&#xD;
![Net model for Semantic Segmentation from the repositories:][9]&#xD;
&#xD;
Net surgery&#xD;
-----------&#xD;
&#xD;
**Modify the Input for the size of the images**&#xD;
&#xD;
    netModel500 = NetReplacePart[netModel, &amp;#034;Input&amp;#034; -&amp;gt; NetEncoder[{&amp;#034;Image&amp;#034;, {500, 500}, &amp;#034;MeanImage&amp;#034; -&amp;gt; {0.485, 0.456, 0.406}}] ]&#xD;
&#xD;
![Replace the encoder to accept images 500x500][10]&#xD;
&#xD;
**Resize the layer**&#xD;
&#xD;
Drop the last three layer to modify the net:&#xD;
&#xD;
    firstPartNet = NetDrop[netModel500, -3]&#xD;
&#xD;
**Convolution layer**&#xD;
&#xD;
Add a convolution layer to have two outputs:&#xD;
&#xD;
    convLayer=NetChain[{firstPartNet, ConvolutionLayer[2, {3, 3}, &amp;#034;Stride&amp;#034; -&amp;gt; {1, 1}, &amp;#034;PaddingSize&amp;#034; -&amp;gt; {12, 12}, &amp;#034;Dilation&amp;#034; -&amp;gt; {12, 12}], ResizeLayer[{500, 500}]}];&#xD;
&#xD;
Take the last two layers from the one with the new encoder:&#xD;
&#xD;
    lastPartNet = NetReplacePart[NetTake[netModel500, -2], &amp;#034;Input&amp;#034; -&amp;gt; Automatic]&#xD;
&#xD;
**SoftmaxLayer**&#xD;
&#xD;
Append the last layers and Softmax Layer with a net decoder of classes:&#xD;
&#xD;
    finalNet = NetAppend[convLayer, {lastPartNet[[1]], SoftmaxLayer[]}, &amp;#034;Output&amp;#034; -&amp;gt; NetDecoder[{&amp;#034;Class&amp;#034;, {0, 1}, &amp;#034;InputDepth&amp;#034; -&amp;gt; 3}]]&#xD;
&#xD;
**Initialize the net**&#xD;
&#xD;
Initialize the final net to check for errors:&#xD;
&#xD;
    iniFinalNet = NetInitialize[finalNet]&#xD;
&#xD;
![Final net][11]&#xD;
&#xD;
Net to train&#xD;
------------&#xD;
&#xD;
**Loss Function**&#xD;
&#xD;
Connect the final net to a loss function:&#xD;
&#xD;
    LossNet = NetGraph[&amp;lt;|&amp;#034;eval&amp;#034; -&amp;gt; finalNet, &amp;#034;loss&amp;#034; -&amp;gt; CrossEntropyLossLayer[&amp;#034;Index&amp;#034;]|&amp;gt;, {&amp;#034;eval&amp;#034; -&amp;gt; &amp;#034;loss&amp;#034;} ]&#xD;
&#xD;
Initialize the LossNet:&#xD;
&#xD;
    iniLossNet = NetInitialize[LossNet]&#xD;
&#xD;
Export the complete net for training:&#xD;
&#xD;
    Export[&amp;#034;iniLossNet.wlnet&amp;#034;, iniLossNet]&#xD;
&#xD;
Generator function&#xD;
==================&#xD;
&#xD;
Reduce Dataset Size&#xD;
-------------------&#xD;
&#xD;
From the MX files created in section. Set the file path for the MX files:&#xD;
&#xD;
    path = &amp;#034;MXFiles/&amp;#034;;&#xD;
    mxFiles = FileNames[path &amp;lt;&amp;gt; &amp;#034;*.mx&amp;#034;];&#xD;
    RandomSample[mxFiles, 1][[1]]&#xD;
&#xD;
**Binary Files**&#xD;
&#xD;
Binary files are a way to reduce of the size while importing the train set. Once the files are binarize the file size reduces and ones read in can be deserialize. At the same time TIF images were converted to JPG to remove unnecessary information while reducing size. &#xD;
&#xD;
Binary write:&#xD;
&#xD;
    binaryWrite[file_,expr_]:=With[{bytes=BinaryWrite[file,BinarySerialize[expr]]},&#xD;
        Close[file]; bytes]&#xD;
&#xD;
Function to convert TIF images to JPG and matrix to Binary:&#xD;
&#xD;
    importAndReExport[path_,folder_]:=Block[{imported,imgs,masks,hashes},&#xD;
    	imported=Import[path];&#xD;
    	imgs=imported[[All,1]];&#xD;
    	masks=imported[[All,2]];&#xD;
    	hashes=Hash/@imgs;&#xD;
    	&#xD;
    	Print[MapThread[Export[folder&amp;lt;&amp;gt;&amp;#034;/&amp;#034;&amp;lt;&amp;gt;ToString[#1]&amp;lt;&amp;gt;&amp;#034;.jpg&amp;#034;,#2]&amp;amp;,{hashes,imgs}];//AbsoluteTiming];&#xD;
    	Print[MapThread[binaryWrite[folder&amp;lt;&amp;gt;&amp;#034;/&amp;#034;&amp;lt;&amp;gt;ToString[#1]&amp;lt;&amp;gt;&amp;#034;.bin&amp;#034;,#2]&amp;amp;,{hashes,masks}];//AbsoluteTiming];&#xD;
    	&#xD;
    	Clear[imported,imgs,masks,hashes]&#xD;
    ]&#xD;
&#xD;
Take each MX file and create the correspondent JPG and BIN file :&#xD;
&#xD;
    Table[importAndReExport[mxFiles[[i]], &amp;#034;binFiles&amp;#034;], {i, 1, Length[mxFiles], 1}]&#xD;
&#xD;
**Binary Read**&#xD;
&#xD;
Read the binary file and Deserialize the file:&#xD;
&#xD;
    BinaryDeserialize[ReadByteArray[&amp;#034;/Users/enricocastro/Documents/GitHub/Project/binFiles/\74004748475675200.bin&amp;#034;]] // Dimensions&#xD;
&#xD;
Training Out of Core&#xD;
====================&#xD;
&#xD;
Partitional Function&#xD;
--------------------&#xD;
&#xD;
**Data from MX files**&#xD;
&#xD;
Take the name of the JPG and BIN files:&#xD;
&#xD;
    trainingDataSet = {FileNames[&amp;#034;binFiles/*.jpg&amp;#034;], FileNames[&amp;#034;binFiles/*.bin&amp;#034;]};&#xD;
&#xD;
Set the data to train:&#xD;
&#xD;
    imageDataSet = Table[File[trainingDataSet[[1, i]]], {i, 10}];&#xD;
    maskDataSet = Table[ReadByteArray[trainingDataSet[[2, i]]], {i, 10}];&#xD;
&#xD;
Associate the image with his respective mask and take a random sample:&#xD;
&#xD;
    data = RandomSample@Thread[imageDataSet -&amp;gt; maskDataSet];&#xD;
    data[[2]]&#xD;
&#xD;
Generator&#xD;
---------&#xD;
&#xD;
In order to train the net with a big amount of data a generator function was created. The generator function load a single batch of data from an external source to train each time. NetTrain[net, f, \[Ellipsis]] calls f at each training batch iteration, thus only keeping a single batch of training data in memory. The function can depend on the batch size, which can be set or set automatic by the computer, the absolute batch that is the number of batches load during the training and the round.&#xD;
&#xD;
partGenerator associate and load a batch of size BatchSize into the net training. In order to do so it takes partitions of the whole dataset in batches of size BatchSize and load the element of this partition taking the module of the AbsoluteBatch. The function also adds one to the mask matrix to get the right values for the net:&#xD;
&#xD;
    partGenerator=Function[Block[{batch,dataSet,batchData},&#xD;
    	If[!ValueQ[partitionedData],partitionedData=Partition[Range[Length[data]],#BatchSize,#BatchSize,1]];&#xD;
    	Print[Association@Thread[Keys[#]-&amp;gt;Values[#]]];&#xD;
    	batch=Mod[#AbsoluteBatch,Floor[Length@data/#BatchSize]];&#xD;
    	batchData=data[[partitionedData[[Echo@(batch+1)]]]];&#xD;
    	&#xD;
    	Thread[Keys[batchData]-&amp;gt;1+BinaryDeserialize/@Values[batchData]]&#xD;
    	(*&amp;lt;|&amp;#034;Input&amp;#034;\[Rule]Keys[batchData],&amp;#034;Target&amp;#034;\[Rule]BinaryDeserialize/@Values[batchData]|&amp;gt;*)&#xD;
    	]&#xD;
    ];&#xD;
&#xD;
**Test of partGenerator**&#xD;
&#xD;
    partGeneratorData = &#xD;
     partGenerator[&amp;lt;|&amp;#034;BatchSize&amp;#034; -&amp;gt; 2, &amp;#034;Round&amp;#034; -&amp;gt; 0, &#xD;
       &amp;#034;AbsoluteBatch&amp;#034; -&amp;gt; 1|&amp;gt;]&#xD;
&#xD;
![&amp;lt;|BatchSize-&amp;gt;2,Round-&amp;gt;0,AbsoluteBatch-&amp;gt;1|&amp;gt;][12]&#xD;
&#xD;
Train test&#xD;
----------&#xD;
&#xD;
Before training for a lot of data is always good to try first with a small set. Clear partitionedData for different batch sizes:&#xD;
&#xD;
    ClearAll[partitionedData];&#xD;
&#xD;
    iniLossNet = Import[&amp;#034;iniLossNet.wlnet&amp;#034;]&#xD;
&#xD;
Set the checkpoint directory:&#xD;
&#xD;
    checkpointDir = &amp;#034;checkpoint&amp;#034;&#xD;
&#xD;
Net training with partGenerator:&#xD;
&#xD;
    iniLossTrainNet = NetTrain[iniLossNet, {partGenerator, &amp;#034;RoundLength&amp;#034; -&amp;gt; 3}, All, MaxTrainingRounds -&amp;gt; 3, TrainingProgressCheckpointing -&amp;gt; {&amp;#034;Directory&amp;#034;, checkpointDir}]&#xD;
&#xD;
Trained Net&#xD;
===========&#xD;
&#xD;
Once trained one can look at the relevant information of the training process. Import the trained net as an object:&#xD;
&#xD;
**Encoder &amp;amp; Decoder**&#xD;
&#xD;
Set the encoders and decoders for further tests. Set the encoder for image size 500x500 and a MeanImage:&#xD;
&#xD;
    enc = NetEncoder[{&amp;#034;Image&amp;#034;, {500, 500}, &amp;#034;MeanImage&amp;#034; -&amp;gt; {0.485, 0.456, 0.406}}];&#xD;
&#xD;
Set the decoder for the classe which 0 means no rooftop and 1 means rooftop:&#xD;
&#xD;
    dec = NetDecoder[{&amp;#034;Class&amp;#034;, {0, 1}, &amp;#034;InputDepth&amp;#034; -&amp;gt; 3}];&#xD;
&#xD;
**Training information**&#xD;
&#xD;
![finalTrainedNet[&amp;#034;LossEvolutionPlot&amp;#034;]][13]&#xD;
&#xD;
![finalTrainedNet[&amp;#034;ErrorRateEvolutionPlot&amp;#034;]][14]&#xD;
&#xD;
![Properties][15]&#xD;
&#xD;
Extract the trained net:&#xD;
&#xD;
    finalTrainedNetEval = &#xD;
     NetExtract[finalTrainedNet[&amp;#034;TrainedNet&amp;#034;], &amp;#034;eval&amp;#034;]&#xD;
&#xD;
Set the encoder:&#xD;
&#xD;
    finalTrainedNetEvalEnc = &#xD;
     NetReplacePart[finalTrainedNetEval, &amp;#034;Input&amp;#034; -&amp;gt; enc ]&#xD;
&#xD;
Set the decoder:&#xD;
&#xD;
    finalTrainedNetEvalDec = &#xD;
     NetReplacePart[finalTrainedNetEvalEnc, &amp;#034;Output&amp;#034; -&amp;gt; dec ]&#xD;
&#xD;
Export the net to test:&#xD;
&#xD;
    Export[&amp;#034;FinalTrainedNetEval.mx&amp;#034;, finalTrainedNetEvalDec]&#xD;
&#xD;
Net Evaluation&#xD;
==============&#xD;
&#xD;
    netEvaluation = &#xD;
     Import[&amp;#034;/Volumes/ECG/ProjectWSS/AerialImageDataset/\&#xD;
    FinalTrainedNetEval.mx&amp;#034;]&#xD;
&#xD;
Test Files&#xD;
----------&#xD;
&#xD;
Take a random file from the training set:&#xD;
&#xD;
    randomFile = RandomSample[FileNames[&amp;#034;image/*.tif&amp;#034;], 1];&#xD;
    TestImage = Import[randomFile[[1]]];&#xD;
    TestMask = &#xD;
      Import[StringReplace[randomFile[[1]], &amp;#034;image/&amp;#034; -&amp;gt; &amp;#034;mask/&amp;#034;]];&#xD;
&#xD;
Take 100 partition of the image to feed into the net:&#xD;
&#xD;
    imageToTest = ImagePartition[TestImage, {500, 500}];&#xD;
    maskToTest = ImagePartition[TestMask, {500, 500}];&#xD;
    rand1 = RandomInteger[{1, 10}];&#xD;
    rand2 = RandomInteger[{1, 10}];&#xD;
&#xD;
    ImageCompose[&#xD;
     imageToTest[[rand1, &#xD;
      rand2]], {Image[netEvaluation[imageToTest[[rand1, rand2]]]], 0.5}]&#xD;
&#xD;
![Image test][16]&#xD;
&#xD;
    ImageCompose[&#xD;
     maskToTest[[rand1, &#xD;
      rand2]], {Image[netEvaluation[imageToTest[[rand1, rand2]]]], 0.5}]&#xD;
&#xD;
![Mask comparision][17]&#xD;
&#xD;
Compare the percentage of building in the area with the net and the mask:&#xD;
&#xD;
    {{&amp;#034;Net&amp;#034;, &amp;#034;Mask&amp;#034;}, {ImageMeasurements[&#xD;
        Image[netEvaluation[imageToTest[[rand1, rand2]]]], &amp;#034;Mean&amp;#034;], &#xD;
       ImageMeasurements[maskToTest[[rand1, rand2]], &amp;#034;Mean&amp;#034;]}} // Dataset&#xD;
&#xD;
![Percentage comparision][18]&#xD;
&#xD;
GeoImage&#xD;
--------&#xD;
&#xD;
    testImage[latitud_, longitud_, net_] := &#xD;
     Module[{geoImage, geoImageResize},&#xD;
      geoImage = &#xD;
       GeoImage[GeoPosition[{latitud, longitud}], &#xD;
        GeoRange -&amp;gt; Quantity[75, &amp;#034;Meters&amp;#034;], GeoProjection -&amp;gt; &amp;#034;Mercator&amp;#034;, &#xD;
        ImageSize -&amp;gt; Small];&#xD;
      geoImageResize = ImageResize[geoImage, {500, 500}];&#xD;
      {ImageCompose[geoImageResize, {Image[net[geoImageResize]], 0.3}]&#xD;
       , Image[net[geoImageResize]]}]&#xD;
&#xD;
**IER-UNAM**&#xD;
&#xD;
    IER = testImage[18.839940, -99.235635, netEvaluation]&#xD;
&#xD;
![IER-UNAM, Temixco, Morelos][19]&#xD;
&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ImageCollage.jpeg&amp;amp;userId=1363133&#xD;
  [2]: https://project.inria.fr/aerialimagelabeling/&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=A1.jpeg&amp;amp;userId=1363133&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=A2.jpeg&amp;amp;userId=1363133&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=C1.jpeg&amp;amp;userId=1363133&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=C2.jpeg&amp;amp;userId=1363133&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Association.jpeg&amp;amp;userId=1363133&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=mxFileTest.jpeg&amp;amp;userId=1363133&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=netModel.jpeg&amp;amp;userId=1363133&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=netModel500.jpeg&amp;amp;userId=1363133&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=finalNet.jpeg&amp;amp;userId=1363133&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=partGenerator.jpeg&amp;amp;userId=1363133&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=FinalLoss.jpeg&amp;amp;userId=1363133&#xD;
  [14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ErrorRate.jpeg&amp;amp;userId=1363133&#xD;
  [15]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Properties.jpeg&amp;amp;userId=1363133&#xD;
  [16]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Test1.jpeg&amp;amp;userId=1363133&#xD;
  [17]: http://community.wolfram.com//c/portal/getImageAttachment?filename=MaskTest.jpeg&amp;amp;userId=1363133&#xD;
  [18]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Percentage.jpeg&amp;amp;userId=1363133&#xD;
  [19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=IER.jpeg&amp;amp;userId=1363133</description>
    <dc:creator>Enrico Castro</dc:creator>
    <dc:date>2018-07-11T19:56:30Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1379392">
    <title>[WWS18] Water Basin Delineation</title>
    <link>https://community.wolfram.com/groups/-/m/t/1379392</link>
    <description>#Summary&#xD;
Detailed digital information about water is of great important not only for urban design and development, but also for [geopolitical strategic plans][1]. A large portion of world population is now living in [water stress regions][2]. There are alarming patterns between the water crisis and political/civil unrest in parts of the world (e.g., Yemen, [Syria][3], even [Iran][4]). Therefore, having digital model of water sources is essential. My main goal here is to extract the hydrographic basin (also called, the drainage basin) out of digital elevation models (DEM).  Detailed watershed segmentation of a geographical region is obtained using built-in morphological functions of Wolfram language that I applied on the DEM of the region. The watershed lines dividing neighboring basins, together with their elevation values, are extracted. We treated the centroid of sub-basins as vertexes of a graph where connections between neighboring vertexes depend on the land surface characteristics and boundary lines. We assumed that a valid connection between two vertexes (say, two sub-basins) can be made only if the two vertexes have minimum elevation at the boundary compared to all neighboring vertexes. Our results show a great match with the the watershed segmentation obtained manually by appropriate choice of markers (say, using a seasoned geographer knowledge).&#xD;
&#xD;
# DEM of Lake Urmia (Orumiyeh, Persian: ??????)&#xD;
The region that I choose for my analysis is [lake Urmia][5] on the north west of Iran. It is a UNESCO biosphere reserve which is now dangerously shrinking due to [water mismanagement and also drought][6]. We set the region a box between two points with altitudes and longitudes {35.5,44} and {39,48}. We extract the DEM using GeoElevationData function.&#xD;
&#xD;
    region = {{35.5, 44}, {39, 48}};&#xD;
    data = N[QuantityMagnitude@&#xD;
        GeoElevationData[region, UnitSystem -&amp;gt; &amp;#034;Metric&amp;#034;]];&#xD;
    reliefmap = &#xD;
     ReliefPlot[data, DataReversed -&amp;gt; True, &#xD;
      PlotLegends -&amp;gt; BarLegend[Automatic, LegendLabel -&amp;gt; &amp;#034;elevation(m)&amp;#034;]]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
# Watershed segmentation&#xD;
We covert the DEM data into an image. &#xD;
&#xD;
    mimg = ImageAdjust[Image[data]];&#xD;
&#xD;
From now on, we shall treat our DEM as an image with colors corresponds to elevations. We find watershed segmentation (i.e., a detailed sub-basin structure) using Immersion method, mainly because the labeling of segments correspond to the relative value for a sub-basin&amp;#039;s minimum elevation. &#xD;
&#xD;
    wsc = WatershedComponents[mimg, Method -&amp;gt; &amp;#034;Immersion&amp;#034;];&#xD;
    bnds = ColorNegate@Image[wsc, &amp;#034;Bit&amp;#034;];&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
Next, we label the boundary between two adjacent sub-basins by the indexes of corresponding sub-basins. To do so, we use black-and-white image of watersheds where the boundaries (say, lines) have value one (white lines). Then, we assign two indexes to the line separating two sub-basins. These indexes are the indexes of adjacent sub-basins separated by the line. We shall do index assignment of lines in two steps: &#xD;
&#xD;
 1. Shift the sub-basin with higher index into the lines (using Erosion). &#xD;
&#xD;
        bindex = Erosion[Replace[wsc, 0 -&amp;gt; Max[wsc] + 1, {2}], 1];&#xD;
&#xD;
 2. Shift the sub-basin with lower index into the lines (using Dilation)&#xD;
&#xD;
        tindex = Dilation[wsc, 1];&#xD;
&#xD;
The first step has one subtlety: to shift the higher index into the lines, first we need to set the boundary value higher than any value in the image; otherwise the Erosion function will extend the boundaries only.&#xD;
&#xD;
    doubleIndexArray = &#xD;
      Replace[Transpose[{bindex, tindex}, {3, 1, 2}], {n_, n_} -&amp;gt; {0, &#xD;
         0}, {2}];&#xD;
    doubleIndexPairs = &#xD;
     Prepend[DeleteCases[&#xD;
       DeleteDuplicates[Flatten[doubleIndexArray, 1]], {0, 0}], {0, 0}]&#xD;
&#xD;
After labeling the boundaries by two indexes, we find the minimum elevation along the boundaries separating two sub-basins. Now we have the information of adjacent sub-basins and the minimum elevation along the boundaries.&#xD;
&#xD;
    bndSegs = &#xD;
      Replace[doubleIndexArray, &#xD;
       Dispatch@MapIndexed[#1 -&amp;gt; First[#2] - 1 &amp;amp;, doubleIndexPairs], {2}];&#xD;
    MinATborders = &#xD;
     Thread[Rest[doubleIndexPairs] -&amp;gt; &#xD;
       ComponentMeasurements[{mimg, bndSegs}, &amp;#034;Min&amp;#034;][[All, 2]]]&#xD;
&#xD;
# Graph made out of centroids of sub-basins  &#xD;
From now on, we shall treat a sub-basin as a vertex. For the sake of representation, the location of the vertex is set as the centroids of sub-basins. The most important question is how the vertexes are connected together and what are the corresponding clusters made out of connected vertexes.  In other word, the clusters represent larger basins that form a unique hydro-graphical ecosystem with a unique water graph. &#xD;
&#xD;
    g0=Graph[Apply[UndirectedEdge,Rest@doubleIndexPairs,{1}]];&#xD;
    g1=WeaklyConnectedGraphComponents[g0][[1]];&#xD;
    basinConnect=Sort[Map[# -&amp;gt; AdjacencyList[g1,#]&amp;amp;,VertexList[g1]]]&#xD;
    sortBasin[x_]:=Keys[x]-&amp;gt;SortBy[Values[x],Association[MinATborders][Sort[{#,Keys[x]}]]&amp;amp;];&#xD;
    sortedBasins=sortBasin[#]&amp;amp;/@basinConnect&#xD;
    &#xD;
&#xD;
##Algorithm to make connections between sub-basins (how/where to connect vertexes and form edges)&#xD;
&#xD;
 1. Built a set for each sub-basin whose elements are the adjacent sub-basins. &#xD;
 2. Sort them by the minimum value of the boundary separating them.&#xD;
 3. Make a connection between two adjacent sub-basin by choosing the first element of the sorted list in step#2&#xD;
 4. Check for possible cycles in the graph (i.e., loops). If any, replace the original connection by the making the connection with the second element in the list of sorted sub-basins obtained in step#2.&#xD;
 5. Repeat step#5 until there is no more change in the graph&#xD;
Here is the graph that we obtain following above steps:&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
 # Comparison of our result with a basin structure obtained by pre-determined markers &#xD;
Let us assume that we are a seasoned geographer with a good knowledge of large basins (e.g., where the rivers are running and what branches of a river are independent and where they merge) and how they are connected on a map. Then, one shall obtain the following basins for our selected region:&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
Now, let us overlay our graph on the top of map and compare different results&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
# Concluding remarks&#xD;
Detailed watershed segmentation of a geographical region is obtained using built-in morphological functions of Wolfram language that we applied on the raw Digital Elevation Model (DEM) of the region. The watershed lines dividing neighboring basins, together with their elevation values, are extracted from DEM. We treated the centroid of sub-basins as vertexes of a graph where connections between neighboring vertexes depend on the land surface characteristics and boundary lines. We assumed that a valid connection between two vertexes (say, two sub-basins) can be made only if the two vertexes have minimum elevation at the boundary compared to all neighboring vertexes. Our results show a great match with the the watershed segmentation obtained manually by appropriate choice of markers (say, using a seasoned geographer knowledge).  &#xD;
&#xD;
#Future works&#xD;
With the detailed dynamic relationships of hydrographic basins in force, we will be able to develop models describing the water flow (or water level) among basins using the precipitation data. Next, the water usage for irrigation and urban uses can be added into the model. Using these information, one will be able to develop an elaborate model for water management of a large hydrographic basin. Our approach can be improved further by treating a few loops (cycles) that appear in the graph.  In this regard, one can remove the connection between two vertexes where the initial one has higher elevation and replace it with the second vertex in the list of neighboring basins sorted by the minimum boundary elevation. &#xD;
&#xD;
&#xD;
  [1]: https://geopoliticalfutures.com/water-geopolitical-imperatives/&#xD;
  [2]: https://www.theguardian.com/cities/2016/jul/29/where-world-most-water-stressed-cities-drought&#xD;
  [3]: http://www.pnas.org/content/112/11/3241&#xD;
  [4]: https://www.nytimes.com/2018/01/18/climate/water-iran.html&#xD;
  [5]: https://www.theguardian.com/world/gallery/2016/sep/02/iran-lake-urmia-in-pictures&#xD;
  [6]: https://link.springer.com/article/10.1007/s11269-011-9909-8&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=1665ReliefMap.png&amp;amp;userId=1351917&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=watershed.png&amp;amp;userId=1351917&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=graph.png&amp;amp;userId=1351917&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=geo-basin.png&amp;amp;userId=1351917&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=overlay.png&amp;amp;userId=1351917</description>
    <dc:creator>Mads Bahrami</dc:creator>
    <dc:date>2018-07-11T19:47:32Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1137218">
    <title>[WSS17] OCR for 8 major writing systems</title>
    <link>https://community.wolfram.com/groups/-/m/t/1137218</link>
    <description>The goal of OCR (Optical Character Recognition) is to recognize characters in images. Here is how I used convolutional neural network to create an OCR working on images of single characters that supports 8 major writing systems: Arabic, Chinese, Cyrillic, Devanagari, Greek, Japanese, Korean, and Latin.&#xD;
&#xD;
## Neural Network ##&#xD;
&#xD;
I developed my neural network based on LeNet by adding batch normalization layers, dropout layers, and more convolutional layers. Here is the architecture of my network:&#xD;
&#xD;
    OUCR = NetChain[{&#xD;
      ConvolutionLayer[32, {5, 5}, &amp;#034;PaddingSize&amp;#034; -&amp;gt; {2, 2}, &amp;#034;Stride&amp;#034; -&amp;gt; 2],&#xD;
      BatchNormalizationLayer[&amp;#034;Input&amp;#034; -&amp;gt; {32, 32, 32}],&#xD;
      ElementwiseLayer[Ramp],&#xD;
      PoolingLayer[{2, 2}, {2, 2}],&#xD;
      ConvolutionLayer[64, {3, 3}, &amp;#034;PaddingSize&amp;#034; -&amp;gt; {1, 1}],&#xD;
      BatchNormalizationLayer[&amp;#034;Input&amp;#034; -&amp;gt; {64, 16, 16}],&#xD;
      ElementwiseLayer[Ramp],&#xD;
      PoolingLayer[{2, 2}, {2, 2}],&#xD;
      ConvolutionLayer[128, {3, 3}, &amp;#034;PaddingSize&amp;#034; -&amp;gt; {1, 1}],&#xD;
      BatchNormalizationLayer[&amp;#034;Input&amp;#034; -&amp;gt; {128, 8, 8}],&#xD;
      ElementwiseLayer[Ramp],&#xD;
      PoolingLayer[{2, 2}, {2, 2}],&#xD;
      ConvolutionLayer[256, {3, 3}, &amp;#034;PaddingSize&amp;#034; -&amp;gt; {1, 1}],&#xD;
      BatchNormalizationLayer[&amp;#034;Input&amp;#034; -&amp;gt; {256, 4, 4}],&#xD;
      ElementwiseLayer[Ramp],&#xD;
      PoolingLayer[{2, 2}, {2, 2}],&#xD;
      FlattenLayer[],&#xD;
      DropoutLayer[0.5],&#xD;
      LinearLayer[],&#xD;
      SoftmaxLayer[]&#xD;
      },&#xD;
     &amp;#034;Output&amp;#034; -&amp;gt; NetDecoder[{&amp;#034;Class&amp;#034;, unicode}],&#xD;
     &amp;#034;Input&amp;#034; -&amp;gt; &#xD;
      NetEncoder[{&amp;#034;Image&amp;#034;, {64, 64}, &amp;#034;Grayscale&amp;#034;, &amp;#034;MeanImage&amp;#034; -&amp;gt; 0.85}]&#xD;
     ]&#xD;
&#xD;
The first convolutional layer has kernels of size 5 and stride 2 to reduce the influence of noise. The fully connected layers are very simple due to the large volume (over 32000) of classes.&#xD;
&#xD;
## Training Set ##&#xD;
&#xD;
To train my neural network, I generated over a million images of characters with different fonts and rotations using Mathematica. At first I used Rasterize[], which turned out to be so slow that it would take tens of hours to generate all the images. So I improved my algorithm by using Image[], Graphics[], and Text[] instead, which took only a few minutes. Here are the two functions I designed to generate images:&#xD;
&#xD;
    unrotated[list_, size_, scale_, font_, horizontal_, vertical_] := &#xD;
      Module[{len, col, row},&#xD;
        len = Length[list];&#xD;
        col = Floor[Sqrt[len]];&#xD;
        row = Ceiling[len / col];&#xD;
        Thread[(Join @@ &#xD;
          ImagePartition[&#xD;
            Image[&#xD;
              Graphics[&#xD;
                MapIndexed[&#xD;
                  Text[&#xD;
                    Style[#1, FontFamily -&amp;gt; font, FontSize -&amp;gt; Scaled[scale / col]],&#xD;
                    Reverse[#2]] &amp;amp;, &#xD;
                  Reverse[&#xD;
                    Partition[FromCharacterCode /@ list, UpTo[col]]&#xD;
                  ],{2}], &#xD;
                PlotRange -&amp;gt; {{horizontal, col + horizontal}, {vertical, row + vertical}},&#xD;
                ImageSize -&amp;gt; {size * col, size * row}], &#xD;
            ColorSpace -&amp;gt; &amp;#034;Grayscale&amp;#034;], size])[[;; len]]&#xD;
          -&amp;gt; &#xD;
          FromCharacterCode /@ list]]&#xD;
&#xD;
    rotated[list_, size_, scale_, font_, angle_, horizontal_, vertical_] := &#xD;
      Module[{len, col, row},&#xD;
        len = Length[list];&#xD;
        col = Floor[Sqrt[len]];&#xD;
        row = Ceiling[len / col];&#xD;
        Thread[(Join @@ &#xD;
          ImagePartition[&#xD;
            Image[&#xD;
              Graphics[&#xD;
                MapIndexed[&#xD;
                  Rotate[&#xD;
                    Text[&#xD;
                      Style[#1, FontFamily -&amp;gt; font, FontSize -&amp;gt; Scaled[scale / col]],&#xD;
                      Reverse@#2], &#xD;
                    RandomVariate[&#xD;
                      NormalDistribution[0, angle]] Degree] &amp;amp;, &#xD;
                  Reverse[&#xD;
                    Partition[FromCharacterCode /@ list, UpTo[col]]&#xD;
                  ], {2}], &#xD;
                PlotRange -&amp;gt; {{horizontal, col + horizontal}, {vertical, row + vertical}},&#xD;
                ImageSize -&amp;gt; {size * col, size * row}], &#xD;
            ColorSpace -&amp;gt; &amp;#034;Grayscale&amp;#034;], size])[[;; len]]&#xD;
          -&amp;gt; &#xD;
          FromCharacterCode /@ list]]&#xD;
&#xD;
These functions take a list of Unicodes and generate images of unrotated and rotated characters of the corresponding Unicodes. There are several tunable parameters. &amp;#034;size&amp;#034; controls the size of the images (size * size), where I used 64 for my training set. &amp;#034;scale&amp;#034; controls the scale of characters in images, where I found 0.7~0.8 suitable for most writing systems and fonts. For &amp;#034;font&amp;#034;, I chose several fonts for each language to make the characters as diverse as possible. &amp;#034;horizontal&amp;#034; and &amp;#034;vertical&amp;#034; are compensations, where 0.5 works for most cases. rotated[] also takes &amp;#034;angle&amp;#034; and generates rotated images whose rotational angles follow a normal distribution with standard deviation of &amp;#034;angle&amp;#034; degrees, where I used 4 degrees in most cases.&#xD;
&#xD;
For each font of each writing system, I generated 1 unrotated and 3 rotated images for the training set and 1 rotated image for the validation set. There was no obvious overfitting or underfitting during the training process, and after 70 rounds of training, the validation loss was down to 5*10^-3.&#xD;
&#xD;
## Tests ##&#xD;
&#xD;
Here is the bar chart of accuracies recognizing characters of each writing system, tested on random samples with random fonts and random rotations:&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
The accuracies recognizing Cyrillic, Greek, and Latin characters are rather low because some of their characters are very similar. The accuracy recognizing Latin characters is especially low because I tested on a random sample of all fonts, and Latin characters can look very different in different fonts, while many fonts don&amp;#039;t support other writing systems.&#xD;
&#xD;
Here is the bar chart of accuracies recognizing a random sample of 200 Chinese characters, tested on characters generated by the computer (different fonts), handwritten by Yan, Zhenqing (709-785, one of the best calligraphers in Chinese history, images from http://www.shufazidian.com/), and handwritten by myself (written on paper, scanned, and processed using Mathematica):&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
Two short examples of how it works (first handwritten by Yan, second handwritten by myself):&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
I also tested my network on many variations of the images, including blurring, adding noise, distortion, zooming in and out, horizontal and vertical movement, and rotation:&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
## Acknowledgements ##&#xD;
&#xD;
I would like to thank my mentor Vladimir Grankovsky for helping me along the whole project and Matteo Salvarezza and Timothée Verdier for helping me set up AWS GPU computing services.&#xD;
&#xD;
## References ##&#xD;
&#xD;
 1. Image source for Yan&amp;#039;s handwritten Chinese characters: http://www.shufazidian.com/&#xD;
 2. My GitHub repository: https://github.com/MatthewChen7211/WSS2017&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=6830WS.png&amp;amp;userId=1123149&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=1449HW.png&amp;amp;userId=1123149&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at5.21.25PM.png&amp;amp;userId=1123149&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Blur.png&amp;amp;userId=1123149&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Noise.png&amp;amp;userId=1123149&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Distortion.png&amp;amp;userId=1123149&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Zoom.png&amp;amp;userId=1123149&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Horizontal.png&amp;amp;userId=1123149&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Vertical.png&amp;amp;userId=1123149&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Rotate.png&amp;amp;userId=1123149</description>
    <dc:creator>Matthew Chen</dc:creator>
    <dc:date>2017-07-05T21:51:05Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3217332">
    <title>[WSRP24] Impact of parameter perturbation on the neural network performance</title>
    <link>https://community.wolfram.com/groups/-/m/t/3217332</link>
    <description>![Test Accuracy][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=CoverImage.png&amp;amp;userId=3216554&#xD;
  [2]: https://www.wolframcloud.com/obj/7e50ca1b-23b7-43e9-a8dc-0b01f627756e</description>
    <dc:creator>Junseo Lee</dc:creator>
    <dc:date>2024-07-11T22:58:30Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1784061">
    <title>Find bright areas on surface maps of moons by points</title>
    <link>https://community.wolfram.com/groups/-/m/t/1784061</link>
    <description># Testing the concept:&#xD;
&#xD;
To test and calibrate the method, I used an example (*not from a moon*): Olympus Mons on Mars, and highlighted areas of the image that stand out as bright white areas, enhanced by code and subsequently inverting the color:&#xD;
&#xD;
    olympus = &#xD;
     GeoGraphics[Entity[&amp;#034;SolarSystemFeature&amp;#034;, &amp;#034;OlympusMonsMars&amp;#034;], &#xD;
      GeoRange -&amp;gt; Quantity[200, &amp;#034;Miles&amp;#034;]]&#xD;
&#xD;
![pic1][1]&#xD;
&#xD;
    ColorNegate[&#xD;
     ChanVeseBinarize[&#xD;
      ColorConvert[ImageAdjust[olympus, {0, 0.8, 0.8}, {0.5, 1}, {0, 1}], &#xD;
       &amp;#034;Grayscale&amp;#034;], Gray]]&#xD;
&#xD;
![pic2][2]&#xD;
&#xD;
After dividing the image (above) into many small regions (5810 smaller images), I characterize each piece with its values (ImageData) using the following line:&#xD;
&#xD;
    cd = Parallelize[&#xD;
       Table[Table[&#xD;
         N[Mean@Flatten@ImageData[((Take[pat, {vv}][[1]])[[uu]])]], {uu, &#xD;
          1, 83}], {vv, 1, 70}]];&#xD;
&#xD;
Then I made *Mathematica* choose regions with average data values with a specific degree of pixels to generate red dots that will be used to mark the regions (it was noted that the method has limitations caused mainly by the size of the smaller regions, requiring a lot of memory and processing, but positively had a relative accuracy):&#xD;
&#xD;
    ur = ImageAssemble[&#xD;
      Parallelize[&#xD;
       Table[Table[&#xD;
         If[((cd[[v]])[[u]]) &amp;lt; 0.85, &#xD;
          ImageCompose[((pat[[v]])[[&#xD;
             u]]), {Graphics[{PointSize[Large], Red, Point[{0, 0}]}]}], &#xD;
          ImageCompose[((pat[[v]])[[&#xD;
             u]]), {Graphics[{PointSize[Tiny], Opacity[0], &#xD;
              Point[{0, 0}]}]}]], {u, 1, 83}], {v, 1, 70}]]]&#xD;
&#xD;
![pic3][3]&#xD;
&#xD;
    ColorReplace[ur, Black]&#xD;
&#xD;
![pic4][4]&#xD;
&#xD;
Now testing with the original Olympus Mons image (with 5810 divisions and marking bright areas for: brightness &amp;gt; 0.67), the code for partition the image and selecting data values to mark light areas:&#xD;
&#xD;
![pic5][5]&#xD;
&#xD;
    cd3 = Parallelize[&#xD;
       Table[Table[&#xD;
         N[Mean@Flatten@ImageData[((Take[pat3, {vv}][[1]])[[uu]])]], {uu, &#xD;
          1, 83}], {vv, 1, 70}]];&#xD;
&#xD;
In the case of the actual image, the average pixel value must be above a specific value for selecting the required areas, the reverse of the concept test. Here is the test done with the raw image:&#xD;
&#xD;
    ur5 = ImageAssemble[&#xD;
      Parallelize[&#xD;
       Table[Table[&#xD;
         If[((cd3[[v]])[[u]]) &amp;gt; 0.67, &#xD;
          ImageCompose[((pat3[[v]])[[&#xD;
             u]]), {Graphics[{PointSize[Large], Red, Point[{0, 0}]}]}], &#xD;
          ImageCompose[((pat3[[v]])[[&#xD;
             u]]), {Graphics[{PointSize[Tiny], Opacity[0], &#xD;
              Point[{0, 0}]}]}]], {u, 1, 83}], {v, 1, 70}]]]&#xD;
&#xD;
![pic6][6]&#xD;
&#xD;
# Testing surface maps of moons:&#xD;
&#xD;
Now testing the surface map of some of the solar system&amp;#039;s moons, so we can see the previous code performance and later some variations of the same for better visualization. Below are the other examples of surface maps tested by the code, with the limit of values of the bright and the number of smaller computed areas of each image chosen for each example.&#xD;
&#xD;
These are the basic lines of code that will be used on the surfaces:&#xD;
&#xD;
(1)  Calculates the values of each piece of the image, same code to all examples (note: set the image on the code!):&#xD;
&#xD;
    x = ImagePartition[&amp;#034;image&amp;#034;, {Scaled[1/70]}];&#xD;
    y = Parallelize[&#xD;
       Table[Table[&#xD;
         N[Mean@Flatten@ImageData[((Take[x, {vv}][[1]])[[uu]])]], {uu, 1, &#xD;
          70}], {vv, 1, 70}]];&#xD;
&#xD;
(2) Generates the points and reassembles the full image. Has some variations as seen in the examples later in the post (note: choose the brightness limit value on the code!):&#xD;
&#xD;
    z = ImageAssemble[&#xD;
      Parallelize[&#xD;
       Table[Table[&#xD;
         If[((y[[v]])[[u]]) &amp;gt; &amp;#034;brightvalue&amp;#034;, &#xD;
          ImageCompose[((x[[v]])[[&#xD;
             u]]), {Graphics[{PointSize[Large], Red, Point[{0, 0}]}]}], &#xD;
          ImageCompose[((x[[v]])[[&#xD;
             u]]), {Graphics[{PointSize[Tiny], Opacity[0], &#xD;
              Point[{0, 0}]}]}]], {u, 1, 70}], {v, 1, 70}]]]&#xD;
&#xD;
Some examples:&#xD;
&#xD;
- **Jupiter´s Moon, Ganymede**:&#xD;
&#xD;
        GeoGraphics[GeoModel -&amp;gt; Entity[&amp;#034;PlanetaryMoon&amp;#034;, &amp;#034;Ganymede&amp;#034;], &#xD;
         GeoRange -&amp;gt; Quantity[1500, &amp;#034;Miles&amp;#034;]]&#xD;
&#xD;
![pic7][7]&#xD;
&#xD;
Using the codes gives the following result for Ganymede (marking for brightness &amp;gt; 0.54):&#xD;
&#xD;
![pic8][8]&#xD;
&#xD;
- **Jupiter´s Moon, Europa** (a bright moon):&#xD;
&#xD;
        GeoGraphics[GeoModel -&amp;gt; Entity[&amp;#034;PlanetaryMoon&amp;#034;, &amp;#034;Europa&amp;#034;], &#xD;
         GeoRange -&amp;gt; Quantity[1000, &amp;#034;Miles&amp;#034;]]&#xD;
&#xD;
![pic9][9]&#xD;
&#xD;
Using the codes gives the following result for Europa, which has a brighter surface (marking for brightness &amp;gt; 0.71):&#xD;
&#xD;
![pic10][10]&#xD;
&#xD;
- **Jupiter´s Moon, Callisto** (a dark moon):&#xD;
&#xD;
        GeoGraphics[GeoModel -&amp;gt; Entity[&amp;#034;PlanetaryMoon&amp;#034;, &amp;#034;Callisto&amp;#034;], &#xD;
         GeoRange -&amp;gt; Quantity[1500, &amp;#034;Miles&amp;#034;]]&#xD;
&#xD;
![pic11][11]&#xD;
&#xD;
Using the codes, we get the following result for Callisto, which has a relatively dark surface (marking for brightness &amp;gt; 0.27):&#xD;
&#xD;
![pic12][12]&#xD;
&#xD;
# Exploring the image with dynamics:&#xD;
&#xD;
- **Saturn´s Moon, Dione**:&#xD;
&#xD;
        GeoGraphics[GeoModel -&amp;gt; Entity[&amp;#034;PlanetaryMoon&amp;#034;, &amp;#034;Dione&amp;#034;], &#xD;
         GeoRange -&amp;gt; Quantity[400, &amp;#034;Miles&amp;#034;]]&#xD;
&#xD;
![pic13][13]&#xD;
&#xD;
Using the first (1) code and making the second (2) code dynamic (below), I got the following result for Dione, a surface with well-distributed bright spots (marking for brightness &amp;gt; 0.55):&#xD;
&#xD;
    {Evaluate[&#xD;
      urm = ImageAssemble[&#xD;
        Parallelize[&#xD;
         Table[Table[&#xD;
           If[((cdm[[v]])[[u]]) &amp;gt; 0.55, &#xD;
            ImageCompose[((patm[[v]])[[&#xD;
               u]]), {Graphics[{PointSize[Large], Red, Point[{0, 0}]}]}], &#xD;
            ImageCompose[((patm[[v]])[[&#xD;
               u]]), {Graphics[{PointSize[Tiny], Opacity[0], &#xD;
                Point[{0, 0}]}]}]], {u, 1, 70}], {v, 1, 70}]]]], &#xD;
     DynamicImage[urm]}&#xD;
&#xD;
![pic14][14]&#xD;
&#xD;
# Marking light and dark areas simultaneously:&#xD;
&#xD;
- **Earth´s Moon**:&#xD;
&#xD;
        GeoImage[GeoRange -&amp;gt; {{-25, -5}, {45, 65}}, GeoModel -&amp;gt; &amp;#034;Moon&amp;#034;]&#xD;
&#xD;
![pic15][15]&#xD;
&#xD;
Using the first (1) code and modifying the second (2) code as below, we can mark the darkest and lightest areas on the map simultaneously. Getting the following result for Earth&amp;#039;s Moon (marking for brightness: &amp;gt; 0.68 {Red}, &amp;lt; 0.61 {Orange}):&#xD;
&#xD;
    urm2 = ImageAssemble[&#xD;
      Parallelize[&#xD;
       Table[Table[&#xD;
         If[((cdm[[v]])[[u]]) &amp;gt; 0.68, &#xD;
          ImageCompose[((patm[[v]])[[&#xD;
             u]]), {Graphics[{PointSize[Large], Red, Point[{0, 0}]}]}], &#xD;
          If[((cdm[[v]])[[u]]) &amp;lt; 0.61, &#xD;
           ImageCompose[((patm[[v]])[[&#xD;
              u]]), {Graphics[{PointSize[Large], Orange, &#xD;
               Point[{0, 0}]}]}], &#xD;
           ImageCompose[((patm[[v]])[[&#xD;
              u]]), {Graphics[{PointSize[Tiny], Opacity[0], &#xD;
               Point[{0, 0}]}]}]]], {u, 1, 76}], {v, 1, 80}]]]&#xD;
&#xD;
![pic16][16]&#xD;
&#xD;
# Viewing different intensities simultaneously:&#xD;
&#xD;
- **Jupiter´s Moon, Io** (a colorful moon):&#xD;
&#xD;
        GeoGraphics[GeoModel -&amp;gt; Entity[&amp;#034;PlanetaryMoon&amp;#034;, &amp;#034;Io&amp;#034;], &#xD;
         GeoRange -&amp;gt; Quantity[1000, &amp;#034;Miles&amp;#034;]]&#xD;
&#xD;
![pic17][17]&#xD;
&#xD;
Modifying the second (2) code so that we have points with different intensities throughout the image and make them stand out with a convenient Hue function:&#xD;
&#xD;
    urm2 = ImageAssemble[&#xD;
      Parallelize[&#xD;
       Table[Table[&#xD;
         ImageCompose[((patm[[v]])[[&#xD;
            u]]), {Graphics[{PointSize[Large], &#xD;
             Hue[(150 - ((cdm[[v]])[[u]])*149)/50], Point[{0, 0}]}]}], {u,&#xD;
           1, 70}], {v, 1, 70}]]]&#xD;
&#xD;
![pic18][18]&#xD;
&#xD;
And finally, modifying again the second code (2), making the points show variations of bright with another Hue function, while dynamically exploring and labeling the intensities:&#xD;
&#xD;
    {Evaluate[&#xD;
      urm = ImageAssemble[&#xD;
        Parallelize[&#xD;
         Table[Table[&#xD;
           ImageCompose[((patm[[v]])[[&#xD;
              u]]), {Graphics[{PointSize[Large], Hue[((cdm[[v]])[[u]])^4],&#xD;
                Point[{0, 0}]}]}], {u, 1, 70}], {v, 1, 70}]]]], &#xD;
     DynamicImage[urm], &#xD;
     TableForm[&#xD;
      Table[{N[(h/30), 2], &#xD;
        Graphics[{PointSize[Large], Hue[(h/30)^4], Point[{0, 0}]}, &#xD;
         ImageSize -&amp;gt; 10]}, {h, 9, 29}], &#xD;
      TableHeadings -&amp;gt; {None, {&amp;#034;bright&amp;#034;, &amp;#034;point&amp;#034;}}]}&#xD;
&#xD;
![pic19][19]&#xD;
&#xD;
Thanks.&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic1.png&amp;amp;userId=1316061&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic2.png&amp;amp;userId=1316061&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic3.png&amp;amp;userId=1316061&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic4.png&amp;amp;userId=1316061&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic5.png&amp;amp;userId=1316061&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic6.png&amp;amp;userId=1316061&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic7.png&amp;amp;userId=1316061&#xD;
  [8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic8.png&amp;amp;userId=1316061&#xD;
  [9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic9.png&amp;amp;userId=1316061&#xD;
  [10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic10.png&amp;amp;userId=1316061&#xD;
  [11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic11.png&amp;amp;userId=1316061&#xD;
  [12]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic12.png&amp;amp;userId=1316061&#xD;
  [13]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic13.png&amp;amp;userId=1316061&#xD;
  [14]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic14.png&amp;amp;userId=1316061&#xD;
  [15]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic15.png&amp;amp;userId=1316061&#xD;
  [16]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic16.png&amp;amp;userId=1316061&#xD;
  [17]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic17.png&amp;amp;userId=1316061&#xD;
  [18]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic18.png&amp;amp;userId=1316061&#xD;
  [19]: https://community.wolfram.com//c/portal/getImageAttachment?filename=pic19.png&amp;amp;userId=1316061</description>
    <dc:creator>Claudio Chaib</dc:creator>
    <dc:date>2019-09-05T03:33:44Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1731520">
    <title>[WSC19] Face Emoji Identification</title>
    <link>https://community.wolfram.com/groups/-/m/t/1731520</link>
    <description>#Introduction&#xD;
&#xD;
&#xD;
Emojis are ideograms used in electronic texts and web pages that were first introduced by Japanese artist Shigetaka Kurita around the late 1900s. Since emojis convey facial expressions and common objects like earth, weather, and food relatively well, they became increasingly popular. Face emojis are everywhere these days because they come in handy when we are trying to communicate with people more comfortably. One can decorate their Instagram, Snapchat or other social media posts with emoji stickers. The Basic idea of my project is to find what face emojis are used in an image.&#xD;
&#xD;
The project aims to train a classifier to learn various types of face emojis and identify them in an image. For example, a person might add a face emoji on his or her image in order to decorate it. When the image is processed, the program should be able to find the face emojis he or she used in the image. After locating them, the program should return what the face emoji is, such as, Crying face or Sleepy face. Classifying the emojis is accomplished via the Classify function where the training data is an association of emoji-names and emoji-images from Apple, Google, and Twitter. Locating the emojis is accomplished via SelectComponents and a masking workflow using ColorDistance and Filling Transform.&#xD;
&#xD;
#Running the Face Emoji Classifier&#xD;
&#xD;
In order to identify the emojis in the sub-images, I had to make a solid custom face emoji classifier. Since I had issues with web-scraping face emoji images, I had to manually. I used 3 different images from Apple, Google,and Twitter, for each type of face emoji.&#xD;
&#xD;
**Small Part of the Dataset, &amp;#039;faceEmojiNames&amp;#039;**&#xD;
&#xD;
![part of the dataset:faceEmojiNames][1]&#xD;
&#xD;
**Small Part of the Dataset, &amp;#039;faceEmojiLists&amp;#039;**&#xD;
&#xD;
&#xD;
![part of the dataset:faceEmojiLists][2]&#xD;
&#xD;
Using that dataset, I trained the **classifier** on different face emoji images with Logistic Regression and the &amp;#034;ImageFeatures&amp;#034; FeatureExtractor.&#xD;
&#xD;
```&#xD;
faceEmojiAT = AssociationThread[faceEmojiNames -&amp;gt; faceEmojiLists]&#xD;
```&#xD;
```&#xD;
emojiClassification = &#xD;
 Classify[faceEmojiAT, FeatureExtractor -&amp;gt; &amp;#034;ImageFeatures&amp;#034;]&#xD;
```&#xD;
&#xD;
![emojiClassification][3]&#xD;
![example results][4]&#xD;
&#xD;
#Finding Face Emojis in an Image&#xD;
&#xD;
![general process][5]&#xD;
&#xD;
Given that most of the face emojis have a shape of a circle and a dominant color of yellow, I ran **ColorDistance** with yellow on the example image which returned a gray-scale image where darker shades are closer to the target color, yellow. &#xD;
&#xD;
**Example Image**&#xD;
&#xD;
![example image][6]&#xD;
&#xD;
```&#xD;
stepOne = &#xD;
 ColorDistance[exampleImage, Yellow]&#xD;
```&#xD;
![output for stepOne][7]&#xD;
&#xD;
I, then, binarized the gray scale image from ColorDistance using the function **Binarize**. It created a binary image with black and white where black is below the set threshold and white is above.&#xD;
&#xD;
```&#xD;
stepTwo = Binarize[stepOne, {0, 0.3}&#xD;
```&#xD;
&#xD;
![output of stepTwo][8]&#xD;
&#xD;
After taking the step of Binarize, I used **FillingTransform**, simplifying the features of the image by filling the entire circle with white. This gave me a completely black image with several white circles detected during the process. &#xD;
&#xD;
```&#xD;
stepThree = FillingTransform[stepTwo]&#xD;
```&#xD;
&#xD;
![output for stepThree][9]&#xD;
&#xD;
Next, I used **SelectComponents** to find features with circularity greater than .9 in the example image and applied **ComponentMeasurements** which returned the position of those circles.&#xD;
&#xD;
```&#xD;
stepFour = SelectComponents[stepThree, #Circularity &amp;gt; .9 &amp;amp;]&#xD;
```&#xD;
&#xD;
![output for stepFour][10]&#xD;
&#xD;
```&#xD;
stepFive = &#xD;
 ComponentMeasurements[stepFour, {&amp;#034;Centroid&amp;#034;, &amp;#034;EquivalentDiskRadius&amp;#034;},&#xD;
   All, &amp;#034;ComponentPropertyAssociation&amp;#034;]&#xD;
```&#xD;
&#xD;
![output for stepFive][11]&#xD;
&#xD;
Later, **Disk** function became useful. It created a disk out of centroid and equivalent disk radius properties, helping me to find the exact coordinates of the circles positions.&#xD;
&#xD;
```&#xD;
stepSix = Disk[#Centroid, #EquivalentDiskRadius] &amp;amp; /@ stepFive&#xD;
```&#xD;
&#xD;
![output for stepSix][12]&#xD;
&#xD;
In order to return the corners of the subimages that contain circles from these coordinate values, I wrote a function called **emojiC**. Using emojiC, I picked up the coordinate values of the corners of the sub-images and used ImageTrim to trim the input image using the coordinates.&#xD;
&#xD;
```&#xD;
emojiC[{{x_, y_}, r_}] := {{x - r, y - r}, {x - r, y + r}, {x + r, &#xD;
   y - r}, {x + r, y + r}}&#xD;
&#xD;
stepSeven = &#xD;
 emojiC[Extract[Part[Values[stepSix], #], {{1}, {2}}]] &amp;amp; /@ &#xD;
  Range[1, Length[Values[stepSix]]]&#xD;
```&#xD;
&#xD;
![output for stepSeven][13]&#xD;
&#xD;
```&#xD;
stepEight = ImageTrim[exampleImage, #] &amp;amp; /@ stepSeven&#xD;
```&#xD;
&#xD;
![output for stepEight][14]&#xD;
&#xD;
The issue of this process was that there were some sub-images of a circle that dont contain face emojis. Given that in most cases the sub-image containing the emoji will have the largest dimensions, I went through the area of each sub-images and drop those that are smaller than 1% of the largest sub-image using **Select**.&#xD;
&#xD;
```&#xD;
areasOfPixels[{x_, y_}] := (x*y)&#xD;
&#xD;
stepNine = &#xD;
 Select[stepEight, (areasOfPixels[ImageDimensions[#]]) &amp;gt; &#xD;
    0.01 (Last[&#xD;
       Sort[Map[areasOfPixels, Map[ImageDimensions, stepEight]]]]) &amp;amp;]&#xD;
```&#xD;
&#xD;
![output for stepNine][15]&#xD;
&#xD;
 Lastly, I applied custom **face emoji classifier** trained on different face emoji images with a method of Image Feature Extractor &amp;amp; Logistic Regression, and ran on the subimages containing the face emojis. Those face emojis with different colors such as red, green, blue, and purple, will also be easily detected by using their dominant colors. &#xD;
&#xD;
```&#xD;
stepTen = emojiClassification[stepNine]&#xD;
```&#xD;
&#xD;
![output for stepTen, the final result][16]&#xD;
&#xD;
#Extension&#xD;
&#xD;
I took these face emojis with yellowish color as an example, but those face emojis with different colors such as red, green, blue, and purple, will also be easily detected by using their own dominant colors.&#xD;
&#xD;
**Example of Face Emojis with Different Colors**&#xD;
&#xD;
![example of face emojis with different colors][17]&#xD;
&#xD;
Since I detected the face emojis on the images using the circular shape of those, I experienced difficulty in creating masks for those face emojis that are not circular. In order to expand on my work, I have to find out a way to detect those face emojis with external features, such as horns, glasses, and hearts. I believe this concept would be achieved by refining or finding the properties and values for the function SelectComponents instead of circularity.&#xD;
&#xD;
[Project Materials &amp;amp; Computational Essay][18]&#xD;
&#xD;
Mentor: [Faizon Zaman][19]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at11.00.46AM.png&amp;amp;userId=1579063&#xD;
  [2]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.48.37AM.png&amp;amp;userId=1579063&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.53.29AM.png&amp;amp;userId=1579063&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.54.32AM.png&amp;amp;userId=1579063&#xD;
  [5]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-10at3.07.14PM.png&amp;amp;userId=1579063&#xD;
  [6]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.21.11AM.png&amp;amp;userId=1579063&#xD;
  [7]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.36.11AM.png&amp;amp;userId=1579063&#xD;
  [8]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.31.32AM.png&amp;amp;userId=1579063&#xD;
  [9]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.31.43AM.png&amp;amp;userId=1579063&#xD;
  [10]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.31.54AM.png&amp;amp;userId=1579063&#xD;
  [11]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.32.05AM.png&amp;amp;userId=1579063&#xD;
  [12]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.32.10AM.png&amp;amp;userId=1579063&#xD;
  [13]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.32.15AM.png&amp;amp;userId=1579063&#xD;
  [14]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.32.21AM.png&amp;amp;userId=1579063&#xD;
  [15]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.32.29AM.png&amp;amp;userId=1579063&#xD;
  [16]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2019-07-11at10.33.07AM.png&amp;amp;userId=1579063&#xD;
  [17]: https://community.wolfram.com//c/portal/getImageAttachment?filename=%E1%84%8B%E1%85%B5%E1%84%80%E1%85%A5.png&amp;amp;userId=1579063&#xD;
  [18]: https://github.com/SeoyoonHan/WSS-Template&#xD;
  [19]: https://www.linkedin.com/in/faizonzaman</description>
    <dc:creator>Seoyoon (Jade) Han</dc:creator>
    <dc:date>2019-07-11T16:07:03Z</dc:date>
  </item>
</rdf:RDF>

