Spaces:
Runtime error
Runtime error
Bradley Gathers
commited on
Commit
•
935240e
1
Parent(s):
7419442
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
+
# Feature Visualization Generator UI
|
2 |
+
|
3 |
+
[![Python][Python-badge]][Python-url]
|
4 |
+
[![Pytorch][Pytorch-badge]][Pytorch-url]
|
5 |
+
|
6 |
+
A Feature Visualization (FV) generator UI. Utilizes the Gradio web framework in conjunction with the [Lucent](https://github.com/greentfrapp/lucent) (Pytorch [Lucid](https://github.com/tensorflow/lucid) framework. Aimed to help others through experiential learning, allowing them to explore different input parameters and settings and quickly see their effects.
|
7 |
+
|
8 |
+
Concepts that are used in the FV generation process such as [Channel Decorrelation and Spatial Decorelation](https://distill.pub/2017/feature-visualization/#d-footnote-8:~:text=the%20training%20data.-,Preconditioning%20and%20Parameterization,-In%20the%20previous) are discussed in the Google Brain Feature Visualization article ([Olah, et al.](https://distill.pub/2017/feature-visualization/))
|
9 |
+
|
10 |
+
Tested layers are Conv2D (Convolutional Layer) and Linear layers. Feel free to experiment, I can not guarantee that they will optimize correctly.
|
11 |
+
|
12 |
+
<!-- TABLE OF CONTENTS -->
|
13 |
+
<details>
|
14 |
+
<summary>Table of Contents</summary>
|
15 |
+
<ol>
|
16 |
+
<li>
|
17 |
+
<a href="#about-the-code">About The Code</a>
|
18 |
+
</li>
|
19 |
+
<li>
|
20 |
+
<a href="#getting-started">Getting Started</a>
|
21 |
+
<ul>
|
22 |
+
<li><a href="#prerequisites">Prerequisites</a></li>
|
23 |
+
<li><a href="#installation">Installation</a></li>
|
24 |
+
</ul>
|
25 |
+
</li>
|
26 |
+
<li>
|
27 |
+
<a href="#usage">Usage</a>
|
28 |
+
<ul>
|
29 |
+
<li><a href="#html-launch">HTML launch</a></li>
|
30 |
+
</ul>
|
31 |
+
</li>
|
32 |
+
</ol>
|
33 |
+
</details>
|
34 |
+
|
35 |
+
### Try it out here! --> --Insert huggingface space here--
|
36 |
+
|
37 |
+
![image](https://github.com/baxtrax/Model-Visualizer/assets/34373485/5c358087-00bb-4bb6-a699-123999ceb367)
|
38 |
+
|
39 |
+
<!-- Improved compatibility of back to top link: See: https://github.com/othneildrew/Best-README-Template/pull/73 -->
|
40 |
+
<a name="readme-top"></a>
|
41 |
+
|
42 |
+
<!-- ABOUT THE CODE-->
|
43 |
+
## About The Code
|
44 |
+
|
45 |
+
The javascript code that runs this website is broken into specific modules to help with readiblity.
|
46 |
+
|
47 |
+
* [canvas.js](scripts/canvas.js)
|
48 |
+
* Drawing the lines connecting each button
|
49 |
+
* Updating the canvas
|
50 |
+
* Button creation / tree traversal
|
51 |
+
* Button navigation
|
52 |
+
* Button attractions
|
53 |
+
* [interactions.js](scripts/interactions.js)
|
54 |
+
* Model input
|
55 |
+
* Model input interaction
|
56 |
+
* Orchastraction of the creation and visualization of the new model
|
57 |
+
* [modelparser.js](scripts/modelparser.js)
|
58 |
+
* Parses pytorch print model input string into a tree data structure (Via. regex)
|
59 |
+
* Cleaning up string input
|
60 |
+
* [tree.js](scripts/tree.js)
|
61 |
+
* Tree data structure used to store the model and navigate through
|
62 |
+
|
63 |
+
> All javascript files are located in the [scripts](scripts) folder.
|
64 |
+
|
65 |
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
66 |
+
|
67 |
+
<!-- GETTING STARTED -->
|
68 |
+
## Getting Started
|
69 |
+
To get a local copy up and running follow these simple steps.
|
70 |
+
|
71 |
+
### Prerequisites
|
72 |
+
|
73 |
+
Make sure to have these setup/installed at a minimum
|
74 |
+
* A modern browser that supports javascript
|
75 |
+
|
76 |
+
(Optional)
|
77 |
+
* A printed pytorch model output to test with
|
78 |
+
* This can be achieved by loading up a pytorch model and printing the model with
|
79 |
+
```python
|
80 |
+
print(<model variable here>)
|
81 |
+
```
|
82 |
+
* I will not be going into detail on how to do this as it is out of the scope of this repo.
|
83 |
+
|
84 |
+
### Installation
|
85 |
+
|
86 |
+
1. Clone the repo
|
87 |
+
```sh
|
88 |
+
git clone git@github.com:baxtrax/Model-Visualizer.git
|
89 |
+
```
|
90 |
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
91 |
+
|
92 |
+
<!-- USAGE EXAMPLES -->
|
93 |
+
## Usage
|
94 |
+
### HTML launch
|
95 |
+
Open the [index.html](index.html) file with a browser or deploy the website with a website deployment software.
|
96 |
+
|
97 |
+
I personally used the VScode extension `Live Server` for local development.
|
98 |
+
|
99 |
+
<p align="right">(<a href="#readme-top">back to top</a>)</p>
|
100 |
+
|
101 |
+
|
102 |
+
<!-- MARKDOWN LINKS & IMAGES -->
|
103 |
+
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
|
104 |
+
[Python-badge]: https://img.shields.io/badge/Python-3776AB.svg?style=for-the-badge&logo=python&logoColor=FFD343
|
105 |
+
[Python-url]: https://www.python.org/
|
106 |
+
[Pytorch-badge]: https://img.shields.io/badge/Pytorch-EE4C2C.svg?style=for-the-badge&logo=pytorch&logoColor=white
|
107 |
+
[Pytorch-url]: https://pytorch.org/
|
108 |
+
|
109 |
+
|
110 |
version https://git-lfs.github.com/spec/v1
|
111 |
+
oid sha256:8f318c9b980e22dbbcab1dc2c6344e36e3a8c6e9cfa9d7410ed9a798da7b2da1
|
112 |
+
size 137
|