• StyleGAN2-ADA (代码理解)


    official code:GitHub - NVlabs/stylegan2-ada-pytorch: StyleGAN2-ADA - Official PyTorch implementation

    运行过程中我出现了错误:

    1、subprocess.CalledProcessError:Command '['ninja','-v']' returned non-zero exit status 1.:

    配置stylegan2环境遇到的一些问题 - 知乎

    注意最后一步一定要安装Install Visual Studio 2019里面的C++,其他的都默认不要选

    2、训练时,卡在Setting up PyTorch plugin "filtered_lrelu_plugin"...不动时,删去C:\Users\ma_pe\AppData\Local\torch_extensions\torch_extensions\Cache\里的所有文件,并重新训练。

    如果遇到RuntimeError:shape ‘[X, X, X, X, X]‘ is invalid for input of size XX,将batch_size设置为2的n次方。

    3、页面文件太小,无法完成操作

    把workers改小一点就行了

    4、你需要修改VSCODE编译器的位置

    1. def _find_compiler_bindir():
    2. patterns = [
    3. 'C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64',
    4. ]
    5. for pattern in patterns:
    6. matches = sorted(glob.glob(pattern))
    7. if len(matches):
    8. return matches[-1]
    9. return None

    出现的问题:

    我在训练我自己的模型的时候出现了model collapse 问题(输出基本一样),然后我搜索相关的答案:

    1)、It's fairly simple: absolute collapse is when all the outputs are exactly the same, irrespective of the input z. If this happens, then there's no other option but to restart the training from zero. A more usual form of collapse is when there are several images being generated by G, but they don't really differ by much. For example, this issue in StyleGAN2-ADA. Note that there is diversity in color, so the key there was to continue training to see if the model could get out of the collapse and that's exactly what happened (this is not always the case, but it's good to try).

    我看答案说就是重新训练或者继续训练有可能会解决这个问题


    使用预训练模型生成图像:

    cifar10:

    python generate.py --outdir=out --seeds=0-35 --class=1 --network=pretrained/cifar10.pkl
    

    afhqcat:

    python generate.py --outdir=out --seeds=0-35 --class=1 --network=pretrained/afhqcat.pkl
    

    数据处理:

    python dataset_tool.py --source=data/downloads/afhq/train/cat --dest=data/datasets/afhqcat.zip
    可选操作:Scaled down 256x256 resolution.
    
    python dataset_tool.py --source=data/downloads/afhq/train/cat --dest=data/datasets/afhqcat1.zip --width=256 --height=256

    这里我来处理14万张 imageMol 图像为256*256:

    python dataset_tool.py --source=D:\pycharm_workspace\1\ImageMol\datasets\pretraining\data\224 --dest=data/datasets/molecular.zip --width=256 --height=256 --max-images=140000


    开始训练:

    python train.py --outdir=data/training-runs --data=data/datasets/cifar10.zip
    python train.py --outdir=data/training-runs --data=data/datasets/afhqcat.zip

    训练14万张分子图像: 

    python train.py --outdir=data/training-runs --data=data/datasets/molecular.zip

    option:是否断点续训?(resumes a previous training run.)

    • --resume=data/training-runs//network-snapshot-.pkl 
  • 相关阅读:
    定时自动刷新页面油猴脚本
    解密Lawnchair:打造个性化极致的Android桌面体验
    js实现购物车加减操作
    102-视频与网络应用篇-环境搭建
    那些年印象深刻的面试
    未来的趋势是什么?为什么说先进计算是未来的趋势?
    top-k问题详解——通过堆解决高频面试题
    Linux: linux常见操作指令
    2023年 DevOps 七大趋势
    Kubernetes(k8s)CNI(Calico)网络模型原理
  • 原文地址:https://blog.csdn.net/weixin_43135178/article/details/126584826