<?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 Artificial Intelligence with no replies sorted by active.</description>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3577512" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3323587" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3098690" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3094975" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3094693" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/3094670" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2818058" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2144200" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/2144104" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1872736" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1379517" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1137429" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1137055" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1137044" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1136941" />
        <rdf:li rdf:resource="https://community.wolfram.com/groups/-/m/t/1136102" />
      </rdf:Seq>
    </items>
  </channel>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3577512">
    <title>Wolfram Neural Networks Boot Camp 2026</title>
    <link>https://community.wolfram.com/groups/-/m/t/3577512</link>
    <description>![enter image description here][1]&#xD;
&#xD;
Hi everybody! In just about six weeks, our online [Neural Networks Boot Camp][2] will begin. This two-week boot camp will feature lectures from Wolfram instructors and developers from the machine learning team. You&amp;#039;ll learn what neural networks are, how you can use pre-trained networks and how to build and train your own models. Explore ways that AI and deep learning can be applied to text, image and audio analysis.&#xD;
&#xD;
Earn certification for:&#xD;
&#xD;
 - **Program completion** (by attending and actively participating in the sessions)&#xD;
 - **Level 1 proficiency in neural networks** (by completing graded exercises)&#xD;
 - **Level 2 applied expertise in neural networks** (by building and training your own neural networks)&#xD;
&#xD;
This boot camp has discounted pricing for students, educators and even hobbyists.&#xD;
&#xD;
&amp;gt; [**REGISTER HERE**][3]&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot_2025-11-1816.21.53.png&amp;amp;userId=1711324&#xD;
  [2]: https://www.wolfram.com/wolfram-u/boot-camp-neural-networks/&#xD;
  [3]: https://www.wolfram.com/wolfram-u/boot-camp-neural-networks/&#xD;
  [4]: https://community.wolfram.com//c/portal/getImageAttachment?filename=WolframUBanner.jpeg&amp;amp;userId=1711324</description>
    <dc:creator>Arben Kalziqi</dc:creator>
    <dc:date>2025-11-18T22:25:23Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3323587">
    <title>Wolfram Neural Networks Boot Camp 2025</title>
    <link>https://community.wolfram.com/groups/-/m/t/3323587</link>
    <description>![enter image description here][1]&#xD;
&#xD;
Hi everybody! In just about six weeks, our online [Neural Networks Boot Camp][2] will begin. This two-week boot camp will feature lectures from Wolfram instructors and developers from the machine learning team. These lectures will cover topics ranging from what a neural network even is all the way to describing generative pre-trained transformers (GPTs) and neural network applications in image, audio and video analysis. We will also cover much of the new LLM-based functionality that has been integrated into Wolfram Language, including some functionality which is yet to be announced :).&#xD;
&#xD;
Earn certification for:&#xD;
&#xD;
 - **Program completion** (by attending and actively participating in the sessions)&#xD;
 - **Level 1 proficiency in neural networks** (by completing graded exercises)&#xD;
 - **Level 2 applied expertise in neural networks** (by building and training your own neural networks)&#xD;
