Skip to content

Commit

Permalink
change bias unit display in FCNN layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Lenail committed May 10, 2018
1 parent 77682b3 commit c357b50
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
10 changes: 10 additions & 0 deletions AlexNet.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<html xmlns="https://www.w3.org/1999/xhtml">

<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-119008715-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-119008715-1');
</script>

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

Expand Down
10 changes: 10 additions & 0 deletions LeNet.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<html xmlns="https://www.w3.org/1999/xhtml">

<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-119008715-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-119008715-1');
</script>

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,3 @@ In the future I'd like to have three layouts:
- [x] Conventional FCNN layout
- [x] [LeNet CNN layout](https://www.pyimagesearch.com/wp-content/uploads/2016/06/lenet_architecture.png)
- [x] [AlexNet layout](https://www.mdpi.com/remotesensing/remotesensing-09-00848/article_deploy/html/images/remotesensing-09-00848-g001.png) (via webGL)


<!-- TODO: AlexNet
- Dense layers
- Download SVG
-->
10 changes: 10 additions & 0 deletions about.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
<html xmlns="https://www.w3.org/1999/xhtml">

<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-119008715-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-119008715-1');
</script>

<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
Expand Down
27 changes: 15 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
<html xmlns="https://www.w3.org/1999/xhtml">

<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-119008715-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'UA-119008715-1');
</script>


<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>

Expand Down Expand Up @@ -150,7 +161,6 @@ <h4>Style:</h4>
</div>
<div id="nnDirection">
<label for="nnDirection" style="margin-right:10px;">Direction</label>
<!-- <input type="range" id="nnDirection" name="" min="30" max="400" step="1" value="100" style="position: relative; top: 3px;"> -->
<div class="form-check form-check-inline">
<label class="form-check-label">
<input class="form-check-input" type="radio" name="nnDirection" id="horizontal" value="right" checked> horizontal
Expand All @@ -163,7 +173,7 @@ <h4>Style:</h4>
</div>
</div>
<div>
<input type="checkbox" id="showBias" name="showBias" value="showBias" checked>
<input type="checkbox" id="showBias" name="showBias" value="showBias">
<label for="showBias">Show Bias Units</label>
</div>
<div>
Expand Down Expand Up @@ -218,13 +228,8 @@ <h4>Architecture:</h4>
<hr>
<button type="button" class="btn btn-sm btn-secondary" id="newRandomWeights">New Random Weights</button>



</div>
<div class="tab-pane fade" id="LeNet" role="tabpanel">
</div>
<div class="tab-pane fade" id="AlexNet" role="tabpanel">
</div>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -304,11 +309,10 @@ <h4>Architecture:</h4>
var layer_offsets = [];
var largest_layer_width = 0;
var nnDirection = 'right'
var showBias = true;
var showBias = false;

var showLabels = true;
let sup = (s) => s.replace('0','⁰').replace('1','¹').replace('2','²').replace('3','³').replace('4','⁴').replace('5','⁵').replace('6','⁶').replace('7','⁷').replace('8','⁸').replace('9','⁹')
// let sup = (s) => s
let textFn = (layer_index, layer_width) => ((layer_index === 0 ? "Input" : (layer_index === architecture.length-1 ? "Output" : "Hidden")) + " Layer ∈ ℝ" + sup(layer_width.toString()));
var nominal_text_size = 12;
var textWidth = 70;
Expand All @@ -326,10 +330,9 @@ <h4>Architecture:</h4>
architecture = $('#architecture').find('input[name="numberOfNodes"]').map((i,el) => $(el).val()).get().filter(input => $.isNumeric(input)).map(s => parseInt(s));

graph.nodes = architecture.map((layer_width, layer_index) => range(layer_width).map(node_index => {return {'id':layer_index+'_'+node_index,'layer':layer_index,'node_index':node_index}}));
if (showBias) { graph.nodes = graph.nodes.map((layer, layer_index) => (layer_index < architecture.length-1 ? [{'id':layer_index+'_-1','layer':layer_index,'node_index':-1}].concat(layer) : layer) ); }
graph.links = pairWise(graph.nodes).map((nodes) => nodes[0].map(left => nodes[1].map(right => {return right.node_index >= 0 ? {'source':left.id,'target':right.id,'weight':randomWeight()} : {} })));
graph.nodes = flatten(graph.nodes);
graph.links = flatten(graph.links).filter(l => Object.keys(l).length > 0);
graph.links = flatten(graph.links).filter(l => (Object.keys(l).length > 0 && (showBias ? (parseInt(l['target'].split('_')[0]) !== architecture.length-1 ? (l['target'].split('_')[1] !== '0') : true) : true)));

label = architecture.map((layer_width, layer_index) => { return {'id':'layer_'+layer_index+'_label','layer':layer_index,'text':textFn(layer_index, layer_width)}});

Expand Down

0 comments on commit c357b50

Please sign in to comment.