visualtorch 0.1__tar.gz → 0.1.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: visualtorch
3
- Version: 0.1
3
+ Version: 0.1.1
4
4
  Summary: Architecture visualization of Torch models
5
5
  Home-page: https://github.com/willyfh/visualtorch
6
6
  Author: Willy Fitra Hendria
@@ -9,13 +9,9 @@ Keywords: visualize architecture,torch visualization,visualtorch
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.6
12
+ Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: pillow>=10.0.0
16
- Requires-Dist: numpy>=1.18.1
17
- Requires-Dist: aggdraw>=1.3.11
18
- Requires-Dist: torch>=2.0.0
19
15
 
20
16
  # ⭐ VisualTorch ⭐
21
17
 
@@ -25,13 +21,13 @@ Requires-Dist: torch>=2.0.0
25
21
 
26
22
  ## Installation
27
23
 
28
- ### Install from PyPI
24
+ ### Install from PyPI (Latest release)
29
25
 
30
26
  ```bash
31
27
  pip install visualtorch
32
28
  ```
33
29
 
34
- ### Install from source (latest)
30
+ ### Install from source
35
31
 
36
32
  ```bash
37
33
  pip install git+https://github.com/willyfh/visualtorch
@@ -39,11 +35,13 @@ pip install git+https://github.com/willyfh/visualtorch
39
35
 
40
36
  ## Usage
41
37
 
38
+ ### Display with Legend
39
+
42
40
  ```python
43
41
  import visualtorch
44
42
  import torch.nn as nn
45
43
 
