Comments (2)
@NRshka You're normalizing along the n_views dimension, but you need to be normalizing along the feature dimension. Features are described by: (batch_size
, n_views
, feature_dim
). n_views
is the number of augmented versions of an image in the batch - since they originate from the same image, we know they're positives. feature_dim
is the dimension of the learned embedding.
So, all you need to do is change "dim=1" to "dim=2" and it should work as intended.
I set all relevant seeds to 0 and got a loss of tensor(7.0303)
using your code above, and replacing criterion with SupConLoss() from 'losses.py'.
from supcontrast.
I really appreciate your explanation!
from supcontrast.
Related Issues (20)
- The problem about the number of positives in code
- Why use two anchors? HOT 1
- Loss function is not convergent when batch-sizes smaller? HOT 4
- the mean and std of cifar dataset
- File "main_supcon.py", line 270, in main opt = parse_option() File "main_supcon.py", line 94, in parse_option assert opt.degrees is not None AssertionError
- Question about potentially incomplete usage of 'logits_mask' HOT 1
- Is this using resnet50x4 width? HOT 2
- file “main_linear.py”, line103, set_model(opt) ,if torch.cuda.is_available() is false, why model will not load_state_dict(state_dict) HOT 1
- Execution of code for ImageNet code (Moco trick) HOT 1
- loss computation: mean and not sum HOT 4
- CE vs CE + SupCon HOT 2
- Purpose of logits_mask? HOT 2
- NaN loss for no positive pair from SupCon
- Pre-trained model HOT 1
- What mean, std and other datapreprocessing transforms did you use for ImageNet? HOT 1
- Moco trick?
- Code for using the ImageNet pretrained model
- solved
- How to change backbone HOT 1
- about loss_in and loss_out in paper
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 supcontrast.