Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,71 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
---
|
4 |
+
|
5 |
+
Aesthetic6+, Aesthetic6.25+ & Aesthetic6.5+ prompts dataset for SiD-LSG training.
|
6 |
+
|
7 |
+
Filtered from dclure/laion-aesthetics-12m-umap.
|
8 |
+
|
9 |
+
All credits to the authors of SiD.
|
10 |
+
|
11 |
+
```python
|
12 |
+
from datasets import load_dataset
|
13 |
+
import os
|
14 |
+
|
15 |
+
dataset_dir = 'aesthetics'
|
16 |
+
|
17 |
+
# ds = load_dataset("parquet", data_dir=dataset_dir, split='train')
|
18 |
+
ds = load_dataset("aesthetics", data_files='train.parquet')
|
19 |
+
# ds = load_dataset(dataset_dir, data_files='train.parquet')
|
20 |
+
six_two_five_plus = []
|
21 |
+
six_five_plus = []
|
22 |
+
six_plus = []
|
23 |
+
|
24 |
+
ds = ds['train']
|
25 |
+
|
26 |
+
total = len(ds)
|
27 |
+
print(f'total {total} records need to be scanned')
|
28 |
+
percent = int(total / 100)
|
29 |
+
i = 0
|
30 |
+
|
31 |
+
for entry in ds:
|
32 |
+
six_plus.append(entry['TEXT'])
|
33 |
+
if entry['AESTHETIC_SCORE'] >= 6.25:
|
34 |
+
six_two_five_plus.append(entry['TEXT'])
|
35 |
+
if entry['AESTHETIC_SCORE'] >= 6.5:
|
36 |
+
six_five_plus.append(entry['TEXT'])
|
37 |
+
i += 1
|
38 |
+
if i % percent == 0:
|
39 |
+
print(f'scanned {i / percent}% data')
|
40 |
+
print(f'got {len(six_plus)} 6.0+, {len(six_two_five_plus)} 6.25+ and {len(six_five_plus)} 6.5+')
|
41 |
+
|
42 |
+
percent = int(len(six_plus) / 100)
|
43 |
+
i = 0
|
44 |
+
with open(os.path.join(dataset_dir, 'aesthetics_6_plus.txt'), 'wt') as f:
|
45 |
+
for row in six_plus:
|
46 |
+
i += 1
|
47 |
+
f.write(row + '\n')
|
48 |
+
if i % percent == 0:
|
49 |
+
print(f'generated {i / percent}% 6.0+ data to text file')
|
50 |
+
print(f'Generated {len(six_plus)} prompts for 6.0+ score')
|
51 |
+
|
52 |
+
percent = int(len(six_two_five_plus) / 100)
|
53 |
+
i = 0
|
54 |
+
with open(os.path.join(dataset_dir, 'aesthetics_625_plus.txt'), 'wt') as f:
|
55 |
+
for row in six_two_five_plus:
|
56 |
+
i += 1
|
57 |
+
f.write(row + '\n')
|
58 |
+
if i % percent == 0:
|
59 |
+
print(f'generated {i / percent}% 6.25+ data to text file')
|
60 |
+
print(f'Generated {len(six_two_five_plus)} prompts for 6.25+ score')
|
61 |
+
|
62 |
+
percent = int(len(six_five_plus) / 100)
|
63 |
+
i = 0
|
64 |
+
with open(os.path.join(dataset_dir, 'aesthetics_65_plus.txt'), 'wt') as f:
|
65 |
+
for row in six_five_plus:
|
66 |
+
i += 1
|
67 |
+
f.write(row + '\n')
|
68 |
+
if i % percent == 0:
|
69 |
+
print(f'generated {i / percent}% 6.5+ data to text file')
|
70 |
+
print(f'Generated {len(six_five_plus)} prompts for 6.5+ score')
|
71 |
+
```
|