您好,我在使用您的代码跑CK+数据集时,每次跑到最后一个批次就会报错说测试图片不存在
Opened this issue · 0 comments
FileNotFoundError Traceback (most recent call last)
in ()
105
106 if name == 'main':
--> 107 tf.app.run()
9 frames
/tensorflow-1.15.0/python3.6/tensorflow_core/python/platform/app.py in run(main, argv)
38 main = main or _sys.modules['main'].main
39
---> 40 _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
/usr/local/lib/python3.6/dist-packages/absl/app.py in run(main, argv, flags_parser)
297 callback()
298 try:
--> 299 _run_main(main, args)
300 except UsageError as error:
301 usage(shorthelp=True, detailed_error=error, exitcode=error.exitcode)
/usr/local/lib/python3.6/dist-packages/absl/app.py in _run_main(main, argv)
248 sys.exit(retval)
249 else:
--> 250 sys.exit(main(argv))
251
252
in main(_)
102 # Below is codes for visualization
103 OPTION = 1
--> 104 visualize(sess, dcgan, FLAGS, OPTION)
105
106 if name == 'main':
/content/drive/My Drive/Colab Notebooks/gan/DCGAN-mydataset/utils.py in visualize(sess, dcgan, config, option)
201 samples = sess.run(dcgan.sampler, feed_dict={dcgan.z: z_sample})
202
--> 203 save_images(samples, [image_frame_dim, image_frame_dim], './samples/test_arange_%s.png' % (idx))
204 elif option == 2:
205 values = np.arange(0, 1, 1./config.batch_size)
/content/drive/My Drive/Colab Notebooks/gan/DCGAN-mydataset/utils.py in save_images(images, size, image_path)
33
34 def save_images(images, size, image_path):
---> 35 return imsave(inverse_transform(images), size, image_path)
36
37 def imread(path, grayscale = False):
/content/drive/My Drive/Colab Notebooks/gan/DCGAN-mydataset/utils.py in imsave(images, size, path)
71 def imsave(images, size, path):
72 image = np.squeeze(merge(images, size))
---> 73 return scipy.misc.imsave(path, image)
74
75 def center_crop(x, crop_h, crop_w,
/usr/local/lib/python3.6/dist-packages/numpy/lib/utils.py in newfunc(*args, **kwds)
99 """arrayrange
is deprecated, use arange
instead!"""
100 warnings.warn(depdoc, DeprecationWarning, stacklevel=2)
--> 101 return func(*args, **kwds)
102
103 newfunc = _set_function_name(newfunc, old_name)
/usr/local/lib/python3.6/dist-packages/scipy/misc/pilutil.py in imsave(name, arr, format)
217 im = toimage(arr, channel_axis=2)
218 if format is None:
--> 219 im.save(name)
220 else:
221 im.save(name, format)
/usr/local/lib/python3.6/dist-packages/PIL/Image.py in save(self, fp, format, **params)
2097 fp = builtins.open(filename, "r+b")
2098 else:
-> 2099 fp = builtins.open(filename, "w+b")
2100
2101 try:
FileNotFoundError: [Errno 2] No such file or directory: './samples/test_arange_0.png'
我检查了util文件里的子函数,并未出错,这里我有点不明白为什么会出现这个错误,您能帮帮我吗?