Comments (4)
Hello @wpumain,
Assuming that in_dim=400, it is likely that feature maps of size Cx20x20 are being used, which are then flattened to a size of Cx400. If mlp_ratio=1, the linear layer will have 400 outputs, which means it will have 400x400 parameters (excluding biases).
If the objective is to plot the learned parameters (not the activations), it is not necessary to feed an image and plot the outputs. Instead, we can plot the learned weights of the Linear layer.
For instance, the code snippet below shows the size of the parameters in the first Linear layer of the first Mixer block:
print(model.aggregator.mix[0].mix[1].weight.shape) # oututs torch.Size([400, 400])
To plot the weights of a single neuron, which is a line of 400 parameters from the weight matrix, it needs to be resized to 20x20 (remember that each neurone is connected to every feature map) and visualized.
all_neurones = model.aggregator.mix[0].mix[1].weight.reshape(-1, 20, 20).detach().cpu() # 400x20x20
random_idx = random.sample(list(range(400)), 1) # select a random idx from 0,399
random_neurone = all_neurones[random_idx] # 1x20x20
random_neurone = random_neurone.permute(1,2,0).numpy() #20x20x1
plt.imshow(random_neurone, cmap='RdBu', interpolation='bicubic')
plt.colorbar()
plt.axis('off')
plt.show()
from mixvpr.
Think you for your help .
Illustration of learned weights from a subset of 24 neurons from the first Feature-Mixer block. Blue color corresponds to positive weights and Red corresponds to negative weights.
What are positive weights?
what are negative weights?
from mixvpr.
Weights refer to the learned parameters of the neuron. If you use the code I shared above you'll get figure similar to the following: https://ibb.co/5MLV4h9
The color bar included in the visualization is self explanatory, blue corresponds to positive weights (parameters) of the neuron, while red corresponds to negative ones.
from mixvpr.
Think you for your help .
from mixvpr.
Related Issues (20)
- Really a good work with simple but effective approach!
- Training loss and generalization during test HOT 4
- Just for testing HOT 2
- A singleGPU will run the results, but multiple GPUs will make an error!! HOT 3
- can you provide more detailed comparative data? HOT 2
- optimizer step HOT 2
- question about backbone ‘Swin’ HOT 5
- Multi-similarity mining on Pittsburgh30k training set HOT 6
- how to change query image shape? HOT 1
- The error samples are due to issues with the ground truth annotations rather than errors in the model predictions. HOT 6
- Dataset HOT 4
- About the specific number of images of the Mapillary Challenge dataset
- would you release the resnet18 pretrained model?
- How to evaluate this model?
- Some questions
- About pitts30k_val.mat. I can not find it in PittsburgDataset HOT 1
- License File
- Releasing the model on torch.hub?
- On releasing the trained weights of ResNet50 with 2048 dimensionality.
- pose estimation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mixvpr.