lsun
lsun copied to clipboard
Failed to export Image
In my folder: bedroom_val, there are data.mdb and lock.mdb.
Then I use
export_images('./bedroom_val', './data',True)
result:
Traceback (most recent call last):
File "/Users/pegasus/Downloads/lsun-master/data.py", line 90, in <module>
export_images('./bedroom_val', './data',True)
File "/Users/pegasus/Downloads/lsun-master/data.py", line 48, in export_images
image_out_path = join(image_out_dir, key + '.webp')
TypeError: can't concat str to bytes
Then i added key.decode() where
image_out_path = join(image_out_dir, key.decode() + '.webp')
However, there still has an error:
Traceback (most recent call last):
File "/Users/pegasus/Downloads/lsun-master/data.py", line 90, in <module>
export_images('./bedroom_val', './data',True)
File "/Users/pegasus/Downloads/lsun-master/data.py", line 50, in export_images
fp.write(val)
TypeError: write() argument must be str, not bytes
I don't know how to fix this problem where
with open(image_out_path, 'w') as fp:
fp.write(val)
same problem, waiting for the solution
The output file needs to be written in binary mode. Try changing line 48 from
with open(image_out_path, 'w') as fp:
to
with open(image_out_path, 'wb') as fp:
Hope it helps you.
@tlvu2697 do you know how to convert it to jpg?
Show in https://github.com/fyu/lsun/issues/11#issuecomment-567390245.
Fixed in this PR.