floodsung / LearningToCompare_FSL

PyTorch code for CVPR 2018 paper: Learning to Compare: Relation Network for Few-Shot Learning (Few-Shot Learning part)
MIT License
1.04k stars 268 forks source link

What is the meaning of writing this line of code? can you tell me behind the reason?i can't understand why to use torch.sum() #22

Open qq542871902 opened 5 years ago

qq542871902 commented 5 years ago

sample_features = feature_encoder(Variable(samples)) # 25x6455 sample_features = sample_features.view(CLASS_NUM,SAMPLE_NUM_PER_CLASS,FEATURE_DIM,5,5) sample_features = torch.sum(sample_features,1).squeeze(1)

huangkainwpu24 commented 5 years ago

5-shot means they are 5 images as the same way, and use torch.sum() makes the same way pictures feature becoming one(five before, a little like average),so 5(way)5(shot)641919(feature) becomes 5(way)6419*19(feature)

526222883 commented 4 years ago

5-shot means they are 5 images as the same way, and use torch.sum() makes the same way pictures feature becoming one(five before, a little like average),so 5(way)_5(shot)_64_19_19(feature) becomes 5(way)_64_19*19(feature)

what's the meaning of 64 and 19*19 ?thank you!