&#xD;
&amp;gt; [**REGISTER HERE.**][2]&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot_2024-11-1816.39.10.png&amp;amp;userId=1711324&#xD;
  [2]: https://www.wolfram.com/wolfram-u/boot-camp-neural-networks/&#xD;
  [3]: https://community.wolfram.com//c/portal/getImageAttachment?filename=WolframUBanner.jpeg&amp;amp;userId=1711324</description>
    <dc:creator>Arben Kalziqi</dc:creator>
    <dc:date>2024-11-18T22:43:26Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3098690">
    <title>[WELP23] Analyzing Video Game Box Art</title>
    <link>https://community.wolfram.com/groups/-/m/t/3098690</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=9760image.jpeg&amp;amp;userId=911151&#xD;
  [2]: https://www.wolframcloud.com/obj/fa97fc66-dfc6-42d2-ad39-b5c612ca0097</description>
    <dc:creator>Wolfram Education Programs</dc:creator>
    <dc:date>2024-01-09T16:08:37Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3094975">
    <title>[WELP23] Neural Network Compression and Empirical Verification of the Winning Lottery Hypothesis</title>
    <link>https://community.wolfram.com/groups/-/m/t/3094975</link>
    <description>![lottery neural nets][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=9580image.jpeg&amp;amp;userId=911151&#xD;
  [2]: https://www.wolframcloud.com/obj/63013bc5-ddfa-4ca1-9f29-a70a3efe4506</description>
    <dc:creator>Wolfram Education Programs</dc:creator>
    <dc:date>2024-01-02T19:16:32Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3094693">
    <title>[WELP23] Web-Based Foreign Language Learning Translation tool using LLMS</title>
    <link>https://community.wolfram.com/groups/-/m/t/3094693</link>
    <description>![language learning][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=7107image.jpeg&amp;amp;userId=911151&#xD;
  [2]: https://www.wolframcloud.com/obj/b692ee5f-d732-4087-a163-ddcef47c9244</description>
    <dc:creator>Wolfram Education Programs</dc:creator>
    <dc:date>2024-01-02T17:13:48Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/3094670">
    <title>[WELP23] PLAPT: Protein - Ligand Binding Affinity Prediction Using Pretrained Transformer Models</title>
    <link>https://community.wolfram.com/groups/-/m/t/3094670</link>
    <description>![machine learning][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=4889image.jpeg&amp;amp;userId=911151&#xD;
  [2]: https://www.wolframcloud.com/obj/29e809c2-c42c-4491-a69e-c1ca763ab6a1</description>
    <dc:creator>Wolfram Education Programs</dc:creator>
    <dc:date>2024-01-02T17:07:26Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/2818058">
    <title>[WELP22] Emotion detection in audio</title>
    <link>https://community.wolfram.com/groups/-/m/t/2818058</link>
    <description>![classifier ][1]&#xD;
&#xD;
&amp;amp;[Wolfram Notebook][2]&#xD;
&#xD;
&#xD;
  [1]: https://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2023-01-27at10.31.22AM.png&amp;amp;userId=911151&#xD;
  [2]: https://www.wolframcloud.com/obj/a266d746-090f-445a-a10f-7113b3e76767</description>
    <dc:creator>Wolfram Education Programs</dc:creator>
    <dc:date>2023-01-27T16:33:55Z</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/2144104">
    <title>[WELP20] Using Linguistic Analysis to Computationally Replace Given Similes</title>
    <link>https://community.wolfram.com/groups/-/m/t/2144104</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/723658f2-7fbd-40e9-b430-1f8271427990&#xD;
&#xD;
 [Original]: https://www.wolframcloud.com/obj/4cbab921-c1df-4a1b-be33-dfd6289fe860</description>
    <dc:creator>Wolfram Education Programs</dc:creator>
    <dc:date>2020-12-21T16:24:15Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1872736">
    <title>[WELP19] Exploring and Predicting Unemployment in the USA</title>
    <link>https://community.wolfram.com/groups/-/m/t/1872736</link>
    <description>&amp;amp;[Wolfram Notebook][1]&#xD;
&#xD;
&#xD;
  [1]: https://www.wolframcloud.com/obj/7552c952-8321-4ea8-804a-b835876bcaa1</description>
    <dc:creator>Wolfram Education Programs</dc:creator>
    <dc:date>2020-02-04T19:43:47Z</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/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/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/1137044">
    <title>[WSS17] Image-to-Latex</title>
    <link>https://community.wolfram.com/groups/-/m/t/1137044</link>
    <description>The following is a short summary of a project I did at the Wolfram Summer School, 2017.&#xD;
&#xD;
In this project we aim to convert any given mathematical expression (printed or or even handwritten) into LaTeX syntax. We implement the algorithm in the Wolfram Language using the built-in Neural Network functionality. We &amp;#034;loosely&amp;#034; follow the algorithm proposed in the paper https://arxiv.org/pdf/1609.04938v1.pdf . &#xD;
&#xD;
The dataset is imported from https://zenodo.org/record/56198#.WVzy-caZORt. It includes a total of approximately 100k formulas and images split into train, validation and test sets. The file &amp;#034;im2latex_formulas.lst&amp;#034; contains 103558 latex formulae separated by &amp;#034;\n&amp;#034; which we import in Mathematica &#xD;
&#xD;
    formulae = StringSplit[Import[&amp;#034;/Users/Himanshu/Desktop/Wolfram Assignments/Wolfram \Project/im2latex_formulas.lst&amp;#034;, &amp;#034;String&amp;#034;], &amp;#034;\n&amp;#034;];&#xD;
&#xD;
Using just `Import[&amp;#034;/Users/Himanshu/Desktop/Project/im2latex_formulas.lst&amp;#034;, &amp;#034;String&amp;#034;]` leads to incorrect number of lines 104563. &#xD;
We then process this data. First we strip off unnecessary elements in the LaTeX formulae ( like \label{eqn} ) and white-spaces as follows: &#xD;
&#xD;
    formulae = &#xD;
      StringSplit[&#xD;
       Import[&amp;#034;/Users/Himanshu/Desktop/Wolfram Assignments/Wolfram \&#xD;
    Project/im2latex_formulas.lst&amp;#034;, &amp;#034;String&amp;#034;], &amp;#034;\n&amp;#034;];&#xD;
    labels = StringTrim[&#xD;
         StringReplace[&#xD;
          StringReplace[#, {&amp;#034;\\label{&amp;#034; ~~ ShortestMatch[___] ~~ &amp;#034;}&amp;#034; :&amp;gt; &amp;#034;&amp;#034;,&#xD;
             &amp;#034;\t&amp;#034; | &amp;#034;\\,&amp;#034; | WhitespaceCharacter | &amp;#034;\\:&amp;#034; | &amp;#034;\\;&amp;#034; -&amp;gt; &amp;#034;~&amp;#034;}], &#xD;
          &amp;#034;~&amp;#034; .. -&amp;gt; &amp;#034;~&amp;#034;], &amp;#034;~&amp;#034;] &amp;amp; /@ formulae;&#xD;
&#xD;
The formulae, stored in the folder &amp;#034;formula_images&amp;#034;, are in png format and rendered as latex expressions on a transparent background. Although they occupy a small size on the disk, while importing in the Mathematica kernel the size of the cropped images increases. &#xD;
&#xD;
    fileDataset[s_String, import_?BooleanQ, folder_String: &amp;#034;&amp;#034;] := &#xD;
     Dataset[&amp;lt;|&amp;#034;Input&amp;#034; -&amp;gt; Last@#, &#xD;
         &amp;#034;Target&amp;#034; -&amp;gt; &#xD;
          labels[[First@# + 1]]|&amp;gt; &amp;amp; /@ ({ToExpression@#[[1]], &#xD;
           If[import, Import, Identity]@&#xD;
            File[folder &amp;lt;&amp;gt; #[[2]] &amp;lt;&amp;gt; &amp;#034;.png&amp;#034;]} &amp;amp;~ParallelMap~&#xD;
         StringSplit[ReadList[s, String]][[;; , {1, 2}]])]&#xD;
&#xD;
The following code generates the training, test and validation dataset. WARNING: Time consuming and requires at least 20 GB of disk space.&#xD;
&#xD;
    trainDataset = &#xD;
       fileDataset[&amp;#034;im2latex_train.lst&amp;#034;, False, &#xD;
        &amp;#034;formula_images/&amp;#034;]; // AbsoluteTiming&#xD;
    testDataset = &#xD;
       fileDataset[&amp;#034;im2latex_test.lst&amp;#034;, False, &#xD;
        &amp;#034;formula_images/&amp;#034;]; // AbsoluteTiming&#xD;
    validateDataset = &#xD;
       fileDataset[&amp;#034;im2latex_validate.lst&amp;#034;, False, &#xD;
        &amp;#034;formula_images/&amp;#034;]; // AbsoluteTiming&#xD;
&#xD;
We also pad the formula images in order to get images of the same size. This is to avoid distortion. The final training / validation / test data is `Dataset` ![enter image description here][1]&#xD;
&#xD;
which is nothing but a list of rules of the following form&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
The length of the training data is 83884, test data is 10355, validation data is 9320. After processing, they occupy a disk size of approximately 20 GB. Since the Dataset generated is huge in size it is not optimal for uploading on the GPU machine. Therefore instead of creating, saving and then uploading the dataset we generate the dataset from the raw data and save it in a temporary variable in memory which is fed into the network for training. &#xD;
&#xD;
Next we turn to the neural network architecture. The neural network architecture is divided in to three stages.&#xD;
&#xD;
1. **Convolutional Network**:  The visual features of an image are extracted with a multi-layer convolutional neural network (CNN) interleaved with max-pooling layers. The CNN takes the raw input and produces a feature grid $\tilde{V}$ of size $D \times H \times W $ where D denotes the number of channels and H and W are the resulted feature map height and width.&#xD;
&#xD;
2. **Row Encoder**: The feature grid $\tilde{V}$ produced by the CNN is fed into a Row Encoder that localizes its input by running a Recurrent Neural Network (RNN) over each of the rows of CNN feature grid $\tilde{V}$ and produces a new feature grid V. For OCR, it is important for the encoder to localize the relative positions within the source image.&#xD;
&#xD;
3.  **Decoder**: The target markup tokens  {$y_t$} are then generated by a decoder based on the row encoded feature grid V. The decoder (equipped with an attention mechanism) is trained to calculate the conditional probability of a token $y_{t+1}$ appearing at position $t+1$ given the sequence ${y_0,y_1,...y_t }$ and the feature grid V.&#xD;
&#xD;
However in my implementation of the network I have not incorporated the attention mechanism. The final network that was used for training is schematically shown below&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
where the encoder is a `NetChain` that consists of CNN interleaved with Pooling and Batch Normalization layers and decoder is a `NetGraph` which is schematically shown below&#xD;
&#xD;
![enter image description here][4] &#xD;
&#xD;
In this work we have been able to implement the first two stages of the algorithm and a slightly modified version of the third stage that cuts away the attention mechanism. We have trained the network on a 12 GB NVIDIA GPU. Training batch size is set to 16 due to the size limit of GPU memory. After 7 rounds the loss drops to 1.48. It is expected that on adding attention layer in the network, the loss should improve. &#xD;
&#xD;
For original and previous work in this direction please refer to the following links&#xD;
&#xD;
 - https://github.com/harvardnlp/im2markup&#xD;
 - https://github.com/ritheshkumar95/im2latex-tensorflow&#xD;
&#xD;
## Acknowledgements ##&#xD;
&#xD;
I would like to thank Giulio Alessandrini, Matteo Salvarezza and Daniel George for useful discussions and helping me out in various stages of the project.&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at3.47.49PM.png&amp;amp;userId=1123238&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at3.48.08PM.png&amp;amp;userId=1123238&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at4.45.12PM.png&amp;amp;userId=1123238&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at4.52.36PM.png&amp;amp;userId=1123238</description>
    <dc:creator>Himanshu Raj</dc:creator>
    <dc:date>2017-07-05T21:16:09Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1136941">
    <title>[WSS17] Semantic Segmentation of Urban Street Scenes</title>
    <link>https://community.wolfram.com/groups/-/m/t/1136941</link>
    <description># Abstract&#xD;
&#xD;
The problem of scene parsing is a difficult one. Despite this complexity, the ability to correctly analyse the environment is critical for the development of autonomous systems such as self-driving cars. Here I describe the procedure to develop a model for semantically segmenting urban street scenes.&#xD;
The aim of my project is to implement a deep neural network in the Wolfram Language which can perform a pixel-wise semantic segmentation of the images contained in the [Cityscapes dataset](https://www.cityscapes-dataset.com/). The dataset used is a challenging one consisting of a comprehensive set of images from various kinds of urban settings.&#xD;
&#xD;
### Note:&#xD;
I have tried to write this post for 2 kinds of readers - those who want a high level overview of what this project does, and those who want to implement a similar model on their own and are looking for guidelines. To cater to both these kinds of readers, I have included as little code in this post as possible, but have referenced the relevant files on my [GitHub repo](https://github.com/saxenarohan97/WolframResearch) as and when required. So if you want to see how I did any of the things I&amp;#039;ve shown here, just scroll around and you will find a link to the relevant file on GitHub.&#xD;
&#xD;
# Project&#xD;
&#xD;
## Neural Netwok Design Overview&#xD;
&#xD;
Here let&amp;#039;s set some ground rules for the design of our network. It doesn&amp;#039;t have to be very detailed, but we must know what we are doing since the preprocessing of our data will depend upon the network design.&#xD;
&#xD;
On the [Cityscapes benchmarks](https://www.cityscapes-dataset.com/benchmarks/#scene-labeling-task) page, there is a list of papers which have achieved a high accuracy on this dataset. As of this writing, the paper with the highest accuracy (with accompanying code) is [PSPNet](https://hszhao.github.io/projects/pspnet/). It uses the 101-layer pretrained [ResNet](https://arxiv.org/abs/1512.03385) network, appended with a custom pyramid pooling scheme.&#xD;
&#xD;
## Data Preparation&#xD;
&#xD;
We must first prepare the data to be fed into the neural network of our design. We will be passing in images of urban scenes into the network. However, they are too large (2048 x 1024 pixels) to be processed easily. PSPNet crops the images to ~720 pixels for this reason. Since we will be working under limited time and a modest GPU, we shall crop the images to 256 x 256.&#xD;
&#xD;
There is a problem with this, however. In an image of 2048 x 1024, a crop of 256 x 256 classes will contain a very small subset of the image, which will in turn contain very few of the classes we want to classify. So our network will not be able to see many classes at once, in the same image. To address this issue, let&amp;#039;s resize the images to 1/4 of the original resolution (that is, to 1024 x 512 pixels).&#xD;
&#xD;
![enter image description here][1]&#xD;
&#xD;
The cropped images look like this:&#xD;
&#xD;
![enter image description here][2]&#xD;
&#xD;
We will feed in the `ImageData` of the input images and get the output mask as an array (which will be the `ImageData` of the output mask). The masks are also resized and cropped in the same way. The code for resizing and cropping the input images and masks is in the file `GetData.nb` on my [GitHub repo](https://github.com/saxenarohan97/WolframResearch).&#xD;
&#xD;
Since we will be using the pretrained weights of ResNet, we must also include the preprocessing that ResNet uses. It subtracts the mean of all images in its dataset from each image before feeding the image into the network. We must extract this mean image, as shown below.&#xD;
&#xD;
## Neural Network Design Details&#xD;
&#xD;
This is what the entire ResNet looks like in Mathematica:&#xD;
&#xD;
![enter image description here][3]&#xD;
&#xD;
Phew, that&amp;#039;s deep! By the way,&#xD;
&#xD;
```meanImg = Normal[NetExtract[resnet, &amp;#034;Input&amp;#034;]][&amp;#034;MeanImage&amp;#034;]```&#xD;
&#xD;
gives us the mean image of ResNet, which we&amp;#039;ll subtract from each input image before sending it into the network (as I&amp;#039;d said above).&#xD;
&#xD;
As the PSPNet paper says, I will chop off the last few layers from layer 5a onwards. Then, I will add a pyramid pooling module which is a series of pooling layers of various sizes. The PSPNet authors have upsampled the images a bit too much for my taste (this could be because they train on the coarse annotations of the Cityscapes dataset). Since we want to train on the fine annotations, I replaced some of the upsampling by deconvolutions (which is basically a learned upsampling). The entire design code of the neural network is in the file `network.nb` on my [GitHub repo](https://github.com/saxenarohan97/WolframResearch).&#xD;
&#xD;
![enter image description here][4]&#xD;
&#xD;
The final network isn&amp;#039;t much to look at because the entire ResNet, the pyramid pooling and other layers have each been compressed to a single line (a `NetGraph` or a `NetChain`).&#xD;
&#xD;
## Train the network&#xD;
&#xD;
Now let&amp;#039;s begin the most fun part of the project - actually training the neural network. For this, I am using an AWS instance with the NVIDIA Tesla K80 GPU. I uploaded all my files onto the remote machine and have written a script to train the network. This script can be found as (surprise!) `script.wl` on my [GitHub repo](https://github.com/saxenarohan97/WolframResearch).&#xD;
&#xD;
A convenient way I like to view my training (on a MacBook) is as such:&#xD;
&#xD;
 - Open 2 terminal windows and log into the AWS instance on both&#xD;
 - Set them up in OS X Split View&#xD;
 - Run the training script in a `tmux` session on one, and a `watch nvidia-smi` on the other&#xD;
 - This shows us the training progress on one side, and the GPU memory usage on the other.&#xD;
&#xD;
Remember that a batch size must be chosen such that it is the largest number of files which can comfortably fit on the GPU/CPU. Here is a screenshot of the network training:&#xD;
&#xD;
![enter image description here][5]&#xD;
&#xD;
We can see the training loss, time spent, etc on the left, and GPU information on the right.&#xD;
&#xD;
Here is the output of `watch nvidia-smi` a bit more clearly:&#xD;
&#xD;
![enter image description here][6]&#xD;
&#xD;
When the training error is reasonable or when you are bored out of your mind waiting for the network to finish training, download the network to your local machine and test it on images!&#xD;
&#xD;
## Test Performance&#xD;
&#xD;
For my test file, see `test performance.nb` on [GitHub](https://github.com/saxenarohan97/WolframResearch).&#xD;
&#xD;
I have organised the paths on my machine such that I can randomly pick an image to visualise it with this code:&#xD;
&#xD;
    i = RandomInteger[{1, Length @ testPics}];&#xD;
    &#xD;
    input = testPics[[i]];&#xD;
    pixelResult = pixelPredict[net, input];&#xD;
    &#xD;
    ImageCollage[&#xD;
    	{&#xD;
    		ArrayPlot[pixelResult, ColorRules -&amp;gt; colorRules],&#xD;
    		fip @ trialFiles[[i]],&#xD;
    		ArrayPlot[importer @ coarseMaskFiles[[i]], ColorRules -&amp;gt; colorRules],&#xD;
    		ArrayPlot[importer @ maskFiles[[i]], ColorRules -&amp;gt; colorRules]&#xD;
    	}&#xD;
    ]&#xD;
&#xD;
This is the output I get from the above piece of code:&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
In clockwise direction starting from top left, these images are:&#xD;
&#xD;
 - Output of my neural network&#xD;
 - Input image&#xD;
 - Fine annotation of the Cityscapes dataset&#xD;
 - Coarse annotation of the Cityscapes dataset&#xD;
&#xD;
As we can see, the network output is better than the coarse annotation, but not as good as the fine annotation. Moreover, it has some difficulty detecting small or thin objects such as poles, signs, etc. I suspect this is because of the large amount of upsampling in the network. If we add more deconvolutions instead, I am confident that the accuracy will further increase.&#xD;
&#xD;
Let&amp;#039;s see the incorrectly classified pixels in white:&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
Yup, as I said, small / thin objects are not so easily spotted by this guy.&#xD;
&#xD;
If we measure the accuracy for this image (percentage of correctly classified pixels):&#xD;
&#xD;
    (1. - Mean @ Flatten[&#xD;
    	Unitize[pixelResult - testMasks[[i]]]&#xD;
    ]) * 100&#xD;
&#xD;
We get `83.6151`. Hey, not too bad for a day&amp;#039;s work!&#xD;
&#xD;
In my [GitHub repo](https://github.com/saxenarohan97/WolframResearch), I have included the code to test the network on the entire test set (3,800 images). But beware! Running it on a CPU takes forever, it is much better to run it on a GPU.&#xD;
&#xD;
# References:&#xD;
 - Zhao, Hengshuang, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. &amp;#034;Pyramid Scene Parsing Network.&amp;#034; [1612.01105] Pyramid Scene Parsing Network. CVPR (IEEE), 27 Apr. 2017. Web. 25 June 2017.&#xD;
 - He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. &amp;#034;Deep Residual Learning for Image Recognition.&amp;#034; [1512.03385] Deep Residual Learning for Image Recognition. CVPR, 10 Dec. 2015. Web. 25 June 2017.&#xD;
 - Cordts, Marius, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. &amp;#034;The Cityscapes Dataset for Semantic Urban Scene Understanding.&amp;#034; [1604.01685] The Cityscapes Dataset for Semantic Urban Scene Understanding. CVPR, 07 Apr. 2016. Web. 25 June 2017.&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=resize.jpg&amp;amp;userId=1098614&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=parts.png&amp;amp;userId=1098614&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=net.png&amp;amp;userId=1098614&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=myNet.png&amp;amp;userId=1098614&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=Training.jpeg&amp;amp;userId=1098614&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=nvidia-smi.jpeg&amp;amp;userId=1098614&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=9248output.png&amp;amp;userId=1098614&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=incorrect.png&amp;amp;userId=1098614</description>
    <dc:creator>Rohan Saxena</dc:creator>
    <dc:date>2017-07-05T21:12:46Z</dc:date>
  </item>
  <item rdf:about="https://community.wolfram.com/groups/-/m/t/1136102">
    <title>[WSS17] Figure out the value of a resistor from an image</title>
    <link>https://community.wolfram.com/groups/-/m/t/1136102</link>
    <description>![Overall steps of the process][1]&#xD;
&#xD;
# Abstract #&#xD;
&#xD;
**Goal of the project:** To output the value of a resistor given a photo of it.&#xD;
The photos are intended to be taken in a white background, like from a white&#xD;
paper sheet and with a cellphone camera.&#xD;
&#xD;
**Summary of work:** Many samples are used in a Classifier, leaving as result a&#xD;
logistic regression, all training and test samples were rotated and cropped&#xD;
 automatically. The resistor position is found using morphological components,&#xD;
 then the picture is cropped and rotated leaving the resistor to cover the&#xD;
 majority of the picture, using the Classifier we obtain the final result.&#xD;
&#xD;
**Results and future work:** The project is limited to a small set of resistors&#xD;
to which it can calculate the value. The next step is to either to crop the&#xD;
color bands of the resistor, and use machine learning in a similar way to&#xD;
determine the color of each of the bands of the resistor, or improve the current&#xD;
 machine learning methods to raise the extent of the project.&#xD;
&#xD;
# First approach #&#xD;
&#xD;
For the first attempt to solve this problem the method suggested in the Lecture&#xD;
Notes in Computer Science where a similar problem is being solved. The&#xD;
difference was that the resistor photos were taken in an environment&#xD;
where the light is controlled, reducing the glare and shadows.&#xD;
&#xD;
The first step was to obtain the background color of the image, this was&#xD;
originally done calculating the mean of the pixels near the edges of the&#xD;
picture, in this case it was done obtaining a mask to identify the background&#xD;
and calculating the mean of all the pixels in it.&#xD;
&#xD;
&#xD;
img = ![initial image][2]&#xD;
&#xD;
&#xD;
&#xD;
```&#xD;
   img = ImageAdjust[ImageResize[img, {500}]];&#xD;
   img = ColorConvert[RemoveAlphaChannel[img],&amp;#034;RGB&amp;#034;];&#xD;
```&#xD;
&#xD;
```&#xD;
    meanColorMask[image_,mask_ ]:= Module[&#xD;
    {toRemove,imgList},&#xD;
    toRemove = PixelValuePositions[mask, Black];&#xD;
    imgList = Transpose @ ImageData[image];&#xD;
    imgList = Delete[imgList, toRemove];&#xD;
    RGBColor[Mean[Catenate @ imgList]]&#xD;
    ]&#xD;
```&#xD;
&#xD;
```&#xD;
getBackColor[image_] := meanColorMask[image, ColorNegate @ AlphaChannel[RemoveBackground[image]]];&#xD;
backColor = getBackColor[img]&#xD;
```&#xD;
&#xD;
![backcolor][3]&#xD;
&#xD;
This color is extracted from the image, then the result of that is converted to grayscale.&#xD;
&#xD;
```&#xD;
absoluteSubstract[image_, color_] := ImageApply[&#xD;
	MapThread[&#xD;
		Abs[#1 - #2]&amp;amp;,&#xD;
		{Flatten[#],Flatten[List @@ color]}&#xD;
	]&amp;amp;,&#xD;
	image&#xD;
]&#xD;
substracted = absoluteSubstract[img, backColor]&#xD;
monochromatic = ColorConvert[substracted,&amp;#034;Grayscale&amp;#034;]&#xD;
```&#xD;
&#xD;
![enter image description here][4]&#xD;
![enter image description here][5]&#xD;
&#xD;
From here we calculate a threshold we are going to use to separate the resistor from the background. A threshold that maximizes the variance between the rows and columns lower and higher than the threshold. Then crop the image based on the values that were higher than it. This method is further explained in \[1] and \[2].&#xD;
&#xD;
```&#xD;
 threshold[n_] := Module[&#xD;
	{num, p, \[Omega], \[Mu], \[Mu]T, maxK, max\[Sigma], \[Sigma]2B, temp, k},&#xD;
	num = Total[n];&#xD;
	p = n / num;&#xD;
	\[Omega] := Sum[p[i],{i,0,#}]&amp;amp;;&#xD;
	\[Mu] := Sum[(i+1) * p[i], {i, 0, #}]&amp;amp;;&#xD;
	\[Mu]T = \[Mu][255];&#xD;
	\[Sigma]2B[x_Integer] := Module[&#xD;
		{\[Mu]k, \[Omega]k},&#xD;
		\[Omega]k = \[Omega][x];&#xD;
		\[Mu]k = \[Mu][x];&#xD;
		If[ \[Omega]k != 0 &amp;amp;&amp;amp; \[Omega]k != 1,&#xD;
			((\[Mu]T*\[Omega]k - \[Mu]k)^2) / (\[Omega]k * (1 - \[Omega]k)),&#xD;
			-1&#xD;
		]&#xD;
	];&#xD;
	max\[Sigma] = 0;&#xD;
	maxK = 255;&#xD;
	For[k = 0, k &amp;lt; 255, k++,&#xD;
		temp = \[Sigma]2B[k];&#xD;
		If[ NumberQ[temp] &amp;amp;&amp;amp; temp &amp;gt; max\[Sigma],&#xD;
			max\[Sigma] = temp;&#xD;
			maxK = k;&#xD;
		]&#xD;
	];&#xD;
	maxK&#xD;
]&#xD;
```&#xD;
&#xD;
```&#xD;
matr = ImageData[monochromatic];&#xD;
verMean = Map[&#xD;
	Mean[Flatten[#]]&amp;amp;,&#xD;
	matr&#xD;
];&#xD;
verMean = Round[verMean * 255];&#xD;
horMean = Map[&#xD;
	Mean[Flatten[#]]&amp;amp;,&#xD;
	Transpose[matr]&#xD;
];&#xD;
horMean = Round[horMean * 255];&#xD;
&#xD;
horFrequency = Counts[Catenate[{horMean,Range[0,255]}]] - 1;&#xD;
verFrequency = Counts[Catenate[{verMean,Range[0,255]}]] - 1;&#xD;
verThreshold = threshold[verFrequency];&#xD;
horThreshold = threshold[horFrequency];&#xD;
&#xD;
verPlot = DiscretePlot[&#xD;
	verMean[[x]],&#xD;
	{x, 1, Length[verMean]},&#xD;
	PlotRange-&amp;gt;All,&#xD;
	ImageSize-&amp;gt;Medium&#xD;
];&#xD;
verThresholdPlot = Plot[&#xD;
	verThreshold,&#xD;
	{x, 1, Length[verMean]},&#xD;
	PlotRange-&amp;gt;All,&#xD;
	ImageSize-&amp;gt;Medium,&#xD;
	PlotStyle-&amp;gt;{Red}&#xD;
];&#xD;
&#xD;
horPlot = DiscretePlot[&#xD;
	horMean[[x]],&#xD;
	{x, 1, Length[horMean]},&#xD;
	PlotRange-&amp;gt;All,&#xD;
	ImageSize-&amp;gt;Medium&#xD;
];&#xD;
horThresholdPlot = Plot[&#xD;
	horThreshold,&#xD;
	{x, 1, Length[horMean]},&#xD;
	PlotRange-&amp;gt;All,&#xD;
	ImageSize-&amp;gt;Medium,&#xD;
	PlotStyle-&amp;gt;{Red}&#xD;
];&#xD;
&#xD;
xPos = Values @ Cases[&#xD;
	MapIndexed[#1-&amp;gt;First[#2]&amp;amp;, horMean],&#xD;
	(x_-&amp;gt;y_)/;x&amp;gt;= horThreshold&#xD;
];&#xD;
xStart = Min[xPos];&#xD;
xEnd = Max[xPos];&#xD;
&#xD;
yPos = Values @ Cases[&#xD;
	MapIndexed[#1-&amp;gt;First[#2]&amp;amp;, verMean],&#xD;
	(x_-&amp;gt;y_)/;x&amp;gt;= verThreshold&#xD;
];&#xD;
yStart = Min[yPos];&#xD;
yEnd = Max[yPos];&#xD;
&#xD;
segmented = ImageTake[&#xD;
	img,&#xD;
	{yStart, yEnd},{xStart, xEnd}&#xD;
];&#xD;
xStartLine = Graphics @ Line[{{xStart, 0},{xStart, 255}}];&#xD;
xEndLine = Graphics @ Line[{{xEnd, 0},{xEnd, 255}}];&#xD;
yStartLine = Graphics @ Line[{{yStart, 0},{yStart, 255}}];&#xD;
yEndLine = Graphics @ Line[{{yEnd, 0},{yEnd, 255}}];&#xD;
Grid[{&#xD;
	{&#xD;
		Show[{horPlot, horThresholdPlot, xStartLine, xEndLine}],&#xD;
		Show[{verPlot, verThresholdPlot, yStartLine, yEndLine}]&#xD;
	},&#xD;
	{&amp;#034;Horizontal mean&amp;#034;, &amp;#034;Vertical mean&amp;#034;}&#xD;
}]&#xD;
segmented&#xD;
```&#xD;
![enter image description here][6]&#xD;
&#xD;
![enter image description here][7]&#xD;
&#xD;
The graphs represent the average color of each of the columns and rows of the pixels of the monochromatic image. The threshold for each of them is represented with the red line and is calculated using the Otsu&amp;#039;s method. The black lines represent the left-most, right-most columns, and top and bottom rows where the mean color is over the threshold. With those values we can cut the resistor of the image.&#xD;
Finally, in this approach we extract an image with a height of 15 pixels.&#xD;
&#xD;
```&#xD;
extracted = ImageCrop[segmented, {ImageDimensions[segmented][[1]], 15}, Center]&#xD;
```&#xD;
&#xD;
![enter image description here][8]&#xD;
&#xD;
To get the color bands, the image is subtracted of the back color and made grayscale, then clustering the bars with the K-means algorithm. However, this method did not result convenient for our use case, as kept marking the glare in the resistor as part of the band.&#xD;
&#xD;
```&#xD;
extracted = ImageResize[extracted, {500}];&#xD;
exBackColor = &#xD;
ColorConvert[&#xD;
	Hue @@ ImageMeasurements[ColorConvert[extracted, &amp;#034;HSB&amp;#034;], &amp;#034;Mean&amp;#034;],&#xD;
	&amp;#034;RGB&amp;#034;&#xD;
]&#xD;
exSubs = &#xD;
TotalVariationFilter @ absoluteSubstract[&#xD;
	extracted,&#xD;
	ColorConvert[exBackColor,&amp;#034;RGB&amp;#034;]&#xD;
]&#xD;
exMono = ColorConvert[exSubs, &amp;#034;Grayscale&amp;#034;]&#xD;
exBinary = Binarize[exMono,Method-&amp;gt;&amp;#034;Cluster&amp;#034;]&#xD;
allX = Map[&#xD;
	Interval[{Ramp[Min[#]],Ramp[Max[#]]}]&amp;amp;,&#xD;
	Values[ComponentMeasurements[&#xD;
		MorphologicalComponents[exBinary],&#xD;
		&amp;#034;MinimalBoundingBox&amp;#034;&#xD;
	]][[All, All, 1]]&#xD;
];&#xD;
allX = List @@ (IntervalUnion @@ allX);&#xD;
squaresX = Polygon @ Map[&#xD;
	Module[&#xD;
		{min, max, height},&#xD;
		min = #[[1]];&#xD;
		max = #[[2]];&#xD;
		height = ImageDimensions[extracted][[2]];&#xD;
		{{min, 1}, {min, height}, {max, height}, {max, 1}}&#xD;
	]&amp;amp;,&#xD;
	allX&#xD;
];&#xD;
HighlightImage[extracted, {Red, squaresX}]&#xD;
```&#xD;
&#xD;
![enter image description here][9]&#xD;
&#xD;
![enter image description here][10]&#xD;
&#xD;
![enter image description here][11]&#xD;
&#xD;
![enter image description here][12]&#xD;
&#xD;
![enter image description here][13]&#xD;
&#xD;
# Second approach #&#xD;
&#xD;
The next approach was to use machine learning to obtain the values of the resistors. Several samples were made taking pictures from resistors on a white background, making sure they had different positions and angles. However, the training was taking too long and causing the Mathematica program to crash. Later it was concluded that the results would improve if the resistor in the photo was cropped, removing several pixels without any information the total memory needed to process the images would be lower.&#xD;
&#xD;
For cropping the resistor from the photo, the following was made:&#xD;
&#xD;
* Pass the photo through ImageAdjust and BrightnessEqualize rise the contrast and remove shadows from the image. &#xD;
* Used the function RemoveBackground to obtain from the alpha channel a mask that would separate the resistor from the background.&#xD;
* Erode said mask, so the wires in the resistor are eliminated from the mask.&#xD;
* Use RegionBinarize to recover the parts of the resistor that were removed from the mask.&#xD;
* Obtain the minimal bounding box and orientation angle from this resistor mask.&#xD;
* Rotate and crop the image according with the previous values.&#xD;
&#xD;
```&#xD;
resistorCrop[image_] := Module[&#xD;
	{preprocess, angle, rotated, newPoints, allX, allY, minX, minY, maxX, maxY, processed, adjusted},&#xD;
	adjusted = ImageAdjust @ BrightnessEqualize[image];&#xD;
	preprocess = SelectComponents[Erosion[AlphaChannel[RemoveBackground[adjusted]],10],&amp;#034;Count&amp;#034;,-1];&#xD;
	preprocess = RegionBinarize[adjusted,preprocess,0.15];&#xD;
	processed = MorphologicalComponents[preprocess];&#xD;
	angle = First @ Values[&#xD;
		ComponentMeasurements[processed, &amp;#034;Orientation&amp;#034;]&#xD;
	];&#xD;
	rotated = ImageRotate[image, -angle, Masking-&amp;gt;Full];&#xD;
	newPoints = First @ Values[ComponentMeasurements[processed, &amp;#034;MinimalBoundingBox&amp;#034;]];&#xD;
	newPoints = RotationTransform[-angle,ImageDimensions[image]/2][newPoints];&#xD;
	newPoints = TranslationTransform[(ImageDimensions[rotated] - ImageDimensions[image])/2][newPoints];&#xD;
	allX = newPoints[[All, 1]];&#xD;
	allY = newPoints[[All, 2]];&#xD;
	minX = Min[allX];&#xD;
	minY = Min[allY];&#xD;
	maxX = Max[allX];&#xD;
	maxY = Max[allY];&#xD;
	ImageTake[rotated, Ramp[ImageDimensions[rotated][[2]]-{maxY, minY}],{minX,maxX}]&#xD;
]&#xD;
```&#xD;
&#xD;
From this function the samples would be cropped to allow the training to run faster. Some images were not cropped correctly and had to be removed. &#xD;
&#xD;
This method can not be used for the final product though, as it takes too much time to filter the images for cropping. One way to make a faster method is to rescale the initial image smaller before obtaining the mask and at the end rescale the cropping coordinates accordingly, reducing the total pixels the program would work on. Naturally this method is less precise.&#xD;
&#xD;
```&#xD;
resistorLightCrop[image_] := Module[&#xD;
	{preprocess, angle, rotated, newPoints, allX, allY, minX, minY, maxX, maxY, processed, adjusted, resized, prop, fullRotated},&#xD;
	resized = ImageResize[image, {500}];&#xD;
	prop = ImageDimensions[image][[1]] / ImageDimensions[resized][[1]];&#xD;
	adjusted = ImageAdjust @ BrightnessEqualize[resized];&#xD;
	preprocess = SelectComponents[Erosion[AlphaChannel[RemoveBackground[adjusted]],10 / prop],&amp;#034;Count&amp;#034;,-1];&#xD;
	preprocess = RegionBinarize[adjusted,preprocess,0.15];&#xD;
	processed = MorphologicalComponents[preprocess];&#xD;
	angle = First @ Values[&#xD;
		ComponentMeasurements[processed, &amp;#034;Orientation&amp;#034;]&#xD;
	];&#xD;
	rotated = ImageRotate[resized, -angle, Masking-&amp;gt;Full];&#xD;
	newPoints = First @ Values[ComponentMeasurements[processed, &amp;#034;MinimalBoundingBox&amp;#034;]];&#xD;
	newPoints = RotationTransform[-angle,ImageDimensions[resized]/2][newPoints];&#xD;
	newPoints = TranslationTransform[(ImageDimensions[rotated] - ImageDimensions[resized])/2][newPoints];&#xD;
	allX = newPoints[[All, 1]];&#xD;
	allY = newPoints[[All, 2]];&#xD;
	minX = Min[allX];&#xD;
	minY = Min[allY];&#xD;
	maxX = Max[allX];&#xD;
	maxY = Max[allY];&#xD;
	fullRotated = ImageRotate[image, -angle, Masking-&amp;gt;Full];&#xD;
	ImageTake[fullRotated, Ramp[ImageDimensions[fullRotated][[2]]-{maxY * prop, minY * prop}],{minX * prop,maxX * prop}]&#xD;
]&#xD;
SetDirectory[NotebookDirectory[]];&#xD;
DumpSave[&amp;#034;resistorLightCrop.mx&amp;#034;, resistorLightCrop];&#xD;
ResetDirectory[];&#xD;
```&#xD;
&#xD;
Once the images of the dataset are loaded we need to create the training set and the test set.&#xD;
&#xD;
As the cropping method used in the training is more accurate than the one used for the final product, adding noise to the samples is needed to improve the results. This is because the method used has shown to fail sometimes in rotating the resistor in a horizontal position, especially if the wires in the resistor are bended, so more samples were the resistor is rotated to random angles were added to make the Classifier be prepared if the cropping function fails to make the rotation. Also, blurry samples using a GaussianFilter were added, to compensate loss of focus in that can be done in the photo. As for the Classifier method, a simple Classify function with a quality performance goal is used because it gave better results than forcing it to be a neural network or using a Predict function.&#xD;
&#xD;
```&#xD;
newBlurry[data_, n_] :=&#xD;
Module[&#xD;
	{toBlur},&#xD;
	toBlur = RandomSample[data, n];&#xD;
	toBlur/.(x_-&amp;gt;y_):&amp;gt;GaussianFilter[x,15]-&amp;gt;y&#xD;
]&#xD;
```&#xD;
&#xD;
```&#xD;
newRotated[data_, n_] := &#xD;
Module[&#xD;
	{toRotate},&#xD;
	toRotate = RandomSample[data, n];&#xD;
	toRotate/.(x_-&amp;gt;y_):&amp;gt;ImageRotate[x,RandomReal[{0, \[Pi]}], Masking-&amp;gt;Full]-&amp;gt;y&#xD;
]&#xD;
```&#xD;
&#xD;
```&#xD;
newBlurry[trainingSet, 1]&#xD;
```&#xD;
&#xD;
![enter image description here][14]&#xD;
&#xD;
```&#xD;
newRotated[trainingSet, 1]&#xD;
```&#xD;
&#xD;
![enter image description here][15]&#xD;
&#xD;
This improved not only the accuracy for the given samples, but also the results on the final product.&#xD;
&#xD;
```&#xD;
cNoParameters = Classify[trainingSet, PerformanceGoal-&amp;gt;&amp;#034;Quality&amp;#034;]&#xD;
```&#xD;
&#xD;
![enter image description here][16]&#xD;
&#xD;
```&#xD;
ClassifierInformation[cNoParameters]&#xD;
```&#xD;
&#xD;
![enter image description here][17]&#xD;
&#xD;
```&#xD;
cNoParametersM = ClassifierMeasurements[cNoParameters, testSet]&#xD;
```&#xD;
&#xD;
![enter image description here][18]&#xD;
&#xD;
```&#xD;
cNoParametersM[&amp;#034;ConfusionMatrixPlot&amp;#034;]&#xD;
```&#xD;
&#xD;
![enter image description here][19]&#xD;
&#xD;
&#xD;
Trying other methods did not give better results&#xD;
&#xD;
```&#xD;
cNeuralNet = Classify[trainingSet, Method-&amp;gt;&amp;#034;NeuralNetwork&amp;#034;, PerformanceGoal-&amp;gt;&amp;#034;Quality&amp;#034;, FeatureExtractor-&amp;gt;&amp;#034;ImageFeatures&amp;#034;];&#xD;
cNeuralNetM = ClassifierMeasurements[cNeuralNet, testSet]&#xD;
```&#xD;
![enter image description here][20]&#xD;
&#xD;
```&#xD;
cNeuralNetM[&amp;#034;ConfusionMatrixPlot&amp;#034;]&#xD;
```&#xD;
&#xD;
![enter image description here][21]&#xD;
&#xD;
# Microsite link #&#xD;
&#xD;
https://wolfr.am/mUtXyBEe&#xD;
&#xD;
# Code #&#xD;
&#xD;
https://github.com/carolinadp/WSS2017&#xD;
&#xD;
# References #&#xD;
&#xD;
\[1] Mitani Y., Sugimura Y., Hamamoto Y. (2008) A Method for Reading a Resistor by Image Processing Techniques. In: Lovrek I., Howlett R.J., Jain L.C. (eds) Knowledge-Based Intelligent Information and Engineering Systems. KES 2008. Lecture Notes in Computer Science, vol 5177. Springer, Berlin, Heidelberg&#xD;
&#xD;
\[2] Otsu N. A Threshold Selection Method from Gray-Level Histograms. IEEE Transactions on Systems, Man and Cybernetics. 1979&#xD;
&#xD;
  [1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=teaserImage.png&amp;amp;userId=1092998&#xD;
  [2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img1.png&amp;amp;userId=1092998&#xD;
  [3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img3.png&amp;amp;userId=1092998&#xD;
  [4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img4.png&amp;amp;userId=1092998&#xD;
  [5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img5.png&amp;amp;userId=1092998&#xD;
  [6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img6.png&amp;amp;userId=1092998&#xD;
  [7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img7.png&amp;amp;userId=1092998&#xD;
  [8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img8.png&amp;amp;userId=1092998&#xD;
  [9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img9.png&amp;amp;userId=1092998&#xD;
  [10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img10.png&amp;amp;userId=1092998&#xD;
  [11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img11.png&amp;amp;userId=1092998&#xD;
  [12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img12.png&amp;amp;userId=1092998&#xD;
  [13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img13.png&amp;amp;userId=1092998&#xD;
  [14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img14.png&amp;amp;userId=1092998&#xD;
  [15]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img15.png&amp;amp;userId=1092998&#xD;
  [16]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at4.54.44PM.png&amp;amp;userId=1092998&#xD;
  [17]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at4.56.40PM.png&amp;amp;userId=1092998&#xD;
  [18]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at5.00.28PM.png&amp;amp;userId=1092998&#xD;
  [19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img16.png&amp;amp;userId=1092998&#xD;
  [20]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ScreenShot2017-07-05at5.08.42PM.png&amp;amp;userId=1092998&#xD;
  [21]: http://community.wolfram.com//c/portal/getImageAttachment?filename=img17.png&amp;amp;userId=1092998</description>
    <dc:creator>Itzel Delgadillo Perez</dc:creator>
    <dc:date>2017-07-05T19:14:05Z</dc:date>
  </item>
</rdf:RDF>

