├── Examples
└── visulization.png
├── License
├── Readme.md
├── detector_codes
├── AutoGAN-master
│ ├── .DS_Store
│ ├── .gitmodules
│ ├── README.md
│ ├── autogan
│ ├── code
│ │ ├── GAN_Detection_Test.py
│ │ ├── GAN_Detection_Train.py
│ │ ├── Loggers.py
│ │ ├── Utils.py
│ │ ├── cycleGAN_dataset.py
│ │ ├── pggan_dnet.py
│ │ ├── run_test.py
│ │ └── run_training.py
│ ├── conda
│ │ └── AutoGAN.yml
│ ├── data
│ │ ├── fake
│ │ └── real
│ └── fig
│ │ ├── AutoGAN.png
│ │ ├── AutoGAN_Image.png
│ │ └── checkerboard.png
├── CNNDetection-master
│ ├── LICENSE.txt
│ ├── README.md
│ ├── data
│ │ ├── __init__.py
│ │ └── datasets.py
│ ├── dataset
│ │ ├── test
│ │ │ └── download_testset.sh
│ │ ├── train
│ │ │ └── download_trainset.sh
│ │ └── val
│ │ │ └── download_valset.sh
│ ├── demo.py
│ ├── demo_dir.py
│ ├── earlystop.py
│ ├── eval.py
│ ├── eval_config.py
│ ├── examples
│ │ ├── fake.png
│ │ ├── real.png
│ │ └── realfakedir
│ │ │ ├── 0_real
│ │ │ └── real.png
│ │ │ └── 1_fake
│ │ │ └── fake.png
│ ├── networks
│ │ ├── __init__.py
│ │ ├── base_model.py
│ │ ├── lpf.py
│ │ ├── resnet.py
│ │ ├── resnet_lpf.py
│ │ └── trainer.py
│ ├── options
│ │ ├── __init__.py
│ │ ├── base_options.py
│ │ ├── test_options.py
│ │ └── train_options.py
│ ├── requirements.txt
│ ├── train.py
│ ├── util.py
│ ├── validate.py
│ └── weights
│ │ └── download_weights.sh
├── F3Net-main
│ ├── README.md
│ └── f3net.py
├── Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master
│ ├── .fuse_hidden0000b11f00000019
│ ├── README.md
│ ├── face.PNG
│ ├── pggan-celeba
│ │ ├── __pycache__
│ │ │ └── resnet18_gram.cpython-37.pyc
│ │ ├── demo.py
│ │ ├── gene.py
│ │ ├── list
│ │ ├── main.py
│ │ ├── resnet18_gram.py
│ │ ├── result.txt
│ │ ├── test.py
│ │ ├── test2.py
│ │ └── test3.py
│ ├── pngdata
│ │ └── data
│ │ │ └── style-ffhq
│ │ │ └── .fuse_hidden0000b34e00000018
│ ├── stylegan-celeba
│ │ ├── .fuse_hidden0000b13200000005
│ │ ├── .fuse_hidden0000b13600000004
│ │ ├── .fuse_hidden0000b13800000003
│ │ ├── .fuse_hidden0000b30800000008
│ │ ├── .fuse_hidden0000b30900000007
│ │ ├── .fuse_hidden0000b55f00000006
│ │ ├── .fuse_hidden0000b5a300000009
│ │ ├── .fuse_hidden0000b5a400000010
│ │ ├── .fuse_hidden0000b5a50000000f
│ │ ├── .fuse_hidden0000b5a800000011
│ │ ├── .fuse_hidden0000b5aa00000013
│ │ ├── .fuse_hidden0000b5ab00000012
│ │ ├── __pycache__
│ │ │ └── resnet18_gram.cpython-37.pyc
│ │ ├── demo.py
│ │ ├── demo.txt
│ │ ├── gene.py
│ │ ├── list
│ │ ├── main.py
│ │ ├── resnet18_gram.py
│ │ ├── result.txt
│ │ ├── test.py
│ │ ├── test2.py
│ │ └── test3.py
│ └── stylegan-ffhq
│ │ ├── __pycache__
│ │ └── resnet18_gram.cpython-37.pyc
│ │ ├── demo.py
│ │ ├── gene.py
│ │ ├── list
│ │ ├── main.py
│ │ ├── resnet18_gram.py
│ │ ├── result.txt
│ │ ├── test.py
│ │ ├── test2.py
│ │ ├── test3.py
│ │ └── test4.py
├── Readme.md
├── Swin-Transformer-main
│ ├── .gitignore
│ ├── CODE_OF_CONDUCT.md
│ ├── LICENSE
│ ├── MODELHUB.md
│ ├── README.md
│ ├── SECURITY.md
│ ├── SUPPORT.md
│ ├── config.py
│ ├── configs
│ │ ├── simmim
│ │ │ ├── simmim_finetune__swin_base__img224_window7__800ep.yaml
│ │ │ ├── simmim_finetune__swinv2_base__img224_window14__800ep.yaml
│ │ │ ├── simmim_pretrain__swin_base__img192_window6__800ep.yaml
│ │ │ └── simmim_pretrain__swinv2_base__img192_window12__800ep.yaml
│ │ ├── swin
│ │ │ ├── swin_base_patch4_window12_384_22kto1k_finetune.yaml
│ │ │ ├── swin_base_patch4_window12_384_finetune.yaml
│ │ │ ├── swin_base_patch4_window7_224.yaml
│ │ │ ├── swin_base_patch4_window7_224_22k.yaml
│ │ │ ├── swin_base_patch4_window7_224_22kto1k_finetune.yaml
│ │ │ ├── swin_large_patch4_window12_384_22kto1k_finetune.yaml
│ │ │ ├── swin_large_patch4_window7_224_22k.yaml
│ │ │ ├── swin_large_patch4_window7_224_22kto1k_finetune.yaml
│ │ │ ├── swin_small_patch4_window7_224.yaml
│ │ │ ├── swin_small_patch4_window7_224_22k.yaml
│ │ │ ├── swin_small_patch4_window7_224_22kto1k_finetune.yaml
│ │ │ ├── swin_tiny_c24_patch4_window8_256.yaml
│ │ │ ├── swin_tiny_patch4_window7_224.yaml
│ │ │ ├── swin_tiny_patch4_window7_224_22k.yaml
│ │ │ └── swin_tiny_patch4_window7_224_22kto1k_finetune.yaml
│ │ ├── swinmlp
│ │ │ ├── swin_mlp_base_patch4_window7_224.yaml
│ │ │ ├── swin_mlp_tiny_c12_patch4_window8_256.yaml
│ │ │ ├── swin_mlp_tiny_c24_patch4_window8_256.yaml
│ │ │ └── swin_mlp_tiny_c6_patch4_window8_256.yaml
│ │ ├── swinmoe
│ │ │ ├── swin_moe_base_patch4_window12_192_16expert_32gpu_22k.yaml
│ │ │ ├── swin_moe_base_patch4_window12_192_32expert_32gpu_22k.yaml
│ │ │ ├── swin_moe_base_patch4_window12_192_8expert_32gpu_22k.yaml
│ │ │ ├── swin_moe_base_patch4_window12_192_cosine_router_32expert_32gpu_22k.yaml
│ │ │ ├── swin_moe_base_patch4_window12_192_densebaseline_22k.yaml
│ │ │ ├── swin_moe_small_patch4_window12_192_16expert_32gpu_22k.yaml
│ │ │ ├── swin_moe_small_patch4_window12_192_32expert_32gpu_22k.yaml
│ │ │ ├── swin_moe_small_patch4_window12_192_64expert_64gpu_22k.yaml
│ │ │ ├── swin_moe_small_patch4_window12_192_8expert_32gpu_22k.yaml
│ │ │ ├── swin_moe_small_patch4_window12_192_cosine_router_32expert_32gpu_22k.yaml
│ │ │ └── swin_moe_small_patch4_window12_192_densebaseline_22k.yaml
│ │ └── swinv2
│ │ │ ├── swinv2_base_patch4_window12_192_22k.yaml
│ │ │ ├── swinv2_base_patch4_window12to16_192to256_22kto1k_ft.yaml
│ │ │ ├── swinv2_base_patch4_window12to24_192to384_22kto1k_ft.yaml
│ │ │ ├── swinv2_base_patch4_window16_256.yaml
│ │ │ ├── swinv2_base_patch4_window8_256.yaml
│ │ │ ├── swinv2_large_patch4_window12_192_22k.yaml
│ │ │ ├── swinv2_large_patch4_window12to16_192to256_22kto1k_ft.yaml
│ │ │ ├── swinv2_large_patch4_window12to24_192to384_22kto1k_ft.yaml
│ │ │ ├── swinv2_small_patch4_window16_256.yaml
│ │ │ ├── swinv2_small_patch4_window8_256.yaml
│ │ │ ├── swinv2_tiny_patch4_window16_256.yaml
│ │ │ └── swinv2_tiny_patch4_window8_256.yaml
│ ├── data
│ │ ├── __init__.py
│ │ ├── build.py
│ │ ├── cached_image_folder.py
│ │ ├── data_simmim_ft.py
│ │ ├── data_simmim_pt.py
│ │ ├── imagenet22k_dataset.py
│ │ ├── map22kto1k.txt
│ │ ├── samplers.py
│ │ └── zipreader.py
│ ├── figures
│ │ └── teaser.png
│ ├── get_started.md
│ ├── kernels
│ │ └── window_process
│ │ │ ├── setup.py
│ │ │ ├── swin_window_process.cpp
│ │ │ ├── swin_window_process_kernel.cu
│ │ │ ├── unit_test.py
│ │ │ └── window_process.py
│ ├── logger.py
│ ├── lr_scheduler.py
│ ├── main.py
│ ├── main_moe.py
│ ├── main_simmim_ft.py
│ ├── main_simmim_pt.py
│ ├── models
│ │ ├── __init__.py
│ │ ├── build.py
│ │ ├── simmim.py
│ │ ├── swin_mlp.py
│ │ ├── swin_transformer.py
│ │ ├── swin_transformer_moe.py
│ │ └── swin_transformer_v2.py
│ ├── optimizer.py
│ ├── utils.py
│ ├── utils_moe.py
│ └── utils_simmim.py
├── deit-main
│ ├── .circleci
│ │ └── config.yml
│ ├── .github
│ │ ├── CODE_OF_CONDUCT.md
│ │ ├── CONTRIBUTING.md
│ │ ├── attn.png
│ │ ├── cait.png
│ │ ├── cosub.png
│ │ ├── deit.png
│ │ ├── hmlp.png
│ │ ├── paral.png
│ │ ├── patch_convnet.png
│ │ ├── resmlp.png
│ │ ├── revenge.png
│ │ └── revenge_da.png
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── README_3things.md
│ ├── README_cait.md
│ ├── README_cosub.md
│ ├── README_deit.md
│ ├── README_patchconvnet.md
│ ├── README_resmlp.md
│ ├── README_revenge.md
│ ├── augment.py
│ ├── cait_models.py
│ ├── datasets.py
│ ├── engine.py
│ ├── hubconf.py
│ ├── losses.py
│ ├── main.py
│ ├── models.py
│ ├── models_v2.py
│ ├── patchconvnet_models.py
│ ├── requirements.txt
│ ├── resmlp_models.py
│ ├── run_with_submitit.py
│ ├── samplers.py
│ ├── tox.ini
│ └── utils.py
└── pytorch-image-models-0.6.12
│ ├── .gitattributes
│ ├── .github
│ ├── FUNDING.yml
│ ├── ISSUE_TEMPLATE
│ │ ├── bug_report.md
│ │ ├── config.yml
│ │ └── feature_request.md
│ └── workflows
│ │ ├── build_documentation.yml
│ │ ├── build_pr_documentation.yml
│ │ ├── delete_doc_comment.yml
│ │ └── tests.yml
│ ├── .gitignore
│ ├── LICENSE
│ ├── MANIFEST.in
│ ├── README.md
│ ├── avg_checkpoints.py
│ ├── benchmark.py
│ ├── bulk_runner.py
│ ├── clean_checkpoint.py
│ ├── convert
│ ├── convert_from_mxnet.py
│ └── convert_nest_flax.py
│ ├── distributed_train.sh
│ ├── docs
│ ├── archived_changes.md
│ ├── changes.md
│ ├── feature_extraction.md
│ ├── index.md
│ ├── javascripts
│ │ └── tables.js
│ ├── models.md
│ ├── models
│ │ ├── .pages
│ │ ├── .templates
│ │ │ ├── code_snippets.md
│ │ │ ├── generate_readmes.py
│ │ │ └── models
│ │ │ │ ├── adversarial-inception-v3.md
│ │ │ │ ├── advprop.md
│ │ │ │ ├── big-transfer.md
│ │ │ │ ├── csp-darknet.md
│ │ │ │ ├── csp-resnet.md
│ │ │ │ ├── csp-resnext.md
│ │ │ │ ├── densenet.md
│ │ │ │ ├── dla.md
│ │ │ │ ├── dpn.md
│ │ │ │ ├── ecaresnet.md
│ │ │ │ ├── efficientnet-pruned.md
│ │ │ │ ├── efficientnet.md
│ │ │ │ ├── ensemble-adversarial.md
│ │ │ │ ├── ese-vovnet.md
│ │ │ │ ├── fbnet.md
│ │ │ │ ├── gloun-inception-v3.md
│ │ │ │ ├── gloun-resnet.md
│ │ │ │ ├── gloun-resnext.md
│ │ │ │ ├── gloun-senet.md
│ │ │ │ ├── gloun-seresnext.md
│ │ │ │ ├── gloun-xception.md
│ │ │ │ ├── hrnet.md
│ │ │ │ ├── ig-resnext.md
│ │ │ │ ├── inception-resnet-v2.md
│ │ │ │ ├── inception-v3.md
│ │ │ │ ├── inception-v4.md
│ │ │ │ ├── legacy-se-resnet.md
│ │ │ │ ├── legacy-se-resnext.md
│ │ │ │ ├── legacy-senet.md
│ │ │ │ ├── mixnet.md
│ │ │ │ ├── mnasnet.md
│ │ │ │ ├── mobilenet-v2.md
│ │ │ │ ├── mobilenet-v3.md
│ │ │ │ ├── nasnet.md
│ │ │ │ ├── noisy-student.md
│ │ │ │ ├── pnasnet.md
│ │ │ │ ├── regnetx.md
│ │ │ │ ├── regnety.md
│ │ │ │ ├── res2net.md
│ │ │ │ ├── res2next.md
│ │ │ │ ├── resnest.md
│ │ │ │ ├── resnet-d.md
│ │ │ │ ├── resnet.md
│ │ │ │ ├── resnext.md
│ │ │ │ ├── rexnet.md
│ │ │ │ ├── se-resnet.md
│ │ │ │ ├── selecsls.md
│ │ │ │ ├── seresnext.md
│ │ │ │ ├── skresnet.md
│ │ │ │ ├── skresnext.md
│ │ │ │ ├── spnasnet.md
│ │ │ │ ├── ssl-resnet.md
│ │ │ │ ├── ssl-resnext.md
│ │ │ │ ├── swsl-resnet.md
│ │ │ │ ├── swsl-resnext.md
│ │ │ │ ├── tf-efficientnet-condconv.md
│ │ │ │ ├── tf-efficientnet-lite.md
│ │ │ │ ├── tf-efficientnet.md
│ │ │ │ ├── tf-inception-v3.md
│ │ │ │ ├── tf-mixnet.md
│ │ │ │ ├── tf-mobilenet-v3.md
│ │ │ │ ├── tresnet.md
│ │ │ │ ├── vision-transformer.md
│ │ │ │ ├── wide-resnet.md
│ │ │ │ └── xception.md
│ │ ├── adversarial-inception-v3.md
│ │ ├── advprop.md
│ │ ├── big-transfer.md
│ │ ├── csp-darknet.md
│ │ ├── csp-resnet.md
│ │ ├── csp-resnext.md
│ │ ├── densenet.md
│ │ ├── dla.md
│ │ ├── dpn.md
│ │ ├── ecaresnet.md
│ │ ├── efficientnet-pruned.md
│ │ ├── efficientnet.md
│ │ ├── ensemble-adversarial.md
│ │ ├── ese-vovnet.md
│ │ ├── fbnet.md
│ │ ├── gloun-inception-v3.md
│ │ ├── gloun-resnet.md
│ │ ├── gloun-resnext.md
│ │ ├── gloun-senet.md
│ │ ├── gloun-seresnext.md
│ │ ├── gloun-xception.md
│ │ ├── hrnet.md
│ │ ├── ig-resnext.md
│ │ ├── inception-resnet-v2.md
│ │ ├── inception-v3.md
│ │ ├── inception-v4.md
│ │ ├── legacy-se-resnet.md
│ │ ├── legacy-se-resnext.md
│ │ ├── legacy-senet.md
│ │ ├── mixnet.md
│ │ ├── mnasnet.md
│ │ ├── mobilenet-v2.md
│ │ ├── mobilenet-v3.md
│ │ ├── nasnet.md
│ │ ├── noisy-student.md
│ │ ├── pnasnet.md
│ │ ├── regnetx.md
│ │ ├── regnety.md
│ │ ├── res2net.md
│ │ ├── res2next.md
│ │ ├── resnest.md
│ │ ├── resnet-d.md
│ │ ├── resnet.md
│ │ ├── resnext.md
│ │ ├── rexnet.md
│ │ ├── se-resnet.md
│ │ ├── selecsls.md
│ │ ├── seresnext.md
│ │ ├── skresnet.md
│ │ ├── skresnext.md
│ │ ├── spnasnet.md
│ │ ├── ssl-resnet.md
│ │ ├── ssl-resnext.md
│ │ ├── swsl-resnet.md
│ │ ├── swsl-resnext.md
│ │ ├── tf-efficientnet-condconv.md
│ │ ├── tf-efficientnet-lite.md
│ │ ├── tf-efficientnet.md
│ │ ├── tf-inception-v3.md
│ │ ├── tf-mixnet.md
│ │ ├── tf-mobilenet-v3.md
│ │ ├── tresnet.md
│ │ ├── vision-transformer.md
│ │ ├── wide-resnet.md
│ │ └── xception.md
│ ├── results.md
│ ├── scripts.md
│ └── training_hparam_examples.md
│ ├── hfdocs
│ └── source
│ │ ├── _config.py
│ │ ├── _toctree.yml
│ │ ├── archived_changes.mdx
│ │ ├── changes.mdx
│ │ ├── feature_extraction.mdx
│ │ ├── index.mdx
│ │ ├── model_pages.mdx
│ │ ├── models.mdx
│ │ ├── models
│ │ ├── adversarial-inception-v3.mdx
│ │ ├── advprop.mdx
│ │ ├── big-transfer.mdx
│ │ ├── csp-darknet.mdx
│ │ ├── csp-resnet.mdx
│ │ ├── csp-resnext.mdx
│ │ ├── densenet.mdx
│ │ ├── dla.mdx
│ │ ├── dpn.mdx
│ │ ├── ecaresnet.mdx
│ │ ├── efficientnet-pruned.mdx
│ │ ├── efficientnet.mdx
│ │ ├── ensemble-adversarial.mdx
│ │ ├── ese-vovnet.mdx
│ │ ├── fbnet.mdx
│ │ ├── gloun-inception-v3.mdx
│ │ ├── gloun-resnet.mdx
│ │ ├── gloun-resnext.mdx
│ │ ├── gloun-senet.mdx
│ │ ├── gloun-seresnext.mdx
│ │ ├── gloun-xception.mdx
│ │ ├── hrnet.mdx
│ │ ├── ig-resnext.mdx
│ │ ├── inception-resnet-v2.mdx
│ │ ├── inception-v3.mdx
│ │ ├── inception-v4.mdx
│ │ ├── legacy-se-resnet.mdx
│ │ ├── legacy-se-resnext.mdx
│ │ ├── legacy-senet.mdx
│ │ ├── mixnet.mdx
│ │ ├── mnasnet.mdx
│ │ ├── mobilenet-v2.mdx
│ │ ├── mobilenet-v3.mdx
│ │ ├── nasnet.mdx
│ │ ├── noisy-student.mdx
│ │ ├── pnasnet.mdx
│ │ ├── regnetx.mdx
│ │ ├── regnety.mdx
│ │ ├── res2net.mdx
│ │ ├── res2next.mdx
│ │ ├── resnest.mdx
│ │ ├── resnet-d.mdx
│ │ ├── resnet.mdx
│ │ ├── resnext.mdx
│ │ ├── rexnet.mdx
│ │ ├── se-resnet.mdx
│ │ ├── selecsls.mdx
│ │ ├── seresnext.mdx
│ │ ├── skresnet.mdx
│ │ ├── skresnext.mdx
│ │ ├── spnasnet.mdx
│ │ ├── ssl-resnet.mdx
│ │ ├── swsl-resnet.mdx
│ │ ├── swsl-resnext.mdx
│ │ ├── tf-efficientnet-condconv.mdx
│ │ ├── tf-efficientnet-lite.mdx
│ │ ├── tf-efficientnet.mdx
│ │ ├── tf-inception-v3.mdx
│ │ ├── tf-mixnet.mdx
│ │ ├── tf-mobilenet-v3.mdx
│ │ ├── tresnet.mdx
│ │ ├── wide-resnet.mdx
│ │ └── xception.mdx
│ │ ├── results.mdx
│ │ ├── scripts.mdx
│ │ └── training_hparam_examples.mdx
│ ├── hubconf.py
│ ├── inference.py
│ ├── mkdocs.yml
│ ├── model-index.yml
│ ├── requirements-docs.txt
│ ├── requirements-modelindex.txt
│ ├── requirements.txt
│ ├── results
│ ├── README.md
│ ├── benchmark-infer-amp-nchw-pt111-cu113-rtx3090.csv
│ ├── benchmark-infer-amp-nchw-pt112-cu113-rtx3090.csv
│ ├── benchmark-infer-amp-nhwc-pt111-cu113-rtx3090.csv
│ ├── benchmark-infer-amp-nhwc-pt112-cu113-rtx3090.csv
│ ├── benchmark-train-amp-nchw-pt111-cu113-rtx3090.csv
│ ├── benchmark-train-amp-nchw-pt112-cu113-rtx3090.csv
│ ├── benchmark-train-amp-nhwc-pt111-cu113-rtx3090.csv
│ ├── benchmark-train-amp-nhwc-pt112-cu113-rtx3090.csv
│ ├── generate_csv_results.py
│ ├── imagenet21k_goog_synsets.txt
│ ├── imagenet_a_indices.txt
│ ├── imagenet_a_synsets.txt
│ ├── imagenet_r_indices.txt
│ ├── imagenet_r_synsets.txt
│ ├── imagenet_real_labels.json
│ ├── imagenet_synsets.txt
│ ├── model_metadata-in1k.csv
│ ├── results-imagenet-a-clean.csv
│ ├── results-imagenet-a.csv
│ ├── results-imagenet-r-clean.csv
│ ├── results-imagenet-r.csv
│ ├── results-imagenet-real.csv
│ ├── results-imagenet.csv
│ ├── results-imagenetv2-matched-frequency.csv
│ └── results-sketch.csv
│ ├── setup.cfg
│ ├── setup.py
│ ├── tests
│ ├── __init__.py
│ ├── test_layers.py
│ ├── test_models.py
│ ├── test_optim.py
│ └── test_utils.py
│ ├── timm
│ ├── __init__.py
│ ├── data
│ │ ├── __init__.py
│ │ ├── auto_augment.py
│ │ ├── config.py
│ │ ├── constants.py
│ │ ├── dataset.py
│ │ ├── dataset_factory.py
│ │ ├── distributed_sampler.py
│ │ ├── loader.py
│ │ ├── mixup.py
│ │ ├── parsers
│ │ │ ├── __init__.py
│ │ │ ├── class_map.py
│ │ │ ├── img_extensions.py
│ │ │ ├── parser.py
│ │ │ ├── parser_factory.py
│ │ │ ├── parser_image_folder.py
│ │ │ ├── parser_image_in_tar.py
│ │ │ ├── parser_image_tar.py
│ │ │ └── parser_tfds.py
│ │ ├── random_erasing.py
│ │ ├── real_labels.py
│ │ ├── tf_preprocessing.py
│ │ ├── transforms.py
│ │ └── transforms_factory.py
│ ├── loss
│ │ ├── __init__.py
│ │ ├── asymmetric_loss.py
│ │ ├── binary_cross_entropy.py
│ │ ├── cross_entropy.py
│ │ └── jsd.py
│ ├── models
│ │ ├── __init__.py
│ │ ├── beit.py
│ │ ├── byoanet.py
│ │ ├── byobnet.py
│ │ ├── cait.py
│ │ ├── coat.py
│ │ ├── convit.py
│ │ ├── convmixer.py
│ │ ├── convnext.py
│ │ ├── crossvit.py
│ │ ├── cspnet.py
│ │ ├── deit.py
│ │ ├── densenet.py
│ │ ├── dla.py
│ │ ├── dpn.py
│ │ ├── edgenext.py
│ │ ├── efficientformer.py
│ │ ├── efficientnet.py
│ │ ├── efficientnet_blocks.py
│ │ ├── efficientnet_builder.py
│ │ ├── factory.py
│ │ ├── features.py
│ │ ├── fx_features.py
│ │ ├── gcvit.py
│ │ ├── ghostnet.py
│ │ ├── gluon_resnet.py
│ │ ├── gluon_xception.py
│ │ ├── hardcorenas.py
│ │ ├── helpers.py
│ │ ├── hrnet.py
│ │ ├── hub.py
│ │ ├── inception_resnet_v2.py
│ │ ├── inception_v3.py
│ │ ├── inception_v4.py
│ │ ├── layers
│ │ │ ├── __init__.py
│ │ │ ├── activations.py
│ │ │ ├── activations_jit.py
│ │ │ ├── activations_me.py
│ │ │ ├── adaptive_avgmax_pool.py
│ │ │ ├── attention_pool2d.py
│ │ │ ├── blur_pool.py
│ │ │ ├── bottleneck_attn.py
│ │ │ ├── cbam.py
│ │ │ ├── classifier.py
│ │ │ ├── cond_conv2d.py
│ │ │ ├── config.py
│ │ │ ├── conv2d_same.py
│ │ │ ├── conv_bn_act.py
│ │ │ ├── create_act.py
│ │ │ ├── create_attn.py
│ │ │ ├── create_conv2d.py
│ │ │ ├── create_norm.py
│ │ │ ├── create_norm_act.py
│ │ │ ├── drop.py
│ │ │ ├── eca.py
│ │ │ ├── evo_norm.py
│ │ │ ├── fast_norm.py
│ │ │ ├── filter_response_norm.py
│ │ │ ├── gather_excite.py
│ │ │ ├── global_context.py
│ │ │ ├── halo_attn.py
│ │ │ ├── helpers.py
│ │ │ ├── inplace_abn.py
│ │ │ ├── lambda_layer.py
│ │ │ ├── linear.py
│ │ │ ├── median_pool.py
│ │ │ ├── mixed_conv2d.py
│ │ │ ├── ml_decoder.py
│ │ │ ├── mlp.py
│ │ │ ├── non_local_attn.py
│ │ │ ├── norm.py
│ │ │ ├── norm_act.py
│ │ │ ├── padding.py
│ │ │ ├── patch_embed.py
│ │ │ ├── pool2d_same.py
│ │ │ ├── pos_embed.py
│ │ │ ├── selective_kernel.py
│ │ │ ├── separable_conv.py
│ │ │ ├── space_to_depth.py
│ │ │ ├── split_attn.py
│ │ │ ├── split_batchnorm.py
│ │ │ ├── squeeze_excite.py
│ │ │ ├── std_conv.py
│ │ │ ├── test_time_pool.py
│ │ │ ├── trace_utils.py
│ │ │ └── weight_init.py
│ │ ├── levit.py
│ │ ├── maxxvit.py
│ │ ├── mlp_mixer.py
│ │ ├── mobilenetv3.py
│ │ ├── mobilevit.py
│ │ ├── mvitv2.py
│ │ ├── nasnet.py
│ │ ├── nest.py
│ │ ├── nfnet.py
│ │ ├── pit.py
│ │ ├── pnasnet.py
│ │ ├── poolformer.py
│ │ ├── pruned
│ │ │ ├── ecaresnet101d_pruned.txt
│ │ │ ├── ecaresnet50d_pruned.txt
│ │ │ ├── efficientnet_b1_pruned.txt
│ │ │ ├── efficientnet_b2_pruned.txt
│ │ │ └── efficientnet_b3_pruned.txt
│ │ ├── pvt_v2.py
│ │ ├── registry.py
│ │ ├── regnet.py
│ │ ├── res2net.py
│ │ ├── resnest.py
│ │ ├── resnet.py
│ │ ├── resnetv2.py
│ │ ├── rexnet.py
│ │ ├── selecsls.py
│ │ ├── senet.py
│ │ ├── sequencer.py
│ │ ├── sknet.py
│ │ ├── swin_transformer.py
│ │ ├── swin_transformer_v2.py
│ │ ├── swin_transformer_v2_cr.py
│ │ ├── tnt.py
│ │ ├── tresnet.py
│ │ ├── twins.py
│ │ ├── vgg.py
│ │ ├── visformer.py
│ │ ├── vision_transformer.py
│ │ ├── vision_transformer_hybrid.py
│ │ ├── vision_transformer_relpos.py
│ │ ├── volo.py
│ │ ├── vovnet.py
│ │ ├── xception.py
│ │ ├── xception_aligned.py
│ │ └── xcit.py
│ ├── optim
│ │ ├── __init__.py
│ │ ├── adabelief.py
│ │ ├── adafactor.py
│ │ ├── adahessian.py
│ │ ├── adamp.py
│ │ ├── adamw.py
│ │ ├── lamb.py
│ │ ├── lars.py
│ │ ├── lookahead.py
│ │ ├── madgrad.py
│ │ ├── nadam.py
│ │ ├── nvnovograd.py
│ │ ├── optim_factory.py
│ │ ├── radam.py
│ │ ├── rmsprop_tf.py
│ │ └── sgdp.py
│ ├── scheduler
│ │ ├── __init__.py
│ │ ├── cosine_lr.py
│ │ ├── multistep_lr.py
│ │ ├── plateau_lr.py
│ │ ├── poly_lr.py
│ │ ├── scheduler.py
│ │ ├── scheduler_factory.py
│ │ ├── step_lr.py
│ │ └── tanh_lr.py
│ ├── utils
│ │ ├── __init__.py
│ │ ├── agc.py
│ │ ├── checkpoint_saver.py
│ │ ├── clip_grad.py
│ │ ├── cuda.py
│ │ ├── decay_batch.py
│ │ ├── distributed.py
│ │ ├── jit.py
│ │ ├── log.py
│ │ ├── metrics.py
│ │ ├── misc.py
│ │ ├── model.py
│ │ ├── model_ema.py
│ │ ├── random.py
│ │ └── summary.py
│ └── version.py
│ ├── train.py
│ └── validate.py
├── generator_codes
├── BigGAN-PyTorch-master
│ ├── .gitignore
│ ├── BigGAN.py
│ ├── BigGANdeep.py
│ ├── LICENSE
│ ├── README.md
│ ├── TFHub
│ │ ├── README.md
│ │ ├── biggan_v1.py
│ │ └── converter.py
│ ├── animal_hash.py
│ ├── calculate_inception_moments.py
│ ├── datasets.py
│ ├── imgs
│ │ ├── D Singular Values.png
│ │ ├── DeepSamples.png
│ │ ├── DogBall.png
│ │ ├── G Singular Values.png
│ │ ├── IS_FID.png
│ │ ├── Losses.png
│ │ ├── header_image.jpg
│ │ └── interp_sample.jpg
│ ├── inception_tf13.py
│ ├── inception_utils.py
│ ├── layers.py
│ ├── logs
│ │ ├── BigGAN_ch96_bs256x8.jsonl
│ │ ├── compare_IS.m
│ │ ├── metalog.txt
│ │ ├── process_inception_log.m
│ │ └── process_training.m
│ ├── losses.py
│ ├── make_hdf5.py
│ ├── sample.py
│ ├── scripts
│ │ ├── launch_BigGAN_bs256x8.sh
│ │ ├── launch_BigGAN_bs512x4.sh
│ │ ├── launch_BigGAN_ch64_bs256x8.sh
│ │ ├── launch_BigGAN_deep.sh
│ │ ├── launch_SAGAN_bs128x2_ema.sh
│ │ ├── launch_SNGAN.sh
│ │ ├── launch_cifar_ema.sh
│ │ ├── sample_BigGAN_bs256x8.sh
│ │ ├── sample_cifar_ema.sh
│ │ └── utils
│ │ │ ├── duplicate.sh
│ │ │ └── prepare_data.sh
│ ├── sync_batchnorm
│ │ ├── __init__.py
│ │ ├── batchnorm.py
│ │ ├── batchnorm_reimpl.py
│ │ ├── comm.py
│ │ ├── replicate.py
│ │ └── unittest.py
│ ├── train.py
│ ├── train_fns.py
│ └── utils.py
├── Readme.md
├── VQ-Diffusion-main
│ ├── LICENSE
│ ├── OUTPUT
│ │ └── pretrained_model
│ │ │ ├── config_imagenet.yaml
│ │ │ ├── config_text.yaml
│ │ │ └── taming_dvae
│ │ │ ├── config.yaml
│ │ │ ├── taming_f8_8192_openimages.yaml
│ │ │ ├── vqgan_ffhq_f16_1024.yaml
│ │ │ └── vqgan_imagenet_f16_16384.yaml
│ ├── SECURITY.md
│ ├── configs
│ │ ├── coco.yaml
│ │ ├── coco_tune.yaml
│ │ ├── cub200.yaml
│ │ ├── ffhq.yaml
│ │ ├── imagenet.yaml
│ │ └── ithq.yaml
│ ├── figures
│ │ └── framework.png
│ ├── help_folder
│ │ ├── readme.md
│ │ └── statistics
│ │ │ ├── taming_vqvae_2887.pt
│ │ │ └── taming_vqvae_974.pt
│ ├── image_synthesis
│ │ ├── data
│ │ │ ├── build.py
│ │ │ ├── cub200_dataset.py
│ │ │ ├── ffhq_dataset.py
│ │ │ ├── imagenet_class_index.json
│ │ │ ├── imagenet_dataset.py
│ │ │ ├── mscoco_dataset.py
│ │ │ └── utils
│ │ │ │ ├── comm.py
│ │ │ │ ├── image_preprocessor.py
│ │ │ │ └── manage.py
│ │ ├── distributed
│ │ │ ├── distributed.py
│ │ │ └── launch.py
│ │ ├── engine
│ │ │ ├── clip_grad_norm.py
│ │ │ ├── ema.py
│ │ │ ├── logger.py
│ │ │ ├── lr_scheduler.py
│ │ │ └── solver.py
│ │ ├── modeling
│ │ │ ├── build.py
│ │ │ ├── codecs
│ │ │ │ ├── base_codec.py
│ │ │ │ ├── image_codec
│ │ │ │ │ ├── ema_vqvae.py
│ │ │ │ │ ├── patch_vqgan.py
│ │ │ │ │ └── taming_gumbel_vqvae.py
│ │ │ │ └── text_codec
│ │ │ │ │ └── tokenize.py
│ │ │ ├── embeddings
│ │ │ │ ├── base_embedding.py
│ │ │ │ ├── class_embedding.py
│ │ │ │ ├── clip_text_embedding.py
│ │ │ │ └── dalle_mask_image_embedding.py
│ │ │ ├── models
│ │ │ │ ├── conditional_dalle.py
│ │ │ │ ├── dalle.py
│ │ │ │ └── unconditional_dalle.py
│ │ │ ├── modules
│ │ │ │ └── clip
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── bpe_simple_vocab_16e6.txt.gz
│ │ │ │ │ ├── clip.py
│ │ │ │ │ ├── clip_tokenizer.py
│ │ │ │ │ ├── model.py
│ │ │ │ │ └── simple_tokenizer.py
│ │ │ ├── transformers
│ │ │ │ ├── diffusion_transformer.py
│ │ │ │ └── transformer_utils.py
│ │ │ └── utils
│ │ │ │ └── misc.py
│ │ ├── taming
│ │ │ ├── lr_scheduler.py
│ │ │ ├── models
│ │ │ │ ├── cond_transformer.py
│ │ │ │ └── vqgan.py
│ │ │ ├── modules
│ │ │ │ ├── diffusionmodules
│ │ │ │ │ └── model.py
│ │ │ │ ├── discriminator
│ │ │ │ │ └── model.py
│ │ │ │ ├── losses
│ │ │ │ │ ├── __init__.py
│ │ │ │ │ ├── lpips.py
│ │ │ │ │ ├── segmentation.py
│ │ │ │ │ └── vqperceptual.py
│ │ │ │ ├── misc
│ │ │ │ │ └── coord.py
│ │ │ │ ├── transformer
│ │ │ │ │ ├── mingpt.py
│ │ │ │ │ └── permuter.py
│ │ │ │ ├── util.py
│ │ │ │ └── vqvae
│ │ │ │ │ └── quantize.py
│ │ │ └── util.py
│ │ └── utils
│ │ │ ├── io.py
│ │ │ └── misc.py
│ ├── inference_VQ_Diffusion.py
│ ├── install_req.sh
│ ├── readme.md
│ ├── running_command
│ │ ├── run_train_coco.py
│ │ ├── run_train_cub.py
│ │ ├── run_train_ffhq.py
│ │ ├── run_train_imagenet.py
│ │ └── run_tune_coco.py
│ └── train.py
├── glide-text2im-main
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── glide_text2im
│ │ ├── __init__.py
│ │ ├── clip
│ │ │ ├── __init__.py
│ │ │ ├── attention.py
│ │ │ ├── config.yaml
│ │ │ ├── encoders.py
│ │ │ ├── model_creation.py
│ │ │ └── utils.py
│ │ ├── download.py
│ │ ├── fp16_util.py
│ │ ├── gaussian_diffusion.py
│ │ ├── model_creation.py
│ │ ├── nn.py
│ │ ├── respace.py
│ │ ├── text2im_model.py
│ │ ├── tokenizer
│ │ │ ├── __init__.py
│ │ │ ├── bpe.py
│ │ │ ├── bpe_simple_vocab_16e6.txt.gz
│ │ │ ├── encoder.json.gz
│ │ │ ├── simple_tokenizer.py
│ │ │ └── vocab.bpe.gz
│ │ ├── unet.py
│ │ └── xf.py
│ ├── model-card.md
│ ├── notebooks
│ │ ├── clip_guided.ipynb
│ │ ├── grass.png
│ │ ├── inpaint.ipynb
│ │ └── text2im.ipynb
│ └── setup.py
├── guided-diffusion-main
│ ├── .gitignore
│ ├── LICENSE
│ ├── README.md
│ ├── datasets
│ │ ├── README.md
│ │ └── lsun_bedroom.py
│ ├── evaluations
│ │ ├── README.md
│ │ ├── evaluator.py
│ │ └── requirements.txt
│ ├── guided_diffusion
│ │ ├── __init__.py
│ │ ├── dist_util.py
│ │ ├── fp16_util.py
│ │ ├── gaussian_diffusion.py
│ │ ├── image_datasets.py
│ │ ├── logger.py
│ │ ├── losses.py
│ │ ├── nn.py
│ │ ├── resample.py
│ │ ├── respace.py
│ │ ├── script_util.py
│ │ ├── train_util.py
│ │ └── unet.py
│ ├── model-card.md
│ ├── scripts
│ │ ├── classifier_sample.py
│ │ ├── classifier_train.py
│ │ ├── image_nll.py
│ │ ├── image_sample.py
│ │ ├── image_train.py
│ │ ├── super_res_sample.py
│ │ └── super_res_train.py
│ └── setup.py
└── stable-diffusion-main
│ ├── LICENSE
│ ├── README.md
│ ├── Stable_Diffusion_v1_Model_Card.md
│ ├── assets
│ ├── a-painting-of-a-fire.png
│ ├── a-photograph-of-a-fire.png
│ ├── a-shirt-with-a-fire-printed-on-it.png
│ ├── a-shirt-with-the-inscription-'fire'.png
│ ├── a-watercolor-painting-of-a-fire.png
│ ├── birdhouse.png
│ ├── fire.png
│ ├── inpainting.png
│ ├── modelfigure.png
│ ├── rdm-preview.jpg
│ ├── reconstruction1.png
│ ├── reconstruction2.png
│ ├── results.gif
│ ├── rick.jpeg
│ ├── stable-samples
│ │ ├── img2img
│ │ │ ├── mountains-1.png
│ │ │ ├── mountains-2.png
│ │ │ ├── mountains-3.png
│ │ │ ├── sketch-mountains-input.jpg
│ │ │ ├── upscaling-in.png
│ │ │ └── upscaling-out.png
│ │ └── txt2img
│ │ │ ├── 000002025.png
│ │ │ ├── 000002035.png
│ │ │ ├── merged-0005.png
│ │ │ ├── merged-0006.png
│ │ │ └── merged-0007.png
│ ├── the-earth-is-on-fire,-oil-on-canvas.png
│ ├── txt2img-convsample.png
│ ├── txt2img-preview.png
│ └── v1-variants-scores.jpg
│ ├── configs
│ ├── autoencoder
│ │ ├── autoencoder_kl_16x16x16.yaml
│ │ ├── autoencoder_kl_32x32x4.yaml
│ │ ├── autoencoder_kl_64x64x3.yaml
│ │ └── autoencoder_kl_8x8x64.yaml
│ ├── latent-diffusion
│ │ ├── celebahq-ldm-vq-4.yaml
│ │ ├── cin-ldm-vq-f8.yaml
│ │ ├── cin256-v2.yaml
│ │ ├── ffhq-ldm-vq-4.yaml
│ │ ├── lsun_bedrooms-ldm-vq-4.yaml
│ │ ├── lsun_churches-ldm-kl-8.yaml
│ │ └── txt2img-1p4B-eval.yaml
│ ├── retrieval-augmented-diffusion
│ │ └── 768x768.yaml
│ └── stable-diffusion
│ │ └── v1-inference.yaml
│ ├── data
│ ├── DejaVuSans.ttf
│ ├── example_conditioning
│ │ ├── superresolution
│ │ │ └── sample_0.jpg
│ │ └── text_conditional
│ │ │ └── sample_0.txt
│ ├── imagenet_clsidx_to_label.txt
│ ├── imagenet_train_hr_indices.p
│ ├── imagenet_val_hr_indices.p
│ ├── index_synset.yaml
│ └── inpainting_examples
│ │ ├── 6458524847_2f4c361183_k.png
│ │ ├── 6458524847_2f4c361183_k_mask.png
│ │ ├── 8399166846_f6fb4e4b8e_k.png
│ │ ├── 8399166846_f6fb4e4b8e_k_mask.png
│ │ ├── alex-iby-G_Pk4D9rMLs.png
│ │ ├── alex-iby-G_Pk4D9rMLs_mask.png
│ │ ├── bench2.png
│ │ ├── bench2_mask.png
│ │ ├── bertrand-gabioud-CpuFzIsHYJ0.png
│ │ ├── bertrand-gabioud-CpuFzIsHYJ0_mask.png
│ │ ├── billow926-12-Wc-Zgx6Y.png
│ │ ├── billow926-12-Wc-Zgx6Y_mask.png
│ │ ├── overture-creations-5sI6fQgYIuo.png
│ │ ├── overture-creations-5sI6fQgYIuo_mask.png
│ │ ├── photo-1583445095369-9c651e7e5d34.png
│ │ └── photo-1583445095369-9c651e7e5d34_mask.png
│ ├── environment.yaml
│ ├── ldm
│ ├── data
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── imagenet.py
│ │ └── lsun.py
│ ├── lr_scheduler.py
│ ├── models
│ │ ├── autoencoder.py
│ │ └── diffusion
│ │ │ ├── __init__.py
│ │ │ ├── classifier.py
│ │ │ ├── ddim.py
│ │ │ ├── ddpm.py
│ │ │ ├── dpm_solver
│ │ │ ├── __init__.py
│ │ │ ├── dpm_solver.py
│ │ │ └── sampler.py
│ │ │ └── plms.py
│ ├── modules
│ │ ├── attention.py
│ │ ├── diffusionmodules
│ │ │ ├── __init__.py
│ │ │ ├── model.py
│ │ │ ├── openaimodel.py
│ │ │ └── util.py
│ │ ├── distributions
│ │ │ ├── __init__.py
│ │ │ └── distributions.py
│ │ ├── ema.py
│ │ ├── encoders
│ │ │ ├── __init__.py
│ │ │ └── modules.py
│ │ ├── image_degradation
│ │ │ ├── __init__.py
│ │ │ ├── bsrgan.py
│ │ │ ├── bsrgan_light.py
│ │ │ ├── utils
│ │ │ │ └── test.png
│ │ │ └── utils_image.py
│ │ ├── losses
│ │ │ ├── __init__.py
│ │ │ ├── contperceptual.py
│ │ │ └── vqperceptual.py
│ │ └── x_transformer.py
│ └── util.py
│ ├── main.py
│ ├── models
│ ├── first_stage_models
│ │ ├── kl-f16
│ │ │ └── config.yaml
│ │ ├── kl-f32
│ │ │ └── config.yaml
│ │ ├── kl-f4
│ │ │ └── config.yaml
│ │ ├── kl-f8
│ │ │ └── config.yaml
│ │ ├── vq-f16
│ │ │ └── config.yaml
│ │ ├── vq-f4-noattn
│ │ │ └── config.yaml
│ │ ├── vq-f4
│ │ │ └── config.yaml
│ │ ├── vq-f8-n256
│ │ │ └── config.yaml
│ │ └── vq-f8
│ │ │ └── config.yaml
│ └── ldm
│ │ ├── bsr_sr
│ │ └── config.yaml
│ │ ├── celeba256
│ │ └── config.yaml
│ │ ├── cin256
│ │ └── config.yaml
│ │ ├── ffhq256
│ │ └── config.yaml
│ │ ├── inpainting_big
│ │ └── config.yaml
│ │ ├── layout2img-openimages256
│ │ └── config.yaml
│ │ ├── lsun_beds256
│ │ └── config.yaml
│ │ ├── lsun_churches256
│ │ └── config.yaml
│ │ ├── semantic_synthesis256
│ │ └── config.yaml
│ │ ├── semantic_synthesis512
│ │ └── config.yaml
│ │ └── text2img256
│ │ └── config.yaml
│ ├── notebook_helpers.py
│ ├── scripts
│ ├── download_first_stages.sh
│ ├── download_models.sh
│ ├── img2img.py
│ ├── inpaint.py
│ ├── knn2img.py
│ ├── latent_imagenet_diffusion.ipynb
│ ├── sample_diffusion.py
│ ├── tests
│ │ └── test_watermark.py
│ ├── train_searcher.py
│ └── txt2img.py
│ └── setup.py
└── index.html
/Examples/visulization.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/Examples/visulization.png
--------------------------------------------------------------------------------
/License:
--------------------------------------------------------------------------------
1 | Licenses
2 |
3 | Unless specifically labeled otherwise, these Datasets are provided to You under the terms of the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License (“CC BY-NC-SA 4.0”), with the additional terms included herein.
4 | The CC BY-NC-SA 4.0 may be accessed at https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode. When You download or use the Datasets from the Website or elsewhere, You are agreeing to comply with the terms of CC BY-NC-SA 4.0, and also agreeing to the Dataset Terms.
5 | Where these Dataset Terms conflict with the terms of CC BY-NC-SA 4.0, these Dataset Terms shall prevail. We reiterate once again that this dataset is used only for non-commercial purposes such as academic research, teaching, or scientific publications.
6 | We prohibits You from using the dataset or any derivative works for commercial purposes, such as selling data or using it for commercial gain.
7 |
--------------------------------------------------------------------------------
/detector_codes/AutoGAN-master/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/AutoGAN-master/.DS_Store
--------------------------------------------------------------------------------
/detector_codes/AutoGAN-master/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "pytorch-CycleGAN-and-pix2pix"]
2 | path = pytorch-CycleGAN-and-pix2pix
3 | url = https://github.com/spongezhang/pytorch-CycleGAN-and-pix2pix.git
4 | branch = auto_gan
5 |
--------------------------------------------------------------------------------
/detector_codes/AutoGAN-master/autogan:
--------------------------------------------------------------------------------
1 | pytorch-CycleGAN-and-pix2pix
--------------------------------------------------------------------------------
/detector_codes/AutoGAN-master/data/fake:
--------------------------------------------------------------------------------
1 | ../autogan/generated/
--------------------------------------------------------------------------------
/detector_codes/AutoGAN-master/data/real:
--------------------------------------------------------------------------------
1 | ../autogan/datasets/
--------------------------------------------------------------------------------
/detector_codes/AutoGAN-master/fig/AutoGAN.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/AutoGAN-master/fig/AutoGAN.png
--------------------------------------------------------------------------------
/detector_codes/AutoGAN-master/fig/AutoGAN_Image.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/AutoGAN-master/fig/AutoGAN_Image.png
--------------------------------------------------------------------------------
/detector_codes/AutoGAN-master/fig/checkerboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/AutoGAN-master/fig/checkerboard.png
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/data/__init__.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 | from torch.utils.data.sampler import WeightedRandomSampler
4 |
5 | from .datasets import dataset_folder
6 |
7 |
8 | def get_dataset(opt):
9 | dset_lst = []
10 | for cls in opt.classes:
11 | root = opt.dataroot + '/' + cls
12 | dset = dataset_folder(opt, root)
13 | dset_lst.append(dset)
14 | return torch.utils.data.ConcatDataset(dset_lst)
15 |
16 |
17 | def get_bal_sampler(dataset):
18 | targets = []
19 | for d in dataset.datasets:
20 | targets.extend(d.targets)
21 |
22 | ratio = np.bincount(targets)
23 | w = 1. / torch.tensor(ratio, dtype=torch.float)
24 | sample_weights = w[targets]
25 | sampler = WeightedRandomSampler(weights=sample_weights,
26 | num_samples=len(sample_weights))
27 | return sampler
28 |
29 |
30 | def create_dataloader(opt):
31 | shuffle = not opt.serial_batches if (opt.isTrain and not opt.class_bal) else False
32 | dataset = get_dataset(opt)
33 | sampler = get_bal_sampler(dataset) if opt.class_bal else None
34 |
35 | data_loader = torch.utils.data.DataLoader(dataset,
36 | batch_size=opt.batch_size,
37 | shuffle=shuffle,
38 | sampler=sampler,
39 | num_workers=int(opt.num_threads))
40 | return data_loader
41 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/dataset/test/download_testset.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | DOCUMENT_ID="1z_fD3UKgWQyOTZIBbYSaQ-hz4AzUrLC1"
3 | FINAL_DOWNLOADED_FILENAME="testset.zip"
4 |
5 | curl -c /tmp/cookies "https://drive.google.com/uc?export=download&id=$DOCUMENT_ID" > /tmp/intermezzo.html
6 | curl -L -b /tmp/cookies "https://drive.google.com$(cat /tmp/intermezzo.html | grep -Po 'uc-download-link" [^>]* href="\K[^"]*' | sed 's/\&/\&/g')" > $FINAL_DOWNLOADED_FILENAME
7 | unzip testset.zip
8 | rm testset.zip
9 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/dataset/train/download_trainset.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | DOCUMENT_ID="1iVNBV0glknyTYGA9bCxT_d0CVTOgGcKh"
3 | FINAL_DOWNLOADED_FILENAME="trainset.zip"
4 |
5 | curl -c /tmp/cookies "https://drive.google.com/uc?export=download&id=$DOCUMENT_ID" > /tmp/intermezzo.html
6 | curl -L -b /tmp/cookies "https://drive.google.com$(cat /tmp/intermezzo.html | grep -Po 'uc-download-link" [^>]* href="\K[^"]*' | sed 's/\&/\&/g')" > $FINAL_DOWNLOADED_FILENAME
7 | unzip trainset.zip
8 | rm trainset.zip
9 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/dataset/val/download_valset.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | DOCUMENT_ID="1FU7xF8Wl_F8b0tgL0529qg2nZ_RpdVNL"
3 | FINAL_DOWNLOADED_FILENAME="valset.zip"
4 |
5 | curl -c /tmp/cookies "https://drive.google.com/uc?export=download&id=$DOCUMENT_ID" > /tmp/intermezzo.html
6 | curl -L -b /tmp/cookies "https://drive.google.com$(cat /tmp/intermezzo.html | grep -Po 'uc-download-link" [^>]* href="\K[^"]*' | sed 's/\&/\&/g')" > $FINAL_DOWNLOADED_FILENAME
7 | unzip valset.zip
8 | rm valset.zip
9 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/demo.py:
--------------------------------------------------------------------------------
1 | import os
2 | import sys
3 | import torch
4 | import torch.nn
5 | import argparse
6 | import numpy as np
7 | import torchvision.transforms as transforms
8 | import torchvision.datasets as datasets
9 | from PIL import Image
10 | from networks.resnet import resnet50
11 |
12 | parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
13 | parser.add_argument('-f','--file', default='examples_realfakedir')
14 | parser.add_argument('-m','--model_path', type=str, default='weights/blur_jpg_prob0.5.pth')
15 | parser.add_argument('-c','--crop', type=int, default=None, help='by default, do not crop. specify crop size')
16 | parser.add_argument('--use_cpu', action='store_true', help='uses gpu by default, turn on to use cpu')
17 |
18 | opt = parser.parse_args()
19 |
20 | model = resnet50(num_classes=1)
21 | state_dict = torch.load(opt.model_path, map_location='cpu')
22 | model.load_state_dict(state_dict['model'])
23 | if(not opt.use_cpu):
24 | model.cuda()
25 | model.eval()
26 |
27 | # Transform
28 | trans_init = []
29 | if(opt.crop is not None):
30 | trans_init = [transforms.CenterCrop(opt.crop),]
31 | print('Cropping to [%i]'%opt.crop)
32 | else:
33 | print('Not cropping')
34 | trans = transforms.Compose(trans_init + [
35 | transforms.ToTensor(),
36 | transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]),
37 | ])
38 |
39 | img = trans(Image.open(opt.file).convert('RGB'))
40 |
41 | with torch.no_grad():
42 | in_tens = img.unsqueeze(0)
43 | if(not opt.use_cpu):
44 | in_tens = in_tens.cuda()
45 | prob = model(in_tens).sigmoid().item()
46 |
47 | print('probability of being synthetic: {:.2f}%'.format(prob * 100))
48 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/eval.py:
--------------------------------------------------------------------------------
1 | import os
2 | import csv
3 | import torch
4 |
5 | from validate import validate
6 | from networks.resnet import resnet50
7 | from options.test_options import TestOptions
8 | from eval_config import *
9 |
10 |
11 | # Running tests
12 | opt = TestOptions().parse(print_options=False)
13 | model_name = os.path.basename(model_path).replace('.pth', '')
14 | rows = [["{} model testing on...".format(model_name)],
15 | ['testset', 'accuracy', 'avg precision']]
16 |
17 | print("{} model testing on...".format(model_name))
18 | for v_id, val in enumerate(vals):
19 | opt.dataroot = '{}/{}'.format(dataroot, val)
20 | opt.classes = os.listdir(opt.dataroot) if multiclass[v_id] else ['']
21 | opt.no_resize = True # testing without resizing by default
22 |
23 | model = resnet50(num_classes=1)
24 | state_dict = torch.load(model_path, map_location='cpu')
25 | model.load_state_dict(state_dict['model'])
26 | model.cuda()
27 | model.eval()
28 |
29 | acc, ap, _, _, _, _ = validate(model, opt)
30 | rows.append([val, acc, ap])
31 | print("({}) acc: {}; ap: {}".format(val, acc, ap))
32 |
33 | csv_name = results_dir + '/{}.csv'.format(model_name)
34 | with open(csv_name, 'w') as f:
35 | csv_writer = csv.writer(f, delimiter=',')
36 | csv_writer.writerows(rows)
37 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/eval_config.py:
--------------------------------------------------------------------------------
1 | from util import mkdir
2 |
3 |
4 | # directory to store the results
5 | results_dir = './results/'
6 | mkdir(results_dir)
7 |
8 | # root to the testsets
9 | dataroot = './dataset/test/'
10 |
11 | # list of synthesis algorithms
12 | vals = ['progan', 'stylegan', 'biggan', 'cyclegan', 'stargan', 'gaugan',
13 | 'crn', 'imle', 'seeingdark', 'san', 'deepfake', 'stylegan2', 'whichfaceisreal']
14 |
15 | # indicates if corresponding testset has multiple classes
16 | multiclass = [1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0]
17 |
18 | # model
19 | model_path = 'weights/blur_jpg_prob0.5.pth'
20 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/examples/fake.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/CNNDetection-master/examples/fake.png
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/examples/real.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/CNNDetection-master/examples/real.png
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/examples/realfakedir/0_real/real.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/CNNDetection-master/examples/realfakedir/0_real/real.png
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/examples/realfakedir/1_fake/fake.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/CNNDetection-master/examples/realfakedir/1_fake/fake.png
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/networks/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/CNNDetection-master/networks/__init__.py
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/options/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/CNNDetection-master/options/__init__.py
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/options/test_options.py:
--------------------------------------------------------------------------------
1 | from .base_options import BaseOptions
2 |
3 |
4 | class TestOptions(BaseOptions):
5 | def initialize(self, parser):
6 | parser = BaseOptions.initialize(self, parser)
7 | parser.add_argument('--model_path')
8 | parser.add_argument('--no_resize', action='store_true')
9 | parser.add_argument('--no_crop', action='store_true')
10 | parser.add_argument('--eval', action='store_true', help='use eval mode during test time.')
11 |
12 | self.isTrain = False
13 | return parser
14 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/requirements.txt:
--------------------------------------------------------------------------------
1 | scipy
2 | scikit-learn
3 | numpy
4 | opencv_python
5 | Pillow
6 | torch>=1.2.0
7 | torchvision
8 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/util.py:
--------------------------------------------------------------------------------
1 | import os
2 | import torch
3 |
4 |
5 | def mkdirs(paths):
6 | if isinstance(paths, list) and not isinstance(paths, str):
7 | for path in paths:
8 | mkdir(path)
9 | else:
10 | mkdir(paths)
11 |
12 |
13 | def mkdir(path):
14 | if not os.path.exists(path):
15 | os.makedirs(path)
16 |
17 |
18 | def unnormalize(tens, mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]):
19 | # assume tensor of shape NxCxHxW
20 | return tens * torch.Tensor(std)[None, :, None, None] + torch.Tensor(
21 | mean)[None, :, None, None]
22 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/validate.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import numpy as np
3 | from networks.resnet import resnet50
4 | from sklearn.metrics import average_precision_score, precision_recall_curve, accuracy_score
5 | from options.test_options import TestOptions
6 | from data import create_dataloader
7 |
8 |
9 | def validate(model, opt):
10 | data_loader = create_dataloader(opt)
11 |
12 | with torch.no_grad():
13 | y_true, y_pred = [], []
14 | for img, label in data_loader:
15 | in_tens = img.cuda()
16 | y_pred.extend(model(in_tens).sigmoid().flatten().tolist())
17 | y_true.extend(label.flatten().tolist())
18 |
19 | y_true, y_pred = np.array(y_true), np.array(y_pred)
20 | r_acc = accuracy_score(y_true[y_true==0], y_pred[y_true==0] > 0.5)
21 | f_acc = accuracy_score(y_true[y_true==1], y_pred[y_true==1] > 0.5)
22 | acc = accuracy_score(y_true, y_pred > 0.5)
23 | ap = average_precision_score(y_true, y_pred)
24 | return acc, ap, r_acc, f_acc, y_true, y_pred
25 |
26 |
27 | if __name__ == '__main__':
28 | opt = TestOptions().parse(print_options=False)
29 |
30 | model = resnet50(num_classes=1)
31 | state_dict = torch.load(opt.model_path, map_location='cpu')
32 | model.load_state_dict(state_dict['model'])
33 | model.cuda()
34 | model.eval()
35 |
36 | acc, avg_precision, r_acc, f_acc, y_true, y_pred = validate(model, opt)
37 |
38 | print("accuracy:", acc)
39 | print("average precision:", avg_precision)
40 |
41 | print("accuracy of real images:", r_acc)
42 | print("accuracy of fake images:", f_acc)
43 |
--------------------------------------------------------------------------------
/detector_codes/CNNDetection-master/weights/download_weights.sh:
--------------------------------------------------------------------------------
1 | wget https://www.dropbox.com/s/2g2jagq2jn1fd0i/blur_jpg_prob0.5.pth?dl=0 -O ./weights/blur_jpg_prob0.5.pth
2 | wget https://www.dropbox.com/s/h7tkpcgiwuftb6g/blur_jpg_prob0.1.pth?dl=0 -O ./weights/blur_jpg_prob0.1.pth
3 |
4 |
--------------------------------------------------------------------------------
/detector_codes/F3Net-main/README.md:
--------------------------------------------------------------------------------
1 | # Thinking in frequency: Face forgery detection by mining frequency-aware clues
2 |
3 | 

