-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement LeNet Style Visualization (#38)
* Add pyproject.toml and fix ruff issues * open file using Path * fix ruff issues * Add lenet style visualization * add docs for lenet style * add usage example for lenet style * fix usage example for LeNet style * Add LeNet style
- Loading branch information
Showing
9 changed files
with
410 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
============ | ||
LeNet Style | ||
============ | ||
|
||
These examples cover LeNet style visualization |
26 changes: 26 additions & 0 deletions
26
docs/examples/lenet_style/plot_basic_sequential_lenet_style.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""LeNet Style Basic Sequential | ||
======================================= | ||
Visualization of basic custom model | ||
""" # noqa: D205 | ||
|
||
import matplotlib.pyplot as plt | ||
import visualtorch | ||
from torch import nn | ||
|
||
# Example of a simple CNN model using nn.Sequential | ||
model = nn.Sequential( | ||
nn.Conv2d(3, 8, kernel_size=3, padding=1), | ||
nn.MaxPool2d(2, 2), | ||
nn.Conv2d(8, 16, kernel_size=3, padding=1), | ||
nn.MaxPool2d(2, 2), | ||
) | ||
|
||
input_shape = (1, 3, 128, 128) | ||
|
||
img = visualtorch.lenet_view(model, input_shape=input_shape) | ||
|
||
plt.axis("off") | ||
plt.tight_layout() | ||
plt.imshow(img) | ||
plt.show() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# LeNet Style View | ||
|
||
```{eval-rst} | ||
.. automodule:: visualtorch.lenet_style | ||
:members: | ||
:show-inheritance: | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.