46
- # Example of aa simple CNN model using nn.Sequential
44
+ # Example of a simple CNN model using nn.Sequential
47
45
  model = nn.Sequential(
48
46
  nn.Conv2d(3, 16, kernel_size=3, padding=1),
49
47
  nn.ReLU(),
@@ -61,13 +59,46 @@ model = nn.Sequential(
61
59
  )
62
60
 
63
61
  input_shape = (1, 3, 224, 224)
62
+
64
63
  visualtorch.layered_view(model, input_shape=input_shape, legend=True).show() # display using your system viewer
65
- visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png') # write to disk
66
- visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png').show() # write and show
67
64
  ```
68
65
 
69
66
  ![simple-cnn](https://github.com/willyfh/visualtorch/assets/5786636/9b646fac-c336-4253-ac01-8f3e6b2fcc0b)
70
67
 
68
+ ### Save the Image
69
+
70
+ ```python
71
+ visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png')
72
+ ```
73
+
74
+ ### 2D View
75
+
76
+ ```python
77
+ visualtorch.layered_view(model, input_shape=input_shape, draw_volume=False)
78
+ ```
79
+
80
+ ![2d-view](https://github.com/willyfh/visualtorch/assets/5786636/5b16c252-f589-4b3f-8ea4-1bc188e6c124)
81
+
82
+ ### Custom Color
83
+
84
+ Use 'fill' to change the color of the layer, and use 'outline' to change the color of the lines.
85
+
86
+ ```python
87
+ from collections import defaultdict
88
+
89
+ color_map = defaultdict(dict)
90
+ color_map[nn.Conv2d]['fill'] = '#FF6F61' # Coral red
91
+ color_map[nn.ReLU]['fill'] = 'skyblue'
92
+ color_map[nn.MaxPool2d]['fill'] = '#88B04B' # Sage green
93
+ color_map[nn.Flatten]['fill'] = 'gold'
94
+ color_map[nn.Linear]['fill'] = '#6B5B95' # Royal purple
95
+
96
+ input_shape = (1, 3, 224, 224)
97
+ visualtorch.layered_view(model, input_shape=input_shape, color_map=color_map
98
+ ```
99
+
100
+ ![custom-color](https://github.com/willyfh/visualtorch/assets/5786636/57f28191-d86e-4419-a015-f5fc7fa17b5a)
101
+
71
102
  ## Contributing
72
103
 
73
104
  Please feel free to send a pull request to contribute to this project.
@@ -77,3 +108,18 @@ Please feel free to send a pull request to contribute to this project.
77
108
  This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/update-readme/LICENSE).
78
109
 
79
110
  Originally, this project was based on the [visualkeras](https://github.com/paulgavrikov/visualkeras) (under the MIT license).
111
+
112
+ ## Citation
113
+
114
+ Please cite this project in your publications if it helps your research as follows:
115
+
116
+ ```bibtex
117
+ @misc{Hendria2024VisualTorch,
118
+ author = {Hendria, Willy Fitra},
119
+ title = {visualtorch},
120
+ year = {2024},
121
+ publisher = {GitHub},
122
+ journal = {GitHub repository},
123
+ note = {\url{https://github.com/willyfh/visualtorch}},
124
+ }
125
+ ```
@@ -6,13 +6,13 @@
6
6
 
7
7
  ## Installation
8
8
 
9
- ### Install from PyPI
9
+ ### Install from PyPI (Latest release)
10
10
 
11
11
  ```bash
12
12
  pip install visualtorch
13
13
  ```
14
14
 
15
- ### Install from source (latest)
15
+ ### Install from source
16
16
 
17
17
  ```bash
18
18
  pip install git+https://github.com/willyfh/visualtorch
@@ -20,11 +20,13 @@ pip install git+https://github.com/willyfh/visualtorch
20
20
 
21
21
  ## Usage
22
22
 
23
+ ### Display with Legend
24
+
23
25
  ```python
24
26
  import visualtorch
25
27
  import torch.nn as nn
26
28
 
27
- # Example of aa simple CNN model using nn.Sequential
29
+ # Example of a simple CNN model using nn.Sequential
28
30
  model = nn.Sequential(
29
31
  nn.Conv2d(3, 16, kernel_size=3, padding=1),
30
32
  nn.ReLU(),
@@ -42,13 +44,46 @@ model = nn.Sequential(
42
44
  )
43
45
 
44
46
  input_shape = (1, 3, 224, 224)
47
+
45
48
  visualtorch.layered_view(model, input_shape=input_shape, legend=True).show() # display using your system viewer
46
- visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png') # write to disk
47
- visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png').show() # write and show
48
49
  ```
49
50
 
50
51
  ![simple-cnn](https://github.com/willyfh/visualtorch/assets/5786636/9b646fac-c336-4253-ac01-8f3e6b2fcc0b)
51
52
 
53
+ ### Save the Image
54
+
55
+ ```python
56
+ visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png')
57
+ ```
58
+
59
+ ### 2D View
60
+
61
+ ```python
62
+ visualtorch.layered_view(model, input_shape=input_shape, draw_volume=False)
63
+ ```
64
+
65
+ ![2d-view](https://github.com/willyfh/visualtorch/assets/5786636/5b16c252-f589-4b3f-8ea4-1bc188e6c124)
66
+
67
+ ### Custom Color
68
+
69
+ Use 'fill' to change the color of the layer, and use 'outline' to change the color of the lines.
70
+
71
+ ```python
72
+ from collections import defaultdict
73
+
74
+ color_map = defaultdict(dict)
75
+ color_map[nn.Conv2d]['fill'] = '#FF6F61' # Coral red
76
+ color_map[nn.ReLU]['fill'] = 'skyblue'
77
+ color_map[nn.MaxPool2d]['fill'] = '#88B04B' # Sage green
78
+ color_map[nn.Flatten]['fill'] = 'gold'
79
+ color_map[nn.Linear]['fill'] = '#6B5B95' # Royal purple
80
+
81
+ input_shape = (1, 3, 224, 224)
82
+ visualtorch.layered_view(model, input_shape=input_shape, color_map=color_map
83
+ ```
84
+
85
+ ![custom-color](https://github.com/willyfh/visualtorch/assets/5786636/57f28191-d86e-4419-a015-f5fc7fa17b5a)
86
+
52
87
  ## Contributing
53
88
 
54
89
  Please feel free to send a pull request to contribute to this project.
@@ -58,3 +93,18 @@ Please feel free to send a pull request to contribute to this project.
58
93
  This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/update-readme/LICENSE).
59
94
 
60
95
  Originally, this project was based on the [visualkeras](https://github.com/paulgavrikov/visualkeras) (under the MIT license).
96
+
97
+ ## Citation
98
+
99
+ Please cite this project in your publications if it helps your research as follows:
100
+
101
+ ```bibtex
102
+ @misc{Hendria2024VisualTorch,
103
+ author = {Hendria, Willy Fitra},
104
+ title = {visualtorch},
105
+ year = {2024},
106
+ publisher = {GitHub},
107
+ journal = {GitHub repository},
108
+ note = {\url{https://github.com/willyfh/visualtorch}},
109
+ }
110
+ ```
File without changes
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="visualtorch",
8
- version="0.1",
8
+ version="0.1.1",
9
9
  author="Willy Fitra Hendria",
10
10
  author_email="willyfitrahendria@gmail.com",
11
11
  description="Architecture visualization of Torch models",
@@ -25,5 +25,5 @@ setuptools.setup(
25
25
  "aggdraw>=1.3.11",
26
26
  "torch>=2.0.0",
27
27
  ],
28
- python_requires=">=3.6",
28
+ python_requires=">=3.10",
29
29
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: visualtorch
3
- Version: 0.1
3
+ Version: 0.1.1
4
4
  Summary: Architecture visualization of Torch models
5
5
  Home-page: https://github.com/willyfh/visualtorch
6
6
  Author: Willy Fitra Hendria
@@ -9,13 +9,9 @@ Keywords: visualize architecture,torch visualization,visualtorch
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.6
12
+ Requires-Python: >=3.10
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: pillow>=10.0.0
16
- Requires-Dist: numpy>=1.18.1
17
- Requires-Dist: aggdraw>=1.3.11
18
- Requires-Dist: torch>=2.0.0
19
15
 
20
16
  # ⭐ VisualTorch ⭐
21
17
 
@@ -25,13 +21,13 @@ Requires-Dist: torch>=2.0.0
25
21
 
26
22
  ## Installation
27
23
 
28
- ### Install from PyPI
24
+ ### Install from PyPI (Latest release)
29
25
 
30
26
  ```bash
31
27
  pip install visualtorch
32
28
  ```
33
29
 
34
- ### Install from source (latest)
30
+ ### Install from source
35
31
 
36
32
  ```bash
37
33
  pip install git+https://github.com/willyfh/visualtorch
@@ -39,11 +35,13 @@ pip install git+https://github.com/willyfh/visualtorch
39
35
 
40
36
  ## Usage
41
37
 
38
+ ### Display with Legend
39
+
42
40
  ```python
43
41
  import visualtorch
44
42
  import torch.nn as nn
45
43
 
46
- # Example of aa simple CNN model using nn.Sequential
44
+ # Example of a simple CNN model using nn.Sequential
47
45
  model = nn.Sequential(
48
46
  nn.Conv2d(3, 16, kernel_size=3, padding=1),
49
47
  nn.ReLU(),
@@ -61,13 +59,46 @@ model = nn.Sequential(
61
59
  )
62
60
 
63
61
  input_shape = (1, 3, 224, 224)
62
+
64
63
  visualtorch.layered_view(model, input_shape=input_shape, legend=True).show() # display using your system viewer
65
- visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png') # write to disk
66
- visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png').show() # write and show
67
64
  ```
68
65
 
69
66
  ![simple-cnn](https://github.com/willyfh/visualtorch/assets/5786636/9b646fac-c336-4253-ac01-8f3e6b2fcc0b)
70
67
 
68
+ ### Save the Image
69
+
70
+ ```python
71
+ visualtorch.layered_view(model, input_shape=input_shape, legend=True, to_file='output.png')
72
+ ```
73
+
74
+ ### 2D View
75
+
76
+ ```python
77
+ visualtorch.layered_view(model, input_shape=input_shape, draw_volume=False)
78
+ ```
79
+
80
+ ![2d-view](https://github.com/willyfh/visualtorch/assets/5786636/5b16c252-f589-4b3f-8ea4-1bc188e6c124)
81
+
82
+ ### Custom Color
83
+
84
+ Use 'fill' to change the color of the layer, and use 'outline' to change the color of the lines.
85
+
86
+ ```python
87
+ from collections import defaultdict
88
+
89
+ color_map = defaultdict(dict)
90
+ color_map[nn.Conv2d]['fill'] = '#FF6F61' # Coral red
91
+ color_map[nn.ReLU]['fill'] = 'skyblue'
92
+ color_map[nn.MaxPool2d]['fill'] = '#88B04B' # Sage green
93
+ color_map[nn.Flatten]['fill'] = 'gold'
94
+ color_map[nn.Linear]['fill'] = '#6B5B95' # Royal purple
95
+
96
+ input_shape = (1, 3, 224, 224)
97
+ visualtorch.layered_view(model, input_shape=input_shape, color_map=color_map
98
+ ```
99
+
100
+ ![custom-color](https://github.com/willyfh/visualtorch/assets/5786636/57f28191-d86e-4419-a015-f5fc7fa17b5a)
101
+
71
102
  ## Contributing
72
103
 
73
104
  Please feel free to send a pull request to contribute to this project.
@@ -77,3 +108,18 @@ Please feel free to send a pull request to contribute to this project.
77
108
  This poject is available as open source under the terms of the [MIT License](https://github.com/willyfh/visualtorch/blob/update-readme/LICENSE).
78
109
 
79
110
  Originally, this project was based on the [visualkeras](https://github.com/paulgavrikov/visualkeras) (under the MIT license).
111
+
112
+ ## Citation
113
+
114
+ Please cite this project in your publications if it helps your research as follows:
115
+
116
+ ```bibtex
117
+ @misc{Hendria2024VisualTorch,
118
+ author = {Hendria, Willy Fitra},
119
+ title = {visualtorch},
120
+ year = {2024},
121
+ publisher = {GitHub},
122
+ journal = {GitHub repository},
123
+ note = {\url{https://github.com/willyfh/visualtorch}},
124
+ }
125
+ ```