Kohaku-Blueleaf
commited on
Commit
β’
974865b
1
Parent(s):
471f3ab
more formats
Browse files- .gitattributes +2 -0
- README.md +26 -11
- danbooru2023-no-index.db +3 -0
- danbooru2023.duckdb +3 -0
- danbooru2023-tags.parquet β others/danbooru2023-tags.parquet +0 -0
- parquet/localpost.parquet +3 -0
- parquet/post.parquet +3 -0
- parquet/posttagrelation.parquet +3 -0
- parquet/tag.parquet +3 -0
- create_db.py β src/create_db.py +0 -0
- create_fts.py β src/create_fts.py +0 -0
- db.py β src/db.py +0 -0
- db_utils.py β src/db_utils.py +0 -0
- profiling.py β src/profiling.py +0 -0
- write_csv.py β src/write_csv.py +0 -0
.gitattributes
CHANGED
@@ -54,3 +54,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
danbooru2023.db filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
54 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
55 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
56 |
danbooru2023.db filter=lfs diff=lfs merge=lfs -text
|
57 |
+
*.db filter=lfs diff=lfs merge=lfs -text
|
58 |
+
*.duckdb filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -6,23 +6,38 @@ task_categories:
|
|
6 |
language:
|
7 |
- en
|
8 |
---
|
9 |
-
|
10 |
# Metadata Database for Danbooru2023
|
|
|
11 |
Danbooru 2023 datasets: https://huggingface.co/datasets/nyanko7/danbooru2023
|
12 |
|
13 |
The latest entry of this database is id 7,866,491. Which is newer than nyanko7's dataset.
|
14 |
|
15 |
-
This dataset contains a sqlite db file which have all the tags and posts metadata in it
|
16 |
The Peewee ORM config file is provided too, plz check it for more information. (Especially on how I link posts and tags together)
|
17 |
|
18 |
-
The original data is from the official dump of the posts info
|
19 |
Check this [link](https://console.cloud.google.com/storage/browser/danbooru_public/data) for more info.
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
|
22 |
## Details
|
|
|
23 |
This section contains some details that you need to be aware of if you want to use other ORM system or use plain SQL query to utilize this database.
|
24 |
|
25 |
#### Custom Enum Fields
|
|
|
26 |
Some fields in Post/Tags use my custom enum field to store type/category or something like that:
|
27 |
|
28 |
* Post.rating
|
@@ -38,23 +53,23 @@ Some fields in Post/Tags use my custom enum field to store type/category or some
|
|
38 |
* 4: meta
|
39 |
|
40 |
#### Tag List
|
41 |
-
|
42 |
-
|
|
|
43 |
The con of this design is the database file will be 1.5x larger than before(we have 0.25B entries for the post-tag pairs), but the query speed become 2~3x faster, so I think it is acceptable.
|
44 |
|
45 |
After done some checking, I can ensure that all the "categorical tag list" can be done by full list + filter, and that is how I done it now. Check the db.py for more details.
|
46 |
|
47 |
-
|
48 |
#### Utils
|
|
|
49 |
if you think above details are too complicated, just use the db_utils.py and other PeeWee API to utilize this database.
|
50 |
I also provide a write_csv.py for exporting whole dataset into csv for data analysis.
|
51 |
|
52 |
-
|
53 |
## License
|
54 |
-
The source code, database file of this repo is licensed under MiT License.<br>
|
55 |
-
**Notice**: The license doesn't cover the "content" of the database.<br>
|
56 |
-
All the content is from official danbooru dumps for posts' meta.
|
57 |
|
|
|
|
|
58 |
|
59 |
## Acknowledgement
|
60 |
-
|
|
|
|
6 |
language:
|
7 |
- en
|
8 |
---
|
|
|
9 |
# Metadata Database for Danbooru2023
|
10 |
+
|
11 |
Danbooru 2023 datasets: https://huggingface.co/datasets/nyanko7/danbooru2023
|
12 |
|
13 |
The latest entry of this database is id 7,866,491. Which is newer than nyanko7's dataset.
|
14 |
|
15 |
+
This dataset contains a sqlite db file which have all the tags and posts metadata in it.`<br>`
|
16 |
The Peewee ORM config file is provided too, plz check it for more information. (Especially on how I link posts and tags together)
|
17 |
|
18 |
+
The original data is from the official dump of the posts info.`<br>`
|
19 |
Check this [link](https://console.cloud.google.com/storage/browser/danbooru_public/data) for more info.
|
20 |
|
21 |
+
## Format
|
22 |
+
|
23 |
+
This dataset contains 3 format but they store same contents:
|
24 |
+
|
25 |
+
* Sqlite (.db)
|
26 |
+
* have 2 versions: with/without index.
|
27 |
+
* Parquet
|
28 |
+
* Parquet files' name indicate the sqlite/duckdb table name.
|
29 |
+
* It is recommended to use post.parquet when you need to export tons of content.
|
30 |
+
* Duckdb (.duckdb)
|
31 |
+
* Although duckdb support index, provided duckdb file doesn't have index in it.
|
32 |
+
|
33 |
+
`others` folder will contains some pre-exported files like tags for each post.
|
34 |
|
35 |
## Details
|
36 |
+
|
37 |
This section contains some details that you need to be aware of if you want to use other ORM system or use plain SQL query to utilize this database.
|
38 |
|
39 |
#### Custom Enum Fields
|
40 |
+
|
41 |
Some fields in Post/Tags use my custom enum field to store type/category or something like that:
|
42 |
|
43 |
* Post.rating
|
|
|
53 |
* 4: meta
|
54 |
|
55 |
#### Tag List
|
56 |
+
|
57 |
+
I use peewee ManyToManyField to implement the Tag List things. Which utilize a through model which have all the pair of Tag and Post`<br>`
|
58 |
+
Since it is very likely we will want to use Tag to query posts, so many-to-many is better.`<br>`
|
59 |
The con of this design is the database file will be 1.5x larger than before(we have 0.25B entries for the post-tag pairs), but the query speed become 2~3x faster, so I think it is acceptable.
|
60 |
|
61 |
After done some checking, I can ensure that all the "categorical tag list" can be done by full list + filter, and that is how I done it now. Check the db.py for more details.
|
62 |
|
|
|
63 |
#### Utils
|
64 |
+
|
65 |
if you think above details are too complicated, just use the db_utils.py and other PeeWee API to utilize this database.
|
66 |
I also provide a write_csv.py for exporting whole dataset into csv for data analysis.
|
67 |
|
|
|
68 |
## License
|
|
|
|
|
|
|
69 |
|
70 |
+
The database files of this repo are licensed under MiT License.<br>
|
71 |
+
The source code files of this repo are licensed under Apache 2.0 License.
|
72 |
|
73 |
## Acknowledgement
|
74 |
+
|
75 |
+
Thx for AngelBottomless for updating new entries
|
danbooru2023-no-index.db
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0e305cd2268612c10250ed33cee7ca26bcc26dd85b598fd01da67b0976b20eba
|
3 |
+
size 7939006464
|
danbooru2023.duckdb
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:812182b1918167cc655161b962d1beb0e3f6e3bbd0b02e60f91d7bf0ea91b339
|
3 |
+
size 2093494272
|
danbooru2023-tags.parquet β others/danbooru2023-tags.parquet
RENAMED
File without changes
|
parquet/localpost.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7b09037fc46c54f79714136168b0d071832ce9625ec6b66568d80f983d808e3e
|
3 |
+
size 2811
|
parquet/post.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:8b6c71139f38947d567661a35d9e8e359b97f13d987fcadee6ac63f6174bf19d
|
3 |
+
size 1690843870
|
parquet/posttagrelation.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ea5f4f78527522bdce9473259199716318f3b7f76a6c1ca2a691f2a216084079
|
3 |
+
size 1775791143
|
parquet/tag.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:df74581905904783dae472d947b586da07996278a96dec1a748c6d08b0611ccb
|
3 |
+
size 14039684
|
create_db.py β src/create_db.py
RENAMED
File without changes
|
create_fts.py β src/create_fts.py
RENAMED
File without changes
|
db.py β src/db.py
RENAMED
File without changes
|
db_utils.py β src/db_utils.py
RENAMED
File without changes
|
profiling.py β src/profiling.py
RENAMED
File without changes
|
write_csv.py β src/write_csv.py
RENAMED
File without changes
|