Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup python #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ year={2019}

## Enviroment
- Python3
- [Pytorch](http://pytorch.org/) before 0.4 (for newer vesion, please see issue #3 )
- [Pytorch](http://pytorch.org/) >= 1.0
- json

To install the dependencies use `pip3 install -r requirements-cpu.txt -f https://download.pytorch.org/whl/torch_stable.html` or `pip3 install -r requirements-gpu.txt`.

## Getting started
### CUB
* Change directory to `./filelists/CUB`
Expand Down Expand Up @@ -52,19 +54,19 @@ See test.json for reference

## Train
Run
```python ./train.py --dataset [DATASETNAME] --model [BACKBONENAME] --method [METHODNAME] [--OPTIONARG]```
```python3 ./train.py --dataset [DATASETNAME] --model [BACKBONENAME] --method [METHODNAME] [--OPTIONARG]```

For example, run `python ./train.py --dataset miniImagenet --model Conv4 --method baseline --train_aug`
Commands below follow this example, and please refer to io_utils.py for additional options.

## Save features
Save the extracted feature before the classifaction layer to increase test speed. This is not applicable to MAML, but are required for other methods.
Run
```python ./save_features.py --dataset miniImagenet --model Conv4 --method baseline --train_aug```
```python3 ./save_features.py --dataset miniImagenet --model Conv4 --method baseline --train_aug```

## Test
Run
```python ./test.py --dataset miniImagenet --model Conv4 --method baseline --train_aug```
```python3 ./test.py --dataset miniImagenet --model Conv4 --method baseline --train_aug```

## Results
* The test results will be recorded in `./record/results.txt`
Expand Down
2 changes: 1 addition & 1 deletion filelists/CUB/download_CUB.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
wget http://www.vision.caltech.edu/visipedia-data/CUB-200-2011/CUB_200_2011.tgz
tar -zxvf CUB_200_2011.tgz
python write_CUB_filelist.py
python3 write_CUB_filelist.py
4 changes: 2 additions & 2 deletions filelists/emnist/download_emnist.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
wget https://github.com/NanqingD/DAOSL/raw/master/data/emnist.zip
unzip emnist.zip
python invert_emnist.py
python write_cross_char_valnovel_filelist.py
python3 invert_emnist.py
python3 write_cross_char_valnovel_filelist.py
4 changes: 2 additions & 2 deletions filelists/miniImagenet/download_miniImagenet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ wget https://raw.githubusercontent.com/twitter/meta-learning-lstm/master/data/mi
wget https://raw.githubusercontent.com/twitter/meta-learning-lstm/master/data/miniImagenet/test.csv
wget http://image-net.org/image/ILSVRC2015/ILSVRC2015_CLS-LOC.tar.gz
tar -zxvf ILSVRC2015_CLS-LOC.tar.gz
python write_miniImagenet_filelist.py
python write_cross_filelist.py
python3 write_miniImagenet_filelist.py
python3 write_cross_filelist.py
6 changes: 3 additions & 3 deletions filelists/omniglot/download_omniglot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ mv $DATADIR/images_evaluation/* $DATADIR/
rmdir $DATADIR/images_background
rmdir $DATADIR/images_evaluation

python rot_omniglot.py
python write_omniglot_filelist.py
python write_cross_char_base_filelist.py
python3 rot_omniglot.py
python3 write_omniglot_filelist.py
python3 write_cross_char_base_filelist.py
4 changes: 4 additions & 0 deletions requirements-cpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
torch==1.4.0+cpu
torchvision==0.5.0+cpu
Pillow
h5py
4 changes: 4 additions & 0 deletions requirements-gpu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
torch>=1.0.0
torchvision
Pillow
h5py