我不断收到 StyleGAN 的断言错误
I keep getting an Assertion Error with StyleGAN
最近我一直在玩弄 StyleGAN 并生成了一个数据集,但是当我尝试 运行 train.py.
时得到以下信息
2020-01-08 13:33:21.943217: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:34: The name tf.Dimension is deprecated. Please use tf.compat.v1.Dimension instead.
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:74: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:128: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
Creating the run dir: results[=10=]003-sgan-datasets-1gpu
Copying files to the run dir
dnnlib: Running training.training_loop.training_loop() on localhost...
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:97: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:109: The name tf.set_random_seed is deprecated. Please use tf.compat.v1.set_random_seed instead.
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:132: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.
2020-01-08 13:33:23.904828: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-01-08 13:33:23.913674: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-01-08 13:33:23.945149: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1660 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:01:00.0
2020-01-08 13:33:23.951080: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2020-01-08 13:33:23.957540: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2020-01-08 13:33:23.964398: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_100.dll
2020-01-08 13:33:23.968829: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_100.dll
2020-01-08 13:33:23.975979: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_100.dll
2020-01-08 13:33:23.983341: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_100.dll
2020-01-08 13:33:23.997908: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-01-08 13:33:24.002421: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-01-08 13:33:24.657141: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-01-08 13:33:24.661322: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165] 0
2020-01-08 13:33:24.663568: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0: N
2020-01-08 13:33:24.667420: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4627 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5)
Streaming data using training.dataset.TFRecordDataset...
Traceback (most recent call last):
File "train.py", line 190, in <module>
main()
File "train.py", line 185, in main
dnnlib.submit_run(**kwargs)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\submission\submit.py", line 290, in submit_run
run_wrapper(submit_config)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\submission\submit.py", line 242, in run_wrapper
util.call_func_by_name(func_name=submit_config.run_func_name, submit_config=submit_config, **submit_config.run_func_kwargs)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\util.py", line 257, in call_func_by_name
return func_obj(*args, **kwargs)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\training_loop.py", line 146, in training_loop
training_set = dataset.load_dataset(data_dir=config.data_dir, verbose=True, **dataset_args)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\dataset.py", line 234, in load_dataset
dataset = dnnlib.util.get_obj_by_name(class_name)(**adjusted_kwargs)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\dataset.py", line 70, in __init__
assert os.path.isdir(self.tfrecord_dir)
AssertionError
我对 StyleGAN 还很陌生,任何建议都会有所帮助。
我已经修改了 Train.py 文件以适应我的单个 GPU 和数据集目录。
正如@Chrispresso 在此问题的评论中所回答的,我在下一行中引用的目录无效,必须将其设置为有效目录。
# Dataset.
desc += '-dataset'; dataset = EasyDict(tfrecord_dir='dataset', resolution=128); train.mirror_augment = False
(这是包含在 StyleGAN 中的 train.py 的第 36 行)
如果其他人遇到此问题,请确保您的数据集位于名为 datasets 的目录中。
这个问题说明你的数据集地址不正确。
为您的数据集提供正确的路径。
最近我一直在玩弄 StyleGAN 并生成了一个数据集,但是当我尝试 运行 train.py.
时得到以下信息2020-01-08 13:33:21.943217: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:34: The name tf.Dimension is deprecated. Please use tf.compat.v1.Dimension instead.
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:74: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:128: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
Creating the run dir: results[=10=]003-sgan-datasets-1gpu
Copying files to the run dir
dnnlib: Running training.training_loop.training_loop() on localhost...
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:97: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:109: The name tf.set_random_seed is deprecated. Please use tf.compat.v1.set_random_seed instead.
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:132: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.
2020-01-08 13:33:23.904828: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-01-08 13:33:23.913674: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-01-08 13:33:23.945149: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1660 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:01:00.0
2020-01-08 13:33:23.951080: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2020-01-08 13:33:23.957540: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2020-01-08 13:33:23.964398: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_100.dll
2020-01-08 13:33:23.968829: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_100.dll
2020-01-08 13:33:23.975979: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_100.dll
2020-01-08 13:33:23.983341: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_100.dll
2020-01-08 13:33:23.997908: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-01-08 13:33:24.002421: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-01-08 13:33:24.657141: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-01-08 13:33:24.661322: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165] 0
2020-01-08 13:33:24.663568: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0: N
2020-01-08 13:33:24.667420: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4627 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5)
Streaming data using training.dataset.TFRecordDataset...
Traceback (most recent call last):
File "train.py", line 190, in <module>
main()
File "train.py", line 185, in main
dnnlib.submit_run(**kwargs)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\submission\submit.py", line 290, in submit_run
run_wrapper(submit_config)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\submission\submit.py", line 242, in run_wrapper
util.call_func_by_name(func_name=submit_config.run_func_name, submit_config=submit_config, **submit_config.run_func_kwargs)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\util.py", line 257, in call_func_by_name
return func_obj(*args, **kwargs)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\training_loop.py", line 146, in training_loop
training_set = dataset.load_dataset(data_dir=config.data_dir, verbose=True, **dataset_args)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\dataset.py", line 234, in load_dataset
dataset = dnnlib.util.get_obj_by_name(class_name)(**adjusted_kwargs)
File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\dataset.py", line 70, in __init__
assert os.path.isdir(self.tfrecord_dir)
AssertionError
我对 StyleGAN 还很陌生,任何建议都会有所帮助。 我已经修改了 Train.py 文件以适应我的单个 GPU 和数据集目录。
正如@Chrispresso 在此问题的评论中所回答的,我在下一行中引用的目录无效,必须将其设置为有效目录。
# Dataset.
desc += '-dataset'; dataset = EasyDict(tfrecord_dir='dataset', resolution=128); train.mirror_augment = False
(这是包含在 StyleGAN 中的 train.py 的第 36 行)
如果其他人遇到此问题,请确保您的数据集位于名为 datasets 的目录中。
这个问题说明你的数据集地址不正确。 为您的数据集提供正确的路径。