
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
GradientVis is a Python library designed for visualizing neural network gradients, aimed at helping researchers and developers better interpret the inner workings of deep learning models. It includes various gradient visualization methods such as GradCAM, SmoothGrad, and Integrated Gradients to make model interpretation easier.
You can install gradientvis
via pip directly from the repository:
pip install gradientvis
from gradientvis.methods.gradcam import GradCAM
from gradientvis.utils.preprocessing import preprocess_image
# Load your model (e.g., a CNN)
model = ...
# Preprocess your input image
image = preprocess_image("path_to_your_image.jpg")
# Generate GradCAM visualization
gradcam = GradCAM(model, model.layer4) # Specify the target layer
cam = gradcam.generate(image, class_idx=0)
# Display the results
import matplotlib.pyplot as plt
plt.imshow(cam, cmap='jet')
plt.show()
from gradientvis.methods.smoothgrad import SmoothGrad
from gradientvis.utils.preprocessing import preprocess_image
# Load your model and image
model = ...
image = preprocess_image("path_to_your_image.jpg")
# Generate SmoothGrad visualization
smoothgrad = SmoothGrad(model)
grad = smoothgrad.generate(image, class_idx=0)
# Display the results
import matplotlib.pyplot as plt
plt.imshow(grad, cmap='jet')
plt.show()
from gradientvis.methods.integrated_gradients import IntegratedGradients
from gradientvis.utils.preprocessing import preprocess_image
# Load your model and image
model = ...
image = preprocess_image("path_to_your_image.jpg")
# Generate Integrated Gradients visualization
integrated_gradients = IntegratedGradients(model)
integrated_grad = integrated_gradients.generate(image, class_idx=0)
# Display the results
import matplotlib.pyplot as plt
plt.imshow(integrated_grad, cmap='jet')
plt.show()
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
A library for visualizing neural network gradients
We found that gradientvis demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.