-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,54 @@ | ||
HashGAN: Deep Learning to Hash with Pair Conditional Wasserstein GAN | ||
===================================== | ||
|
||
Code for ["HashGAN: Deep Learning to Hash with Pair Conditional Wasserstein GAN"](http://openaccess.thecvf.com/content_cvpr_2018/papers/Cao_HashGAN_Deep_Learning_CVPR_2018_paper.pdf). | ||
Code for CVPR 2018 Paper ["HashGAN: Deep Learning to Hash with Pair Conditional Wasserstein GAN"](http://openaccess.thecvf.com/content_cvpr_2018/papers/Cao_HashGAN_Deep_Learning_CVPR_2018_paper.pdf). | ||
|
||
|
||
## Prerequisites | ||
|
||
- Python3, NumPy, TensorFlow-gpu, SciPy, Matplotlib, easydict, yacs, tqdm | ||
- Python3, NumPy, TensorFlow-gpu, SciPy, Matplotlib, OpenCV, easydict, yacs, tqdm | ||
- A recent NVIDIA GPU | ||
|
||
We provide a `environment.yaml` for you and you can simplely use `conda env create -f environment.yml` to create the environment | ||
|
||
```bash | ||
conda create --no-default-packages -n HashGAN python=3.6 && source activate HashGAN | ||
conda install -y numpy scipy matplotlib tensorflow-gpu opencv | ||
pip install easydict yacs tqdm pillow | ||
``` | ||
|
||
## Data Preparation | ||
In `data_list/` folder, we give three examples to show how to prepare image training data. If you want to add other datasets as the input, you need to prepare `train.txt`, `test.txt`, `database.txt` and `database_nolabel.txt` as CIFAR-10 dataset. | ||
|
||
You can download the whole cifar10 dataset including the images and data list from [here](https://github.com/thulab/DeepHash/releases/download/v0.1/cifar10.zip), and unzip it to data/cifar10 folder. | ||
You can download the whole cifar10 dataset including the images and data list from [here](https://github.com/thulab/DeepHash/releases/download/v0.1/cifar10.zip), and unzip it to `data/cifar10` folder. | ||
|
||
Make sure the tree of `/path/to/project/data/cifar10` looks like this: | ||
If you need run on NUSWIDE_81 and COCO, we recommend you to follow [here](https://github.com/thuml/HashNet/tree/master/pytorch#datasets) to prepare NUSWIDE_81 and COCO images. | ||
|
||
``` | ||
. | ||
|-- database.txt | ||
|-- database_nolabel.txt | ||
|-- test | ||
|-- test.txt | ||
|-- train | ||
`-- train.txt | ||
``` | ||
## Pretrained Models | ||
You can download the pretrained models in the [release page](https://github.com/thuml/HashGAN/releases) and modify config file to use the pretrained models. | ||
|
||
## Training | ||
|
||
If you need run on NUSWIDE_81 and COCO, we recommend you to follow https://github.com/thuml/HashNet/tree/master/pytorch#datasets to prepare NUSWIDE_81 and COCO images. | ||
The training process can be divided into two step: | ||
1. Training a image generator. | ||
2. Fintune Alexnet using original labeled images and generated images. | ||
|
||
## Models | ||
### TODO | ||
In `config` folder, we provide some examples to prepare yaml configuration. | ||
|
||
- [ ] code refactor | ||
- [ ] wgan scale == 0 | ||
- [ ] G, D architecture | ||
- [ ] evaluate mode | ||
- [ ] resume training | ||
- [ ] tensorboard | ||
- [ ] experiment | ||
- [ ] training longger | ||
- [ ] code release | ||
- [ ] pretrained G model | ||
- [ ] Pretrain model of Alexnet | ||
- [ ] rerun all process on a fresh machine | ||
``` | ||
config | ||
├── cifar_evaluation.yaml | ||
├── cifar_step_1.yaml | ||
├── cifar_step_2.yaml | ||
└── nuswide_step_1.yaml | ||
``` | ||
|
||
You can run the model using command like the following: | ||
|
||
Configuration for th models is specified in a list of constants at the top of | ||
the file, you can use the following command to run it: | ||
- `python main.py --cfg config/cifar_step_1.yaml --gpus 0` | ||
- `python main.py --cfg config/cifar_step_2.yaml --gpus 0` | ||
|
||
- `python main.py` | ||
You can use tensorboard to monitor the training process such as losses and Mean Average Precision. | ||
|
||
## Citation | ||
If you use this code for your research, please consider citing: | ||
|
@@ -63,7 +64,7 @@ If you use this code for your research, please consider citing: | |
|
||
## Contact | ||
If you have any problem about our code, feel free to contact | ||
- [email protected] | ||
- [email protected] | ||
|
||
- [email protected] | ||
|
||
or describe your problem in Issues. |