Skip to content

ZYXinnn/Dynamic-Meta-Filter-Reproduction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

Environment

https://download.pytorch.org/whl/torch_stable.html
% pip install https://download.pytorch.org/whl/cu101/torch-1.4.0-cp37-cp37m-win_amd64.whl
% pip install https://download.pytorch.org/whl/cu101/torch-1.7.0%2Bcu101-cp37-cp37m-win_amd64.whl
  • torchdiffeq == 0.1.1
  • torchvision == 0.18.0
% pip install https://download.pytorch.org/whl/cu101/torchvision-0.5.0-cp37-cp37m-win_amd64.whl
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
  • tqdm

  • numpy

Setup

LibFewShot

git clone https://github.com/RL-VIG/LibFewShot.git

Conda

conda create -n libfewshot python=3.9
conda activate libfewshot
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
pip install torchdiffeq==0.1.1
pip install -r '\your_path\LibFewShot\requirements.txt'

Test the installation

  1. download miniImageNet--ravi.tar.gz and extract it to \your_path\LibFewShot\data\fewshot

  2. set the config as follows in run_trainer.py:

    config = Config("./config/test_install.yaml").get_config_dict()
    
  3. modify data_root in config/headers/data.yaml to the path of the dataset to be used.

    /data/fewshot/miniImageNet--ravi   -->    ./data/fewshot/miniImageNet--ravi
    
  4. run code

    python run_trainer.py
    
  5. If the first output is correct, it means that LibFewShot has been successfully installed.

将Dynamic-Meta-filter模型移植至LibFewShot框架内

代码格式

在Dynamic-Meta-filter代码中,已移植或使用或无用的部分使用

# use ********************************************
# end_use ****************************************

在LibFewShot框架代码中,在.yaml修改的代码是将原有代码全部注释(#)并重新书写,在.py加入的代码使用

# add ********************************************
# end_add ****************************************

已全部修改/使用的代码使用

# use_all ********************************************

以下是已经全部完成修改/使用的代码

5.22

\LibFewShot\config\headers\optimizer.yaml ---warmup未引用

\Dynamic-Meta-filter\torchFewShot\optimizers.py

\LibFewShot\config\headers\device.yaml

\LibFewShot\core\model\meta\DynamicWeights.py ---加入DynamicWeights.py但未完全实现

5.23

\LibFewShot\config\headers\losses.yaml

model DynamicWeightsModel

  • set_forward:用于推理阶段调用,返回分类输出以及准确率。
  • set_forward_loss:用于训练阶段调用,返回分类输出、准确率以及前向损失。
  • set_forward_adaptation是微调网络阶段的分类过程所采用的逻辑
  • sub_optimizer用于在微调时提供新的局部优化器。)

完成lr_scheduler以及warmup:MultiStepLR ---其中iters_per_epoch: # len(trainloader) 未使用

Todo

model存在问题

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published