← 开源
facebookresearch

pytorch_GAN_zoo

A mix of GAN implementations including progressive growing

Model DevelopmentArchitecturePython
在 GitHub 打开
增长势头
+024 小时新增 Star0.0%
1.63k
Star
268
Fork
+2
本周
4
贡献者
创建于 2019-01-17 · 更新于 2026-10-13 · 今日第 9826 名
主要开发者
MoluganHelgeSJohnson-yue

facebookresearch/pytorch_GAN_zoo 排名第 9,826,有 1,627 个星标。

同类别比较

facebookresearch/pytorch_GAN_zoo 排名第 9,826,此处有 8 个同类条目;csinva/imodels 排名第 9,825。

同类别比较
名称排名指标
autonomio/talos9,813
语言:
Python
星标数:
1,635
分叉数:
265
简介:
Hyperparameter Experiments with TensorFlow and Keras
openai/evolution-strategies-starter9,814
语言:
Python
星标数:
1,635
分叉数:
281
简介:
Code for the paper "Evolution Strategies as a Scalable Alternative to Reinforcement Learning"
yoshitomo-matsubara/torchdistill9,821
语言:
Python
星标数:
1,633
分叉数:
144
简介:
A coding-free framework built on PyTorch for reproducible deep learning studies. PyTorch Ecosystem. 🏆26 knowledge distillation methods presented at TPAMI, CVPR, ICLR, ECCV, NeurIPS, ICCV, AAAI, etc are implemented so far. 🎁 Trained models, training logs and configurations are available for ensuring the reproducibiliy and benchmark.
csinva/imodels9,825
语言:
Jupyter Notebook
星标数:
1,627
分叉数:
148
简介:
Interpretable ML package 🔍 for concise, transparent, and accurate predictive modeling (sklearn-compatible).
tensorflow/mesh9,828
语言:
Python
星标数:
1,627
分叉数:
255
简介:
Mesh TensorFlow: Model Parallelism Made Easier
pavlin-policar/openTSNE9,831
语言:
Python
星标数:
1,625
分叉数:
179
简介:
Extensible, parallel implementations of t-SNE
facebookresearch/higher9,834
语言:
Python
星标数:
1,624
分叉数:
125
简介:
higher is a pytorch library allowing users to obtain higher order gradients over losses spanning training loops rather than individual training steps.
guochengqian/Magic1239,837
语言:
Jupyter Notebook
星标数:
1,623
分叉数:
97
简介:
[ICLR'24] Official PyTorch Implementation of Magic123: One Image to High-Quality 3D Object Generation Using Both 2D and 3D Diffusion Priors
关键参数与规格
关键参数与规格
参数值
语言Python
类别Model Development
子类别Architecture
关键词Image production
星标数1,627
分叉数268
贡献者4
创建日期2019-01-17
更新日期2026-10-13
1 天星标数0
7 天星标数2
排名9,826
上次排名9,864
排名变化38
7 天星标排名7,981
上次 7 天星标排名8,022
7 天星标排名变化41
总星标排名7,562
上次总星标排名7,554
总星标排名变化-8
国家USA
README 摘录

Pytorch GAN Zoo A GAN toolbox for researchers and developers with: Progressive Growing of GAN(PGAN): DCGAN: StyleGAN (beta): Picture: Generated samples from GANs trained on celebaHQ, fashionGen, DTD. Picture: fake faces with celebaHQ This code also implements diverse tools: GDPP method from GDPP: Learning Diverse Generations Using Determinantal Point Process Image generation "inspired" from a reference image using an already trained GAN from Inspirational Adversarial Image Generation AC-GAN conditioning from Conditional Image Synthesis With Auxiliary Classifier GANs SWD

metric Inception Score Logistic loss from Which training method of GANs actually converge Requirements This project requires: pytorch torchvision numpy scipy h5py (fashionGen) Optional: visdom nevergrad (inspirational generation) If you don't already have pytorch or torchvision please have a look at as the installation command may vary depending on your OS and your version of CUDA. You can install all other dependencies with pip by running: Recommended datasets celebA: celebAHQ: fashionGen: DTD: CIFAR10: Quick training The datasets. py script allows

you to prepare your datasets and build their corresponding configuration files. If you want to waste no time and just launch a training session on celeba cropped And wait for a few days. Your checkpoints will be dumped in output_networks/celeba_cropped. You should get 128x128 generations at the end. For celebaHQ: Your checkpoints will be dumped in output_networks/celebaHQ. You should get 1024x1024 generations at the end. For fashionGen: The above command will train the fashionGen model

up resolution 256x256. If you want to train fashionGen on a specific sub-dataset for example CLOTHING, run: Four sub-datasets are available: CLOTHING, SHOES, BAGS and ACCESSORIES. For the DTD texture dataset: For cifar10: Load a pretrained model with torch. hub Models trained on celebaHQ, fashionGen, cifar10 and celeba cropped are available with torch. Checkpoints: PGAN: celebaHQ celeba_cropped dtd DCGAN fashionGen See hubconf. (beta) StyleGAN To run StyleGAN, use the model name StyleGAN when running train. Besides,to

run StyleGAN you can use the pre-computed configurations for celeba and celebaHQ. For example: Advanced guidelines How to run a training session ? Where: 1 - MODEL_NAME is the name of the model you want to run. Currently, two models are available: 2 - CONFIGURATION_FILE(mandatory): path to a training configuration file. This file is a json file containing at least a pathDB entry with the path to the training dataset. See below for more informations about this file. 3

- RUN_NAME is the name you want to give to your training session. All checkpoints will be saved in $OUTPUT_DIRECTORY/$RUN_NAME. Default value is default 4 - OUTPUT_DIRECTORY is the directory were all training sessions are saved. Default value is output_networks 5 - OVERRIDES: you can overrides some of the models parameters defined in "config" field of the configuration file(see below) in the command line. For example: Will force the learning rate to be 0. 2 in

the training whatever the configuration file coin. To get all the possible override options, please type: Configuration file of a

常见问题

记录了多少星标和分叉?

facebookresearch/pytorch_GAN_zoo 有 1,627 个星标和 268 个分叉。

仓库排名是多少?

facebookresearch/pytorch_GAN_zoo 排名第 9,826。

记录的语言和类别是什么?

facebookresearch/pytorch_GAN_zoo 有 1,627 个星标,语言为 Python,类别为 Model Development。

哪个仓库排名最接近?

facebookresearch/pytorch_GAN_zoo 与 csinva/imodels 比较,后者排名第 9,825,有 1,627 个星标。

README

Pytorch GAN Zoo

A GAN toolbox for researchers and developers with:

Picture: Generated samples from GANs trained on celebaHQ, fashionGen, DTD.

Picture: fake faces with celebaHQ

This code also implements diverse tools:

Requirements

This project requires:

  • pytorch
  • torchvision
  • numpy
  • scipy
  • h5py (fashionGen)

Optional:

  • visdom
  • nevergrad (inspirational generation)

If you don't already have pytorch or torchvision please have a look at https://pytorch.org/ as the installation command may vary depending on your OS and your version of CUDA.

You can install all other dependencies with pip by running:

pip install -r requirements.txt

Recommended datasets

Quick training

The datasets.py script allows you to prepare your datasets and build their corresponding configuration files.

If you want to waste no time and just launch a training session on celeba cropped

python datasets.py celeba_cropped $PATH_TO_CELEBA/img_align_celeba/ -o $OUTPUT_DATASET
python train.py PGAN -c config_celeba_cropped.json --restart -n celeba_cropped

And wait for a few days. Your checkpoints will be dumped in output_networks/celeba_cropped. You should get 128x128 generations at the end.

For celebaHQ:

python datasets.py celebaHQ $PATH_TO_CELEBAHQ -o $OUTPUT_DATASET - f
python train.py PGAN -c config_celebaHQ.json --restart -n celebaHQ

Your checkpoints will be dumped in output_networks/celebaHQ. You should get 1024x1024 generations at the end.

For fashionGen:

python datasets.py fashionGen $PATH_TO_FASHIONGEN_RES_256 -o $OUTPUT_DIR
python train.py PGAN -c config_fashionGen.json --restart -n fashionGen

The above command will train the fashionGen model up resolution 256x256. If you want to train fashionGen on a specific sub-dataset for example CLOTHING, run:

python train.py PGAN -c config_fashionGen.json --restart -n fashionGen -v CLOTHING

Four sub-datasets are available: CLOTHING, SHOES, BAGS and ACCESSORIES.

For the DTD texture dataset:

python datasets.py dtd $PATH_TO_DTD
python train.py PGAN -c config_dtd.json --restart -n dtd

For cifar10:

python datasets.py cifar10 $PATH_TO_CIFAR10 -o $OUTPUT_DATASET
python train.py PGAN -c config_cifar10.json --restart -n cifar10

Load a pretrained model with torch.hub

Models trained on celebaHQ, fashionGen, cifar10 and celeba cropped are available with torch.hub.

Checkpoints:

See hubconf.py for how to load a checkpoint !

GDPP

To apply the GDPP loss to your model just add the option --GDPP true to your training command.

(beta) StyleGAN

To run StyleGAN, use the model name StyleGAN when running train.py. Besides,to run StyleGAN you can use the pre-computed configurations for celeba and celebaHQ. For example:

python train.py StyleGAN -c config_celebaHQ.json --restart -n style_gan_celeba

Advanced guidelines

How to run a training session ?

python train.py $MODEL_NAME -c $CONFIGURATION_FILE[-n $RUN_NAME][-d $OUTPUT_DIRECTORY][OVERRIDES]

Where:

1 - MODEL_NAME is the name of the model you want to run. Currently, two models are available: - PGAN(progressive growing of gan) - PPGAN(decoupled version of PGAN)

2 - CONFIGURATION_FILE(mandatory): path to a training configuration file. This file is a json file containing at least a pathDB entry with the path to the training dataset. See below for more informations about this file.

3 - RUN_NAME is the name you want to give to your training session. All checkpoints will be saved in $OUTPUT_DIRECTORY/$RUN_NAME. Default value is default

4 - OUTPUT_DIRECTORY is the directory were all training sessions are saved. Default value is output_networks

5 - OVERRIDES: you can overrides some of the models parameters defined in "config" field of the configuration file(see below) in the command line. For example:

python train.py PPGAN -c coin.json -n PAN --learningRate 0.2

Will force the learning rate to be 0.2 in the training whatever the configuration file coin.json specifies.

To get all the possible override options, please type:

python train.py $MODEL_NAME --overrides

Configuration file of a training session

The minimum configuration file for a training session is a json file with the following lines

{
    "pathDB": PATH_TO_YOUR_DATASET
}

Where a dataset can be:

  • a folder with all your images in .jpg, .png or .npy format
  • a folder with N subfolder and images in it (see imagefolderDataset = True below)
  • a .h5 file(cf fashionGen)

To this you can add a "config" entry giving overrides to the standard configuration. See models/trainer/standard_configurations to see all possible options. For example:

{
    "pathDB": PATH_TO_YOUR_DATASET,
    "config": {"baseLearningRate": 0.1,
               "miniBatchSize": 22}
}

Will override the learning rate and the mini-batch-size. Please note that if you specify a - -baseLearningRate option in your command line, the command line will prevail. Depending on how you work you might prefer to have specific configuration files for each run or only rely on one configuration file and input your training parameters via the command line.

Other fields are available on the configuration file, like:

  • pathAttribDict(string): path to a .json file matching each image with its attributes. To be more precise with a standard dataset, it is a dictionary with the following entries:
{
    image_name1.jpg: {attribute1: label, attribute2, label ...}
    image_name2.jpg: {attribute1: label, attribute2, label ...}
    ...
}

With a dataset in the fashionGen format(.h5) it's a dictionary summing up statistics on the class to be sampled.

  • imagefolderDataset(bool): set to true to handle datasets in the torchvision.datasets.ImageFolder format
  • selectedAttributes(list): if specified, learn only the given attributes during the training session
  • pathPartition(string): path to a partition of the training dataset
  • partitionValue(string): if pathPartition is specified, name of the partition to choose
  • miniBatchScheduler(dictionary): dictionary updating the size of the mini batch at different scale of the training ex {"2": 16, "7": 8} meaning that the mini batch size will be 16 from scale 16 to 6 and 8 from scale 7
  • configScheduler(dictionary): dictionary updating the model configuration at different scale of the training ex {"2": {"baseLearningRate": 0.1, "epsilonD": 1}} meaning that the learning rate and epsilonD will be updated to 0.1 and 1 from scale 2 and beyond

How to run a evaluation of the results of your training session ?

You need to use the eval.py script.

Image generation

You can generate more images from an existing checkpoint using:

python eval.py visualization -n $modelName -m $modelType

Where modelType is in [PGAN, PPGAN, DCGAN] and modelName is the name given to your model. This script will load the last checkpoint detected at testNets/$modelName. If you want to load a specific iteration, please call:

python eval.py visualization -n $modelName -m $modelType -s $SCALE -i $ITER

If your model is conditioned, you can ask the visualizer to print out some conditioned generations. First, use --showLabels to see all the available categories and their labels.

python eval.py visualization -n $modelName -m $modelType --showLabels

Then, run your generation with:

python eval.py visualization -n $modelName -m $modelType --$CATEGORY_NAME $LABEL_NAME

For example with a model trained on fashionGen:

python eval.py visualization -n $modelName -m $modelType --Class T_SHIRT

Will plot a batch of T_SHIRTS in visdom.

Fake dataset generation

To save a randomly generated fake dataset from a checkpoint please use:

python eval.py visualization -n $modelName -m $modelType --save_dataset $PATH_TO_THE_OUTPUT_DATASET --size_dataset $SIZE_OF_THE_OUTPUT

SWD metric

Using the same kind of configuration file as above, just launch:

python eval.py laplacian_SWD -c $CONFIGURATION_FILE -n $modelName -m $modelType

Where $CONFIGURATION_FILE is the training configuration file called by train.py (see above): it must contains a "pathDB" field pointing to path to the dataset's directory. For example, if you followed the instruction of the Quick Training section to launch a training session on celebaHQ your configuration file will be config_celebaHQ.json.

You can add optional arguments:

  • -s $SCALE: specify the scale at which the evaluation should be done(if not set, will take the highest one)
  • -i $ITER: specify the iteration to evaluate(if not set, will take the highest one)
  • --selfNoise: returns the typical noise of the SWD distance for each resolution

Inspirational generation

To make an inspirational generation, you first need to build a feature extractor:

python save_feature_extractor.py {vgg16, vgg19} $PATH_TO_THE_OUTPUT_FEATURE_EXTRACTOR --layers 3 4 5

Then run your model:

python eval.py inspirational_generation -n $modelName -m $modelType --inputImage $pathTotheInputImage -f $PATH_TO_THE_OUTPUT_FEATURE_EXTRACTOR

I have generated my metrics. How can i plot them on visdom ?

Just run

python eval.py metric_plot  -n $modelName

LICENSE

This project is under BSD-3 license.

排名相邻
同类项目