Tsingularity / FRN

(CVPR 2021) Few-Shot Classification with Feature Map Reconstruction Networks
MIT License
107 stars 18 forks source link

Request for visualization code #16

Open sausage0611 opened 1 month ago

sausage0611 commented 1 month ago

Dear author, hello! I'm sorry to disturb you, but I would also like to have a copy of the same visualization code. If it's convenient for you, could you please send it to me? my email is meiyinhu@email.ncu.edu.cn. I'm sorry to bother you.

daviswer commented 1 month ago

Hello! Thanks for reaching out. Unfortunately the status of the old visualization code is somewhat in limbo at this point... after offline discussion from #14 we determined that the trained model used for the reconstruction doesn't match the weights for the publicly released model (our working code model was trained with a different seed). So the visualization code plus training code for the reconstructor can be found here (training was relatively quick on a single GPU from what I recall), but may also require some updating as it was built to hook into our working code rather than the public code in this repo. I'll leave the following possible recommendations:

- z = model.get_feature_vector(inp.cuda())*np.sqrt(640) 
  Be changed to -> z = model.feature_extractor(inp.cuda()) 
                -> z = z.view(z.shape[0], 25, -1)*np.sqrt(640)
  The reason is that 'FRN' object has no attribute 'get_feature_vector'

- eval_loader = dataloader.meta_test_dataloader(val_path, way=5, shot=5, pre=True)
  Be changed to -> eval_loader = dataloader.meta_test_dataloader(val_path, way=5, shot=5, pre=False, transform_type=0)

- Try removing the np.sqrt(640) scaling factor on the feature vector above. 
  Given that the regenerator code is clearly set up for an older version of the model code, 
  there might be a scaling mismatch. 
  You might also try multiplying by 640 instead of sqrt(640), for the same reason.
daviswer commented 1 month ago

(Requesting that we leave this issue open so that future requests can be directed here)

sausage0611 commented 1 month ago

(Requesting that we leave this issue open so that future requests can be directed here)

Okay, thank you very much for your help!