4 |
5 | *European Conference on Computer Vision 2020*
6 |
7 |
8 | This implementation is mainly based on the desciption in the [paper](https://www.ecva.net/papers/eccv_2020/papers_ECCV/papers/123570086.pdf) on top of XceptionNet. The inplementation has three models:
9 | * **MixBlock**: Two-stream Collaborative Framework (@ block 7 and block 12). If you change the input image size, revise the ```width``` and ```height``` parameters in lines ```49``` and ```50```.
10 | * **FAD**: Frequency-aware Decomposition
11 | * **LFS**: Local Frequency Statistics
12 |
13 |
14 | Source code is mainly referenced from this [repo](https://github.com/yyk-wew/F3Net).
15 | Download pre-trained XceptionNet from [here](http://data.lip6.fr/cadene/pretrainedmodels/xception-b5690688.pth).
16 | #
17 | *Star if you find it useful.* ⭐
18 |
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/.fuse_hidden0000b11f00000019:
--------------------------------------------------------------------------------
1 | #
2 | ## Global Texture Enhancement for Fake Face Detection in the Wild (CVPR2020)
3 |
4 | Code for the paper [Global Texture Enhancement for Fake Face Detection in the Wild](https://arxiv.org/abs/2002.00133), CVPR 2020.
5 |
6 | **Authors**: Zhengzhe Liu, Xiaojuan Qi, Philip H.S. Torr
7 |
8 |
9 |
10 |
11 | ## Demo
12 |
13 | Download [the model and the demo data](https://drive.google.com/) for StyleGAN-FFHQ, StyleGAN-CelebA and PGGAN-CelebA, respectively. In each folder,
14 |
15 | ```
16 | python demo.py
17 | ```
18 |
19 | It will print the file name, processing (resize 8x, JPEG or original image) and prediction (0 for fake and 1 for real).
20 |
21 | ## Data Preparation
22 |
23 | Download the 10k images from FFHQ, CelebA, and generate 10k images using StyleGAN, PGGAN on the datasets. Please save the 1024*1024 resolution images with PNG format, not JPG.
24 |
25 | Optionally, to evaluate the low-resolution GANs, download images from CelebA dataset, and generate images using DCGAN, DRAGAN and StarGAN.
26 |
27 |
28 | ## Training
29 |
30 | Generate the filelist for training.
31 |
32 | ```
33 | python gene.py
34 | ```
35 |
36 | Put graminit.pth to the training folder as initialization, and start training, while evaluate the model on the validation set regularly to choose the best model.
37 |
38 | ```
39 | python main.py
40 | ```
41 |
42 | ## Evaluation
43 |
44 |
45 | Modify "root" folder and image path in test.py, and then test the images on all the datasets.
46 |
47 | ```
48 | python test.py
49 | python test2.py
50 | python test3.py
51 | ```
52 |
53 | ## Contact
54 | If you have any questions or suggestions about this repo, please feel free to contact me (liuzhengzhelzz@gmail.com).
55 |
56 |
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/README.md:
--------------------------------------------------------------------------------
1 | #
2 | ## Global Texture Enhancement for Fake Face Detection in the Wild (CVPR2020)
3 |
4 | Code for the paper [Global Texture Enhancement for Fake Face Detection in the Wild](https://arxiv.org/abs/2002.00133), CVPR 2020.
5 |
6 | **Authors**: Zhengzhe Liu, Xiaojuan Qi, Philip H.S. Torr
7 |
8 |
9 |
10 |
11 | ## Demo
12 |
13 | Download [the model and the demo data](https://drive.google.com/drive/folders/10fSAR8lh94FDGNoMMo5cfDCKQqkZ2Nsm?usp=sharing) for StyleGAN-FFHQ, StyleGAN-CelebA and PGGAN-CelebA, respectively. In each folder,
14 |
15 | ```
16 | python demo.py
17 | ```
18 |
19 | It will print the file name, processing (resize 8x, JPEG or original image) and prediction (0 for fake and 1 for real).
20 |
21 | ## Data Preparation
22 |
23 | Download the 10k images from FFHQ, CelebA, and generate 10k images using StyleGAN, PGGAN on the datasets. Please save the 1024*1024 resolution images with PNG format, not JPG.
24 |
25 | Optionally, to evaluate the low-resolution GANs, download images from CelebA dataset, and generate images using DCGAN, DRAGAN and StarGAN.
26 |
27 |
28 | ## Training
29 |
30 | Generate the filelist for training.
31 |
32 | ```
33 | python gene.py
34 | ```
35 |
36 | Put graminit.pth to the training folder as initialization, and start training, while evaluate the model on the validation set regularly to choose the best model.
37 |
38 | ```
39 | python main.py
40 | ```
41 |
42 | ## Evaluation
43 |
44 |
45 | Modify "root" folder and image path in test.py, and then test the images on all the datasets.
46 |
47 | ```
48 | python test.py
49 | python test2.py
50 | python test3.py
51 | ```
52 |
53 | ## Contact
54 | If you have any questions or suggestions about this repo, please feel free to contact me (liuzhengzhelzz@gmail.com).
55 |
56 |
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/face.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/face.PNG
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/pggan-celeba/__pycache__/resnet18_gram.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/pggan-celeba/__pycache__/resnet18_gram.cpython-37.pyc
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/pggan-celeba/gene.py:
--------------------------------------------------------------------------------
1 | import glob,random
2 |
3 | root='./'
4 | lines=[]
5 | paths1=glob.glob(root+'pngdata/prog-gan-cele/*.png')
6 | for path in paths1:
7 | line=path+' 0\n'
8 | lines.append(line)
9 |
10 | paths2=glob.glob(root+'pngdata/celeba-1024/*.png')
11 | for path in paths2:
12 | line=path+' 1\n'
13 | lines.append(line)
14 |
15 | f=open('list.txt', 'w')
16 | random.shuffle(lines)
17 | for line in lines:
18 | f.write(line)
19 | f.close()
20 |
21 |
22 |
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/pggan-celeba/result.txt:
--------------------------------------------------------------------------------
1 | [0.7][0.][0.8][0.][0.8][0.][0.][0.81818182][0.][0.90909091][0.][0.90909091][0.90909091][0.][0.90909091][0.][0.90909091][0.][0.81818182][0.][0.72727273][0.][0.71428571][0.][0.][0.81818182][0.][0.90909091][0.][0.]
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/pngdata/data/style-ffhq/.fuse_hidden0000b34e00000018:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/pngdata/data/style-ffhq/.fuse_hidden0000b34e00000018
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-celeba/.fuse_hidden0000b30800000008:
--------------------------------------------------------------------------------
1 | [0.][0.][0.][0.][0.][0.][0.][0.][0.][0.][0.][0.][0.][0.][0.][0.][0.][0.]
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-celeba/.fuse_hidden0000b55f00000006:
--------------------------------------------------------------------------------
1 | [0.8][0.][0.9][0.][0.9][0.][0.][0.90909091][0.][0.90909091][0.][0.90909091][0.54545455][0.][0.81818182][0.][0.90909091][0.][0.85714286][0.][0.72727273][0.][0.80952381][0.][0.][0.81818182][0.][0.90909091][0.27272727][0.]
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-celeba/.fuse_hidden0000b5a400000010:
--------------------------------------------------------------------------------
1 | import sys
2 | import numpy as np
3 | import torch,os,random,glob
4 | from torch import nn
5 | from torch import optim
6 | import torch.nn.functional as F
7 | from torch.autograd import Variable
8 | from torchvision import datasets, transforms#, models
9 | from torch.utils.data import Dataset, DataLoader
10 | import cv2
11 | import torch.utils.model_zoo as model_zoo
12 | import resnet18_gram as resnet
13 | import os
14 | #import scipy.io
15 | from torchvision.transforms import transforms
16 |
17 |
18 | for idx in range(115,116):
19 | model=torch.load('aerialmodel'+str(idx)+'.pth')
20 | model.eval()
21 | corr=0.0
22 | wrong=0.0
23 |
24 | corrs = np.zeros((2,1))
25 | wrongs = np.zeros((2,1))
26 |
27 |
28 | gt=1
29 | cnt=0
30 | paths=glob.glob('/media/lzz/LENOVO_USB_HDD1/pngdata/fang/*')
31 | for path in paths:
32 | name=path.split('/')[-1].split('.')[0]
33 | if int(cnt)>10000:
34 | continue
35 | cnt+=1
36 | im=cv2.imread(path)
37 | h=im.shape[0]
38 | ims = np.zeros((1, 3, h, h))
39 | ims[0, 0, :, :] = im[:, :, 0]
40 | ims[0, 1, :, :] = im[:, :, 1]
41 | ims[0, 2, :, :] = im[:, :, 2]
42 |
43 | image_tensor =torch.tensor(ims).float()
44 | inputs = Variable(image_tensor).float().cuda()
45 | output = model(inputs)
46 | output=output.detach().cpu().numpy()
47 |
48 | pred=np.argmax(output)
49 | print (gt,pred)
50 |
51 | if int(gt)==int(pred):
52 | corr+=1
53 | corrs[int(gt)] = corrs[int(gt)]+1
54 | else:
55 | wrong+=1
56 | wrongs[int(gt)] = wrongs[int(gt)] + 1
57 |
58 | print(corrs[0]/(corrs[0]+wrongs[0]+1))
59 | print(corrs[1]/(corrs[1]+wrongs[1]+1),idx)
60 |
61 |
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-celeba/__pycache__/resnet18_gram.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-celeba/__pycache__/resnet18_gram.cpython-37.pyc
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-celeba/demo.txt:
--------------------------------------------------------------------------------
1 | [0.72727273][0.][0.72727273][0.][0.80952381][0.][0.][0.81818182][0.][0.90909091][0.45454545][0.][0.7][0.][0.][0.90909091][0.27272727][0.]
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-celeba/gene.py:
--------------------------------------------------------------------------------
1 | import glob,random
2 |
3 | root='./'
4 | lines=[]
5 | paths1=glob.glob(root+'pngdata/style-cele/*.png')
6 | for path in paths1:
7 | line=path+' 0\n'
8 | lines.append(line)
9 |
10 | paths2=glob.glob(root+'pngdata/celeba-1024/*.png')
11 | for path in paths2:
12 | line=path+' 1\n'
13 | lines.append(line)
14 |
15 | f=open('list.txt', 'w')
16 | random.shuffle(lines)
17 | for line in lines:
18 | f.write(line)
19 | f.close()
20 |
21 |
22 |
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-celeba/result.txt:
--------------------------------------------------------------------------------
1 | [0.8][0.][0.9][0.][0.9][0.][0.][0.90909091][0.][0.90909091][0.][0.90909091][0.54545455][0.][0.81818182][0.][0.90909091][0.][0.85714286][0.][0.72727273][0.][0.80952381][0.][0.][0.81818182][0.][0.90909091][0.27272727][0.]
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-ffhq/__pycache__/resnet18_gram.cpython-37.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-ffhq/__pycache__/resnet18_gram.cpython-37.pyc
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-ffhq/gene.py:
--------------------------------------------------------------------------------
1 | import glob,random
2 |
3 | root='./'
4 | lines=[]
5 | paths1=glob.glob(root+'pngdata/style-ffhq/*.png')
6 | for path in paths1:
7 | line=path+' 0\n'
8 | lines.append(line)
9 |
10 | paths2=glob.glob(root+'pngdata/style-ffhq/*.png')
11 | for path in paths2:
12 | line=path+' 1\n'
13 | lines.append(line)
14 |
15 | f=open('list.txt', 'w')
16 | random.shuffle(lines)
17 | for line in lines:
18 | f.write(line)
19 | f.close()
20 |
21 |
22 |
--------------------------------------------------------------------------------
/detector_codes/Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master/stylegan-ffhq/result.txt:
--------------------------------------------------------------------------------
1 | [0.90909091][0.][0.90909091][0.][0.90909091][0.][0.][0.81818182][0.][0.90909091][0.][0.90909091][0.][0.90909091][0.5][0.]
--------------------------------------------------------------------------------
/detector_codes/Readme.md:
--------------------------------------------------------------------------------
1 | # Codes of Detectors
2 |
3 | These are the codes of the detectors used in GenImage benchmark.
4 |
5 | ResNet50: pytorch-image-models-0.6.12
6 |
7 | DeiT-s:deit-main
8 |
9 | Swin-T:Swin-Transformer-main
10 |
11 | CNNSpot: CNNDetection-master
12 |
13 | Spec:AutoGAN
14 |
15 | F3Net:F3Net-main
16 |
17 | GramNet:Global_Texture_Enhancement_for_Fake_Face_Detection_in_the-Wild-master
18 |
19 |
20 |
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Microsoft Open Source Code of Conduct
2 |
3 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4 |
5 | Resources:
6 |
7 | - [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8 | - [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9 | - Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
10 |
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/SUPPORT.md:
--------------------------------------------------------------------------------
1 | # TODO: The maintainer of this repo has not yet edited this file
2 |
3 | **REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project?
4 |
5 | - **No CSS support:** Fill out this template with information about how to file issues and get help.
6 | - **Yes CSS support:** Fill out an intake form at [aka.ms/spot](https://aka.ms/spot). CSS will work with/help you to determine next steps. More details also available at [aka.ms/onboardsupport](https://aka.ms/onboardsupport).
7 | - **Not sure?** Fill out a SPOT intake as though the answer were "Yes". CSS will help you decide.
8 |
9 | *Then remove this first heading from this SUPPORT.MD file before publishing your repo.*
10 |
11 | # Support
12 |
13 | ## How to file issues and get help
14 |
15 | This project uses GitHub Issues to track bugs and feature requests. Please search the existing
16 | issues before filing new issues to avoid duplicates. For new issues, file your bug or
17 | feature request as a new Issue.
18 |
19 | For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE
20 | FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER
21 | CHANNEL. WHERE WILL YOU HELP PEOPLE?**.
22 |
23 | ## Microsoft Support Policy
24 |
25 | Support for this **PROJECT or PRODUCT** is limited to the resources listed above.
26 |
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/simmim/simmim_finetune__swin_base__img224_window7__800ep.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: simmim_finetune
4 | DROP_PATH_RATE: 0.1
5 | SWIN:
6 | EMBED_DIM: 128
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 4, 8, 16, 32 ]
9 | WINDOW_SIZE: 7
10 | DATA:
11 | IMG_SIZE: 224
12 | TRAIN:
13 | EPOCHS: 100
14 | WARMUP_EPOCHS: 20
15 | BASE_LR: 1.25e-3
16 | WARMUP_LR: 2.5e-7
17 | MIN_LR: 2.5e-7
18 | WEIGHT_DECAY: 0.05
19 | LAYER_DECAY: 0.8
20 | PRINT_FREQ: 100
21 | SAVE_FREQ: 5
22 | TAG: simmim_finetune__swin_base__img224_window7__800ep
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/simmim/simmim_finetune__swinv2_base__img224_window14__800ep.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swinv2
3 | NAME: simmim_finetune
4 | DROP_PATH_RATE: 0.1
5 | SWINV2:
6 | EMBED_DIM: 128
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 4, 8, 16, 32 ]
9 | WINDOW_SIZE: 14
10 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ]
11 | DATA:
12 | IMG_SIZE: 224
13 | TRAIN:
14 | EPOCHS: 100
15 | WARMUP_EPOCHS: 20
16 | BASE_LR: 1.25e-3
17 | WARMUP_LR: 2.5e-7
18 | MIN_LR: 2.5e-7
19 | WEIGHT_DECAY: 0.05
20 | LAYER_DECAY: 0.75
21 | PRINT_FREQ: 100
22 | SAVE_FREQ: 5
23 | TAG: simmim_finetune__swinv2_base__img224_window14__800ep
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/simmim/simmim_pretrain__swin_base__img192_window6__800ep.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: simmim_pretrain
4 | DROP_PATH_RATE: 0.0
5 | SWIN:
6 | EMBED_DIM: 128
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 4, 8, 16, 32 ]
9 | WINDOW_SIZE: 6
10 | DATA:
11 | IMG_SIZE: 192
12 | MASK_PATCH_SIZE: 32
13 | MASK_RATIO: 0.6
14 | TRAIN:
15 | EPOCHS: 800
16 | WARMUP_EPOCHS: 10
17 | BASE_LR: 1e-4
18 | WARMUP_LR: 5e-7
19 | WEIGHT_DECAY: 0.05
20 | LR_SCHEDULER:
21 | NAME: 'multistep'
22 | GAMMA: 0.1
23 | MULTISTEPS: [700,]
24 | PRINT_FREQ: 100
25 | SAVE_FREQ: 5
26 | TAG: simmim_pretrain__swin_base__img192_window6__800ep
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/simmim/simmim_pretrain__swinv2_base__img192_window12__800ep.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swinv2
3 | NAME: simmim_pretrain
4 | DROP_PATH_RATE: 0.1
5 | SIMMIM:
6 | NORM_TARGET:
7 | ENABLE: True
8 | PATCH_SIZE: 47
9 | SWINV2:
10 | EMBED_DIM: 128
11 | DEPTHS: [ 2, 2, 18, 2 ]
12 | NUM_HEADS: [ 4, 8, 16, 32 ]
13 | WINDOW_SIZE: 12
14 | DATA:
15 | IMG_SIZE: 192
16 | MASK_PATCH_SIZE: 32
17 | MASK_RATIO: 0.6
18 | TRAIN:
19 | EPOCHS: 800
20 | WARMUP_EPOCHS: 10
21 | BASE_LR: 1e-4
22 | WARMUP_LR: 5e-7
23 | WEIGHT_DECAY: 0.05
24 | LR_SCHEDULER:
25 | NAME: 'multistep'
26 | GAMMA: 0.1
27 | MULTISTEPS: [700,]
28 | PRINT_FREQ: 100
29 | SAVE_FREQ: 5
30 | TAG: simmim_pretrain__swinv2_base__img192_window12__800ep
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_base_patch4_window12_384_22kto1k_finetune.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 384
3 | MODEL:
4 | TYPE: swin
5 | NAME: swin_base_patch4_window12_384_22kto1k_finetune
6 | DROP_PATH_RATE: 0.2
7 | SWIN:
8 | EMBED_DIM: 128
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 12
12 | TRAIN:
13 | EPOCHS: 30
14 | WARMUP_EPOCHS: 5
15 | WEIGHT_DECAY: 1e-8
16 | BASE_LR: 2e-05
17 | WARMUP_LR: 2e-08
18 | MIN_LR: 2e-07
19 | TEST:
20 | CROP: False
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_base_patch4_window12_384_finetune.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 384
3 | MODEL:
4 | TYPE: swin
5 | NAME: swin_base_patch4_window12_384_finetune
6 | DROP_PATH_RATE: 0.5
7 | SWIN:
8 | EMBED_DIM: 128
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 12
12 | TRAIN:
13 | EPOCHS: 30
14 | WARMUP_EPOCHS: 5
15 | WEIGHT_DECAY: 1e-8
16 | BASE_LR: 2e-05
17 | WARMUP_LR: 2e-08
18 | MIN_LR: 2e-07
19 | TEST:
20 | CROP: False
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_base_patch4_window7_224.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: swin_base_patch4_window7_224
4 | DROP_PATH_RATE: 0.5
5 | SWIN:
6 | EMBED_DIM: 128
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 4, 8, 16, 32 ]
9 | WINDOW_SIZE: 7
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_base_patch4_window7_224_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | MODEL:
4 | TYPE: swin
5 | NAME: swin_base_patch4_window7_224_22k
6 | DROP_PATH_RATE: 0.2
7 | SWIN:
8 | EMBED_DIM: 128
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 7
12 | TRAIN:
13 | EPOCHS: 90
14 | WARMUP_EPOCHS: 5
15 | WEIGHT_DECAY: 0.05
16 | BASE_LR: 1.25e-4 # 4096 batch-size
17 | WARMUP_LR: 1.25e-7
18 | MIN_LR: 1.25e-6
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_base_patch4_window7_224_22kto1k_finetune.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: swin_base_patch4_window7_224_22kto1k_finetune
4 | DROP_PATH_RATE: 0.2
5 | SWIN:
6 | EMBED_DIM: 128
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 4, 8, 16, 32 ]
9 | WINDOW_SIZE: 7
10 | TRAIN:
11 | EPOCHS: 30
12 | WARMUP_EPOCHS: 5
13 | WEIGHT_DECAY: 1e-8
14 | BASE_LR: 2e-05
15 | WARMUP_LR: 2e-08
16 | MIN_LR: 2e-07
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_large_patch4_window12_384_22kto1k_finetune.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 384
3 | MODEL:
4 | TYPE: swin
5 | NAME: swin_large_patch4_window12_384_22kto1k_finetune
6 | DROP_PATH_RATE: 0.2
7 | SWIN:
8 | EMBED_DIM: 192
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 6, 12, 24, 48 ]
11 | WINDOW_SIZE: 12
12 | TRAIN:
13 | EPOCHS: 30
14 | WARMUP_EPOCHS: 5
15 | WEIGHT_DECAY: 1e-8
16 | BASE_LR: 2e-05
17 | WARMUP_LR: 2e-08
18 | MIN_LR: 2e-07
19 | TEST:
20 | CROP: False
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_large_patch4_window7_224_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | MODEL:
4 | TYPE: swin
5 | NAME: swin_large_patch4_window7_224_22k
6 | DROP_PATH_RATE: 0.2
7 | SWIN:
8 | EMBED_DIM: 192
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 6, 12, 24, 48 ]
11 | WINDOW_SIZE: 7
12 | TRAIN:
13 | EPOCHS: 90
14 | WARMUP_EPOCHS: 5
15 | WEIGHT_DECAY: 0.05
16 | BASE_LR: 1.25e-4 # 4096 batch-size
17 | WARMUP_LR: 1.25e-7
18 | MIN_LR: 1.25e-6
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_large_patch4_window7_224_22kto1k_finetune.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: swin_large_patch4_window7_224_22kto1k_finetune
4 | DROP_PATH_RATE: 0.2
5 | SWIN:
6 | EMBED_DIM: 192
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 6, 12, 24, 48 ]
9 | WINDOW_SIZE: 7
10 | TRAIN:
11 | EPOCHS: 30
12 | WARMUP_EPOCHS: 5
13 | WEIGHT_DECAY: 1e-8
14 | BASE_LR: 2e-05
15 | WARMUP_LR: 2e-08
16 | MIN_LR: 2e-07
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_small_patch4_window7_224.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: swin_small_patch4_window7_224
4 | DROP_PATH_RATE: 0.3
5 | SWIN:
6 | EMBED_DIM: 96
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 3, 6, 12, 24 ]
9 | WINDOW_SIZE: 7
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_small_patch4_window7_224_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | MODEL:
4 | TYPE: swin
5 | NAME: swin_small_patch4_window7_224_22k
6 | DROP_PATH_RATE: 0.2
7 | SWIN:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 3, 6, 12, 24 ]
11 | WINDOW_SIZE: 7
12 | TRAIN:
13 | EPOCHS: 90
14 | WARMUP_EPOCHS: 5
15 | WEIGHT_DECAY: 0.05
16 | BASE_LR: 1.25e-4 # 4096 batch-size
17 | WARMUP_LR: 1.25e-7
18 | MIN_LR: 1.25e-6
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_small_patch4_window7_224_22kto1k_finetune.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: swin_small_patch4_window7_224_22kto1k_finetune
4 | DROP_PATH_RATE: 0.2
5 | SWIN:
6 | EMBED_DIM: 96
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 3, 6, 12, 24 ]
9 | WINDOW_SIZE: 7
10 | TRAIN:
11 | EPOCHS: 30
12 | WARMUP_EPOCHS: 5
13 | WEIGHT_DECAY: 1e-8
14 | BASE_LR: 2e-05
15 | WARMUP_LR: 2e-08
16 | MIN_LR: 2e-07
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_tiny_c24_patch4_window8_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swin
5 | NAME: swin_tiny_c24_patch4_window8_256
6 | DROP_PATH_RATE: 0.2
7 | SWIN:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 6, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 8
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_tiny_patch4_window7_224.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: swin_tiny_patch4_window7_224
4 | DROP_PATH_RATE: 0.2
5 | SWIN:
6 | EMBED_DIM: 96
7 | DEPTHS: [ 2, 2, 6, 2 ]
8 | NUM_HEADS: [ 3, 6, 12, 24 ]
9 | WINDOW_SIZE: 7
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_tiny_patch4_window7_224_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | MODEL:
4 | TYPE: swin
5 | NAME: swin_tiny_patch4_window7_224_22k
6 | DROP_PATH_RATE: 0.1
7 | SWIN:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 6, 2 ]
10 | NUM_HEADS: [ 3, 6, 12, 24 ]
11 | WINDOW_SIZE: 7
12 | TRAIN:
13 | EPOCHS: 90
14 | WARMUP_EPOCHS: 5
15 | WEIGHT_DECAY: 0.05
16 | BASE_LR: 1.25e-4 # 4096 batch-size
17 | WARMUP_LR: 1.25e-7
18 | MIN_LR: 1.25e-6
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swin/swin_tiny_patch4_window7_224_22kto1k_finetune.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin
3 | NAME: swin_tiny_patch4_window7_224_22kto1k_finetune
4 | DROP_PATH_RATE: 0.1
5 | SWIN:
6 | EMBED_DIM: 96
7 | DEPTHS: [ 2, 2, 6, 2 ]
8 | NUM_HEADS: [ 3, 6, 12, 24 ]
9 | WINDOW_SIZE: 7
10 | TRAIN:
11 | EPOCHS: 30
12 | WARMUP_EPOCHS: 5
13 | WEIGHT_DECAY: 1e-8
14 | BASE_LR: 2e-05
15 | WARMUP_LR: 2e-08
16 | MIN_LR: 2e-07
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmlp/swin_mlp_base_patch4_window7_224.yaml:
--------------------------------------------------------------------------------
1 | MODEL:
2 | TYPE: swin_mlp
3 | NAME: swin_mlp_base_patch4_window7_224
4 | DROP_PATH_RATE: 0.5
5 | SWIN_MLP:
6 | EMBED_DIM: 128
7 | DEPTHS: [ 2, 2, 18, 2 ]
8 | NUM_HEADS: [ 4, 8, 16, 32 ]
9 | WINDOW_SIZE: 7
10 |
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmlp/swin_mlp_tiny_c12_patch4_window8_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swin_mlp
5 | NAME: swin_mlp_tiny_c12_patch4_window8_256
6 | DROP_PATH_RATE: 0.2
7 | SWIN_MLP:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 6, 2 ]
10 | NUM_HEADS: [ 8, 16, 32, 64 ]
11 | WINDOW_SIZE: 8
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmlp/swin_mlp_tiny_c24_patch4_window8_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swin_mlp
5 | NAME: swin_mlp_tiny_c24_patch4_window8_256
6 | DROP_PATH_RATE: 0.2
7 | SWIN_MLP:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 6, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 8
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmlp/swin_mlp_tiny_c6_patch4_window8_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swin_mlp
5 | NAME: swin_mlp_tiny_c6_patch4_window8_256
6 | DROP_PATH_RATE: 0.2
7 | SWIN_MLP:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 6, 2 ]
10 | NUM_HEADS: [ 16, 32, 64, 128 ]
11 | WINDOW_SIZE: 8
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_base_patch4_window12_192_16expert_32gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_base_patch4_window12_192_16expert_32gpu_22k
7 | DROP_PATH_RATE: 0.3
8 | SWIN_MOE:
9 | EMBED_DIM: 128
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 4, 8, 16, 32 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: -2
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | IS_GSHARD_LOSS: False
20 | MOE_DROP: 0.1
21 | AUX_LOSS_WEIGHT: 0.01
22 | TRAIN:
23 | EPOCHS: 90
24 | WARMUP_EPOCHS: 10
25 | WEIGHT_DECAY: 0.1
26 | BASE_LR: 1.25e-4 # 4096 batch-size
27 | WARMUP_LR: 1.25e-7
28 | MIN_LR: 1.25e-6
29 | CLIP_GRAD: 3.0
30 | TEST:
31 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_base_patch4_window12_192_32expert_32gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_base_patch4_window12_192_32expert_32gpu_22k
7 | DROP_PATH_RATE: 0.3
8 | SWIN_MOE:
9 | EMBED_DIM: 128
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 4, 8, 16, 32 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: 1
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | IS_GSHARD_LOSS: False
20 | MOE_DROP: 0.1
21 | AUX_LOSS_WEIGHT: 0.01
22 | TRAIN:
23 | EPOCHS: 90
24 | WARMUP_EPOCHS: 10
25 | WEIGHT_DECAY: 0.1
26 | BASE_LR: 1.25e-4 # 4096 batch-size
27 | WARMUP_LR: 1.25e-7
28 | MIN_LR: 1.25e-6
29 | CLIP_GRAD: 3.0
30 | TEST:
31 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_base_patch4_window12_192_8expert_32gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_base_patch4_window12_192_8expert_32gpu_22k
7 | DROP_PATH_RATE: 0.3
8 | SWIN_MOE:
9 | EMBED_DIM: 128
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 4, 8, 16, 32 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: -4
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | IS_GSHARD_LOSS: False
20 | MOE_DROP: 0.1
21 | AUX_LOSS_WEIGHT: 0.01
22 | TRAIN:
23 | EPOCHS: 90
24 | WARMUP_EPOCHS: 10
25 | WEIGHT_DECAY: 0.1
26 | BASE_LR: 1.25e-4 # 4096 batch-size
27 | WARMUP_LR: 1.25e-7
28 | MIN_LR: 1.25e-6
29 | CLIP_GRAD: 3.0
30 | TEST:
31 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_base_patch4_window12_192_cosine_router_32expert_32gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_base_patch4_window12_192_cosine_router_32expert_32gpu_22k
7 | DROP_PATH_RATE: 0.3
8 | SWIN_MOE:
9 | EMBED_DIM: 128
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 4, 8, 16, 32 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: 1
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | COSINE_ROUTER: True
20 | IS_GSHARD_LOSS: False
21 | MOE_DROP: 0.1
22 | AUX_LOSS_WEIGHT: 0.01
23 | TRAIN:
24 | EPOCHS: 90
25 | WARMUP_EPOCHS: 10
26 | WEIGHT_DECAY: 0.1
27 | BASE_LR: 1.25e-4 # 4096 batch-size
28 | WARMUP_LR: 1.25e-7
29 | MIN_LR: 1.25e-6
30 | CLIP_GRAD: 3.0
31 | TEST:
32 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_base_patch4_window12_192_densebaseline_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_base_patch4_window12_192_densebaseline_22k
7 | DROP_PATH_RATE: 0.2
8 | SWIN_MOE:
9 | EMBED_DIM: 128
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 4, 8, 16, 32 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ -1 ], [ -1 ] ]
15 | TRAIN:
16 | EPOCHS: 90
17 | WARMUP_EPOCHS: 10
18 | WEIGHT_DECAY: 0.1
19 | BASE_LR: 1.25e-4 # 4096 batch-size
20 | WARMUP_LR: 1.25e-7
21 | MIN_LR: 1.25e-6
22 | CLIP_GRAD: 3.0
23 | MOE:
24 | SAVE_MASTER: True
25 | TEST:
26 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_small_patch4_window12_192_16expert_32gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_small_patch4_window12_192_16expert_32gpu_22k
7 | DROP_PATH_RATE: 0.2
8 | SWIN_MOE:
9 | EMBED_DIM: 96
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 3, 6, 12, 24 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: -2
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | IS_GSHARD_LOSS: False
20 | MOE_DROP: 0.1
21 | AUX_LOSS_WEIGHT: 0.01
22 | TRAIN:
23 | EPOCHS: 90
24 | WARMUP_EPOCHS: 10
25 | WEIGHT_DECAY: 0.1
26 | BASE_LR: 1.25e-4 # 4096 batch-size
27 | WARMUP_LR: 1.25e-7
28 | MIN_LR: 1.25e-6
29 | CLIP_GRAD: 3.0
30 | TEST:
31 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_small_patch4_window12_192_32expert_32gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_small_patch4_window12_192_32expert_32gpu_22k
7 | DROP_PATH_RATE: 0.2
8 | SWIN_MOE:
9 | EMBED_DIM: 96
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 3, 6, 12, 24 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: 1
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | IS_GSHARD_LOSS: False
20 | MOE_DROP: 0.1
21 | AUX_LOSS_WEIGHT: 0.01
22 | TRAIN:
23 | EPOCHS: 90
24 | WARMUP_EPOCHS: 10
25 | WEIGHT_DECAY: 0.1
26 | BASE_LR: 1.25e-4 # 4096 batch-size
27 | WARMUP_LR: 1.25e-7
28 | MIN_LR: 1.25e-6
29 | CLIP_GRAD: 3.0
30 | TEST:
31 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_small_patch4_window12_192_64expert_64gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_small_patch4_window12_192_64expert_64gpu_22k
7 | DROP_PATH_RATE: 0.2
8 | SWIN_MOE:
9 | EMBED_DIM: 96
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 3, 6, 12, 24 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: 1
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | IS_GSHARD_LOSS: False
20 | MOE_DROP: 0.1
21 | AUX_LOSS_WEIGHT: 0.01
22 | TRAIN:
23 | EPOCHS: 90
24 | WARMUP_EPOCHS: 10
25 | WEIGHT_DECAY: 0.1
26 | BASE_LR: 1.25e-4 # 4096 batch-size
27 | WARMUP_LR: 1.25e-7
28 | MIN_LR: 1.25e-6
29 | CLIP_GRAD: 3.0
30 | TEST:
31 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_small_patch4_window12_192_8expert_32gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_small_patch4_window12_192_8expert_32gpu_22k
7 | DROP_PATH_RATE: 0.2
8 | SWIN_MOE:
9 | EMBED_DIM: 96
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 3, 6, 12, 24 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: -4
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | IS_GSHARD_LOSS: False
20 | MOE_DROP: 0.1
21 | AUX_LOSS_WEIGHT: 0.01
22 | TRAIN:
23 | EPOCHS: 90
24 | WARMUP_EPOCHS: 10
25 | WEIGHT_DECAY: 0.1
26 | BASE_LR: 1.25e-4 # 4096 batch-size
27 | WARMUP_LR: 1.25e-7
28 | MIN_LR: 1.25e-6
29 | CLIP_GRAD: 3.0
30 | TEST:
31 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_small_patch4_window12_192_cosine_router_32expert_32gpu_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_small_patch4_window12_192_cosine_router_32expert_32gpu_22k
7 | DROP_PATH_RATE: 0.2
8 | SWIN_MOE:
9 | EMBED_DIM: 96
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 3, 6, 12, 24 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | INIT_STD: 0.005
15 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ 1, 3, 5, 7, 9, 11, 13, 15, 17 ], [ 1 ] ]
16 | NUM_LOCAL_EXPERTS: 1
17 | TOP_VALUE: 1
18 | CAPACITY_FACTOR: 1.25
19 | COSINE_ROUTER: True
20 | IS_GSHARD_LOSS: False
21 | MOE_DROP: 0.1
22 | AUX_LOSS_WEIGHT: 0.01
23 | TRAIN:
24 | EPOCHS: 90
25 | WARMUP_EPOCHS: 10
26 | WEIGHT_DECAY: 0.1
27 | BASE_LR: 1.25e-4 # 4096 batch-size
28 | WARMUP_LR: 1.25e-7
29 | MIN_LR: 1.25e-6
30 | CLIP_GRAD: 3.0
31 | TEST:
32 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinmoe/swin_moe_small_patch4_window12_192_densebaseline_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swin_moe
6 | NAME: swin_moe_small_patch4_window12_192_densebaseline_22k
7 | DROP_PATH_RATE: 0.2
8 | SWIN_MOE:
9 | EMBED_DIM: 96
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 3, 6, 12, 24 ]
12 | WINDOW_SIZE: 12
13 | MLP_FC2_BIAS: False
14 | MOE_BLOCKS: [ [ -1 ], [ -1 ], [ -1 ], [ -1 ] ]
15 | TRAIN:
16 | EPOCHS: 90
17 | WARMUP_EPOCHS: 10
18 | WEIGHT_DECAY: 0.1
19 | BASE_LR: 1.25e-4 # 4096 batch-size
20 | WARMUP_LR: 1.25e-7
21 | MIN_LR: 1.25e-6
22 | CLIP_GRAD: 3.0
23 | MOE:
24 | SAVE_MASTER: True
25 | TEST:
26 | SHUFFLE: True
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_base_patch4_window12_192_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swinv2
6 | NAME: swinv2_base_patch4_window12_192_22k
7 | DROP_PATH_RATE: 0.2
8 | SWINV2:
9 | EMBED_DIM: 128
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 4, 8, 16, 32 ]
12 | WINDOW_SIZE: 12
13 | TRAIN:
14 | EPOCHS: 90
15 | WARMUP_EPOCHS: 5
16 | WEIGHT_DECAY: 0.1
17 | BASE_LR: 1.25e-4 # 4096 batch-size
18 | WARMUP_LR: 1.25e-7
19 | MIN_LR: 1.25e-6
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_base_patch4_window12to16_192to256_22kto1k_ft.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_base_patch4_window12to16_192to256_22kto1k_ft
6 | DROP_PATH_RATE: 0.2
7 | SWINV2:
8 | EMBED_DIM: 128
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 16
12 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ]
13 | TRAIN:
14 | EPOCHS: 30
15 | WARMUP_EPOCHS: 5
16 | WEIGHT_DECAY: 1e-8
17 | BASE_LR: 2e-05
18 | WARMUP_LR: 2e-08
19 | MIN_LR: 2e-07
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_base_patch4_window12to24_192to384_22kto1k_ft.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 384
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_base_patch4_window12to24_192to384_22kto1k_ft
6 | DROP_PATH_RATE: 0.2
7 | SWINV2:
8 | EMBED_DIM: 128
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 24
12 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ]
13 | TRAIN:
14 | EPOCHS: 30
15 | WARMUP_EPOCHS: 5
16 | WEIGHT_DECAY: 1e-8
17 | BASE_LR: 2e-05
18 | WARMUP_LR: 2e-08
19 | MIN_LR: 2e-07
20 | TEST:
21 | CROP: False
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_base_patch4_window16_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_base_patch4_window16_256
6 | DROP_PATH_RATE: 0.5
7 | SWINV2:
8 | EMBED_DIM: 128
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 16
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_base_patch4_window8_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_base_patch4_window8_256
6 | DROP_PATH_RATE: 0.5
7 | SWINV2:
8 | EMBED_DIM: 128
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 4, 8, 16, 32 ]
11 | WINDOW_SIZE: 8
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_large_patch4_window12_192_22k.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | DATASET: imagenet22K
3 | IMG_SIZE: 192
4 | MODEL:
5 | TYPE: swinv2
6 | NAME: swinv2_large_patch4_window12_192_22k
7 | DROP_PATH_RATE: 0.2
8 | SWINV2:
9 | EMBED_DIM: 192
10 | DEPTHS: [ 2, 2, 18, 2 ]
11 | NUM_HEADS: [ 6, 12, 24, 48 ]
12 | WINDOW_SIZE: 12
13 | TRAIN:
14 | EPOCHS: 90
15 | WARMUP_EPOCHS: 5
16 | WEIGHT_DECAY: 0.1
17 | BASE_LR: 1.25e-4 # 4096 batch-size
18 | WARMUP_LR: 1.25e-7
19 | MIN_LR: 1.25e-6
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_large_patch4_window12to16_192to256_22kto1k_ft.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_base_patch4_window12to16_192to256_22kto1k_ft
6 | DROP_PATH_RATE: 0.2
7 | SWINV2:
8 | EMBED_DIM: 192
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 6, 12, 24, 48 ]
11 | WINDOW_SIZE: 16
12 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ]
13 | TRAIN:
14 | EPOCHS: 30
15 | WARMUP_EPOCHS: 5
16 | WEIGHT_DECAY: 1e-8
17 | BASE_LR: 2e-05
18 | WARMUP_LR: 2e-08
19 | MIN_LR: 2e-07
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_large_patch4_window12to24_192to384_22kto1k_ft.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 384
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_large_patch4_window12to24_192to384_22kto1k_ft
6 | DROP_PATH_RATE: 0.2
7 | SWINV2:
8 | EMBED_DIM: 192
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 6, 12, 24, 48 ]
11 | WINDOW_SIZE: 24
12 | PRETRAINED_WINDOW_SIZES: [ 12, 12, 12, 6 ]
13 | TRAIN:
14 | EPOCHS: 30
15 | WARMUP_EPOCHS: 5
16 | WEIGHT_DECAY: 1e-8
17 | BASE_LR: 2e-05
18 | WARMUP_LR: 2e-08
19 | MIN_LR: 2e-07
20 | TEST:
21 | CROP: False
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_small_patch4_window16_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_small_patch4_window16_256
6 | DROP_PATH_RATE: 0.3
7 | SWINV2:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 3, 6, 12, 24 ]
11 | WINDOW_SIZE: 16
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_small_patch4_window8_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_small_patch4_window8_256
6 | DROP_PATH_RATE: 0.3
7 | SWINV2:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 18, 2 ]
10 | NUM_HEADS: [ 3, 6, 12, 24 ]
11 | WINDOW_SIZE: 8
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_tiny_patch4_window16_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_tiny_patch4_window16_256
6 | DROP_PATH_RATE: 0.2
7 | SWINV2:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 6, 2 ]
10 | NUM_HEADS: [ 3, 6, 12, 24 ]
11 | WINDOW_SIZE: 16
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/configs/swinv2/swinv2_tiny_patch4_window8_256.yaml:
--------------------------------------------------------------------------------
1 | DATA:
2 | IMG_SIZE: 256
3 | MODEL:
4 | TYPE: swinv2
5 | NAME: swinv2_tiny_patch4_window8_256
6 | DROP_PATH_RATE: 0.2
7 | SWINV2:
8 | EMBED_DIM: 96
9 | DEPTHS: [ 2, 2, 6, 2 ]
10 | NUM_HEADS: [ 3, 6, 12, 24 ]
11 | WINDOW_SIZE: 8
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/data/__init__.py:
--------------------------------------------------------------------------------
1 | from .build import build_loader as _build_loader
2 | from .data_simmim_pt import build_loader_simmim
3 | from .data_simmim_ft import build_loader_finetune
4 |
5 |
6 | def build_loader(config, simmim=False, is_pretrain=False):
7 | if not simmim:
8 | return _build_loader(config)
9 | if is_pretrain:
10 | return build_loader_simmim(config)
11 | else:
12 | return build_loader_finetune(config)
13 |
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/data/samplers.py:
--------------------------------------------------------------------------------
1 | # --------------------------------------------------------
2 | # Swin Transformer
3 | # Copyright (c) 2021 Microsoft
4 | # Licensed under The MIT License [see LICENSE for details]
5 | # Written by Ze Liu
6 | # --------------------------------------------------------
7 |
8 | import torch
9 |
10 |
11 | class SubsetRandomSampler(torch.utils.data.Sampler):
12 | r"""Samples elements randomly from a given list of indices, without replacement.
13 |
14 | Arguments:
15 | indices (sequence): a sequence of indices
16 | """
17 |
18 | def __init__(self, indices):
19 | self.epoch = 0
20 | self.indices = indices
21 |
22 | def __iter__(self):
23 | return (self.indices[i] for i in torch.randperm(len(self.indices)))
24 |
25 | def __len__(self):
26 | return len(self.indices)
27 |
28 | def set_epoch(self, epoch):
29 | self.epoch = epoch
30 |
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/figures/teaser.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/Swin-Transformer-main/figures/teaser.png
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/kernels/window_process/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 | from torch.utils.cpp_extension import BuildExtension, CUDAExtension
3 |
4 |
5 | setup(name='swin_window_process',
6 | ext_modules=[
7 | CUDAExtension('swin_window_process', [
8 | 'swin_window_process.cpp',
9 | 'swin_window_process_kernel.cu',
10 | ])
11 | ],
12 | cmdclass={'build_ext': BuildExtension})
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/logger.py:
--------------------------------------------------------------------------------
1 | # --------------------------------------------------------
2 | # Swin Transformer
3 | # Copyright (c) 2021 Microsoft
4 | # Licensed under The MIT License [see LICENSE for details]
5 | # Written by Ze Liu
6 | # --------------------------------------------------------
7 |
8 | import os
9 | import sys
10 | import logging
11 | import functools
12 | from termcolor import colored
13 |
14 |
15 | @functools.lru_cache()
16 | def create_logger(output_dir, dist_rank=0, name=''):
17 | # create logger
18 | logger = logging.getLogger(name)
19 | logger.setLevel(logging.DEBUG)
20 | logger.propagate = False
21 |
22 | # create formatter
23 | fmt = '[%(asctime)s %(name)s] (%(filename)s %(lineno)d): %(levelname)s %(message)s'
24 | color_fmt = colored('[%(asctime)s %(name)s]', 'green') + \
25 | colored('(%(filename)s %(lineno)d)', 'yellow') + ': %(levelname)s %(message)s'
26 |
27 | # create console handlers for master process
28 | if dist_rank == 0:
29 | console_handler = logging.StreamHandler(sys.stdout)
30 | console_handler.setLevel(logging.DEBUG)
31 | console_handler.setFormatter(
32 | logging.Formatter(fmt=color_fmt, datefmt='%Y-%m-%d %H:%M:%S'))
33 | logger.addHandler(console_handler)
34 |
35 | # create file handlers
36 | file_handler = logging.FileHandler(os.path.join(output_dir, f'log_rank{dist_rank}.txt'), mode='a')
37 | file_handler.setLevel(logging.DEBUG)
38 | file_handler.setFormatter(logging.Formatter(fmt=fmt, datefmt='%Y-%m-%d %H:%M:%S'))
39 | logger.addHandler(file_handler)
40 |
41 | return logger
42 |
--------------------------------------------------------------------------------
/detector_codes/Swin-Transformer-main/models/__init__.py:
--------------------------------------------------------------------------------
1 | from .build import build_model
--------------------------------------------------------------------------------
/detector_codes/deit-main/.circleci/config.yml:
--------------------------------------------------------------------------------
1 | version: 2.1
2 |
3 | jobs:
4 | python_lint:
5 | docker:
6 | - image: circleci/python:3.7
7 | steps:
8 | - checkout
9 | - run:
10 | command: |
11 | pip install --user --progress-bar off flake8 typing
12 | flake8 .
13 | test:
14 | docker:
15 | - image: circleci/python:3.7
16 | steps:
17 | - checkout
18 | - run:
19 | command: |
20 | pip install --user --progress-bar off pytest
21 | pip install --user --progress-bar off torch torchvision
22 | pip install --user --progress-bar off timm==0.3.2
23 | pytest .
24 |
25 | workflows:
26 | build:
27 | jobs:
28 | - python_lint
29 |
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Code of Conduct
2 |
3 | Facebook has adopted a Code of Conduct that we expect project participants to adhere to.
4 | Please read the [full text](https://code.fb.com/codeofconduct/)
5 | so that you can understand what actions will and will not be tolerated.
6 |
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to DeiT
2 | We want to make contributing to this project as easy and transparent as
3 | possible.
4 |
5 | ## Our Development Process
6 | Minor changes and improvements will be released on an ongoing basis. Larger changes (e.g., changesets implementing a new paper) will be released on a more periodic basis.
7 |
8 | ## Pull Requests
9 | We actively welcome your pull requests.
10 |
11 | 1. Fork the repo and create your branch from `main`.
12 | 2. If you've added code that should be tested, add tests.
13 | 3. If you've changed APIs, update the documentation.
14 | 4. Ensure the test suite passes.
15 | 5. Make sure your code lints.
16 | 6. If you haven't already, complete the Contributor License Agreement ("CLA").
17 |
18 | ## Contributor License Agreement ("CLA")
19 | In order to accept your pull request, we need you to submit a CLA. You only need
20 | to do this once to work on any of Facebook's open source projects.
21 |
22 | Complete your CLA here:
23 |
24 | ## Issues
25 | We use GitHub issues to track public bugs. Please ensure your description is
26 | clear and has sufficient instructions to be able to reproduce the issue.
27 |
28 | Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe
29 | disclosure of security bugs. In those cases, please go through the process
30 | outlined on that page and do not file a public issue.
31 |
32 | ## Coding Style
33 | * 4 spaces for indentation rather than tabs
34 | * 80 character line length
35 | * PEP8 formatting following [Black](https://black.readthedocs.io/en/stable/)
36 |
37 | ## License
38 | By contributing to DeiT, you agree that your contributions will be licensed
39 | under the LICENSE file in the root directory of this source tree.
40 |
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/attn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/attn.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/cait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/cait.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/cosub.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/cosub.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/deit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/deit.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/hmlp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/hmlp.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/paral.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/paral.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/patch_convnet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/patch_convnet.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/resmlp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/resmlp.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/revenge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/revenge.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.github/revenge_da.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/deit-main/.github/revenge_da.png
--------------------------------------------------------------------------------
/detector_codes/deit-main/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | **/__pycache__/**
3 | imnet_resnet50_scratch/timm_temp/
4 | .dumbo.json
5 | checkpoints/
6 |
--------------------------------------------------------------------------------
/detector_codes/deit-main/README_cosub.md:
--------------------------------------------------------------------------------
1 | # Co-training 2L Submodels for Visual Recognition
2 |
3 | This repository contains PyTorch evaluation code, training code and pretrained models for the following projects:
4 | * [DeiT](README_deit.md) (Data-Efficient Image Transformers), ICML 2021
5 | * [CaiT](README_cait.md) (Going deeper with Image Transformers), ICCV 2021 (Oral)
6 | * [ResMLP](README_resmlp.md) (ResMLP: Feedforward networks for image classification with data-efficient training)
7 | * [PatchConvnet](README_patchconvnet.md) (Augmenting Convolutional networks with attention-based aggregation)
8 | * [3Things](README_3things.md) (Three things everyone should know about Vision Transformers)
9 | * [DeiT III](README_revenge.md) (DeiT III: Revenge of the ViT)
10 | * Cosub (Co-training 2L Submodels for Visual Recognition)
11 |
12 | This new training recipes improve previous training strategy with different architectures:
13 |
14 | 
15 |
16 | For details see [Co-training 2L Submodels for Visual Recognition](https://arxiv.org/pdf/2212.04884.pdf) by Hugo Touvron, Matthieu Cord, Maxime Oquab, Piotr Bojanowski, Jakob Verbeek and Hervé Jégou.
17 |
18 | If you use this code for a paper please cite:
19 |
20 | ```
21 | @article{Touvron2022Cotraining2S,
22 | title={Co-training 2L Submodels for Visual Recognition},
23 | author={Hugo Touvron and Matthieu Cord and Maxime Oquab and Piotr Bojanowski and Jakob Verbeek and Herv'e J'egou},
24 | journal={arXiv preprint arXiv:2212.04884},
25 | year={2022},
26 | }
27 | ```
28 |
--------------------------------------------------------------------------------
/detector_codes/deit-main/hubconf.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2015-present, Facebook, Inc.
2 | # All rights reserved.
3 | from models import *
4 | from cait_models import *
5 | from resmlp_models import *
6 | #from patchconvnet_models import *
7 |
8 | dependencies = ["torch", "torchvision", "timm"]
9 |
--------------------------------------------------------------------------------
/detector_codes/deit-main/requirements.txt:
--------------------------------------------------------------------------------
1 | torch==1.13.1
2 | torchvision==0.8.1
3 | timm==0.3.2
4 |
--------------------------------------------------------------------------------
/detector_codes/deit-main/tox.ini:
--------------------------------------------------------------------------------
1 | [flake8]
2 | max-line-length = 120
3 | ignore = F401,E402,F403,W503,W504
4 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/.gitattributes:
--------------------------------------------------------------------------------
1 | *.ipynb linguist-documentation
2 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 | github: rwightman
3 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a bug report to help us improve. Issues are for reporting bugs or requesting
4 | features, the discussion forum is available for asking questions or seeking help
5 | from the community.
6 | title: "[BUG] Issue title..."
7 | labels: bug
8 | assignees: rwightman
9 |
10 | ---
11 |
12 | **Describe the bug**
13 | A clear and concise description of what the bug is.
14 |
15 | **To Reproduce**
16 | Steps to reproduce the behavior:
17 | 1.
18 | 2.
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. Windows 10, Ubuntu 18.04]
28 | - This repository version [e.g. pip 0.3.1 or commit ref]
29 | - PyTorch version w/ CUDA/cuDNN [e.g. from `conda list`, 1.7.0 py3.8_cuda11.0.221_cudnn8.0.3_0]
30 |
31 | **Additional context**
32 | Add any other context about the problem here.
33 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/.github/ISSUE_TEMPLATE/config.yml:
--------------------------------------------------------------------------------
1 | blank_issues_enabled: false
2 | contact_links:
3 | - name: Community Discussions
4 | url: https://github.com/rwightman/pytorch-image-models/discussions
5 | about: Hparam request in issues will be ignored! Issues are for features and bugs. Questions can be asked in Discussions.
6 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project. Hparam requests, training help are not feature requests.
4 | The discussion forum is available for asking questions or seeking help from the community.
5 | title: "[FEATURE] Feature title..."
6 | labels: enhancement
7 | assignees: ''
8 |
9 | ---
10 |
11 | **Is your feature request related to a problem? Please describe.**
12 | A clear and concise description of what the problem is.
13 |
14 | **Describe the solution you'd like**
15 | A clear and concise description of what you want to happen.
16 |
17 | **Describe alternatives you've considered**
18 | A clear and concise description of any alternative solutions or features you've considered.
19 |
20 | **Additional context**
21 | Add any other context or screenshots about the feature request here.
22 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/.github/workflows/build_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Build documentation
2 |
3 | on:
4 | push:
5 | branches:
6 | - master
7 | - doc-builder*
8 | - v*-release
9 |
10 | jobs:
11 | build:
12 | uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
13 | with:
14 | commit_sha: ${{ github.sha }}
15 | package: pytorch-image-models
16 | package_name: timm
17 | repo_owner: rwightman
18 | path_to_docs: pytorch-image-models/hfdocs/source
19 | secrets:
20 | token: ${{ secrets.HUGGINGFACE_PUSH }}
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/.github/workflows/build_pr_documentation.yml:
--------------------------------------------------------------------------------
1 | name: Build PR Documentation
2 |
3 | on:
4 | pull_request:
5 |
6 | concurrency:
7 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
8 | cancel-in-progress: true
9 |
10 | jobs:
11 | build:
12 | uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
13 | with:
14 | commit_sha: ${{ github.event.pull_request.head.sha }}
15 | pr_number: ${{ github.event.number }}
16 | package: pytorch-image-models
17 | package_name: timm
18 | repo_owner: rwightman
19 | path_to_docs: pytorch-image-models/hfdocs/source
20 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/.github/workflows/delete_doc_comment.yml:
--------------------------------------------------------------------------------
1 | name: Delete dev documentation
2 |
3 | on:
4 | pull_request:
5 | types: [ closed ]
6 |
7 |
8 | jobs:
9 | delete:
10 | uses: huggingface/doc-builder/.github/workflows/delete_doc_comment.yml@main
11 | with:
12 | pr_number: ${{ github.event.number }}
13 | package: timm
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/MANIFEST.in:
--------------------------------------------------------------------------------
1 | include timm/models/pruned/*.txt
2 |
3 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/distributed_train.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | NUM_PROC=$1
3 | shift
4 | python3 -m torch.distributed.launch --nproc_per_node=$NUM_PROC train.py "$@"
5 |
6 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/docs/javascripts/tables.js:
--------------------------------------------------------------------------------
1 | app.location$.subscribe(function() {
2 | var tables = document.querySelectorAll("article table")
3 | tables.forEach(function(table) {
4 | new Tablesort(table)
5 | })
6 | })
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/docs/models/.pages:
--------------------------------------------------------------------------------
1 | title: Model Pages
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/hfdocs/source/_config.py:
--------------------------------------------------------------------------------
1 | default_branch_name = "master"
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/hfdocs/source/model_pages.mdx:
--------------------------------------------------------------------------------
1 | # Available Models
2 |
3 | `timm` comes bundled with a number of model architectures and corresponding pretrained models.
4 |
5 | In these pages, you will find the models available in the `timm` library, as well as information on how to use them.
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/hubconf.py:
--------------------------------------------------------------------------------
1 | dependencies = ['torch']
2 | from timm.models import registry
3 |
4 | globals().update(registry._model_entrypoints)
5 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/mkdocs.yml:
--------------------------------------------------------------------------------
1 | site_name: 'Pytorch Image Models'
2 | site_description: 'Pretained Image Recognition Models'
3 | repo_name: 'rwightman/pytorch-image-models'
4 | repo_url: 'https://github.com/rwightman/pytorch-image-models'
5 | nav:
6 | - index.md
7 | - models.md
8 | - ... | models/*.md
9 | - results.md
10 | - scripts.md
11 | - training_hparam_examples.md
12 | - feature_extraction.md
13 | - changes.md
14 | - archived_changes.md
15 | theme:
16 | name: 'material'
17 | feature:
18 | tabs: false
19 | extra_javascript:
20 | - 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-MML-AM_CHTML'
21 | - https://cdnjs.cloudflare.com/ajax/libs/tablesort/5.2.1/tablesort.min.js
22 | - javascripts/tables.js
23 | markdown_extensions:
24 | - codehilite:
25 | linenums: true
26 | - admonition
27 | - pymdownx.arithmatex
28 | - pymdownx.betterem:
29 | smart_enable: all
30 | - pymdownx.caret
31 | - pymdownx.critic
32 | - pymdownx.details
33 | - pymdownx.emoji:
34 | emoji_generator: !!python/name:pymdownx.emoji.to_svg
35 | - pymdownx.inlinehilite
36 | - pymdownx.magiclink
37 | - pymdownx.mark
38 | - pymdownx.smartsymbols
39 | - pymdownx.superfences
40 | - pymdownx.tasklist:
41 | custom_checkbox: true
42 | - pymdownx.tilde
43 | - mdx_truly_sane_lists
44 | plugins:
45 | - search
46 | - awesome-pages
47 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/model-index.yml:
--------------------------------------------------------------------------------
1 | Import:
2 | - ./docs/models/*.md
3 | Library:
4 | Name: PyTorch Image Models
5 | Headline: PyTorch image models, scripts, pretrained weights
6 | Website: https://rwightman.github.io/pytorch-image-models/
7 | Repository: https://github.com/rwightman/pytorch-image-models
8 | Docs: https://rwightman.github.io/pytorch-image-models/
9 | README: "# PyTorch Image Models\r\n\r\nPyTorch Image Models (TIMM) is a library\
10 | \ for state-of-the-art image classification. With this library you can:\r\n\r\n\
11 | - Choose from 300+ pre-trained state-of-the-art image classification models.\r\
12 | \n- Train models afresh on research datasets such as ImageNet using provided scripts.\r\
13 | \n- Finetune pre-trained models on your own datasets, including the latest cutting\
14 | \ edge models."
15 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/requirements-docs.txt:
--------------------------------------------------------------------------------
1 | mkdocs
2 | mkdocs-material
3 | mdx_truly_sane_lists
4 | mkdocs-awesome-pages-plugin
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/requirements-modelindex.txt:
--------------------------------------------------------------------------------
1 | model-index==0.1.10
2 | jinja2==2.11.3
3 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/requirements.txt:
--------------------------------------------------------------------------------
1 | torch>=1.7
2 | torchvision
3 | pyyaml
4 | huggingface_hub
5 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/setup.cfg:
--------------------------------------------------------------------------------
1 | [dist_conda]
2 |
3 | conda_name_differences = 'torch:pytorch'
4 | channels = pytorch
5 | noarch = True
6 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/tests/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/detector_codes/pytorch-image-models-0.6.12/tests/__init__.py
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/__init__.py:
--------------------------------------------------------------------------------
1 | from .version import __version__
2 | from .models import create_model, list_models, is_model, list_modules, model_entrypoint, \
3 | is_scriptable, is_exportable, set_scriptable, set_exportable, has_pretrained_cfg_key, is_pretrained_cfg_key, \
4 | get_pretrained_cfg_value, is_model_pretrained
5 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/data/__init__.py:
--------------------------------------------------------------------------------
1 | from .auto_augment import RandAugment, AutoAugment, rand_augment_ops, auto_augment_policy,\
2 | rand_augment_transform, auto_augment_transform
3 | from .config import resolve_data_config
4 | from .constants import *
5 | from .dataset import ImageDataset, IterableImageDataset, AugMixDataset
6 | from .dataset_factory import create_dataset
7 | from .loader import create_loader
8 | from .mixup import Mixup, FastCollateMixup
9 | from .parsers import create_parser,\
10 | get_img_extensions, is_img_extension, set_img_extensions, add_img_extensions, del_img_extensions
11 | from .real_labels import RealLabelsImagenet
12 | from .transforms import *
13 | from .transforms_factory import create_transform
14 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/data/constants.py:
--------------------------------------------------------------------------------
1 | DEFAULT_CROP_PCT = 0.875
2 | IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406)
3 | IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225)
4 | IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5)
5 | IMAGENET_INCEPTION_STD = (0.5, 0.5, 0.5)
6 | IMAGENET_DPN_MEAN = (124 / 255, 117 / 255, 104 / 255)
7 | IMAGENET_DPN_STD = tuple([1 / (.0167 * 255)] * 3)
8 | OPENAI_CLIP_MEAN = (0.48145466, 0.4578275, 0.40821073)
9 | OPENAI_CLIP_STD = (0.26862954, 0.26130258, 0.27577711)
10 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/data/parsers/__init__.py:
--------------------------------------------------------------------------------
1 | from .parser_factory import create_parser
2 | from .img_extensions import *
3 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/data/parsers/class_map.py:
--------------------------------------------------------------------------------
1 | import os
2 | import pickle
3 |
4 | def load_class_map(map_or_filename, root=''):
5 | if isinstance(map_or_filename, dict):
6 | assert dict, 'class_map dict must be non-empty'
7 | return map_or_filename
8 | class_map_path = map_or_filename
9 | if not os.path.exists(class_map_path):
10 | class_map_path = os.path.join(root, class_map_path)
11 | assert os.path.exists(class_map_path), 'Cannot locate specified class map file (%s)' % map_or_filename
12 | class_map_ext = os.path.splitext(map_or_filename)[-1].lower()
13 | if class_map_ext == '.txt':
14 | with open(class_map_path) as f:
15 | class_to_idx = {v.strip(): k for k, v in enumerate(f)}
16 | elif class_map_ext == '.pkl':
17 | with open(class_map_path,'rb') as f:
18 | class_to_idx = pickle.load(f)
19 | else:
20 | assert False, f'Unsupported class map file extension ({class_map_ext}).'
21 | return class_to_idx
22 |
23 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/data/parsers/img_extensions.py:
--------------------------------------------------------------------------------
1 | from copy import deepcopy
2 |
3 | __all__ = ['get_img_extensions', 'is_img_extension', 'set_img_extensions', 'add_img_extensions', 'del_img_extensions']
4 |
5 |
6 | IMG_EXTENSIONS = ('.png', '.jpg', '.jpeg') # singleton, kept public for bwd compat use
7 | _IMG_EXTENSIONS_SET = set(IMG_EXTENSIONS) # set version, private, kept in sync
8 |
9 |
10 | def _set_extensions(extensions):
11 | global IMG_EXTENSIONS
12 | global _IMG_EXTENSIONS_SET
13 | dedupe = set() # NOTE de-duping tuple while keeping original order
14 | IMG_EXTENSIONS = tuple(x for x in extensions if x not in dedupe and not dedupe.add(x))
15 | _IMG_EXTENSIONS_SET = set(extensions)
16 |
17 |
18 | def _valid_extension(x: str):
19 | return x and isinstance(x, str) and len(x) >= 2 and x.startswith('.')
20 |
21 |
22 | def is_img_extension(ext):
23 | return ext in _IMG_EXTENSIONS_SET
24 |
25 |
26 | def get_img_extensions(as_set=False):
27 | return deepcopy(_IMG_EXTENSIONS_SET if as_set else IMG_EXTENSIONS)
28 |
29 |
30 | def set_img_extensions(extensions):
31 | assert len(extensions)
32 | for x in extensions:
33 | assert _valid_extension(x)
34 | _set_extensions(extensions)
35 |
36 |
37 | def add_img_extensions(ext):
38 | if not isinstance(ext, (list, tuple, set)):
39 | ext = (ext,)
40 | for x in ext:
41 | assert _valid_extension(x)
42 | extensions = IMG_EXTENSIONS + tuple(ext)
43 | _set_extensions(extensions)
44 |
45 |
46 | def del_img_extensions(ext):
47 | if not isinstance(ext, (list, tuple, set)):
48 | ext = (ext,)
49 | extensions = tuple(x for x in IMG_EXTENSIONS if x not in ext)
50 | _set_extensions(extensions)
51 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/data/parsers/parser.py:
--------------------------------------------------------------------------------
1 | from abc import abstractmethod
2 |
3 |
4 | class Parser:
5 | def __init__(self):
6 | pass
7 |
8 | @abstractmethod
9 | def _filename(self, index, basename=False, absolute=False):
10 | pass
11 |
12 | def filename(self, index, basename=False, absolute=False):
13 | return self._filename(index, basename=basename, absolute=absolute)
14 |
15 | def filenames(self, basename=False, absolute=False):
16 | return [self._filename(index, basename=basename, absolute=absolute) for index in range(len(self))]
17 |
18 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/data/parsers/parser_factory.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | from .parser_image_folder import ParserImageFolder
4 | from .parser_image_in_tar import ParserImageInTar
5 |
6 |
7 | def create_parser(name, root, split='train', **kwargs):
8 | name = name.lower()
9 | name = name.split('/', 2)
10 | prefix = ''
11 | if len(name) > 1:
12 | prefix = name[0]
13 | name = name[-1]
14 |
15 | # FIXME improve the selection right now just tfds prefix or fallback path, will need options to
16 | # explicitly select other options shortly
17 | if prefix == 'tfds':
18 | from .parser_tfds import ParserTfds # defer tensorflow import
19 | parser = ParserTfds(root, name, split=split, **kwargs)
20 | else:
21 | assert os.path.exists(root)
22 | # default fallback path (backwards compat), use image tar if root is a .tar file, otherwise image folder
23 | # FIXME support split here, in parser?
24 | if os.path.isfile(root) and os.path.splitext(root)[1] == '.tar':
25 | parser = ParserImageInTar(root, **kwargs)
26 | else:
27 | parser = ParserImageFolder(root, **kwargs)
28 | return parser
29 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/data/real_labels.py:
--------------------------------------------------------------------------------
1 | """ Real labels evaluator for ImageNet
2 | Paper: `Are we done with ImageNet?` - https://arxiv.org/abs/2006.07159
3 | Based on Numpy example at https://github.com/google-research/reassessed-imagenet
4 |
5 | Hacked together by / Copyright 2020 Ross Wightman
6 | """
7 | import os
8 | import json
9 | import numpy as np
10 |
11 |
12 | class RealLabelsImagenet:
13 |
14 | def __init__(self, filenames, real_json='real.json', topk=(1, 5)):
15 | with open(real_json) as real_labels:
16 | real_labels = json.load(real_labels)
17 | real_labels = {f'ILSVRC2012_val_{i + 1:08d}.JPEG': labels for i, labels in enumerate(real_labels)}
18 | self.real_labels = real_labels
19 | self.filenames = filenames
20 | assert len(self.filenames) == len(self.real_labels)
21 | self.topk = topk
22 | self.is_correct = {k: [] for k in topk}
23 | self.sample_idx = 0
24 |
25 | def add_result(self, output):
26 | maxk = max(self.topk)
27 | _, pred_batch = output.topk(maxk, 1, True, True)
28 | pred_batch = pred_batch.cpu().numpy()
29 | for pred in pred_batch:
30 | filename = self.filenames[self.sample_idx]
31 | filename = os.path.basename(filename)
32 | if self.real_labels[filename]:
33 | for k in self.topk:
34 | self.is_correct[k].append(
35 | any([p in self.real_labels[filename] for p in pred[:k]]))
36 | self.sample_idx += 1
37 |
38 | def get_accuracy(self, k=None):
39 | if k is None:
40 | return {k: float(np.mean(self.is_correct[k])) * 100 for k in self.topk}
41 | else:
42 | return float(np.mean(self.is_correct[k])) * 100
43 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/loss/__init__.py:
--------------------------------------------------------------------------------
1 | from .asymmetric_loss import AsymmetricLossMultiLabel, AsymmetricLossSingleLabel
2 | from .binary_cross_entropy import BinaryCrossEntropy
3 | from .cross_entropy import LabelSmoothingCrossEntropy, SoftTargetCrossEntropy
4 | from .jsd import JsdCrossEntropy
5 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/loss/cross_entropy.py:
--------------------------------------------------------------------------------
1 | """ Cross Entropy w/ smoothing or soft targets
2 |
3 | Hacked together by / Copyright 2021 Ross Wightman
4 | """
5 |
6 | import torch
7 | import torch.nn as nn
8 | import torch.nn.functional as F
9 |
10 |
11 | class LabelSmoothingCrossEntropy(nn.Module):
12 | """ NLL loss with label smoothing.
13 | """
14 | def __init__(self, smoothing=0.1):
15 | super(LabelSmoothingCrossEntropy, self).__init__()
16 | assert smoothing < 1.0
17 | self.smoothing = smoothing
18 | self.confidence = 1. - smoothing
19 |
20 | def forward(self, x: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
21 | logprobs = F.log_softmax(x, dim=-1)
22 | nll_loss = -logprobs.gather(dim=-1, index=target.unsqueeze(1))
23 | nll_loss = nll_loss.squeeze(1)
24 | smooth_loss = -logprobs.mean(dim=-1)
25 | loss = self.confidence * nll_loss + self.smoothing * smooth_loss
26 | return loss.mean()
27 |
28 |
29 | class SoftTargetCrossEntropy(nn.Module):
30 |
31 | def __init__(self):
32 | super(SoftTargetCrossEntropy, self).__init__()
33 |
34 | def forward(self, x: torch.Tensor, target: torch.Tensor) -> torch.Tensor:
35 | loss = torch.sum(-target * F.log_softmax(x, dim=-1), dim=-1)
36 | return loss.mean()
37 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/loss/jsd.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | import torch.nn.functional as F
4 |
5 | from .cross_entropy import LabelSmoothingCrossEntropy
6 |
7 |
8 | class JsdCrossEntropy(nn.Module):
9 | """ Jensen-Shannon Divergence + Cross-Entropy Loss
10 |
11 | Based on impl here: https://github.com/google-research/augmix/blob/master/imagenet.py
12 | From paper: 'AugMix: A Simple Data Processing Method to Improve Robustness and Uncertainty -
13 | https://arxiv.org/abs/1912.02781
14 |
15 | Hacked together by / Copyright 2020 Ross Wightman
16 | """
17 | def __init__(self, num_splits=3, alpha=12, smoothing=0.1):
18 | super().__init__()
19 | self.num_splits = num_splits
20 | self.alpha = alpha
21 | if smoothing is not None and smoothing > 0:
22 | self.cross_entropy_loss = LabelSmoothingCrossEntropy(smoothing)
23 | else:
24 | self.cross_entropy_loss = torch.nn.CrossEntropyLoss()
25 |
26 | def __call__(self, output, target):
27 | split_size = output.shape[0] // self.num_splits
28 | assert split_size * self.num_splits == output.shape[0]
29 | logits_split = torch.split(output, split_size)
30 |
31 | # Cross-entropy is only computed on clean images
32 | loss = self.cross_entropy_loss(logits_split[0], target[:split_size])
33 | probs = [F.softmax(logits, dim=1) for logits in logits_split]
34 |
35 | # Clamp mixture distribution to avoid exploding KL divergence
36 | logp_mixture = torch.clamp(torch.stack(probs).mean(axis=0), 1e-7, 1).log()
37 | loss += self.alpha * sum([F.kl_div(
38 | logp_mixture, p_split, reduction='batchmean') for p_split in probs]) / len(probs)
39 | return loss
40 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/models/layers/blur_pool.py:
--------------------------------------------------------------------------------
1 | """
2 | BlurPool layer inspired by
3 | - Kornia's Max_BlurPool2d
4 | - Making Convolutional Networks Shift-Invariant Again :cite:`zhang2019shiftinvar`
5 |
6 | Hacked together by Chris Ha and Ross Wightman
7 | """
8 |
9 | import torch
10 | import torch.nn as nn
11 | import torch.nn.functional as F
12 | import numpy as np
13 | from .padding import get_padding
14 |
15 |
16 | class BlurPool2d(nn.Module):
17 | r"""Creates a module that computes blurs and downsample a given feature map.
18 | See :cite:`zhang2019shiftinvar` for more details.
19 | Corresponds to the Downsample class, which does blurring and subsampling
20 |
21 | Args:
22 | channels = Number of input channels
23 | filt_size (int): binomial filter size for blurring. currently supports 3 (default) and 5.
24 | stride (int): downsampling filter stride
25 |
26 | Returns:
27 | torch.Tensor: the transformed tensor.
28 | """
29 | def __init__(self, channels, filt_size=3, stride=2) -> None:
30 | super(BlurPool2d, self).__init__()
31 | assert filt_size > 1
32 | self.channels = channels
33 | self.filt_size = filt_size
34 | self.stride = stride
35 | self.padding = [get_padding(filt_size, stride, dilation=1)] * 4
36 | coeffs = torch.tensor((np.poly1d((0.5, 0.5)) ** (self.filt_size - 1)).coeffs.astype(np.float32))
37 | blur_filter = (coeffs[:, None] * coeffs[None, :])[None, None, :, :].repeat(self.channels, 1, 1, 1)
38 | self.register_buffer('filt', blur_filter, persistent=False)
39 |
40 | def forward(self, x: torch.Tensor) -> torch.Tensor:
41 | x = F.pad(x, self.padding, 'reflect')
42 | return F.conv2d(x, self.filt, stride=self.stride, groups=self.channels)
43 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/models/layers/conv2d_same.py:
--------------------------------------------------------------------------------
1 | """ Conv2d w/ Same Padding
2 |
3 | Hacked together by / Copyright 2020 Ross Wightman
4 | """
5 | import torch
6 | import torch.nn as nn
7 | import torch.nn.functional as F
8 | from typing import Tuple, Optional
9 |
10 | from .padding import pad_same, get_padding_value
11 |
12 |
13 | def conv2d_same(
14 | x, weight: torch.Tensor, bias: Optional[torch.Tensor] = None, stride: Tuple[int, int] = (1, 1),
15 | padding: Tuple[int, int] = (0, 0), dilation: Tuple[int, int] = (1, 1), groups: int = 1):
16 | x = pad_same(x, weight.shape[-2:], stride, dilation)
17 | return F.conv2d(x, weight, bias, stride, (0, 0), dilation, groups)
18 |
19 |
20 | class Conv2dSame(nn.Conv2d):
21 | """ Tensorflow like 'SAME' convolution wrapper for 2D convolutions
22 | """
23 |
24 | def __init__(self, in_channels, out_channels, kernel_size, stride=1,
25 | padding=0, dilation=1, groups=1, bias=True):
26 | super(Conv2dSame, self).__init__(
27 | in_channels, out_channels, kernel_size, stride, 0, dilation, groups, bias)
28 |
29 | def forward(self, x):
30 | return conv2d_same(x, self.weight, self.bias, self.stride, self.padding, self.dilation, self.groups)
31 |
32 |
33 | def create_conv2d_pad(in_chs, out_chs, kernel_size, **kwargs):
34 | padding = kwargs.pop('padding', '')
35 | kwargs.setdefault('bias', False)
36 | padding, is_dynamic = get_padding_value(padding, kernel_size, **kwargs)
37 | if is_dynamic:
38 | return Conv2dSame(in_chs, out_chs, kernel_size, **kwargs)
39 | else:
40 | return nn.Conv2d(in_chs, out_chs, kernel_size, padding=padding, **kwargs)
41 |
42 |
43 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/models/layers/create_conv2d.py:
--------------------------------------------------------------------------------
1 | """ Create Conv2d Factory Method
2 |
3 | Hacked together by / Copyright 2020 Ross Wightman
4 | """
5 |
6 | from .mixed_conv2d import MixedConv2d
7 | from .cond_conv2d import CondConv2d
8 | from .conv2d_same import create_conv2d_pad
9 |
10 |
11 | def create_conv2d(in_channels, out_channels, kernel_size, **kwargs):
12 | """ Select a 2d convolution implementation based on arguments
13 | Creates and returns one of torch.nn.Conv2d, Conv2dSame, MixedConv2d, or CondConv2d.
14 |
15 | Used extensively by EfficientNet, MobileNetv3 and related networks.
16 | """
17 | if isinstance(kernel_size, list):
18 | assert 'num_experts' not in kwargs # MixNet + CondConv combo not supported currently
19 | if 'groups' in kwargs:
20 | groups = kwargs.pop('groups')
21 | if groups == in_channels:
22 | kwargs['depthwise'] = True
23 | else:
24 | assert groups == 1
25 | # We're going to use only lists for defining the MixedConv2d kernel groups,
26 | # ints, tuples, other iterables will continue to pass to normal conv and specify h, w.
27 | m = MixedConv2d(in_channels, out_channels, kernel_size, **kwargs)
28 | else:
29 | depthwise = kwargs.pop('depthwise', False)
30 | # for DW out_channels must be multiple of in_channels as must have out_channels % groups == 0
31 | groups = in_channels if depthwise else kwargs.pop('groups', 1)
32 | if 'num_experts' in kwargs and kwargs['num_experts'] > 0:
33 | m = CondConv2d(in_channels, out_channels, kernel_size, groups=groups, **kwargs)
34 | else:
35 | m = create_conv2d_pad(in_channels, out_channels, kernel_size, groups=groups, **kwargs)
36 | return m
37 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/models/layers/helpers.py:
--------------------------------------------------------------------------------
1 | """ Layer/Module Helpers
2 |
3 | Hacked together by / Copyright 2020 Ross Wightman
4 | """
5 | from itertools import repeat
6 | import collections.abc
7 |
8 |
9 | # From PyTorch internals
10 | def _ntuple(n):
11 | def parse(x):
12 | if isinstance(x, collections.abc.Iterable) and not isinstance(x, str):
13 | return x
14 | return tuple(repeat(x, n))
15 | return parse
16 |
17 |
18 | to_1tuple = _ntuple(1)
19 | to_2tuple = _ntuple(2)
20 | to_3tuple = _ntuple(3)
21 | to_4tuple = _ntuple(4)
22 | to_ntuple = _ntuple
23 |
24 |
25 | def make_divisible(v, divisor=8, min_value=None, round_limit=.9):
26 | min_value = min_value or divisor
27 | new_v = max(min_value, int(v + divisor / 2) // divisor * divisor)
28 | # Make sure that round down does not go down by more than 10%.
29 | if new_v < round_limit * v:
30 | new_v += divisor
31 | return new_v
32 |
33 |
34 | def extend_tuple(x, n):
35 | # pdas a tuple to specified n by padding with last value
36 | if not isinstance(x, (tuple, list)):
37 | x = (x,)
38 | else:
39 | x = tuple(x)
40 | pad_n = n - len(x)
41 | if pad_n <= 0:
42 | return x[:n]
43 | return x + (x[-1],) * pad_n
44 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/models/layers/linear.py:
--------------------------------------------------------------------------------
1 | """ Linear layer (alternate definition)
2 | """
3 | import torch
4 | import torch.nn.functional as F
5 | from torch import nn as nn
6 |
7 |
8 | class Linear(nn.Linear):
9 | r"""Applies a linear transformation to the incoming data: :math:`y = xA^T + b`
10 |
11 | Wraps torch.nn.Linear to support AMP + torchscript usage by manually casting
12 | weight & bias to input.dtype to work around an issue w/ torch.addmm in this use case.
13 | """
14 | def forward(self, input: torch.Tensor) -> torch.Tensor:
15 | if torch.jit.is_scripting():
16 | bias = self.bias.to(dtype=input.dtype) if self.bias is not None else None
17 | return F.linear(input, self.weight.to(dtype=input.dtype), bias=bias)
18 | else:
19 | return F.linear(input, self.weight, self.bias)
20 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/models/layers/patch_embed.py:
--------------------------------------------------------------------------------
1 | """ Image to Patch Embedding using Conv2d
2 |
3 | A convolution based approach to patchifying a 2D image w/ embedding projection.
4 |
5 | Based on the impl in https://github.com/google-research/vision_transformer
6 |
7 | Hacked together by / Copyright 2020 Ross Wightman
8 | """
9 | from torch import nn as nn
10 |
11 | from .helpers import to_2tuple
12 | from .trace_utils import _assert
13 |
14 |
15 | class PatchEmbed(nn.Module):
16 | """ 2D Image to Patch Embedding
17 | """
18 | def __init__(
19 | self,
20 | img_size=224,
21 | patch_size=16,
22 | in_chans=3,
23 | embed_dim=768,
24 | norm_layer=None,
25 | flatten=True,
26 | bias=True,
27 | ):
28 | super().__init__()
29 | img_size = to_2tuple(img_size)
30 | patch_size = to_2tuple(patch_size)
31 | self.img_size = img_size
32 | self.patch_size = patch_size
33 | self.grid_size = (img_size[0] // patch_size[0], img_size[1] // patch_size[1])
34 | self.num_patches = self.grid_size[0] * self.grid_size[1]
35 | self.flatten = flatten
36 |
37 | self.proj = nn.Conv2d(in_chans, embed_dim, kernel_size=patch_size, stride=patch_size, bias=bias)
38 | self.norm = norm_layer(embed_dim) if norm_layer else nn.Identity()
39 |
40 | def forward(self, x):
41 | B, C, H, W = x.shape
42 | _assert(H == self.img_size[0], f"Input image height ({H}) doesn't match model ({self.img_size[0]}).")
43 | _assert(W == self.img_size[1], f"Input image width ({W}) doesn't match model ({self.img_size[1]}).")
44 | x = self.proj(x)
45 | if self.flatten:
46 | x = x.flatten(2).transpose(1, 2) # BCHW -> BNC
47 | x = self.norm(x)
48 | return x
49 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/models/layers/trace_utils.py:
--------------------------------------------------------------------------------
1 | try:
2 | from torch import _assert
3 | except ImportError:
4 | def _assert(condition: bool, message: str):
5 | assert condition, message
6 |
7 |
8 | def _float_to_int(x: float) -> int:
9 | """
10 | Symbolic tracing helper to substitute for inbuilt `int`.
11 | Hint: Inbuilt `int` can't accept an argument of type `Proxy`
12 | """
13 | return int(x)
14 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/optim/__init__.py:
--------------------------------------------------------------------------------
1 | from .adabelief import AdaBelief
2 | from .adafactor import Adafactor
3 | from .adahessian import Adahessian
4 | from .adamp import AdamP
5 | from .adamw import AdamW
6 | from .lamb import Lamb
7 | from .lars import Lars
8 | from .lookahead import Lookahead
9 | from .madgrad import MADGRAD
10 | from .nadam import Nadam
11 | from .nvnovograd import NvNovoGrad
12 | from .radam import RAdam
13 | from .rmsprop_tf import RMSpropTF
14 | from .sgdp import SGDP
15 | from .optim_factory import create_optimizer, create_optimizer_v2, optimizer_kwargs
16 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/scheduler/__init__.py:
--------------------------------------------------------------------------------
1 | from .cosine_lr import CosineLRScheduler
2 | from .multistep_lr import MultiStepLRScheduler
3 | from .plateau_lr import PlateauLRScheduler
4 | from .poly_lr import PolyLRScheduler
5 | from .step_lr import StepLRScheduler
6 | from .tanh_lr import TanhLRScheduler
7 |
8 | from .scheduler_factory import create_scheduler
9 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/__init__.py:
--------------------------------------------------------------------------------
1 | from .agc import adaptive_clip_grad
2 | from .checkpoint_saver import CheckpointSaver
3 | from .clip_grad import dispatch_clip_grad
4 | from .cuda import ApexScaler, NativeScaler
5 | from .decay_batch import decay_batch_step, check_batch_size_retry
6 | from .distributed import distribute_bn, reduce_tensor
7 | from .jit import set_jit_legacy, set_jit_fuser
8 | from .log import setup_default_logging, FormatterNoInfo
9 | from .metrics import AverageMeter, accuracy
10 | from .misc import natural_key, add_bool_arg
11 | from .model import unwrap_model, get_state_dict, freeze, unfreeze
12 | from .model_ema import ModelEma, ModelEmaV2
13 | from .random import random_seed
14 | from .summary import update_summary, get_outdir
15 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/agc.py:
--------------------------------------------------------------------------------
1 | """ Adaptive Gradient Clipping
2 |
3 | An impl of AGC, as per (https://arxiv.org/abs/2102.06171):
4 |
5 | @article{brock2021high,
6 | author={Andrew Brock and Soham De and Samuel L. Smith and Karen Simonyan},
7 | title={High-Performance Large-Scale Image Recognition Without Normalization},
8 | journal={arXiv preprint arXiv:},
9 | year={2021}
10 | }
11 |
12 | Code references:
13 | * Official JAX impl (paper authors): https://github.com/deepmind/deepmind-research/tree/master/nfnets
14 | * Phil Wang's PyTorch gist: https://gist.github.com/lucidrains/0d6560077edac419ab5d3aa29e674d5c
15 |
16 | Hacked together by / Copyright 2021 Ross Wightman
17 | """
18 | import torch
19 |
20 |
21 | def unitwise_norm(x, norm_type=2.0):
22 | if x.ndim <= 1:
23 | return x.norm(norm_type)
24 | else:
25 | # works for nn.ConvNd and nn,Linear where output dim is first in the kernel/weight tensor
26 | # might need special cases for other weights (possibly MHA) where this may not be true
27 | return x.norm(norm_type, dim=tuple(range(1, x.ndim)), keepdim=True)
28 |
29 |
30 | def adaptive_clip_grad(parameters, clip_factor=0.01, eps=1e-3, norm_type=2.0):
31 | if isinstance(parameters, torch.Tensor):
32 | parameters = [parameters]
33 | for p in parameters:
34 | if p.grad is None:
35 | continue
36 | p_data = p.detach()
37 | g_data = p.grad.detach()
38 | max_norm = unitwise_norm(p_data, norm_type=norm_type).clamp_(min=eps).mul_(clip_factor)
39 | grad_norm = unitwise_norm(g_data, norm_type=norm_type)
40 | clipped_grad = g_data * (max_norm / grad_norm.clamp(min=1e-6))
41 | new_grads = torch.where(grad_norm < max_norm, g_data, clipped_grad)
42 | p.grad.detach().copy_(new_grads)
43 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/clip_grad.py:
--------------------------------------------------------------------------------
1 | import torch
2 |
3 | from timm.utils.agc import adaptive_clip_grad
4 |
5 |
6 | def dispatch_clip_grad(parameters, value: float, mode: str = 'norm', norm_type: float = 2.0):
7 | """ Dispatch to gradient clipping method
8 |
9 | Args:
10 | parameters (Iterable): model parameters to clip
11 | value (float): clipping value/factor/norm, mode dependant
12 | mode (str): clipping mode, one of 'norm', 'value', 'agc'
13 | norm_type (float): p-norm, default 2.0
14 | """
15 | if mode == 'norm':
16 | torch.nn.utils.clip_grad_norm_(parameters, value, norm_type=norm_type)
17 | elif mode == 'value':
18 | torch.nn.utils.clip_grad_value_(parameters, value)
19 | elif mode == 'agc':
20 | adaptive_clip_grad(parameters, value, norm_type=norm_type)
21 | else:
22 | assert False, f"Unknown clip mode ({mode})."
23 |
24 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/distributed.py:
--------------------------------------------------------------------------------
1 | """ Distributed training/validation utils
2 |
3 | Hacked together by / Copyright 2020 Ross Wightman
4 | """
5 | import torch
6 | from torch import distributed as dist
7 |
8 | from .model import unwrap_model
9 |
10 |
11 | def reduce_tensor(tensor, n):
12 | rt = tensor.clone()
13 | dist.all_reduce(rt, op=dist.ReduceOp.SUM)
14 | rt /= n
15 | return rt
16 |
17 |
18 | def distribute_bn(model, world_size, reduce=False):
19 | # ensure every node has the same running bn stats
20 | for bn_name, bn_buf in unwrap_model(model).named_buffers(recurse=True):
21 | if ('running_mean' in bn_name) or ('running_var' in bn_name):
22 | if reduce:
23 | # average bn stats across whole group
24 | torch.distributed.all_reduce(bn_buf, op=dist.ReduceOp.SUM)
25 | bn_buf /= float(world_size)
26 | else:
27 | # broadcast bn stats from rank 0 to whole group
28 | torch.distributed.broadcast(bn_buf, 0)
29 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/log.py:
--------------------------------------------------------------------------------
1 | """ Logging helpers
2 |
3 | Hacked together by / Copyright 2020 Ross Wightman
4 | """
5 | import logging
6 | import logging.handlers
7 |
8 |
9 | class FormatterNoInfo(logging.Formatter):
10 | def __init__(self, fmt='%(levelname)s: %(message)s'):
11 | logging.Formatter.__init__(self, fmt)
12 |
13 | def format(self, record):
14 | if record.levelno == logging.INFO:
15 | return str(record.getMessage())
16 | return logging.Formatter.format(self, record)
17 |
18 |
19 | def setup_default_logging(default_level=logging.INFO, log_path=''):
20 | console_handler = logging.StreamHandler()
21 | console_handler.setFormatter(FormatterNoInfo())
22 | logging.root.addHandler(console_handler)
23 | logging.root.setLevel(default_level)
24 | if log_path:
25 | file_handler = logging.handlers.RotatingFileHandler(log_path, maxBytes=(1024 ** 2 * 2), backupCount=3)
26 | file_formatter = logging.Formatter("%(asctime)s - %(name)20s: [%(levelname)8s] - %(message)s")
27 | file_handler.setFormatter(file_formatter)
28 | logging.root.addHandler(file_handler)
29 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/metrics.py:
--------------------------------------------------------------------------------
1 | """ Eval metrics and related
2 |
3 | Hacked together by / Copyright 2020 Ross Wightman
4 | """
5 |
6 |
7 | class AverageMeter:
8 | """Computes and stores the average and current value"""
9 | def __init__(self):
10 | self.reset()
11 |
12 | def reset(self):
13 | self.val = 0
14 | self.avg = 0
15 | self.sum = 0
16 | self.count = 0
17 |
18 | def update(self, val, n=1):
19 | self.val = val
20 | self.sum += val * n
21 | self.count += n
22 | self.avg = self.sum / self.count
23 |
24 |
25 | def accuracy(output, target, topk=(1,)):
26 | """Computes the accuracy over the k top predictions for the specified values of k"""
27 | maxk = min(max(topk), output.size()[1])
28 | batch_size = target.size(0)
29 | _, pred = output.topk(maxk, 1, True, True)
30 | pred = pred.t()
31 | correct = pred.eq(target.reshape(1, -1).expand_as(pred))
32 | return [correct[:min(k, maxk)].reshape(-1).float().sum(0) * 100. / batch_size for k in topk]
33 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/misc.py:
--------------------------------------------------------------------------------
1 | """ Misc utils
2 |
3 | Hacked together by / Copyright 2020 Ross Wightman
4 | """
5 | import re
6 |
7 |
8 | def natural_key(string_):
9 | """See http://www.codinghorror.com/blog/archives/001018.html"""
10 | return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', string_.lower())]
11 |
12 |
13 | def add_bool_arg(parser, name, default=False, help=''):
14 | dest_name = name.replace('-', '_')
15 | group = parser.add_mutually_exclusive_group(required=False)
16 | group.add_argument('--' + name, dest=dest_name, action='store_true', help=help)
17 | group.add_argument('--no-' + name, dest=dest_name, action='store_false', help=help)
18 | parser.set_defaults(**{dest_name: default})
19 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/random.py:
--------------------------------------------------------------------------------
1 | import random
2 | import numpy as np
3 | import torch
4 |
5 |
6 | def random_seed(seed=42, rank=0):
7 | torch.manual_seed(seed + rank)
8 | np.random.seed(seed + rank)
9 | random.seed(seed + rank)
10 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/utils/summary.py:
--------------------------------------------------------------------------------
1 | """ Summary utilities
2 |
3 | Hacked together by / Copyright 2020 Ross Wightman
4 | """
5 | import csv
6 | import os
7 | from collections import OrderedDict
8 | try:
9 | import wandb
10 | except ImportError:
11 | pass
12 |
13 | def get_outdir(path, *paths, inc=False):
14 | outdir = os.path.join(path, *paths)
15 | if not os.path.exists(outdir):
16 | os.makedirs(outdir)
17 | elif inc:
18 | count = 1
19 | outdir_inc = outdir + '-' + str(count)
20 | while os.path.exists(outdir_inc):
21 | count = count + 1
22 | outdir_inc = outdir + '-' + str(count)
23 | assert count < 100
24 | outdir = outdir_inc
25 | os.makedirs(outdir)
26 | return outdir
27 |
28 |
29 | def update_summary(epoch, train_metrics, eval_metrics, filename, write_header=False, log_wandb=False):
30 | rowd = OrderedDict(epoch=epoch)
31 | rowd.update([('train_' + k, v) for k, v in train_metrics.items()])
32 | rowd.update([('eval_' + k, v) for k, v in eval_metrics.items()])
33 | if log_wandb:
34 | wandb.log(rowd)
35 | with open(filename, mode='a') as cf:
36 | dw = csv.DictWriter(cf, fieldnames=rowd.keys())
37 | if write_header: # first iteration (epoch == 1 can't be used)
38 | dw.writeheader()
39 | dw.writerow(rowd)
40 |
--------------------------------------------------------------------------------
/detector_codes/pytorch-image-models-0.6.12/timm/version.py:
--------------------------------------------------------------------------------
1 | __version__ = '0.6.12'
2 |
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/.gitignore:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Andy Brock
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/TFHub/README.md:
--------------------------------------------------------------------------------
1 | # BigGAN-PyTorch TFHub converter
2 | This dir contains scripts for taking the [pre-trained generator weights from TFHub](https://tfhub.dev/s?q=biggan) and porting them to BigGAN-Pytorch.
3 |
4 | In addition to the base libraries for BigGAN-PyTorch, to run this code you will need:
5 |
6 | TensorFlow
7 | TFHub
8 | parse
9 |
10 | Note that this code is only presently set up to run the ported models without truncation--you'll need to accumulate standing stats at each truncation level yourself if you wish to employ it.
11 |
12 | To port the 128x128 model from tfhub, produce a pretrained weights .pth file, and generate samples using all your GPUs, run
13 |
14 | `python converter.py -r 128 --generate_samples --parallel`
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/imgs/D Singular Values.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/BigGAN-PyTorch-master/imgs/D Singular Values.png
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/imgs/DeepSamples.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/BigGAN-PyTorch-master/imgs/DeepSamples.png
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/imgs/DogBall.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/BigGAN-PyTorch-master/imgs/DogBall.png
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/imgs/G Singular Values.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/BigGAN-PyTorch-master/imgs/G Singular Values.png
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/imgs/IS_FID.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/BigGAN-PyTorch-master/imgs/IS_FID.png
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/imgs/Losses.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/BigGAN-PyTorch-master/imgs/Losses.png
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/imgs/header_image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/BigGAN-PyTorch-master/imgs/header_image.jpg
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/imgs/interp_sample.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/BigGAN-PyTorch-master/imgs/interp_sample.jpg
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/logs/process_inception_log.m:
--------------------------------------------------------------------------------
1 | function [itr, IS, FID, t] = process_inception_log(fname, which_log)
2 | f = sprintf('%s_%s',fname, which_log);%'G_loss.log');
3 | fid = fopen(f,'r');
4 | itr = [];
5 | IS = [];
6 | FID = [];
7 | t = [];
8 | i = 1;
9 | while ~feof(fid);
10 | s = fgets(fid);
11 | parsed = sscanf(s,'{"itr": %d, "IS_mean": %f, "IS_std": %f, "FID": %f, "_stamp": %f}');
12 | itr(i) = parsed(1);
13 | IS(i) = parsed(2);
14 | FID(i) = parsed(4);
15 | t(i) = parsed(5);
16 | i = i + 1;
17 | end
18 | fclose(fid);
19 | end
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/losses.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn.functional as F
3 |
4 | # DCGAN loss
5 | def loss_dcgan_dis(dis_fake, dis_real):
6 | L1 = torch.mean(F.softplus(-dis_real))
7 | L2 = torch.mean(F.softplus(dis_fake))
8 | return L1, L2
9 |
10 |
11 | def loss_dcgan_gen(dis_fake):
12 | loss = torch.mean(F.softplus(-dis_fake))
13 | return loss
14 |
15 |
16 | # Hinge Loss
17 | def loss_hinge_dis(dis_fake, dis_real):
18 | loss_real = torch.mean(F.relu(1. - dis_real))
19 | loss_fake = torch.mean(F.relu(1. + dis_fake))
20 | return loss_real, loss_fake
21 | # def loss_hinge_dis(dis_fake, dis_real): # This version returns a single loss
22 | # loss = torch.mean(F.relu(1. - dis_real))
23 | # loss += torch.mean(F.relu(1. + dis_fake))
24 | # return loss
25 |
26 |
27 | def loss_hinge_gen(dis_fake):
28 | loss = -torch.mean(dis_fake)
29 | return loss
30 |
31 | # Default to hinge loss
32 | generator_loss = loss_hinge_gen
33 | discriminator_loss = loss_hinge_dis
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/launch_BigGAN_bs256x8.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | python train.py \
3 | --dataset I128_hdf5 --parallel --shuffle --num_workers 8 --batch_size 256 --load_in_mem \
4 | --num_G_accumulations 8 --num_D_accumulations 8 \
5 | --num_D_steps 1 --G_lr 1e-4 --D_lr 4e-4 --D_B2 0.999 --G_B2 0.999 \
6 | --G_attn 64 --D_attn 64 \
7 | --G_nl inplace_relu --D_nl inplace_relu \
8 | --SN_eps 1e-6 --BN_eps 1e-5 --adam_eps 1e-6 \
9 | --G_ortho 0.0 \
10 | --G_shared \
11 | --G_init ortho --D_init ortho \
12 | --hier --dim_z 120 --shared_dim 128 \
13 | --G_eval_mode \
14 | --G_ch 96 --D_ch 96 \
15 | --ema --use_ema --ema_start 20000 \
16 | --test_every 2000 --save_every 1000 --num_best_copies 5 --num_save_copies 2 --seed 0 \
17 | --use_multiepoch_sampler \
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/launch_BigGAN_bs512x4.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | python train.py \
3 | --dataset I128_hdf5 --parallel --shuffle --num_workers 8 --batch_size 512 --load_in_mem \
4 | --num_G_accumulations 4 --num_D_accumulations 4 \
5 | --num_D_steps 1 --G_lr 1e-4 --D_lr 4e-4 --D_B2 0.999 --G_B2 0.999 \
6 | --G_attn 64 --D_attn 64 \
7 | --G_nl inplace_relu --D_nl inplace_relu \
8 | --SN_eps 1e-6 --BN_eps 1e-5 --adam_eps 1e-6 \
9 | --G_ortho 0.0 \
10 | --G_shared \
11 | --G_init ortho --D_init ortho \
12 | --hier --dim_z 120 --shared_dim 128 \
13 | --G_eval_mode \
14 | --G_ch 96 --D_ch 96 \
15 | --ema --use_ema --ema_start 20000 \
16 | --test_every 2000 --save_every 1000 --num_best_copies 5 --num_save_copies 2 --seed 0 \
17 | --use_multiepoch_sampler \
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/launch_BigGAN_ch64_bs256x8.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | python train.py \
3 | --dataset I128_hdf5 --parallel --shuffle --num_workers 8 --batch_size 256 --load_in_mem \
4 | --num_G_accumulations 8 --num_D_accumulations 8 \
5 | --num_D_steps 1 --G_lr 1e-4 --D_lr 4e-4 --D_B2 0.999 --G_B2 0.999 \
6 | --G_attn 64 --D_attn 64 \
7 | --G_nl inplace_relu --D_nl inplace_relu \
8 | --SN_eps 1e-6 --BN_eps 1e-5 --adam_eps 1e-6 \
9 | --G_ortho 0.0 \
10 | --G_shared \
11 | --G_init ortho --D_init ortho \
12 | --hier --dim_z 120 --shared_dim 128 \
13 | --G_eval_mode \
14 | --G_ch 64 --G_ch 64 \
15 | --ema --use_ema --ema_start 20000 \
16 | --test_every 2000 --save_every 1000 --num_best_copies 5 --num_save_copies 2 --seed 0 \
17 | --use_multiepoch_sampler
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/launch_BigGAN_deep.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | python train.py \
3 | --model BigGANdeep \
4 | --dataset I128_hdf5 --parallel --shuffle --num_workers 8 --batch_size 256 \
5 | --num_G_accumulations 8 --num_D_accumulations 8 \
6 | --num_D_steps 1 --G_lr 1e-4 --D_lr 4e-4 --D_B2 0.999 --G_B2 0.999 \
7 | --G_attn 64 --D_attn 64 \
8 | --G_ch 128 --D_ch 128 \
9 | --G_depth 2 --D_depth 2 \
10 | --G_nl inplace_relu --D_nl inplace_relu \
11 | --SN_eps 1e-6 --BN_eps 1e-5 --adam_eps 1e-6 \
12 | --G_ortho 0.0 \
13 | --G_shared \
14 | --G_init ortho --D_init ortho \
15 | --hier --dim_z 128 --shared_dim 128 \
16 | --ema --use_ema --ema_start 20000 --G_eval_mode \
17 | --test_every 2000 --save_every 500 --num_best_copies 5 --num_save_copies 2 --seed 0 \
18 | --use_multiepoch_sampler \
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/launch_SAGAN_bs128x2_ema.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | python train.py \
3 | --dataset I128_hdf5 --parallel --shuffle --num_workers 8 --batch_size 128 \
4 | --num_G_accumulations 2 --num_D_accumulations 2 \
5 | --num_D_steps 1 --G_lr 1e-4 --D_lr 4e-4 --D_B2 0.999 --G_B2 0.999 \
6 | --G_attn 64 --D_attn 64 \
7 | --G_nl relu --D_nl relu \
8 | --SN_eps 1e-8 --BN_eps 1e-5 --adam_eps 1e-8 \
9 | --G_ortho 0.0 \
10 | --G_init xavier --D_init xavier \
11 | --ema --use_ema --ema_start 2000 --G_eval_mode \
12 | --test_every 2000 --save_every 1000 --num_best_copies 5 --num_save_copies 2 --seed 0 \
13 | --name_suffix SAGAN_ema \
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/launch_SNGAN.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | python train.py \
3 | --dataset I128_hdf5 --parallel --shuffle --num_workers 8 --batch_size 64 \
4 | --num_G_accumulations 1 --num_D_accumulations 1 \
5 | --num_D_steps 5 --G_lr 2e-4 --D_lr 2e-4 --D_B2 0.900 --G_B2 0.900 \
6 | --G_attn 0 --D_attn 0 \
7 | --G_nl relu --D_nl relu \
8 | --SN_eps 1e-8 --BN_eps 1e-5 --adam_eps 1e-8 \
9 | --G_ortho 0.0 \
10 | --D_thin \
11 | --G_init xavier --D_init xavier \
12 | --G_eval_mode \
13 | --test_every 2000 --save_every 1000 --num_best_copies 5 --num_save_copies 2 --seed 0 \
14 | --name_suffix SNGAN \
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/launch_cifar_ema.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | CUDA_VISIBLE_DEVICES=0,1 python train.py \
3 | --shuffle --batch_size 50 --parallel \
4 | --num_G_accumulations 1 --num_D_accumulations 1 --num_epochs 500 \
5 | --num_D_steps 4 --G_lr 2e-4 --D_lr 2e-4 \
6 | --dataset C10 \
7 | --G_ortho 0.0 \
8 | --G_attn 0 --D_attn 0 \
9 | --G_init N02 --D_init N02 \
10 | --ema --use_ema --ema_start 1000 \
11 | --test_every 5000 --save_every 2000 --num_best_copies 5 --num_save_copies 2 --seed 0
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/sample_BigGAN_bs256x8.sh:
--------------------------------------------------------------------------------
1 | # use z_var to change the variance of z for all the sampling
2 | # use --mybn --accumulate_stats --num_standing_accumulations 32 to
3 | # use running stats
4 | python sample.py \
5 | --dataset I128_hdf5 --parallel --shuffle --num_workers 8 --batch_size 256 \
6 | --num_G_accumulations 8 --num_D_accumulations 8 \
7 | --num_D_steps 1 --G_lr 1e-4 --D_lr 4e-4 --D_B2 0.999 --G_B2 0.999 \
8 | --G_attn 64 --D_attn 64 \
9 | --G_ch 96 --D_ch 96 \
10 | --G_nl inplace_relu --D_nl inplace_relu \
11 | --SN_eps 1e-6 --BN_eps 1e-5 --adam_eps 1e-6 \
12 | --G_ortho 0.0 \
13 | --G_shared \
14 | --G_init ortho --D_init ortho --skip_init \
15 | --hier --dim_z 120 --shared_dim 128 \
16 | --ema --ema_start 20000 \
17 | --use_multiepoch_sampler \
18 | --test_every 2000 --save_every 1000 --num_best_copies 5 --num_save_copies 2 --seed 0 \
19 | --skip_init --G_batch_size 512 --use_ema --G_eval_mode --sample_trunc_curves 0.05_0.05_1.0 \
20 | --sample_inception_metrics --sample_npz --sample_random --sample_sheets --sample_interps
21 |
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/sample_cifar_ema.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | CUDA_VISIBLE_DEVICES=0,1 python sample.py \
3 | --shuffle --batch_size 50 --G_batch_size 256 --parallel \
4 | --num_G_accumulations 1 --num_D_accumulations 1 --num_epochs 500 \
5 | --num_D_steps 4 --G_lr 2e-4 --D_lr 2e-4 \
6 | --dataset C10 \
7 | --G_ortho 0.0 \
8 | --G_attn 0 --D_attn 0 \
9 | --G_init N02 --D_init N02 \
10 | --ema --use_ema --ema_start 1000 \
11 | --test_every 5000 --save_every 2000 --num_best_copies 5 --num_save_copies 2 --seed 0
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/utils/duplicate.sh:
--------------------------------------------------------------------------------
1 | #duplicate.sh
2 | source=BigGAN_I128_hdf5_seed0_Gch64_Dch64_bs256_Glr1.0e-04_Dlr4.0e-04_Gnlinplace_relu_Dnlinplace_relu_Ginitxavier_Dinitxavier_Gshared_alex0
3 | target=BigGAN_I128_hdf5_seed0_Gch64_Dch64_bs256_Glr1.0e-04_Dlr4.0e-04_Gnlinplace_relu_Dnlinplace_relu_Ginitxavier_Dinitxavier_Gshared_alex0A
4 | logs_root=logs
5 | weights_root=weights
6 | echo "copying ${source} to ${target}"
7 | cp -r ${logs_root}/${source} ${logs_root}/${target}
8 | cp ${logs_root}/${source}_log.jsonl ${logs_root}/${target}_log.jsonl
9 | cp ${weights_root}/${source}_G.pth ${weights_root}/${target}_G.pth
10 | cp ${weights_root}/${source}_G_ema.pth ${weights_root}/${target}_G_ema.pth
11 | cp ${weights_root}/${source}_D.pth ${weights_root}/${target}_D.pth
12 | cp ${weights_root}/${source}_G_optim.pth ${weights_root}/${target}_G_optim.pth
13 | cp ${weights_root}/${source}_D_optim.pth ${weights_root}/${target}_D_optim.pth
14 | cp ${weights_root}/${source}_state_dict.pth ${weights_root}/${target}_state_dict.pth
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/scripts/utils/prepare_data.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | python make_hdf5.py --dataset I128 --batch_size 256 --data_root data
3 | python calculate_inception_moments.py --dataset I128_hdf5 --data_root data
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/sync_batchnorm/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # File : __init__.py
3 | # Author : Jiayuan Mao
4 | # Email : maojiayuan@gmail.com
5 | # Date : 27/01/2018
6 | #
7 | # This file is part of Synchronized-BatchNorm-PyTorch.
8 | # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
9 | # Distributed under MIT License.
10 |
11 | from .batchnorm import SynchronizedBatchNorm1d, SynchronizedBatchNorm2d, SynchronizedBatchNorm3d
12 | from .replicate import DataParallelWithCallback, patch_replication_callback
13 |
--------------------------------------------------------------------------------
/generator_codes/BigGAN-PyTorch-master/sync_batchnorm/unittest.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # File : unittest.py
3 | # Author : Jiayuan Mao
4 | # Email : maojiayuan@gmail.com
5 | # Date : 27/01/2018
6 | #
7 | # This file is part of Synchronized-BatchNorm-PyTorch.
8 | # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
9 | # Distributed under MIT License.
10 |
11 | import unittest
12 | import torch
13 |
14 |
15 | class TorchTestCase(unittest.TestCase):
16 | def assertTensorClose(self, x, y):
17 | adiff = float((x - y).abs().max())
18 | if (y == 0).all():
19 | rdiff = 'NaN'
20 | else:
21 | rdiff = float((adiff / y).abs().max())
22 |
23 | message = (
24 | 'Tensor close check failed\n'
25 | 'adiff={}\n'
26 | 'rdiff={}\n'
27 | ).format(adiff, rdiff)
28 | self.assertTrue(torch.allclose(x, y), message)
29 |
30 |
--------------------------------------------------------------------------------
/generator_codes/Readme.md:
--------------------------------------------------------------------------------
1 | # Codes of Detectors
2 |
3 | These are the codes of the detectors used in GenImage benchmark.
4 |
5 | Stable Diffusion: stable-diffusion-main (https://github.com/CompVis/stable-diffusion)
6 |
7 | GLIDE: guided-diffusion-main (https://github.com/openai/glide-text2im)
8 |
9 | VDQM: VQ-Diffusion-main (https://github.com/microsoft/VQ-Diffusion)
10 |
11 | BigGAN: BigGAN-PyTorch-master (https://github.com/ajbrock/BigGAN-PyTorch)
12 |
13 | ADM: guided-diffusion-main (https://github.com/openai/guided-diffusion)
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE
22 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/OUTPUT/pretrained_model/taming_dvae/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | params:
3 | decoder_config:
4 | params:
5 | attn_resolutions:
6 | - - 32
7 | - 32
8 | ch: 64
9 | ch_mult:
10 | - 1
11 | - 2
12 | - 4
13 | - 8
14 | dropout: 0.0
15 | num_res_blocks: 2
16 | out_ch: 3
17 | resolution:
18 | - 256
19 | - 256
20 | z_channels: 256
21 | target: image_synthesis.modeling.codecs.image_codec.patch_vqgan.Decoder
22 | embed_dim: 128
23 | encoder_config:
24 | params:
25 | activate_output: false
26 | attn_resolutions:
27 | - - 32
28 | - 32
29 | ch: 64
30 | ch_mult:
31 | - 1
32 | - 2
33 | - 4
34 | - 8
35 | dropout: 0.0
36 | in_channels: 3
37 | num_res_blocks: 2
38 | out_ch: 3
39 | resolution:
40 | - 256
41 | - 256
42 | z_channels: 256
43 | target: image_synthesis.modeling.codecs.image_codec.patch_vqgan.Encoder
44 | n_embed: 4096
45 | quantizer_type: EMAVQ
46 | trainable: true
47 | target: image_synthesis.modeling.codecs.image_codec.patch_vqgan.PatchVQGAN
48 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/OUTPUT/pretrained_model/taming_dvae/taming_f8_8192_openimages.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: image_synthesis.taming.models.vqgan.GumbelVQ
4 | params:
5 | kl_weight: 1.0e-08
6 | embed_dim: 256
7 | n_embed: 8192
8 | monitor: val/rec_loss
9 | temperature_scheduler_config:
10 | target: image_synthesis.taming.lr_scheduler.LambdaWarmUpCosineScheduler
11 | params:
12 | warm_up_steps: 0
13 | max_decay_steps: 1000001
14 | lr_start: 0.9
15 | lr_max: 0.9
16 | lr_min: 1.0e-06
17 | ddconfig:
18 | double_z: false
19 | z_channels: 256
20 | resolution: 256
21 | in_channels: 3
22 | out_ch: 3
23 | ch: 128
24 | ch_mult:
25 | - 1
26 | - 1
27 | - 2
28 | - 4
29 | num_res_blocks: 2
30 | attn_resolutions:
31 | - 32
32 | dropout: 0.0
33 | lossconfig:
34 | target: image_synthesis.taming.modules.losses.vqperceptual.DummyLoss
35 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/OUTPUT/pretrained_model/taming_dvae/vqgan_ffhq_f16_1024.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 0.0625
3 | target: image_synthesis.taming.models.cond_transformer.Net2NetTransformer
4 | params:
5 | cond_stage_config: __is_unconditional__
6 | first_stage_key: image
7 | transformer_config:
8 | target: image_synthesis.taming.modules.transformer.mingpt.GPT
9 | params:
10 | vocab_size: 1024
11 | block_size: 256
12 | n_layer: 24
13 | n_head: 16
14 | n_embd: 1664
15 | first_stage_config:
16 | target: image_synthesis.taming.models.vqgan.VQModel
17 | params:
18 | embed_dim: 256
19 | n_embed: 1024
20 | ddconfig:
21 | double_z: false
22 | z_channels: 256
23 | resolution: 256
24 | in_channels: 3
25 | out_ch: 3
26 | ch: 128
27 | ch_mult:
28 | - 1
29 | - 1
30 | - 2
31 | - 2
32 | - 4
33 | num_res_blocks: 2
34 | attn_resolutions:
35 | - 16
36 | dropout: 0.0
37 | lossconfig:
38 | target: image_synthesis.taming.modules.losses.vqperceptual.DummyLoss
39 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/OUTPUT/pretrained_model/taming_dvae/vqgan_imagenet_f16_16384.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: image_synthesis.taming.models.vqgan.VQModel
4 | params:
5 | embed_dim: 256
6 | n_embed: 16384
7 | monitor: val/rec_loss
8 | ddconfig:
9 | double_z: false
10 | z_channels: 256
11 | resolution: 256
12 | in_channels: 3
13 | out_ch: 3
14 | ch: 128
15 | ch_mult:
16 | - 1
17 | - 1
18 | - 2
19 | - 2
20 | - 4
21 | num_res_blocks: 2
22 | attn_resolutions:
23 | - 16
24 | dropout: 0.0
25 | lossconfig:
26 | target: image_synthesis.taming.modules.losses.vqperceptual.VQLPIPSWithDiscriminator
27 | params:
28 | disc_conditional: false
29 | disc_in_channels: 3
30 | disc_start: 0
31 | disc_weight: 0.75
32 | disc_num_layers: 2
33 | codebook_weight: 1.0
34 |
35 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/figures/framework.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/VQ-Diffusion-main/figures/framework.png
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/help_folder/readme.md:
--------------------------------------------------------------------------------
1 | Statistics folder contains some dictionary to shrink the codebook from [Taming Transformer](https://github.com/CompVis/taming-transformers).
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/help_folder/statistics/taming_vqvae_2887.pt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/VQ-Diffusion-main/help_folder/statistics/taming_vqvae_2887.pt
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/help_folder/statistics/taming_vqvae_974.pt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/VQ-Diffusion-main/help_folder/statistics/taming_vqvae_974.pt
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/data/ffhq_dataset.py:
--------------------------------------------------------------------------------
1 | from torch.utils.data import Dataset
2 | import numpy as np
3 | import io
4 | from PIL import Image
5 | import os
6 | import json
7 | import random
8 | from image_synthesis.utils.misc import instantiate_from_config
9 | import torchvision.datasets as datasets
10 |
11 | class FFHQDataset(datasets.ImageFolder):
12 | def __init__(self, data_root, im_preprocessor_config):
13 | self.img_preprocessor = instantiate_from_config(im_preprocessor_config)
14 | super(FFHQDataset, self).__init__(root=data_root)
15 |
16 | def __getitem__(self, index):
17 | # image_name = self.imgs[index][0].split('/')[-1]
18 | image = super(FFHQDataset, self).__getitem__(index)[0]
19 | image = self.img_preprocessor(image=np.array(image).astype(np.uint8))['image']
20 | data = {
21 | 'image': np.transpose(image.astype(np.float32), (2, 0, 1)),
22 | }
23 | return data
24 |
25 |
26 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/engine/clip_grad_norm.py:
--------------------------------------------------------------------------------
1 | from torch.nn.utils import clip_grad_norm_
2 |
3 |
4 | class ClipGradNorm(object):
5 | def __init__(self,
6 | start_iteration=0,
7 | end_iteration=-1, # if negative, the norm will be always clipped
8 | max_norm=0.5):
9 | self.start_iteration = start_iteration
10 | self.end_iteration = end_iteration
11 | self.max_norm = max_norm
12 |
13 | self.last_epoch = -1
14 |
15 |
16 | def __call__(self, parameters):
17 | self.last_epoch += 1
18 | clip = False
19 | if self.last_epoch >= self.start_iteration:
20 | clip = True
21 | if self.end_iteration > 0 and self.last_epoch < self.end_iteration:
22 | clip = True
23 | if clip:
24 | clip_grad_norm_(parameters, max_norm=self.max_norm)
25 |
26 | def state_dict(self):
27 | return {key: value for key, value in self.__dict__.items()}
28 |
29 |
30 | def load_state_dict(self, state_dict):
31 | self.__dict__.update(state_dict)
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/modeling/build.py:
--------------------------------------------------------------------------------
1 | from image_synthesis.utils.misc import instantiate_from_config
2 |
3 |
4 | def build_model(config, args=None):
5 | return instantiate_from_config(config['model'])
6 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/modeling/codecs/base_codec.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from torch import nn
3 |
4 |
5 | class BaseCodec(nn.Module):
6 |
7 | def get_tokens(self, x, **kwargs):
8 | """
9 | Input:
10 | x: input data
11 | Return:
12 | indices: B x L, the codebook indices, where L is the length
13 | of flattened feature map size
14 | """
15 | raise NotImplementedError
16 |
17 | def get_number_of_tokens(self):
18 | """
19 | Return: int, the number of tokens
20 | """
21 | raise NotImplementedError
22 |
23 | def encode(self, img):
24 | raise NotImplementedError
25 |
26 | def decode(self, img_seq):
27 | raise NotImplementedError
28 |
29 | def forward(self, **kwargs):
30 | raise NotImplementedError
31 |
32 | def train(self, mode=True):
33 | self.training = mode
34 | if self.trainable and mode:
35 | return super().train(True)
36 | else:
37 | return super().train(False)
38 |
39 | def _set_trainable(self):
40 | if not self.trainable:
41 | for pn, p in self.named_parameters():
42 | p.requires_grad = False
43 | self.eval()
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/modeling/embeddings/base_embedding.py:
--------------------------------------------------------------------------------
1 | import torch
2 | from torch import nn
3 |
4 |
5 | class BaseEmbedding(nn.Module):
6 |
7 | def get_loss(self):
8 | return None
9 |
10 | def forward(self, **kwargs):
11 | raise NotImplementedError
12 |
13 | def train(self, mode=True):
14 | self.training = mode
15 | if self.trainable and mode:
16 | super().train()
17 | return self
18 |
19 | def _set_trainable(self):
20 | if not self.trainable:
21 | for pn, p in self.named_parameters():
22 | p.requires_grad = False
23 | self.eval()
24 |
25 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/modeling/embeddings/class_embedding.py:
--------------------------------------------------------------------------------
1 | import torch
2 | import torch.nn as nn
3 | from .base_embedding import BaseEmbedding
4 |
5 | class ClassEmbedding(BaseEmbedding):
6 | def __init__(self,
7 | num_embed=1000,
8 | embed_dim=512,
9 | identity=False,
10 | trainable=True,
11 | ):
12 | super().__init__()
13 | self.identity = identity
14 | self.trainable = trainable
15 | self.num_embed = num_embed
16 | self.embed_dim = embed_dim
17 | if self.identity == False:
18 |
19 | self.emb = nn.Embedding(self.num_embed, embed_dim)
20 | self._set_trainable()
21 |
22 | def forward(self, index, **kwargs):
23 | """
24 | index: B x L, index
25 | mask: B x L, bool type. The value of False indicating padded index
26 | """
27 | if self.identity == True:
28 | return index
29 | else:
30 | emb = self.emb(index).unsqueeze(1)
31 | return emb
32 |
33 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/modeling/modules/clip/README.md:
--------------------------------------------------------------------------------
1 | https://github.com/openai/CLIP
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/modeling/modules/clip/__init__.py:
--------------------------------------------------------------------------------
1 | from .clip import *
2 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/modeling/modules/clip/bpe_simple_vocab_16e6.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/VQ-Diffusion-main/image_synthesis/modeling/modules/clip/bpe_simple_vocab_16e6.txt.gz
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/taming/lr_scheduler.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 |
4 | class LambdaWarmUpCosineScheduler:
5 | """
6 | note: use with a base_lr of 1.0
7 | """
8 | def __init__(self, warm_up_steps, lr_min, lr_max, lr_start, max_decay_steps, verbosity_interval=0):
9 | self.lr_warm_up_steps = warm_up_steps
10 | self.lr_start = lr_start
11 | self.lr_min = lr_min
12 | self.lr_max = lr_max
13 | self.lr_max_decay_steps = max_decay_steps
14 | self.last_lr = 0.
15 | self.verbosity_interval = verbosity_interval
16 |
17 | def schedule(self, n):
18 | if self.verbosity_interval > 0:
19 | if n % self.verbosity_interval == 0: print(f"current step: {n}, recent lr-multiplier: {self.last_lr}")
20 | if n < self.lr_warm_up_steps:
21 | lr = (self.lr_max - self.lr_start) / self.lr_warm_up_steps * n + self.lr_start
22 | self.last_lr = lr
23 | return lr
24 | else:
25 | t = (n - self.lr_warm_up_steps) / (self.lr_max_decay_steps - self.lr_warm_up_steps)
26 | t = min(t, 1.0)
27 | lr = self.lr_min + 0.5 * (self.lr_max - self.lr_min) * (
28 | 1 + np.cos(t * np.pi))
29 | self.last_lr = lr
30 | return lr
31 |
32 | def __call__(self, n):
33 | return self.schedule(n)
34 |
35 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/taming/modules/losses/__init__.py:
--------------------------------------------------------------------------------
1 | from image_synthesis.taming.modules.losses.vqperceptual import DummyLoss
2 |
3 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/taming/modules/losses/segmentation.py:
--------------------------------------------------------------------------------
1 | import torch.nn as nn
2 | import torch.nn.functional as F
3 |
4 |
5 | class BCELoss(nn.Module):
6 | def forward(self, prediction, target):
7 | loss = F.binary_cross_entropy_with_logits(prediction,target)
8 | return loss, {}
9 |
10 |
11 | class BCELossWithQuant(nn.Module):
12 | def __init__(self, codebook_weight=1.):
13 | super().__init__()
14 | self.codebook_weight = codebook_weight
15 |
16 | def forward(self, qloss, target, prediction, split):
17 | bce_loss = F.binary_cross_entropy_with_logits(prediction,target)
18 | loss = bce_loss + self.codebook_weight*qloss
19 | return loss, {"{}/total_loss".format(split): loss.clone().detach().mean(),
20 | "{}/bce_loss".format(split): bce_loss.detach().mean(),
21 | "{}/quant_loss".format(split): qloss.detach().mean()
22 | }
23 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/taming/modules/misc/coord.py:
--------------------------------------------------------------------------------
1 | import torch
2 |
3 | class CoordStage(object):
4 | def __init__(self, n_embed, down_factor):
5 | self.n_embed = n_embed
6 | self.down_factor = down_factor
7 |
8 | def eval(self):
9 | return self
10 |
11 | def encode(self, c):
12 | """fake vqmodel interface"""
13 | assert 0.0 <= c.min() and c.max() <= 1.0
14 | b,ch,h,w = c.shape
15 | assert ch == 1
16 |
17 | c = torch.nn.functional.interpolate(c, scale_factor=1/self.down_factor,
18 | mode="area")
19 | c = c.clamp(0.0, 1.0)
20 | c = self.n_embed*c
21 | c_quant = c.round()
22 | c_ind = c_quant.to(dtype=torch.long)
23 |
24 | info = None, None, c_ind
25 | return c_quant, None, info
26 |
27 | def decode(self, c):
28 | c = c/self.n_embed
29 | c = torch.nn.functional.interpolate(c, scale_factor=self.down_factor,
30 | mode="nearest")
31 | return c
32 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/image_synthesis/utils/io.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import yaml
3 | import torch
4 | import json
5 |
6 | def load_yaml_config(path):
7 | with open(path) as f:
8 | config = yaml.full_load(f)
9 | return config
10 |
11 |
12 | def save_config_to_yaml(config, path):
13 | assert path.endswith('.yaml')
14 | with open(path, 'w') as f:
15 | f.write(yaml.dump(config))
16 | f.close()
17 |
18 | def save_dict_to_json(d, path, indent=None):
19 | json.dump(d, open(path, 'w'), indent=indent)
20 |
21 |
22 | def load_dict_from_json(path):
23 | return json.load(open(path, 'r'))
24 |
25 |
26 | def write_args(args, path):
27 | args_dict = dict((name, getattr(args, name)) for name in dir(args)if not name.startswith('_'))
28 | with open(path, 'a') as args_file:
29 | args_file.write('==> torch version: {}\n'.format(torch.__version__))
30 | args_file.write('==> cudnn version: {}\n'.format(torch.backends.cudnn.version()))
31 | args_file.write('==> Cmd:\n')
32 | args_file.write(str(sys.argv))
33 | args_file.write('\n==> args:\n')
34 | for k, v in sorted(args_dict.items()):
35 | args_file.write(' %s: %s\n' % (str(k), str(v)))
36 | args_file.close()
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/install_req.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | pip install torch==1.9.0 torchvision --no-cache-dir -U | cat
3 | pip install omegaconf pytorch-lightning --no-cache-dir -U | cat
4 | pip install timm==0.3.4 --no-cache-dir -U | cat
5 | pip install tensorboard==1.15.0 --no-cache-dir -U | cat
6 | pip install lmdb tqdm --no-cache-dir -U | cat
7 | pip install einops ftfy --no-cache-dir -U | cat
8 | pip install git+https://github.com/openai/DALL-E.git --no-cache-dir -U | cat
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/running_command/run_train_coco.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | string = "python train.py --name coco_train --config_file configs/coco.yaml --num_node 1 --tensorboard --load_path OUTPUT/pretrained_model/CC_pretrained.pth"
4 |
5 | os.system(string)
6 |
7 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/running_command/run_train_cub.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | string = "python train.py --name cub200_train --config_file configs/cub200.yaml --num_node 1 --tensorboard --load_path OUTPUT/pretrained_model/CC_pretrained.pth"
4 |
5 | os.system(string)
6 |
7 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/running_command/run_train_ffhq.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | string = "python train.py --name ffhq_train --config_file configs/ffhq.yaml --num_node 1 --tensorboard"
4 |
5 | os.system(string)
6 |
7 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/running_command/run_train_imagenet.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | string = "python train.py --name imagenet_train --config_file configs/imagenet.yaml --num_node 1 --tensorboard"
4 |
5 | os.system(string)
6 |
7 |
--------------------------------------------------------------------------------
/generator_codes/VQ-Diffusion-main/running_command/run_tune_coco.py:
--------------------------------------------------------------------------------
1 | import os
2 |
3 | string = "python train.py --name coco_tune --config_file configs/coco_tune.yaml --num_node 1 --tensorboard --load_path OUTPUT/pretrained_model/COCO_pretrained.pth"
4 |
5 | os.system(string)
6 |
7 |
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/.gitignore:
--------------------------------------------------------------------------------
1 | __pycache__/
2 | *.egg-info/
3 | .DS_Store
4 |
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 OpenAI
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/README.md:
--------------------------------------------------------------------------------
1 | # GLIDE
2 |
3 | This is the official codebase for running the small, filtered-data GLIDE model from [GLIDE: Towards Photorealistic Image Generation and Editing with Text-Guided Diffusion Models](https://arxiv.org/abs/2112.10741).
4 |
5 | For details on the pre-trained models in this repository, see the [Model Card](model-card.md).
6 |
7 | # Usage
8 |
9 | To install this package, clone this repository and then run:
10 |
11 | ```
12 | pip install -e .
13 | ```
14 |
15 | For detailed usage examples, see the [notebooks](notebooks) directory.
16 |
17 | * The [text2im](notebooks/text2im.ipynb) [![][colab]][colab-text2im] notebook shows how to use GLIDE (filtered) with classifier-free guidance to produce images conditioned on text prompts.
18 | * The [inpaint](notebooks/inpaint.ipynb) [![][colab]][colab-inpaint] notebook shows how to use GLIDE (filtered) to fill in a masked region of an image, conditioned on a text prompt.
19 | * The [clip_guided](notebooks/clip_guided.ipynb) [![][colab]][colab-guided] notebook shows how to use GLIDE (filtered) + a filtered noise-aware CLIP model to produce images conditioned on text prompts.
20 |
21 | [colab]:
22 | [colab-text2im]:
23 | [colab-inpaint]:
24 | [colab-guided]:
25 |
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/glide_text2im/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | A codebase for performing model inference with a text-conditional diffusion model.
3 | """
4 |
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/glide_text2im/clip/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/glide-text2im-main/glide_text2im/clip/__init__.py
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/glide_text2im/clip/config.yaml:
--------------------------------------------------------------------------------
1 | logit_scale: 100.0
2 |
3 | # Diffusion settings
4 | beta_schedule: "squaredcos_cap_v2"
5 | n_timesteps: 1000
6 |
7 | # Architecture settings
8 | image_size: 64
9 | patch_size: 4
10 | n_vocab: 65536
11 | max_text_len: 77
12 | n_embd: 512
13 | n_head_state_text: 64
14 | n_head_text: 8
15 | n_xf_blocks_text: 12
16 | n_head_state_image: 64
17 | n_head_image: 12
18 | n_xf_blocks_image: 12
19 |
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/glide_text2im/fp16_util.py:
--------------------------------------------------------------------------------
1 | """
2 | Helpers to inference with 16-bit precision.
3 | """
4 |
5 | import torch.nn as nn
6 |
7 |
8 | def convert_module_to_f16(l):
9 | """
10 | Convert primitive modules to float16.
11 | """
12 | if isinstance(l, (nn.Conv1d, nn.Conv2d, nn.Conv3d)):
13 | l.weight.data = l.weight.data.half()
14 | if l.bias is not None:
15 | l.bias.data = l.bias.data.half()
16 |
17 |
18 | def convert_module_to_f32(l):
19 | """
20 | Convert primitive modules to float32, undoing convert_module_to_f16().
21 | """
22 | if isinstance(l, (nn.Conv1d, nn.Conv2d, nn.Conv3d)):
23 | l.weight.data = l.weight.data.float()
24 | if l.bias is not None:
25 | l.bias.data = l.bias.data.float()
26 |
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/glide_text2im/tokenizer/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/glide-text2im-main/glide_text2im/tokenizer/__init__.py
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/glide_text2im/tokenizer/bpe_simple_vocab_16e6.txt.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/glide-text2im-main/glide_text2im/tokenizer/bpe_simple_vocab_16e6.txt.gz
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/glide_text2im/tokenizer/encoder.json.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/glide-text2im-main/glide_text2im/tokenizer/encoder.json.gz
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/glide_text2im/tokenizer/vocab.bpe.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/glide-text2im-main/glide_text2im/tokenizer/vocab.bpe.gz
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/notebooks/grass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/glide-text2im-main/notebooks/grass.png
--------------------------------------------------------------------------------
/generator_codes/glide-text2im-main/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 |
3 | setup(
4 | name="glide-text2im",
5 | packages=[
6 | "glide_text2im",
7 | "glide_text2im.clip",
8 | "glide_text2im.tokenizer",
9 | ],
10 | package_data={
11 | "glide_text2im.tokenizer": [
12 | "bpe_simple_vocab_16e6.txt.gz",
13 | "encoder.json.gz",
14 | "vocab.bpe.gz",
15 | ],
16 | "glide_text2im.clip": ["config.yaml"],
17 | },
18 | install_requires=[
19 | "Pillow",
20 | "attrs",
21 | "torch",
22 | "filelock",
23 | "requests",
24 | "tqdm",
25 | "ftfy",
26 | "regex",
27 | "numpy",
28 | ],
29 | author="OpenAI",
30 | )
31 |
--------------------------------------------------------------------------------
/generator_codes/guided-diffusion-main/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | __pycache__/
3 | classify_image_graph_def.pb
4 |
--------------------------------------------------------------------------------
/generator_codes/guided-diffusion-main/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 OpenAI
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/generator_codes/guided-diffusion-main/evaluations/requirements.txt:
--------------------------------------------------------------------------------
1 | tensorflow-gpu>=2.0
2 | scipy
3 | requests
4 | tqdm
--------------------------------------------------------------------------------
/generator_codes/guided-diffusion-main/guided_diffusion/__init__.py:
--------------------------------------------------------------------------------
1 | """
2 | Codebase for "Improved Denoising Diffusion Probabilistic Models".
3 | """
4 |
--------------------------------------------------------------------------------
/generator_codes/guided-diffusion-main/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 |
3 | setup(
4 | name="guided-diffusion",
5 | py_modules=["guided_diffusion"],
6 | install_requires=["blobfile>=1.0.5", "torch", "tqdm"],
7 | )
8 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/a-painting-of-a-fire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/a-painting-of-a-fire.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/a-photograph-of-a-fire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/a-photograph-of-a-fire.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/a-shirt-with-a-fire-printed-on-it.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/a-shirt-with-a-fire-printed-on-it.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/a-shirt-with-the-inscription-'fire'.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/a-shirt-with-the-inscription-'fire'.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/a-watercolor-painting-of-a-fire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/a-watercolor-painting-of-a-fire.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/birdhouse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/birdhouse.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/fire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/fire.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/inpainting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/inpainting.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/modelfigure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/modelfigure.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/rdm-preview.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/rdm-preview.jpg
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/reconstruction1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/reconstruction1.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/reconstruction2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/reconstruction2.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/results.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/results.gif
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/rick.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/rick.jpeg
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/mountains-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/mountains-1.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/mountains-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/mountains-2.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/mountains-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/mountains-3.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/sketch-mountains-input.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/sketch-mountains-input.jpg
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/upscaling-in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/upscaling-in.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/upscaling-out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/img2img/upscaling-out.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/000002025.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/000002025.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/000002035.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/000002035.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/merged-0005.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/merged-0005.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/merged-0006.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/merged-0006.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/merged-0007.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/stable-samples/txt2img/merged-0007.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/the-earth-is-on-fire,-oil-on-canvas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/the-earth-is-on-fire,-oil-on-canvas.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/txt2img-convsample.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/txt2img-convsample.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/txt2img-preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/txt2img-preview.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/assets/v1-variants-scores.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/assets/v1-variants-scores.jpg
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/configs/autoencoder/autoencoder_kl_16x16x16.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-6
3 | target: ldm.models.autoencoder.AutoencoderKL
4 | params:
5 | monitor: "val/rec_loss"
6 | embed_dim: 16
7 | lossconfig:
8 | target: ldm.modules.losses.LPIPSWithDiscriminator
9 | params:
10 | disc_start: 50001
11 | kl_weight: 0.000001
12 | disc_weight: 0.5
13 |
14 | ddconfig:
15 | double_z: True
16 | z_channels: 16
17 | resolution: 256
18 | in_channels: 3
19 | out_ch: 3
20 | ch: 128
21 | ch_mult: [ 1,1,2,2,4] # num_down = len(ch_mult)-1
22 | num_res_blocks: 2
23 | attn_resolutions: [16]
24 | dropout: 0.0
25 |
26 |
27 | data:
28 | target: main.DataModuleFromConfig
29 | params:
30 | batch_size: 12
31 | wrap: True
32 | train:
33 | target: ldm.data.imagenet.ImageNetSRTrain
34 | params:
35 | size: 256
36 | degradation: pil_nearest
37 | validation:
38 | target: ldm.data.imagenet.ImageNetSRValidation
39 | params:
40 | size: 256
41 | degradation: pil_nearest
42 |
43 | lightning:
44 | callbacks:
45 | image_logger:
46 | target: main.ImageLogger
47 | params:
48 | batch_frequency: 1000
49 | max_images: 8
50 | increase_log_steps: True
51 |
52 | trainer:
53 | benchmark: True
54 | accumulate_grad_batches: 2
55 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/configs/autoencoder/autoencoder_kl_32x32x4.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-6
3 | target: ldm.models.autoencoder.AutoencoderKL
4 | params:
5 | monitor: "val/rec_loss"
6 | embed_dim: 4
7 | lossconfig:
8 | target: ldm.modules.losses.LPIPSWithDiscriminator
9 | params:
10 | disc_start: 50001
11 | kl_weight: 0.000001
12 | disc_weight: 0.5
13 |
14 | ddconfig:
15 | double_z: True
16 | z_channels: 4
17 | resolution: 256
18 | in_channels: 3
19 | out_ch: 3
20 | ch: 128
21 | ch_mult: [ 1,2,4,4 ] # num_down = len(ch_mult)-1
22 | num_res_blocks: 2
23 | attn_resolutions: [ ]
24 | dropout: 0.0
25 |
26 | data:
27 | target: main.DataModuleFromConfig
28 | params:
29 | batch_size: 12
30 | wrap: True
31 | train:
32 | target: ldm.data.imagenet.ImageNetSRTrain
33 | params:
34 | size: 256
35 | degradation: pil_nearest
36 | validation:
37 | target: ldm.data.imagenet.ImageNetSRValidation
38 | params:
39 | size: 256
40 | degradation: pil_nearest
41 |
42 | lightning:
43 | callbacks:
44 | image_logger:
45 | target: main.ImageLogger
46 | params:
47 | batch_frequency: 1000
48 | max_images: 8
49 | increase_log_steps: True
50 |
51 | trainer:
52 | benchmark: True
53 | accumulate_grad_batches: 2
54 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/configs/autoencoder/autoencoder_kl_64x64x3.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-6
3 | target: ldm.models.autoencoder.AutoencoderKL
4 | params:
5 | monitor: "val/rec_loss"
6 | embed_dim: 3
7 | lossconfig:
8 | target: ldm.modules.losses.LPIPSWithDiscriminator
9 | params:
10 | disc_start: 50001
11 | kl_weight: 0.000001
12 | disc_weight: 0.5
13 |
14 | ddconfig:
15 | double_z: True
16 | z_channels: 3
17 | resolution: 256
18 | in_channels: 3
19 | out_ch: 3
20 | ch: 128
21 | ch_mult: [ 1,2,4 ] # num_down = len(ch_mult)-1
22 | num_res_blocks: 2
23 | attn_resolutions: [ ]
24 | dropout: 0.0
25 |
26 |
27 | data:
28 | target: main.DataModuleFromConfig
29 | params:
30 | batch_size: 12
31 | wrap: True
32 | train:
33 | target: ldm.data.imagenet.ImageNetSRTrain
34 | params:
35 | size: 256
36 | degradation: pil_nearest
37 | validation:
38 | target: ldm.data.imagenet.ImageNetSRValidation
39 | params:
40 | size: 256
41 | degradation: pil_nearest
42 |
43 | lightning:
44 | callbacks:
45 | image_logger:
46 | target: main.ImageLogger
47 | params:
48 | batch_frequency: 1000
49 | max_images: 8
50 | increase_log_steps: True
51 |
52 | trainer:
53 | benchmark: True
54 | accumulate_grad_batches: 2
55 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/configs/autoencoder/autoencoder_kl_8x8x64.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-6
3 | target: ldm.models.autoencoder.AutoencoderKL
4 | params:
5 | monitor: "val/rec_loss"
6 | embed_dim: 64
7 | lossconfig:
8 | target: ldm.modules.losses.LPIPSWithDiscriminator
9 | params:
10 | disc_start: 50001
11 | kl_weight: 0.000001
12 | disc_weight: 0.5
13 |
14 | ddconfig:
15 | double_z: True
16 | z_channels: 64
17 | resolution: 256
18 | in_channels: 3
19 | out_ch: 3
20 | ch: 128
21 | ch_mult: [ 1,1,2,2,4,4] # num_down = len(ch_mult)-1
22 | num_res_blocks: 2
23 | attn_resolutions: [16,8]
24 | dropout: 0.0
25 |
26 | data:
27 | target: main.DataModuleFromConfig
28 | params:
29 | batch_size: 12
30 | wrap: True
31 | train:
32 | target: ldm.data.imagenet.ImageNetSRTrain
33 | params:
34 | size: 256
35 | degradation: pil_nearest
36 | validation:
37 | target: ldm.data.imagenet.ImageNetSRValidation
38 | params:
39 | size: 256
40 | degradation: pil_nearest
41 |
42 | lightning:
43 | callbacks:
44 | image_logger:
45 | target: main.ImageLogger
46 | params:
47 | batch_frequency: 1000
48 | max_images: 8
49 | increase_log_steps: True
50 |
51 | trainer:
52 | benchmark: True
53 | accumulate_grad_batches: 2
54 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/DejaVuSans.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/DejaVuSans.ttf
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/example_conditioning/superresolution/sample_0.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/example_conditioning/superresolution/sample_0.jpg
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/example_conditioning/text_conditional/sample_0.txt:
--------------------------------------------------------------------------------
1 | A basket of cerries
2 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/imagenet_train_hr_indices.p:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/imagenet_train_hr_indices.p
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/imagenet_val_hr_indices.p:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/imagenet_val_hr_indices.p
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/6458524847_2f4c361183_k.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/6458524847_2f4c361183_k.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/6458524847_2f4c361183_k_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/6458524847_2f4c361183_k_mask.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/8399166846_f6fb4e4b8e_k.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/8399166846_f6fb4e4b8e_k.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/8399166846_f6fb4e4b8e_k_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/8399166846_f6fb4e4b8e_k_mask.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/alex-iby-G_Pk4D9rMLs.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/alex-iby-G_Pk4D9rMLs.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/alex-iby-G_Pk4D9rMLs_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/alex-iby-G_Pk4D9rMLs_mask.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/bench2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/bench2.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/bench2_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/bench2_mask.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/bertrand-gabioud-CpuFzIsHYJ0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/bertrand-gabioud-CpuFzIsHYJ0.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/bertrand-gabioud-CpuFzIsHYJ0_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/bertrand-gabioud-CpuFzIsHYJ0_mask.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/billow926-12-Wc-Zgx6Y.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/billow926-12-Wc-Zgx6Y.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/billow926-12-Wc-Zgx6Y_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/billow926-12-Wc-Zgx6Y_mask.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/photo-1583445095369-9c651e7e5d34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/photo-1583445095369-9c651e7e5d34.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/data/inpainting_examples/photo-1583445095369-9c651e7e5d34_mask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/data/inpainting_examples/photo-1583445095369-9c651e7e5d34_mask.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/environment.yaml:
--------------------------------------------------------------------------------
1 | name: ldm
2 | channels:
3 | - pytorch
4 | - defaults
5 | dependencies:
6 | - python=3.8.5
7 | - pip=20.3
8 | - cudatoolkit=11.3
9 | - pytorch=1.11.0
10 | - torchvision=0.12.0
11 | - numpy=1.19.2
12 | - pip:
13 | - albumentations==0.4.3
14 | - diffusers
15 | - opencv-python==4.1.2.30
16 | - pudb==2019.2
17 | - invisible-watermark
18 | - imageio==2.9.0
19 | - imageio-ffmpeg==0.4.2
20 | - pytorch-lightning==1.4.2
21 | - omegaconf==2.1.1
22 | - test-tube>=0.7.5
23 | - streamlit>=0.73.1
24 | - einops==0.3.0
25 | - torch-fidelity==0.3.0
26 | - transformers==4.19.2
27 | - torchmetrics==0.6.0
28 | - kornia==0.6
29 | - -e git+https://github.com/CompVis/taming-transformers.git@master#egg=taming-transformers
30 | - -e git+https://github.com/openai/CLIP.git@main#egg=clip
31 | - -e .
32 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/data/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/ldm/data/__init__.py
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/data/base.py:
--------------------------------------------------------------------------------
1 | from abc import abstractmethod
2 | from torch.utils.data import Dataset, ConcatDataset, ChainDataset, IterableDataset
3 |
4 |
5 | class Txt2ImgIterableBaseDataset(IterableDataset):
6 | '''
7 | Define an interface to make the IterableDatasets for text2img data chainable
8 | '''
9 | def __init__(self, num_records=0, valid_ids=None, size=256):
10 | super().__init__()
11 | self.num_records = num_records
12 | self.valid_ids = valid_ids
13 | self.sample_ids = valid_ids
14 | self.size = size
15 |
16 | print(f'{self.__class__.__name__} dataset contains {self.__len__()} examples.')
17 |
18 | def __len__(self):
19 | return self.num_records
20 |
21 | @abstractmethod
22 | def __iter__(self):
23 | pass
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/models/diffusion/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/ldm/models/diffusion/__init__.py
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/models/diffusion/dpm_solver/__init__.py:
--------------------------------------------------------------------------------
1 | from .sampler import DPMSolverSampler
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/modules/diffusionmodules/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/ldm/modules/diffusionmodules/__init__.py
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/modules/distributions/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/ldm/modules/distributions/__init__.py
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/modules/encoders/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/ldm/modules/encoders/__init__.py
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/modules/image_degradation/__init__.py:
--------------------------------------------------------------------------------
1 | from ldm.modules.image_degradation.bsrgan import degradation_bsrgan_variant as degradation_fn_bsr
2 | from ldm.modules.image_degradation.bsrgan_light import degradation_bsrgan_variant as degradation_fn_bsr_light
3 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/modules/image_degradation/utils/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GenImage-Dataset/GenImage/746781bfa446619e1a4629726eb98d5e69c18240/generator_codes/stable-diffusion-main/ldm/modules/image_degradation/utils/test.png
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/ldm/modules/losses/__init__.py:
--------------------------------------------------------------------------------
1 | from ldm.modules.losses.contperceptual import LPIPSWithDiscriminator
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/kl-f16/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.AutoencoderKL
4 | params:
5 | monitor: val/rec_loss
6 | embed_dim: 16
7 | lossconfig:
8 | target: ldm.modules.losses.LPIPSWithDiscriminator
9 | params:
10 | disc_start: 50001
11 | kl_weight: 1.0e-06
12 | disc_weight: 0.5
13 | ddconfig:
14 | double_z: true
15 | z_channels: 16
16 | resolution: 256
17 | in_channels: 3
18 | out_ch: 3
19 | ch: 128
20 | ch_mult:
21 | - 1
22 | - 1
23 | - 2
24 | - 2
25 | - 4
26 | num_res_blocks: 2
27 | attn_resolutions:
28 | - 16
29 | dropout: 0.0
30 | data:
31 | target: main.DataModuleFromConfig
32 | params:
33 | batch_size: 6
34 | wrap: true
35 | train:
36 | target: ldm.data.openimages.FullOpenImagesTrain
37 | params:
38 | size: 384
39 | crop_size: 256
40 | validation:
41 | target: ldm.data.openimages.FullOpenImagesValidation
42 | params:
43 | size: 384
44 | crop_size: 256
45 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/kl-f32/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.AutoencoderKL
4 | params:
5 | monitor: val/rec_loss
6 | embed_dim: 64
7 | lossconfig:
8 | target: ldm.modules.losses.LPIPSWithDiscriminator
9 | params:
10 | disc_start: 50001
11 | kl_weight: 1.0e-06
12 | disc_weight: 0.5
13 | ddconfig:
14 | double_z: true
15 | z_channels: 64
16 | resolution: 256
17 | in_channels: 3
18 | out_ch: 3
19 | ch: 128
20 | ch_mult:
21 | - 1
22 | - 1
23 | - 2
24 | - 2
25 | - 4
26 | - 4
27 | num_res_blocks: 2
28 | attn_resolutions:
29 | - 16
30 | - 8
31 | dropout: 0.0
32 | data:
33 | target: main.DataModuleFromConfig
34 | params:
35 | batch_size: 6
36 | wrap: true
37 | train:
38 | target: ldm.data.openimages.FullOpenImagesTrain
39 | params:
40 | size: 384
41 | crop_size: 256
42 | validation:
43 | target: ldm.data.openimages.FullOpenImagesValidation
44 | params:
45 | size: 384
46 | crop_size: 256
47 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/kl-f4/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.AutoencoderKL
4 | params:
5 | monitor: val/rec_loss
6 | embed_dim: 3
7 | lossconfig:
8 | target: ldm.modules.losses.LPIPSWithDiscriminator
9 | params:
10 | disc_start: 50001
11 | kl_weight: 1.0e-06
12 | disc_weight: 0.5
13 | ddconfig:
14 | double_z: true
15 | z_channels: 3
16 | resolution: 256
17 | in_channels: 3
18 | out_ch: 3
19 | ch: 128
20 | ch_mult:
21 | - 1
22 | - 2
23 | - 4
24 | num_res_blocks: 2
25 | attn_resolutions: []
26 | dropout: 0.0
27 | data:
28 | target: main.DataModuleFromConfig
29 | params:
30 | batch_size: 10
31 | wrap: true
32 | train:
33 | target: ldm.data.openimages.FullOpenImagesTrain
34 | params:
35 | size: 384
36 | crop_size: 256
37 | validation:
38 | target: ldm.data.openimages.FullOpenImagesValidation
39 | params:
40 | size: 384
41 | crop_size: 256
42 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/kl-f8/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.AutoencoderKL
4 | params:
5 | monitor: val/rec_loss
6 | embed_dim: 4
7 | lossconfig:
8 | target: ldm.modules.losses.LPIPSWithDiscriminator
9 | params:
10 | disc_start: 50001
11 | kl_weight: 1.0e-06
12 | disc_weight: 0.5
13 | ddconfig:
14 | double_z: true
15 | z_channels: 4
16 | resolution: 256
17 | in_channels: 3
18 | out_ch: 3
19 | ch: 128
20 | ch_mult:
21 | - 1
22 | - 2
23 | - 4
24 | - 4
25 | num_res_blocks: 2
26 | attn_resolutions: []
27 | dropout: 0.0
28 | data:
29 | target: main.DataModuleFromConfig
30 | params:
31 | batch_size: 4
32 | wrap: true
33 | train:
34 | target: ldm.data.openimages.FullOpenImagesTrain
35 | params:
36 | size: 384
37 | crop_size: 256
38 | validation:
39 | target: ldm.data.openimages.FullOpenImagesValidation
40 | params:
41 | size: 384
42 | crop_size: 256
43 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/vq-f16/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.VQModel
4 | params:
5 | embed_dim: 8
6 | n_embed: 16384
7 | ddconfig:
8 | double_z: false
9 | z_channels: 8
10 | resolution: 256
11 | in_channels: 3
12 | out_ch: 3
13 | ch: 128
14 | ch_mult:
15 | - 1
16 | - 1
17 | - 2
18 | - 2
19 | - 4
20 | num_res_blocks: 2
21 | attn_resolutions:
22 | - 16
23 | dropout: 0.0
24 | lossconfig:
25 | target: taming.modules.losses.vqperceptual.VQLPIPSWithDiscriminator
26 | params:
27 | disc_conditional: false
28 | disc_in_channels: 3
29 | disc_start: 250001
30 | disc_weight: 0.75
31 | disc_num_layers: 2
32 | codebook_weight: 1.0
33 |
34 | data:
35 | target: main.DataModuleFromConfig
36 | params:
37 | batch_size: 14
38 | num_workers: 20
39 | wrap: true
40 | train:
41 | target: ldm.data.openimages.FullOpenImagesTrain
42 | params:
43 | size: 384
44 | crop_size: 256
45 | validation:
46 | target: ldm.data.openimages.FullOpenImagesValidation
47 | params:
48 | size: 384
49 | crop_size: 256
50 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/vq-f4-noattn/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.VQModel
4 | params:
5 | embed_dim: 3
6 | n_embed: 8192
7 | monitor: val/rec_loss
8 |
9 | ddconfig:
10 | attn_type: none
11 | double_z: false
12 | z_channels: 3
13 | resolution: 256
14 | in_channels: 3
15 | out_ch: 3
16 | ch: 128
17 | ch_mult:
18 | - 1
19 | - 2
20 | - 4
21 | num_res_blocks: 2
22 | attn_resolutions: []
23 | dropout: 0.0
24 | lossconfig:
25 | target: taming.modules.losses.vqperceptual.VQLPIPSWithDiscriminator
26 | params:
27 | disc_conditional: false
28 | disc_in_channels: 3
29 | disc_start: 11
30 | disc_weight: 0.75
31 | codebook_weight: 1.0
32 |
33 | data:
34 | target: main.DataModuleFromConfig
35 | params:
36 | batch_size: 8
37 | num_workers: 12
38 | wrap: true
39 | train:
40 | target: ldm.data.openimages.FullOpenImagesTrain
41 | params:
42 | crop_size: 256
43 | validation:
44 | target: ldm.data.openimages.FullOpenImagesValidation
45 | params:
46 | crop_size: 256
47 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/vq-f4/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.VQModel
4 | params:
5 | embed_dim: 3
6 | n_embed: 8192
7 | monitor: val/rec_loss
8 |
9 | ddconfig:
10 | double_z: false
11 | z_channels: 3
12 | resolution: 256
13 | in_channels: 3
14 | out_ch: 3
15 | ch: 128
16 | ch_mult:
17 | - 1
18 | - 2
19 | - 4
20 | num_res_blocks: 2
21 | attn_resolutions: []
22 | dropout: 0.0
23 | lossconfig:
24 | target: taming.modules.losses.vqperceptual.VQLPIPSWithDiscriminator
25 | params:
26 | disc_conditional: false
27 | disc_in_channels: 3
28 | disc_start: 0
29 | disc_weight: 0.75
30 | codebook_weight: 1.0
31 |
32 | data:
33 | target: main.DataModuleFromConfig
34 | params:
35 | batch_size: 8
36 | num_workers: 16
37 | wrap: true
38 | train:
39 | target: ldm.data.openimages.FullOpenImagesTrain
40 | params:
41 | crop_size: 256
42 | validation:
43 | target: ldm.data.openimages.FullOpenImagesValidation
44 | params:
45 | crop_size: 256
46 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/vq-f8-n256/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.VQModel
4 | params:
5 | embed_dim: 4
6 | n_embed: 256
7 | monitor: val/rec_loss
8 | ddconfig:
9 | double_z: false
10 | z_channels: 4
11 | resolution: 256
12 | in_channels: 3
13 | out_ch: 3
14 | ch: 128
15 | ch_mult:
16 | - 1
17 | - 2
18 | - 2
19 | - 4
20 | num_res_blocks: 2
21 | attn_resolutions:
22 | - 32
23 | dropout: 0.0
24 | lossconfig:
25 | target: taming.modules.losses.vqperceptual.VQLPIPSWithDiscriminator
26 | params:
27 | disc_conditional: false
28 | disc_in_channels: 3
29 | disc_start: 250001
30 | disc_weight: 0.75
31 | codebook_weight: 1.0
32 |
33 | data:
34 | target: main.DataModuleFromConfig
35 | params:
36 | batch_size: 10
37 | num_workers: 20
38 | wrap: true
39 | train:
40 | target: ldm.data.openimages.FullOpenImagesTrain
41 | params:
42 | size: 384
43 | crop_size: 256
44 | validation:
45 | target: ldm.data.openimages.FullOpenImagesValidation
46 | params:
47 | size: 384
48 | crop_size: 256
49 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/first_stage_models/vq-f8/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 4.5e-06
3 | target: ldm.models.autoencoder.VQModel
4 | params:
5 | embed_dim: 4
6 | n_embed: 16384
7 | monitor: val/rec_loss
8 | ddconfig:
9 | double_z: false
10 | z_channels: 4
11 | resolution: 256
12 | in_channels: 3
13 | out_ch: 3
14 | ch: 128
15 | ch_mult:
16 | - 1
17 | - 2
18 | - 2
19 | - 4
20 | num_res_blocks: 2
21 | attn_resolutions:
22 | - 32
23 | dropout: 0.0
24 | lossconfig:
25 | target: taming.modules.losses.vqperceptual.VQLPIPSWithDiscriminator
26 | params:
27 | disc_conditional: false
28 | disc_in_channels: 3
29 | disc_num_layers: 2
30 | disc_start: 1
31 | disc_weight: 0.6
32 | codebook_weight: 1.0
33 | data:
34 | target: main.DataModuleFromConfig
35 | params:
36 | batch_size: 10
37 | num_workers: 20
38 | wrap: true
39 | train:
40 | target: ldm.data.openimages.FullOpenImagesTrain
41 | params:
42 | size: 384
43 | crop_size: 256
44 | validation:
45 | target: ldm.data.openimages.FullOpenImagesValidation
46 | params:
47 | size: 384
48 | crop_size: 256
49 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/models/ldm/semantic_synthesis256/config.yaml:
--------------------------------------------------------------------------------
1 | model:
2 | base_learning_rate: 1.0e-06
3 | target: ldm.models.diffusion.ddpm.LatentDiffusion
4 | params:
5 | linear_start: 0.0015
6 | linear_end: 0.0205
7 | log_every_t: 100
8 | timesteps: 1000
9 | loss_type: l1
10 | first_stage_key: image
11 | cond_stage_key: segmentation
12 | image_size: 64
13 | channels: 3
14 | concat_mode: true
15 | cond_stage_trainable: true
16 | unet_config:
17 | target: ldm.modules.diffusionmodules.openaimodel.UNetModel
18 | params:
19 | image_size: 64
20 | in_channels: 6
21 | out_channels: 3
22 | model_channels: 128
23 | attention_resolutions:
24 | - 32
25 | - 16
26 | - 8
27 | num_res_blocks: 2
28 | channel_mult:
29 | - 1
30 | - 4
31 | - 8
32 | num_heads: 8
33 | first_stage_config:
34 | target: ldm.models.autoencoder.VQModelInterface
35 | params:
36 | embed_dim: 3
37 | n_embed: 8192
38 | ddconfig:
39 | double_z: false
40 | z_channels: 3
41 | resolution: 256
42 | in_channels: 3
43 | out_ch: 3
44 | ch: 128
45 | ch_mult:
46 | - 1
47 | - 2
48 | - 4
49 | num_res_blocks: 2
50 | attn_resolutions: []
51 | dropout: 0.0
52 | lossconfig:
53 | target: torch.nn.Identity
54 | cond_stage_config:
55 | target: ldm.modules.encoders.modules.SpatialRescaler
56 | params:
57 | n_stages: 2
58 | in_channels: 182
59 | out_channels: 3
60 |
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/scripts/download_first_stages.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | wget -O models/first_stage_models/kl-f4/model.zip https://ommer-lab.com/files/latent-diffusion/kl-f4.zip
3 | wget -O models/first_stage_models/kl-f8/model.zip https://ommer-lab.com/files/latent-diffusion/kl-f8.zip
4 | wget -O models/first_stage_models/kl-f16/model.zip https://ommer-lab.com/files/latent-diffusion/kl-f16.zip
5 | wget -O models/first_stage_models/kl-f32/model.zip https://ommer-lab.com/files/latent-diffusion/kl-f32.zip
6 | wget -O models/first_stage_models/vq-f4/model.zip https://ommer-lab.com/files/latent-diffusion/vq-f4.zip
7 | wget -O models/first_stage_models/vq-f4-noattn/model.zip https://ommer-lab.com/files/latent-diffusion/vq-f4-noattn.zip
8 | wget -O models/first_stage_models/vq-f8/model.zip https://ommer-lab.com/files/latent-diffusion/vq-f8.zip
9 | wget -O models/first_stage_models/vq-f8-n256/model.zip https://ommer-lab.com/files/latent-diffusion/vq-f8-n256.zip
10 | wget -O models/first_stage_models/vq-f16/model.zip https://ommer-lab.com/files/latent-diffusion/vq-f16.zip
11 |
12 |
13 |
14 | cd models/first_stage_models/kl-f4
15 | unzip -o model.zip
16 |
17 | cd ../kl-f8
18 | unzip -o model.zip
19 |
20 | cd ../kl-f16
21 | unzip -o model.zip
22 |
23 | cd ../kl-f32
24 | unzip -o model.zip
25 |
26 | cd ../vq-f4
27 | unzip -o model.zip
28 |
29 | cd ../vq-f4-noattn
30 | unzip -o model.zip
31 |
32 | cd ../vq-f8
33 | unzip -o model.zip
34 |
35 | cd ../vq-f8-n256
36 | unzip -o model.zip
37 |
38 | cd ../vq-f16
39 | unzip -o model.zip
40 |
41 | cd ../..
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/scripts/tests/test_watermark.py:
--------------------------------------------------------------------------------
1 | import cv2
2 | import fire
3 | from imwatermark import WatermarkDecoder
4 |
5 |
6 | def testit(img_path):
7 | bgr = cv2.imread(img_path)
8 | decoder = WatermarkDecoder('bytes', 136)
9 | watermark = decoder.decode(bgr, 'dwtDct')
10 | try:
11 | dec = watermark.decode('utf-8')
12 | except:
13 | dec = "null"
14 | print(dec)
15 |
16 |
17 | if __name__ == "__main__":
18 | fire.Fire(testit)
--------------------------------------------------------------------------------
/generator_codes/stable-diffusion-main/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup, find_packages
2 |
3 | setup(
4 | name='latent-diffusion',
5 | version='0.0.1',
6 | description='',
7 | packages=find_packages(),
8 | install_requires=[
9 | 'torch',
10 | 'numpy',
11 | 'tqdm',
12 | ],
13 | )
--------------------------------------------------------------------------------