Unrecognized arguments using generate.py StyleGAN 2 ADA

375 views Asked by At

I have trained the ffqh1024 model of StyleGAN 2 ADA (link to their repo) with a custom mammograms dataset in Google Colab. My trained model .pkl file is ready on a drive folder and I want to generate images using that .pkl file. I tried:

!python generate.py --outdir='/content/drive/MyDrive/TFM/Generated' --trunc=1 --seeds=85,265,297,849 \ --network='/content/drive/MyDrive/TFM/colab-sg2-ada/stylegan2-ada/results/00025-ddsm-auto1-bg-resumecustom/network-snapshot-000096.pkl'

As recommended on the GitHub, but I get this error:

usage: generate.py [-h] {generate-images,truncation-traversal,generate-latent-walk,generate-neighbors,lerp-video} ... generate.py: error: unrecognized arguments: --outdir='/content/drive/MyDrive/TFM/Generated' --trunc=1 --seeds=85,265,297,849 --network='/content/drive/MyDrive/TFM/colab-sg2-ada/stylegan2-ada/results/00025-ddsm-auto1-bg-resumecustom/network-snapshot-000096.pkl'

Dont really know why generate.py doesnt recognize the arguments... I had to !pip install opensimplex in order to generate.py to run, don't know if it has something to do with the issue...

In the StyleGAN 2 ADA repo, there are examples of image generation with a trained model:

# Generate curated MetFaces images without truncation (Fig.10 left)
python generate.py --outdir=out --trunc=1 --seeds=85,265,297,849 \
    --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada/pretrained/metfaces.pkl

And this is the result of doing !python generate.py -h:

usage: generate.py [-h]
                   {generate-images,truncation-traversal,generate-latent-walk,generate-neighbors,lerp-video}
                   ...

Generate images using pretrained network pickle.

positional arguments:
  {generate-images,truncation-traversal,generate-latent-walk,generate-neighbors,lerp-video}
                        Sub-commands
    generate-images     Generate images
    truncation-traversal
                        Generate truncation walk
    generate-latent-walk
                        Generate latent walk
    generate-neighbors  Generate random neighbors of a seed
    lerp-video          Generate interpolation video (lerp) between random
                        vectors

optional arguments:
  -h, --help            show this help message and exit

examples:

  # Generate curated MetFaces images without truncation (Fig.10 left)
  python generate.py --outdir=out --trunc=1 --seeds=85,265,297,849 \
      --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada/pretrained/metfaces.pkl

  # Generate uncurated MetFaces images with truncation (Fig.12 upper left)
  python generate.py --outdir=out --trunc=0.7 --seeds=600-605 \
      --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada/pretrained/metfaces.pkl

  # Generate class conditional CIFAR-10 images (Fig.17 left, Car)
  python generate.py --outdir=out --trunc=1 --seeds=0-35 --class=1 \
      --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada/pretrained/cifar10.pkl

  # Render image from projected latent vector
  python generate.py --outdir=out --dlatents=out/dlatents.npz \
      --network=https://nvlabs-fi-cdn.nvidia.com/stylegan2-ada/pretrained/ffhq.pkl
1

There are 1 answers

0
Gass On

try to remove \ from the command line. I'm not sure it will work