File size: 2,271 Bytes
c979c0e
ee12b5c
 
c979c0e
 
 
1c2e5e8
 
 
 
 
c979c0e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
language:
- en
license: apache-2.0
---

download with 
```python
huggingface-cli download Yuanzhi/aesthetics_prompts_laion --repo-type=dataset --local-dir aesthetics
```

Aesthetic6+, Aesthetic6.25+ & Aesthetic6.5+ prompts dataset for SiD-LSG training.

Filtered from dclure/laion-aesthetics-12m-umap.

All credits to the authors of SiD.

```python
from datasets import load_dataset
import os

dataset_dir = 'aesthetics'

# ds = load_dataset("parquet", data_dir=dataset_dir, split='train')
ds = load_dataset("aesthetics", data_files='train.parquet')
# ds = load_dataset(dataset_dir, data_files='train.parquet')
six_two_five_plus = []
six_five_plus = []
six_plus = []

ds = ds['train']

total = len(ds)
print(f'total {total} records need to be scanned')
percent = int(total / 100)
i = 0

for entry in ds:
    six_plus.append(entry['TEXT'])
    if entry['AESTHETIC_SCORE'] >= 6.25:
        six_two_five_plus.append(entry['TEXT'])
    if entry['AESTHETIC_SCORE'] >= 6.5:
        six_five_plus.append(entry['TEXT'])
    i += 1
    if i % percent == 0:
        print(f'scanned {i / percent}% data')
print(f'got {len(six_plus)} 6.0+, {len(six_two_five_plus)} 6.25+ and {len(six_five_plus)} 6.5+')

percent = int(len(six_plus) / 100)
i = 0
with open(os.path.join(dataset_dir, 'aesthetics_6_plus.txt'), 'wt') as f:
    for row in six_plus:
        i += 1
        f.write(row + '\n')
        if i % percent == 0:
            print(f'generated {i / percent}% 6.0+ data to text file')
print(f'Generated {len(six_plus)} prompts for 6.0+ score')

percent = int(len(six_two_five_plus) / 100)
i = 0
with open(os.path.join(dataset_dir, 'aesthetics_625_plus.txt'), 'wt') as f:
    for row in six_two_five_plus:
        i += 1
        f.write(row + '\n')
        if i % percent == 0:
            print(f'generated {i / percent}% 6.25+ data to text file')
print(f'Generated {len(six_two_five_plus)} prompts for 6.25+ score')

percent = int(len(six_five_plus) / 100)
i = 0
with open(os.path.join(dataset_dir, 'aesthetics_65_plus.txt'), 'wt') as f:
    for row in six_five_plus:
        i += 1
        f.write(row + '\n')
        if i % percent == 0:
            print(f'generated {i / percent}% 6.5+ data to text file')
print(f'Generated {len(six_five_plus)} prompts for 6.5+ score')
```