write laion examples

This commit is contained in:
Patrick Esser 2022-07-23 09:29:31 +00:00
parent e80471a2cd
commit 3e40515427
1 changed files with 4 additions and 0 deletions

View File

@ -347,6 +347,7 @@ def example03():
dataset = (dataset
.select(filter_keys)
.decode('pil', handler=wds.warn_and_continue))
n_save = 20
n_total = 0
n_large = 0
n_large_nowm = 0
@ -356,6 +357,9 @@ def example03():
n_large += 1
if filter_watermark(example):
n_large_nowm += 1
if n_large_nowm < n_save+1:
image = example["jpg"]
image.save(os.path.join("tmp", f"{n_large_nowm-1:06}.png"))
if i%500 == 0:
print(i)