前提
Google colabにてpythonを用いてStyleGANを実行しています。
今回の質問はエラーではありません。
実現したいこと
https://qiita.com/Phoeboooo/items/12d21916de56d125f0be
上記のサイトの
・潜在ベクトルを選ぶ
・画像生成
・生成画像を保存する
の項目にて、
複数の異なる画像を同時に生成し、保存したいと考えています。
該当のソースコード
潜在ベクトルを選ぶ
python
1# Pick latent vector. 2rnd = np.random.RandomState(200) 3latents = rnd.randn(1, Gs.input_shape[1])
画像の生成
python
1# Generate image. 2fmt = dict(func=tflib.convert_images_to_uint8, nchw_to_nhwc=True) 3images = Gs.run(latents, None, truncation_psi=0.7, randomize_noise=True, output_transform=fmt)
生成画像を保存する
python
1# Save image. 2os.makedirs(config.result_dir, exist_ok=True) 3png_filename = os.path.join(config.result_dir, 'example200.png') 4PIL.Image.fromarray(images[0], 'RGB').save(png_filename)
試したこと
潜在ベクトルの数値(本コードは200)をfor文にて変数を用いて行おうと思いましたが、
rndがIndentationErrorを起こしてしまいました。
python
1# Pick latent vector. 2for i in range(200,699) : 3rnd = np.random.RandomState(i) 4latents = rnd.randn(1, Gs.input_shape[1])
エラーメッセージ
File "<ipython-input-61-8ce0a78b2a57>", line 3 rnd = np.random.RandomState(i) ^ IndentationError: expected an indented block

回答1件
あなたの回答
tips
プレビュー