GithubHelp home page GithubHelp logo

tsingularity / frn Goto Github PK

View Code? Open in Web Editor NEW
103.0 103.0 18.0 1.22 MB

(CVPR 2021) Few-Shot Classification with Feature Map Reconstruction Networks

License: MIT License

Shell 10.77% Python 74.76% Jupyter Notebook 14.47%
few-shot-learning

frn's People

Contributors

daviswer avatar tsingularity avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

frn's Issues

Issue on the aux loss

Thanks for your work.
I print the L1 L2 variable in the auxrank() function of frn_train.py and find that the last half elements are 0. Is this consistent with the Auxiliary Loss in the paper (i and j belong to different categories).

About MatchingNet

Dear authors
Sorry to bother you. In your paper, i notice that you re-implement MatchingNet using the pre-trained backbone.
Could you kindly provide the code of your implementation on MatchingNet? I followed the code from "A closer look at few-shot", and used the pre-trained model from your code. However, it seems that the model learns nothing and I cannot reproduce the results.

Thank you in advance.

Some data set links failed

Dear author, hello. I noticed that some of the data set links you provide in the readme file are not accessible (e.g. tired-imagenet), is it possible to ask you to provide a new link? Thank you for your help.

RuntimeError: inverse_cuda: For batch 0: U(2,2) is zero, singular U.

Great work!

We meet an issue caused by the computation of inverse_cuda We have pasted the error information as shown below,

m_inv = (sts+torch.eye(sts.size(-1)).to(sts.device).unsqueeze(0).mul(lam)).inverse() # way, d, d
RuntimeError: inverse_cuda: For batch 0: U(2,2) is zero, singular U.

May I repalce inverse() withcholesky_inverse()?

How to change the batch_size

Hello, I found that the memory occupied by the program is very small, but there is no way to change the batch_size

Are drop blocks used indeed?

Hello,

Thank you for your interesting work! πŸ˜ƒ
According to the your arxiv paper page 12, you stated that you used drop blocks.

But the code base never leads me into the dropblock forwarding path. The code below never runs:

if self.drop_rate > 0:
if self.drop_block == True:
feat_size = out.size()[2]
keep_rate = max(1.0 - self.drop_rate / (20*2000) * (self.num_batches_tracked), 1.0 - self.drop_rate)
gamma = (1 - keep_rate) / self.block_size**2 * feat_size**2 / (feat_size - self.block_size + 1)**2
out = self.DropBlock(out, gamma=gamma)
else:
out = F.dropout(out, p=self.drop_rate, training=self.training, inplace=True)

possibily because the initial drop-out rate is set to 0:

def resnet12(drop_rate=0.1, dropblock_size=5, max_pool=True, **kwargs):
"""Constructs a ResNet-12 model.
"""
model = ResNet(BasicBlock, [1, 1, 1, 1], max_pool=max_pool, **kwargs)
return model

I hope it is a mistake on either the supplementary matarials or the code (or me πŸ˜‰).
Congraturations and I hope you see you soon in CVPR'21!

Sincerely,
Dahyun

pretrain accuracy

Dear author, sorry to bother you~
when I use pretrain model (/trained_model_weights/ResNet-12_finetune/model.pth) to train, I found that the accuracy is only 20%. I don't know what's wrong? Maybe I use false pretain model? I don't know~~
Maybe you have some good advice~
hope you have a good day~

Issue on pre-training

I ran mini-ImageNet/FRN/ResNet-12_pretrain/train.sh according to the instructions but got this error, which I think is caused by the network outputting the inf value. Reducing the initial learning rate to 1e-3 can avoid this error.

Traceback (most recent call last):
File "train.py", line 35, in
tm.train(model)
File "../../../../trainers/trainer.py", line 185, in train
iter_counter=iter_counter)
File "../../../../trainers/frn_train.py", line 97, in pre_train
log_prediction = model.forward_pretrain(inp)
File "../../../../models/FRN.py", line 136, in forward_pretrain
beta=beta) # wayquery_shotresolution, way
File "../../../../models/FRN.py", line 75, in get_recon_dist
m_inv = (sts + torch.eye(sts.size(-1)).to(sts.device).unsqueeze(0).mul(lam)).inverse() # way, d, d
RuntimeError: CUDA error: an illegal memory access was encountered

Looking forward to your reply!

Performance on CUB

Thanks for sharing the codes and your excellent work.

In Table 3, I notice that ProtoNet achieves 81.50 with pre-training and 83.88 under your implementation using the basic Conv-4 backbone. Then, in 9.1, I find that you said "Conv-4 are trained with 20-way 5-shot for 5 shot model, and 30-way 1-shot for 1-shot model".
So, the accuracy of 83.88 under your implementation is trained from scratch using the above settings with SGD? Did you implement ProtoNet using the general setting (e.g., 5-way 5-shot and 1-shot)?

Sorry to bother you and thank you in advance.

Issue on regularization

Hi, thank you for this enlightening work!

And sorry for bothering if this is a basic question, but I am new to this field and I would like to know why the support features can span the feature space when kr > d, as stated in section 3.2 in your paper. Also what does it mean by "span the feature space"?

If kr > d, reconstruction may become trivial, as the support features can span the feature space. Conversely, reconstruction is difficult when d > kr

If the explanation may be lengthy, could you recommend some keywords I could use to find related materials so I can learn it myself?Thank you in advance!

How to predict new images with pre-trained model.

Assuming I have a new image without labeling it into any class id, what should I modify the given code to gain the right class id with your suggested model? Your solution seems very appropriate to my problems, and I truly hope that I could apply it precisely to mine, so I really look forward to your answer! Thank you in advance!

About the training process

Excellent work!

The results of multiple trainings are inconsistent, and sometimes the training process will not converge or "'NaN or Inf found in input tensor'" will appear. Is it related to the fixed random number seed?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.