pxovela commited on
Commit
ad73752
1 Parent(s): d8ad9ff

Uploading Files used for generating wd14 tags

Browse files
Vodka_v3_tagger/analyzing tags.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
Vodka_v3_tagger/convnextv2_v2_selected_tags.csv ADDED
The diff for this file is too large to render. See raw diff
 
Vodka_v3_tagger/exclude_tags.csv ADDED
The diff for this file is too large to render. See raw diff
 
Vodka_v3_tagger/fox_tagger.ipynb ADDED
@@ -0,0 +1,1614 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 41,
6
+ "id": "761173b3",
7
+ "metadata": {},
8
+ "outputs": [],
9
+ "source": [
10
+ "#import libraries\n",
11
+ "\n",
12
+ "import argparse\n",
13
+ "import json\n",
14
+ "import logging\n",
15
+ "from dataclasses import asdict, dataclass\n",
16
+ "from os import PathLike, getenv\n",
17
+ "from pathlib import Path\n",
18
+ "from typing import Any, Dict, List, Optional, Tuple\n",
19
+ "\n",
20
+ "import numpy as np\n",
21
+ "import onnxruntime as rt\n",
22
+ "from huggingface_hub import snapshot_download\n",
23
+ "from pandas import read_csv\n",
24
+ "from PIL import Image\n",
25
+ "from torch.utils.data import DataLoader, Dataset\n",
26
+ "from tqdm.auto import tqdm\n",
27
+ "import csv \n",
28
+ "import pandas as pd"
29
+ ]
30
+ },
31
+ {
32
+ "cell_type": "code",
33
+ "execution_count": 42,
34
+ "id": "ffc17b6b",
35
+ "metadata": {},
36
+ "outputs": [],
37
+ "source": [
38
+ "# allowed extensions\n",
39
+ "IMAGE_EXTENSIONS = [\".jpg\", \".jpeg\", \".png\", \".gif\", \".webp\", \".bmp\", \".tiff\", \".tif\"]"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type": "code",
44
+ "execution_count": 43,
45
+ "id": "d289afd3",
46
+ "metadata": {},
47
+ "outputs": [],
48
+ "source": [
49
+ "# model input shape\n",
50
+ "IMAGE_SIZE = 448"
51
+ ]
52
+ },
53
+ {
54
+ "cell_type": "code",
55
+ "execution_count": 44,
56
+ "id": "465fcb74",
57
+ "metadata": {},
58
+ "outputs": [],
59
+ "source": [
60
+ "# hf hub insists on putting things in the cache dir then hardlinking and unlinking\n",
61
+ "# which breaks across mount points, so we override it here unless an explicit path is given in args\n",
62
+ "HF_HOME = getenv(\"HF_HOME\", Path.cwd().joinpath(\".cache\"))\n",
63
+ "CACHE_DIR = HF_HOME.joinpath(\"huggingface_hub\")"
64
+ ]
65
+ },
66
+ {
67
+ "cell_type": "code",
68
+ "execution_count": 45,
69
+ "id": "4734bb95",
70
+ "metadata": {},
71
+ "outputs": [],
72
+ "source": [
73
+ "class DictJsonMixin:\n",
74
+ " def asdict(self, *args, **kwargs) -> Dict[str, Any]:\n",
75
+ " return asdict(self, *args, **kwargs)\n",
76
+ "\n",
77
+ " def asjson(self, *args, **kwargs):\n",
78
+ " return json.dumps(asdict(self, *args, **kwargs))"
79
+ ]
80
+ },
81
+ {
82
+ "cell_type": "code",
83
+ "execution_count": 46,
84
+ "id": "fb1d91b2",
85
+ "metadata": {},
86
+ "outputs": [],
87
+ "source": [
88
+ "@dataclass\n",
89
+ "class LabelData(DictJsonMixin):\n",
90
+ " \"\"\"\n",
91
+ " A class that represents label data.\n",
92
+ " \"\"\"\n",
93
+ " names: List[str]\n",
94
+ " rating: List[np.int64]\n",
95
+ " general: List[np.int64]\n",
96
+ " character: List[np.int64]"
97
+ ]
98
+ },
99
+ {
100
+ "cell_type": "code",
101
+ "execution_count": 47,
102
+ "id": "3b7bd9e9",
103
+ "metadata": {},
104
+ "outputs": [],
105
+ "source": [
106
+ "@dataclass\n",
107
+ "class ImageLabels(DictJsonMixin):\n",
108
+ " \"\"\"\n",
109
+ " A class that represents image labels.\n",
110
+ " \"\"\"\n",
111
+ " caption: str\n",
112
+ " booru: str\n",
113
+ " rating: str\n",
114
+ " general: Dict[str, float]\n",
115
+ " character: Dict[str, float]\n",
116
+ " ratings: Dict[str, float]"
117
+ ]
118
+ },
119
+ {
120
+ "cell_type": "code",
121
+ "execution_count": 48,
122
+ "id": "1a40cc56",
123
+ "metadata": {},
124
+ "outputs": [],
125
+ "source": [
126
+ "logging.basicConfig(level=logging.INFO)\n",
127
+ "\n",
128
+ "logger = logging.getLogger(__name__)\n",
129
+ "logger.setLevel(logging.INFO)"
130
+ ]
131
+ },
132
+ {
133
+ "cell_type": "code",
134
+ "execution_count": 49,
135
+ "id": "59cbbf48",
136
+ "metadata": {},
137
+ "outputs": [],
138
+ "source": [
139
+ "def get_model_repo(base_model: str = \"convnextv2\") -> str:\n",
140
+ " return f\"SmilingWolf/wd-v1-4-{base_model}-tagger-v2\""
141
+ ]
142
+ },
143
+ {
144
+ "cell_type": "code",
145
+ "execution_count": 50,
146
+ "id": "5518fa1b",
147
+ "metadata": {},
148
+ "outputs": [],
149
+ "source": [
150
+ "def collate_fn_remove_corrupted(batch):\n",
151
+ " \"\"\"Collate function that allows to remove corrupted examples in the\n",
152
+ " dataloader. It expects that the dataloader returns 'None' when that occurs.\n",
153
+ " The 'None's in the batch are removed.\n",
154
+ " \"\"\"\n",
155
+ " # Filter out all the Nones (corrupted examples)\n",
156
+ " return [x for x in batch if x is not None]"
157
+ ]
158
+ },
159
+ {
160
+ "cell_type": "code",
161
+ "execution_count": 51,
162
+ "id": "8481068c",
163
+ "metadata": {},
164
+ "outputs": [],
165
+ "source": [
166
+ "def load_labels(model_path: Path) -> LabelData:\n",
167
+ " path = model_path.joinpath(\"selected_tags.csv\")\n",
168
+ " df = read_csv(path)\n",
169
+ "\n",
170
+ " tag_data = LabelData(\n",
171
+ " names=df[\"name\"].tolist(),\n",
172
+ " rating=list(np.where(df[\"category\"] == 9)[0]),\n",
173
+ " general=list(np.where(df[\"category\"] == 0)[0]),\n",
174
+ " character=list(np.where(df[\"category\"] == 4)[0]),\n",
175
+ " )\n",
176
+ "\n",
177
+ " return tag_data"
178
+ ]
179
+ },
180
+ {
181
+ "cell_type": "code",
182
+ "execution_count": 52,
183
+ "id": "593bf897",
184
+ "metadata": {},
185
+ "outputs": [],
186
+ "source": [
187
+ "def preprocess_image(image: Image.Image, size_px: int = IMAGE_SIZE, upscale=True) -> Image.Image:\n",
188
+ " \"\"\"\n",
189
+ " Preprocess an image to be square and centered on a white background.\n",
190
+ " \"\"\"\n",
191
+ " # make tuple for PIL\n",
192
+ " size = (size_px, size_px)\n",
193
+ "\n",
194
+ " # scale up or down (maintaining aspect ratio) as needed\n",
195
+ " if image.width > size_px or image.height > size_px:\n",
196
+ " image.thumbnail(size, Image.Resampling.LANCZOS)\n",
197
+ " elif upscale is True:\n",
198
+ " ratio = size_px / max(image.width, image.height)\n",
199
+ " scale_to = (int(image.width * ratio), int(image.height * ratio))\n",
200
+ " image = image.resize(scale_to, Image.LANCZOS)\n",
201
+ "\n",
202
+ " # work out where to paste the image to make it square\n",
203
+ " delta_h = (size_px - image.height) // 2\n",
204
+ " delta_w = (size_px - image.width) // 2\n",
205
+ "\n",
206
+ " # paste image onto square white canvas, centered\n",
207
+ " image = image.convert(\"RGBA\")\n",
208
+ " canvas = Image.new(\"RGBA\", size, (255, 255, 255))\n",
209
+ " canvas.paste(image, box=(delta_w, delta_h), mask=image)\n",
210
+ "\n",
211
+ " # convert to 24-bit BGR for OpenCV and return\n",
212
+ " canvas = canvas.convert(\"RGB\").convert(\"BGR;24\")\n",
213
+ " return canvas"
214
+ ]
215
+ },
216
+ {
217
+ "cell_type": "code",
218
+ "execution_count": 53,
219
+ "id": "6fd3593f",
220
+ "metadata": {},
221
+ "outputs": [],
222
+ "source": [
223
+ "class ImageDataset(Dataset):\n",
224
+ " def __init__(self, image_paths: List[Path], size_px: int = IMAGE_SIZE, upscale: bool = True):\n",
225
+ " self.size_px = size_px\n",
226
+ " self.upscale = upscale\n",
227
+ " self.images = [p for p in image_paths if p.suffix.lower() in IMAGE_EXTENSIONS]\n",
228
+ "\n",
229
+ " def __len__(self):\n",
230
+ " return len(self.images)\n",
231
+ "\n",
232
+ " def __getitem__(self, idx):\n",
233
+ " image_path: Path = self.images[idx]\n",
234
+ " try:\n",
235
+ " image = Image.open(image_path)\n",
236
+ " image = preprocess_image(image, self.size_px, self.upscale)\n",
237
+ " image = np.asarray(image)\n",
238
+ " image = image.astype(np.float32)\n",
239
+ " image = np.expand_dims(image, axis=0)\n",
240
+ " except Exception as e:\n",
241
+ " logging.exception(f\"Could not load image from {image_path}, error: {e}\")\n",
242
+ " return None\n",
243
+ " return image, image_path"
244
+ ]
245
+ },
246
+ {
247
+ "cell_type": "code",
248
+ "execution_count": 54,
249
+ "id": "be8dc9e4",
250
+ "metadata": {},
251
+ "outputs": [
252
+ {
253
+ "data": {
254
+ "text/plain": [
255
+ "['1girl',\n",
256
+ " 'long_hair',\n",
257
+ " 'breasts',\n",
258
+ " 'blush',\n",
259
+ " 'smile',\n",
260
+ " 'short_hair',\n",
261
+ " 'open_mouth',\n",
262
+ " 'bangs',\n",
263
+ " 'blue_eyes',\n",
264
+ " 'skirt',\n",
265
+ " 'blonde_hair',\n",
266
+ " 'large_breasts',\n",
267
+ " 'brown_hair',\n",
268
+ " 'shirt',\n",
269
+ " 'black_hair',\n",
270
+ " 'hair_ornament',\n",
271
+ " 'red_eyes',\n",
272
+ " 'thighhighs',\n",
273
+ " 'gloves',\n",
274
+ " 'long_sleeves',\n",
275
+ " '1boy',\n",
276
+ " 'hat',\n",
277
+ " 'dress',\n",
278
+ " 'bow',\n",
279
+ " 'ribbon',\n",
280
+ " 'navel',\n",
281
+ " 'holding',\n",
282
+ " '2girls',\n",
283
+ " 'animal_ears',\n",
284
+ " 'cleavage',\n",
285
+ " 'hair_between_eyes',\n",
286
+ " 'bare_shoulders',\n",
287
+ " 'twintails',\n",
288
+ " 'brown_eyes',\n",
289
+ " 'medium_breasts',\n",
290
+ " 'sitting',\n",
291
+ " 'very_long_hair',\n",
292
+ " 'closed_mouth',\n",
293
+ " 'underwear',\n",
294
+ " 'nipples',\n",
295
+ " 'school_uniform',\n",
296
+ " 'green_eyes',\n",
297
+ " 'blue_hair',\n",
298
+ " 'standing',\n",
299
+ " 'purple_eyes',\n",
300
+ " 'collarbone',\n",
301
+ " 'panties',\n",
302
+ " 'jacket',\n",
303
+ " 'tail',\n",
304
+ " 'swimsuit',\n",
305
+ " 'hair_ribbon',\n",
306
+ " 'yellow_eyes',\n",
307
+ " 'white_shirt',\n",
308
+ " 'ponytail',\n",
309
+ " 'weapon',\n",
310
+ " 'pink_hair',\n",
311
+ " 'purple_hair',\n",
312
+ " 'ass',\n",
313
+ " 'braid',\n",
314
+ " 'flower',\n",
315
+ " 'ahoge',\n",
316
+ " 'white_hair',\n",
317
+ " 'short_sleeves',\n",
318
+ " ':d',\n",
319
+ " 'hetero',\n",
320
+ " 'hair_bow',\n",
321
+ " 'grey_hair',\n",
322
+ " 'male_focus',\n",
323
+ " 'heart',\n",
324
+ " 'pantyhose',\n",
325
+ " 'sidelocks',\n",
326
+ " 'bikini',\n",
327
+ " 'thighs',\n",
328
+ " 'red_hair',\n",
329
+ " 'multicolored_hair',\n",
330
+ " 'cowboy_shot',\n",
331
+ " 'sweat',\n",
332
+ " 'pleated_skirt',\n",
333
+ " 'hairband',\n",
334
+ " 'earrings',\n",
335
+ " 'small_breasts',\n",
336
+ " 'boots',\n",
337
+ " 'lying',\n",
338
+ " 'frills',\n",
339
+ " 'parted_lips',\n",
340
+ " 'detached_sleeves',\n",
341
+ " 'one_eye_closed',\n",
342
+ " 'japanese_clothes',\n",
343
+ " 'green_hair',\n",
344
+ " 'multiple_boys',\n",
345
+ " 'open_clothes',\n",
346
+ " 'wings',\n",
347
+ " 'necktie',\n",
348
+ " 'horns',\n",
349
+ " 'sky',\n",
350
+ " 'penis',\n",
351
+ " 'shoes',\n",
352
+ " 'glasses',\n",
353
+ " 'shorts',\n",
354
+ " 'barefoot',\n",
355
+ " 'teeth',\n",
356
+ " 'pussy',\n",
357
+ " 'serafuku',\n",
358
+ " 'sleeveless',\n",
359
+ " 'alternate_costume',\n",
360
+ " 'choker',\n",
361
+ " 'tongue',\n",
362
+ " 'pointy_ears',\n",
363
+ " 'black_gloves',\n",
364
+ " 'socks',\n",
365
+ " 'hairclip',\n",
366
+ " 'elbow_gloves',\n",
367
+ " 'fang',\n",
368
+ " 'midriff',\n",
369
+ " 'striped',\n",
370
+ " 'puffy_sleeves',\n",
371
+ " 'collared_shirt',\n",
372
+ " 'belt',\n",
373
+ " 'pants',\n",
374
+ " 'sword',\n",
375
+ " 'black_thighhighs',\n",
376
+ " 'virtual_youtuber',\n",
377
+ " 'cat_ears',\n",
378
+ " 'tears',\n",
379
+ " 'white_gloves',\n",
380
+ " 'hand_up',\n",
381
+ " 'hair_flower',\n",
382
+ " '3girls',\n",
383
+ " 'spread_legs',\n",
384
+ " 'cum',\n",
385
+ " 'hood',\n",
386
+ " '2boys',\n",
387
+ " 'sex',\n",
388
+ " 'tongue_out',\n",
389
+ " 'miniskirt',\n",
390
+ " 'wide_sleeves',\n",
391
+ " 'blunt_bangs',\n",
392
+ " 'on_back',\n",
393
+ " 'fingerless_gloves',\n",
394
+ " 'bowtie',\n",
395
+ " 'black_skirt',\n",
396
+ " 'medium_hair',\n",
397
+ " 'pink_eyes',\n",
398
+ " 'armpits',\n",
399
+ " 'sailor_collar',\n",
400
+ " 'kimono',\n",
401
+ " 'grey_background',\n",
402
+ " 'necklace',\n",
403
+ " 'off_shoulder',\n",
404
+ " 'stomach',\n",
405
+ " 'bag',\n",
406
+ " 'hair_bun',\n",
407
+ " 'clothes_lift',\n",
408
+ " 'star_(symbol)',\n",
409
+ " 'scarf',\n",
410
+ " 'cape',\n",
411
+ " 'nail_polish',\n",
412
+ " 'black_footwear',\n",
413
+ " 'holding_weapon',\n",
414
+ " 'bra',\n",
415
+ " 'white_dress',\n",
416
+ " 'orange_hair',\n",
417
+ " 'yuri',\n",
418
+ " 'sweatdrop',\n",
419
+ " 'armor',\n",
420
+ " 'rabbit_ears',\n",
421
+ " 'mole',\n",
422
+ " 'white_panties',\n",
423
+ " 'hair_over_one_eye',\n",
424
+ " 'grin',\n",
425
+ " 'huge_breasts',\n",
426
+ " 'looking_at_another',\n",
427
+ " ':o',\n",
428
+ " 'uniform',\n",
429
+ " 'black_eyes',\n",
430
+ " 'apron',\n",
431
+ " 'character_name',\n",
432
+ " 'vest',\n",
433
+ " 'black_dress',\n",
434
+ " 'arm_up',\n",
435
+ " 'vaginal',\n",
436
+ " 'red_bow',\n",
437
+ " 'high_heels',\n",
438
+ " 'twin_braids',\n",
439
+ " 'arms_up',\n",
440
+ " 'flat_chest',\n",
441
+ " 'side_ponytail',\n",
442
+ " 'collar',\n",
443
+ " 'bracelet',\n",
444
+ " 'feet',\n",
445
+ " 'covered_nipples',\n",
446
+ " 'two-tone_hair',\n",
447
+ " 'aqua_eyes',\n",
448
+ " 'sweater',\n",
449
+ " 'speech_bubble',\n",
450
+ " 'white_thighhighs',\n",
451
+ " 'leotard',\n",
452
+ " 'open_jacket',\n",
453
+ " 'official_alternate_costume',\n",
454
+ " 'red_ribbon',\n",
455
+ " 'tree',\n",
456
+ " 'cup',\n",
457
+ " 'puffy_short_sleeves',\n",
458
+ " 'lips',\n",
459
+ " 'blue_skirt',\n",
460
+ " 'zettai_ryouiki',\n",
461
+ " 'streaked_hair',\n",
462
+ " 'coat',\n",
463
+ " 'black_jacket',\n",
464
+ " 'crop_top',\n",
465
+ " 'groin',\n",
466
+ " 'fingernails',\n",
467
+ " 'v-shaped_eyebrows',\n",
468
+ " 'cat_tail',\n",
469
+ " 'neckerchief',\n",
470
+ " 'orange_eyes',\n",
471
+ " 'animal_ear_fluff',\n",
472
+ " 'head_tilt',\n",
473
+ " 'see-through',\n",
474
+ " 'hand_on_hip',\n",
475
+ " 'gun',\n",
476
+ " 'legs',\n",
477
+ " 'one-piece_swimsuit',\n",
478
+ " 'sleeves_past_wrists',\n",
479
+ " 'parted_bangs',\n",
480
+ " 'wrist_cuffs',\n",
481
+ " 'grey_eyes',\n",
482
+ " 'torn_clothes',\n",
483
+ " 'plaid',\n",
484
+ " 'black_pantyhose',\n",
485
+ " 'maid',\n",
486
+ " 'symbol-shaped_pupils',\n",
487
+ " 'hands_up',\n",
488
+ " 'sash',\n",
489
+ " 'fur_trim',\n",
490
+ " 'kneehighs',\n",
491
+ " 'maid_headdress',\n",
492
+ " 'black_panties',\n",
493
+ " 'cosplay',\n",
494
+ " 'bare_arms',\n",
495
+ " 'petals',\n",
496
+ " 'pubic_hair',\n",
497
+ " 'black_shirt',\n",
498
+ " 'fox_ears',\n",
499
+ " 'loli',\n",
500
+ " 'short_shorts',\n",
501
+ " 'ascot',\n",
502
+ " 'clothing_cutout',\n",
503
+ " 'completely_nude',\n",
504
+ " 'dutch_angle',\n",
505
+ " 'eyelashes',\n",
506
+ " 'bar_censor',\n",
507
+ " 'mole_under_eye',\n",
508
+ " 'pokemon_(creature)',\n",
509
+ " 'no_humans',\n",
510
+ " 'bare_legs',\n",
511
+ " 'window',\n",
512
+ " 'open_shirt',\n",
513
+ " 'sparkle',\n",
514
+ " 'dress_shirt',\n",
515
+ " 'kneeling',\n",
516
+ " 'sleeveless_shirt',\n",
517
+ " 'single_braid',\n",
518
+ " 'v',\n",
519
+ " 'black_headwear',\n",
520
+ " 'strapless',\n",
521
+ " '4girls',\n",
522
+ " 'bell',\n",
523
+ " 'hug',\n",
524
+ " 'no_bra',\n",
525
+ " 'saliva',\n",
526
+ " 'double_bun',\n",
527
+ " 'black_ribbon',\n",
528
+ " 'uncensored',\n",
529
+ " 'aqua_hair',\n",
530
+ " 'bodysuit',\n",
531
+ " 'blood',\n",
532
+ " 'bed',\n",
533
+ " 'hoodie',\n",
534
+ " 'military_uniform',\n",
535
+ " 'sideboob',\n",
536
+ " 'black_bow',\n",
537
+ " 'covered_navel',\n",
538
+ " 'tattoo',\n",
539
+ " 'gradient_hair',\n",
540
+ " 'skindentation',\n",
541
+ " 'neck_ribbon',\n",
542
+ " 'pussy_juice',\n",
543
+ " 'profile',\n",
544
+ " 'makeup',\n",
545
+ " 'thigh_strap',\n",
546
+ " 'leaning_forward',\n",
547
+ " 'multiple_views',\n",
548
+ " '4koma',\n",
549
+ " 'capelet',\n",
550
+ " 'mask',\n",
551
+ " 'muscular',\n",
552
+ " 'anus',\n",
553
+ " 'no_panties',\n",
554
+ " 'witch_hat',\n",
555
+ " 'detached_collar',\n",
556
+ " 'toes',\n",
557
+ " ':3',\n",
558
+ " 'copyright_name',\n",
559
+ " 'alternate_hairstyle',\n",
560
+ " 'underboob',\n",
561
+ " 'night',\n",
562
+ " 'buttons',\n",
563
+ " 'floating_hair',\n",
564
+ " 'fruit',\n",
565
+ " 'sleeveless_dress',\n",
566
+ " 'depth_of_field',\n",
567
+ " 'feet_out_of_frame',\n",
568
+ " 'headband',\n",
569
+ " 'fake_animal_ears',\n",
570
+ " '^_^',\n",
571
+ " 'blue_dress',\n",
572
+ " 'cameltoe',\n",
573
+ " 'cum_in_pussy',\n",
574
+ " 'fox_tail',\n",
575
+ " 'swept_bangs',\n",
576
+ " 'shadow',\n",
577
+ " 'black_bikini',\n",
578
+ " 'red_skirt',\n",
579
+ " 'nose_blush',\n",
580
+ " 'bottomless',\n",
581
+ " 'glowing',\n",
582
+ " 'side-tie_bikini_bottom',\n",
583
+ " 'rose',\n",
584
+ " 'bed_sheet',\n",
585
+ " 'colored_skin',\n",
586
+ " 'turtleneck',\n",
587
+ " 'holding_hands',\n",
588
+ " 'facial_hair',\n",
589
+ " 'chain',\n",
590
+ " 'headgear',\n",
591
+ " 'bird',\n",
592
+ " 'pov',\n",
593
+ " 'siblings',\n",
594
+ " 'headphones',\n",
595
+ " 'ocean',\n",
596
+ " '6+girls',\n",
597
+ " 'low_twintails',\n",
598
+ " 'heterochromia',\n",
599
+ " 'arm_support',\n",
600
+ " 'animal',\n",
601
+ " 'halterneck',\n",
602
+ " 'frown',\n",
603
+ " 'leaf',\n",
604
+ " 'beret',\n",
605
+ " 'white_headwear',\n",
606
+ " 'umbrella',\n",
607
+ " 'on_bed',\n",
608
+ " 'one_side_up',\n",
609
+ " 'embarrassed',\n",
610
+ " 'thigh_boots',\n",
611
+ " 'fangs',\n",
612
+ " 'upper_teeth_only',\n",
613
+ " 'watermark',\n",
614
+ " 'from_above',\n",
615
+ " 'back',\n",
616
+ " 'highleg',\n",
617
+ " 'blue_background',\n",
618
+ " 'ass_visible_through_thighs',\n",
619
+ " 'wavy_hair',\n",
620
+ " 'garter_straps',\n",
621
+ " 'black_choker',\n",
622
+ " 'halo',\n",
623
+ " 'blue_bow',\n",
624
+ " 'scar',\n",
625
+ " 'white_bikini',\n",
626
+ " 'on_side',\n",
627
+ " 'plaid_skirt',\n",
628
+ " 'chair',\n",
629
+ " 'transparent_background',\n",
630
+ " 'wariza',\n",
631
+ " 'facial_mark',\n",
632
+ " 'mouth_hold',\n",
633
+ " 'looking_away',\n",
634
+ " 'traditional_media',\n",
635
+ " 'beach',\n",
636
+ " 'bandages',\n",
637
+ " 'parody',\n",
638
+ " 'female_pubic_hair',\n",
639
+ " 'expressionless',\n",
640
+ " 'brown_footwear',\n",
641
+ " 'blush_stickers',\n",
642
+ " 'shirt_lift',\n",
643
+ " 'thick_thighs',\n",
644
+ " 'no_shoes',\n",
645
+ " 'holding_sword',\n",
646
+ " 'hair_tubes',\n",
647
+ " 'chinese_clothes',\n",
648
+ " 'drill_hair',\n",
649
+ " 'grabbing',\n",
650
+ " 'arms_behind_back',\n",
651
+ " 'soles',\n",
652
+ " 'obi',\n",
653
+ " 'heart-shaped_pupils',\n",
654
+ " 'eating',\n",
655
+ " 'clothes_pull',\n",
656
+ " 'looking_down',\n",
657
+ " 'phone',\n",
658
+ " 'black_shorts',\n",
659
+ " 'thigh_gap',\n",
660
+ " 'black_pants',\n",
661
+ " 'short_dress',\n",
662
+ " 'topless',\n",
663
+ " 'piercing',\n",
664
+ " 'pantyshot',\n",
665
+ " 'hair_intakes',\n",
666
+ " 'eyepatch',\n",
667
+ " 'border',\n",
668
+ " 'skirt_lift',\n",
669
+ " 'floral_print',\n",
670
+ " 'stuffed_toy',\n",
671
+ " 'bound',\n",
672
+ " 'formal',\n",
673
+ " 'playboy_bunny',\n",
674
+ " 'flying_sweatdrops',\n",
675
+ " 'crossed_arms',\n",
676
+ " 'wavy_mouth',\n",
677
+ " 'magical_girl',\n",
678
+ " 'erection',\n",
679
+ " 'abs',\n",
680
+ " 'moon',\n",
681
+ " 'half-closed_eyes',\n",
682
+ " 'leg_up',\n",
683
+ " 'from_below',\n",
684
+ " 'red_dress',\n",
685
+ " 'cleavage_cutout',\n",
686
+ " 'sandals',\n",
687
+ " 'table',\n",
688
+ " 'happy',\n",
689
+ " 'sunlight',\n",
690
+ " 'oral',\n",
691
+ " 'cover',\n",
692
+ " 'squatting',\n",
693
+ " 'single_hair_bun',\n",
694
+ " 'cat',\n",
695
+ " 'testicles',\n",
696
+ " 'pink_background',\n",
697
+ " 'sunglasses',\n",
698
+ " 'scrunchie',\n",
699
+ " 'white_footwear',\n",
700
+ " 'dark-skinned_male',\n",
701
+ " 'underwear_only',\n",
702
+ " 'cum_on_body',\n",
703
+ " 'trembling',\n",
704
+ " 'bob_cut',\n",
705
+ " 'ring',\n",
706
+ " 'bdsm',\n",
707
+ " 'school_swimsuit',\n",
708
+ " 'mob_cap',\n",
709
+ " 'wolf_ears',\n",
710
+ " 'blazer',\n",
711
+ " 'light_brown_hair',\n",
712
+ " 'white_jacket',\n",
713
+ " 'standing_on_one_leg',\n",
714
+ " 'sleeping',\n",
715
+ " 'thick_eyebrows',\n",
716
+ " 'backpack',\n",
717
+ " 'white_skirt',\n",
718
+ " 'demon_girl',\n",
719
+ " 'frilled_dress',\n",
720
+ " 'eyes_visible_through_hair',\n",
721
+ " 'breast_grab',\n",
722
+ " 'cardigan',\n",
723
+ " 'knee_boots',\n",
724
+ " 'suspenders',\n",
725
+ " 'hat_ribbon',\n",
726
+ " 'crossed_legs',\n",
727
+ " 'lingerie',\n",
728
+ " 'stuffed_animal',\n",
729
+ " 'katana',\n",
730
+ " 'hood_down',\n",
731
+ " ';d',\n",
732
+ " '3boys',\n",
733
+ " 'bat_wings',\n",
734
+ " 'horse_ears',\n",
735
+ " 'helmet',\n",
736
+ " 'cloudy_sky',\n",
737
+ " 'cellphone',\n",
738
+ " 'crying',\n",
739
+ " 'antenna_hair',\n",
740
+ " 'own_hands_together',\n",
741
+ " 'tank_top',\n",
742
+ " 'bottle',\n",
743
+ " 'suit',\n",
744
+ " 'grass',\n",
745
+ " 'outstretched_arms',\n",
746
+ " 'cross',\n",
747
+ " 'bug',\n",
748
+ " 'holding_food',\n",
749
+ " 'fire',\n",
750
+ " 'frilled_skirt',\n",
751
+ " 'tiara',\n",
752
+ " 'aged_down',\n",
753
+ " 'polka_dot',\n",
754
+ " 'feathers',\n",
755
+ " 'breasts_out',\n",
756
+ " 'crossover',\n",
757
+ " 'crown',\n",
758
+ " 'high_ponytail',\n",
759
+ " 'looking_up',\n",
760
+ " 'black_hairband',\n",
761
+ " 'bent_over',\n",
762
+ " 'undressing',\n",
763
+ " 'blue_shirt',\n",
764
+ " 'white_bow',\n",
765
+ " '5girls',\n",
766
+ " 'straddling',\n",
767
+ " 'light_smile',\n",
768
+ " 'knife',\n",
769
+ " 'pectorals',\n",
770
+ " 'x_hair_ornament',\n",
771
+ " 'plant',\n",
772
+ " 'couple',\n",
773
+ " 'denim',\n",
774
+ " 'on_stomach',\n",
775
+ " 'wing_collar',\n",
776
+ " '>_<',\n",
777
+ " 'robot',\n",
778
+ " 'white_flower',\n",
779
+ " 'hair_bobbles',\n",
780
+ " 'fellatio',\n",
781
+ " 'outstretched_arm',\n",
782
+ " 'sharp_teeth',\n",
783
+ " 'blue_ribbon',\n",
784
+ " 'lipstick',\n",
785
+ " 'tan',\n",
786
+ " 'girl_on_top',\n",
787
+ " 'cat_girl',\n",
788
+ " 'short_twintails',\n",
789
+ " 'lifted_by_self',\n",
790
+ " 'bondage',\n",
791
+ " 'curtains',\n",
792
+ " 'white_socks',\n",
793
+ " 'letterboxed',\n",
794
+ " 'animal_print',\n",
795
+ " 'muscular_male',\n",
796
+ " 'spiked_hair',\n",
797
+ " 'pointing',\n",
798
+ " 'pink_bow',\n",
799
+ " 'juliet_sleeves',\n",
800
+ " 'monster_girl',\n",
801
+ " 'sex_from_behind',\n",
802
+ " 'slit_pupils',\n",
803
+ " 'polearm',\n",
804
+ " 'all_fours',\n",
805
+ " 'blue_jacket',\n",
806
+ " 'sisters',\n",
807
+ " '^^^',\n",
808
+ " 'frilled_sleeves',\n",
809
+ " 'hand_on_own_chest',\n",
810
+ " 'red_necktie',\n",
811
+ " 'blue_sailor_collar',\n",
812
+ " 'crescent',\n",
813
+ " '?',\n",
814
+ " 'staff',\n",
815
+ " 'black_background',\n",
816
+ " 'clenched_teeth',\n",
817
+ " 'panty_pull',\n",
818
+ " 'cherry_blossoms',\n",
819
+ " 'head_wings',\n",
820
+ " 'horse_girl',\n",
821
+ " 'brooch',\n",
822
+ " 'goggles',\n",
823
+ " 'demon_horns',\n",
824
+ " 'towel',\n",
825
+ " 'blouse',\n",
826
+ " 'shaded_face',\n",
827
+ " 'red_flower',\n",
828
+ " 'green_skirt',\n",
829
+ " 'fox_girl',\n",
830
+ " 'ground_vehicle',\n",
831
+ " 'cover_page',\n",
832
+ " 'black_bra',\n",
833
+ " 'elf',\n",
834
+ " 'bike_shorts',\n",
835
+ " 'otoko_no_ko',\n",
836
+ " 'wind',\n",
837
+ " 'casual',\n",
838
+ " 'black_socks',\n",
839
+ " 'loafers',\n",
840
+ " 't-shirt',\n",
841
+ " 'motion_lines',\n",
842
+ " 'shoulder_armor',\n",
843
+ " 'gauntlets',\n",
844
+ " 'no_pants',\n",
845
+ " 'building',\n",
846
+ " 'pink_panties',\n",
847
+ " 'messy_hair',\n",
848
+ " 'single_thighhigh',\n",
849
+ " 'multiple_tails',\n",
850
+ " 'kiss',\n",
851
+ " 'wristband',\n",
852
+ " 'group_sex',\n",
853
+ " 'breast_press',\n",
854
+ " 'between_breasts',\n",
855
+ " 'surprised',\n",
856
+ " 'striped_panties',\n",
857
+ " 'hat_bow',\n",
858
+ " 'gem',\n",
859
+ " 'butterfly',\n",
860
+ " 'red_footwear',\n",
861
+ " 'red_shirt',\n",
862
+ " 'sheath',\n",
863
+ " 'sneakers',\n",
864
+ " 'rabbit_tail',\n",
865
+ " 'tassel',\n",
866
+ " 'instrument',\n",
867
+ " 'box',\n",
868
+ " 'ear_piercing',\n",
869
+ " 'drooling',\n",
870
+ " 'fishnets',\n",
871
+ " 'ribbon_trim',\n",
872
+ " 'clenched_hand',\n",
873
+ " 'sex_toy',\n",
874
+ " 'red_bowtie',\n",
875
+ " 'third_eye',\n",
876
+ " 'skirt_set',\n",
877
+ " 'child',\n",
878
+ " 'hakama',\n",
879
+ " 'pale_skin',\n",
880
+ " 'portrait',\n",
881
+ " 'musical_note',\n",
882
+ " 'revealing_clothes',\n",
883
+ " 'rope',\n",
884
+ " 'star_(sky)',\n",
885
+ " 'wet_clothes',\n",
886
+ " 'steam',\n",
887
+ " 'candy',\n",
888
+ " 'pink_dress',\n",
889
+ " 'genderswap',\n",
890
+ " 'facial',\n",
891
+ " 'demon_tail',\n",
892
+ " 'dog_ears',\n",
893
+ " 'anal',\n",
894
+ " 'foreshortening',\n",
895
+ " 'holding_gun',\n",
896
+ " 'nature',\n",
897
+ " 'covering',\n",
898
+ " 'adapted_costume',\n",
899
+ " 'side-tie_panties',\n",
900
+ " 'black_nails',\n",
901
+ " 'night_sky',\n",
902
+ " 'christmas',\n",
903
+ " 'breath',\n",
904
+ " 'ejaculation',\n",
905
+ " 'veil',\n",
906
+ " 'scenery',\n",
907
+ " 'armband',\n",
908
+ " 'peaked_cap',\n",
909
+ " 'waist_apron',\n",
910
+ " 'lace_trim',\n",
911
+ " 'convenient_censoring',\n",
912
+ " 'white_apron',\n",
913
+ " 'couch',\n",
914
+ " 'arms_behind_head',\n",
915
+ " 'china_dress',\n",
916
+ " 'bandaid',\n",
917
+ " 'holding_cup',\n",
918
+ " 'black_leotard',\n",
919
+ " 'male_pubic_hair',\n",
920
+ " 'interlocked_fingers',\n",
921
+ " 'mole_under_mouth',\n",
922
+ " 'microphone',\n",
923
+ " 'bridal_gauntlets',\n",
924
+ " 'bara',\n",
925
+ " 'strapless_dress',\n",
926
+ " 'tokin_hat',\n",
927
+ " 'yaoi',\n",
928
+ " 'straight_hair',\n",
929
+ " 'front-tie_top',\n",
930
+ " 'bow_panties',\n",
931
+ " 'lace',\n",
932
+ " 'mecha',\n",
933
+ " 'hakama_skirt',\n",
934
+ " 'hand_fan',\n",
935
+ " 'white_ribbon',\n",
936
+ " 'glowing_eyes',\n",
937
+ " 'anger_vein',\n",
938
+ " '...',\n",
939
+ " 'breasts_apart',\n",
940
+ " 'no_headwear',\n",
941
+ " 'hair_over_shoulder',\n",
942
+ " 'clothes_writing',\n",
943
+ " 'jingle_bell',\n",
944
+ " 'baseball_cap',\n",
945
+ " 'yellow_background',\n",
946
+ " 'hair_flaps',\n",
947
+ " 'string_bikini',\n",
948
+ " 'feathered_wings',\n",
949
+ " 'hooded_jacket',\n",
950
+ " 'cum_on_breasts',\n",
951
+ " 'bikini_top_only',\n",
952
+ " 'red_headwear',\n",
953
+ " 'twin_drills',\n",
954
+ " 'facing_viewer',\n",
955
+ " 'skin_tight',\n",
956
+ " 'multiple_penises',\n",
957
+ " 'semi-rimless_eyewear',\n",
958
+ " 'red_nails',\n",
959
+ " 'bright_pupils',\n",
960
+ " 'black_necktie',\n",
961
+ " 'web_address',\n",
962
+ " ':<',\n",
963
+ " 'angry',\n",
964
+ " 'grey_shirt',\n",
965
+ " 'cloak',\n",
966
+ " 'eyewear_on_head',\n",
967
+ " 'motor_vehicle',\n",
968
+ " 'red_background',\n",
969
+ " 'claws',\n",
970
+ " 'side_braid',\n",
971
+ " 'wolf_tail',\n",
972
+ " 'pelvic_curtain',\n",
973
+ " 'light_particles',\n",
974
+ " 'light_purple_hair',\n",
975
+ " 'multicolored_clothes',\n",
976
+ " 'carrying',\n",
977
+ " 'micro_bikini',\n",
978
+ " 'knees_up',\n",
979
+ " 'smartphone',\n",
980
+ " 'corset',\n",
981
+ " 'tentacles',\n",
982
+ " 'index_finger_raised',\n",
983
+ " 'clothing_aside',\n",
984
+ " 'purple_dress',\n",
985
+ " 'extra_ears',\n",
986
+ " 'rifle',\n",
987
+ " 'striped_thighhighs',\n",
988
+ " 'white_border',\n",
989
+ " 'mary_janes',\n",
990
+ " 'beard',\n",
991
+ " 'paizuri',\n",
992
+ " 'vertical_stripes',\n",
993
+ " 'red_jacket',\n",
994
+ " ':p',\n",
995
+ " 'red_neckerchief',\n",
996
+ " 'short_hair_with_long_locks',\n",
997
+ " 'scar_on_face',\n",
998
+ " 'tareme',\n",
999
+ " 'neck_bell',\n",
1000
+ " 'licking',\n",
1001
+ " 'furry',\n",
1002
+ " 'single_horn',\n",
1003
+ " 'strap_slip',\n",
1004
+ " 'finger_to_mouth',\n",
1005
+ " 'pom_pom_(clothes)',\n",
1006
+ " 'snow',\n",
1007
+ " 'french_braid',\n",
1008
+ " 'close-up',\n",
1009
+ " 'androgynous',\n",
1010
+ " '1other',\n",
1011
+ " 'areola_slip',\n",
1012
+ " 'forehead',\n",
1013
+ " 'puffy_nipples',\n",
1014
+ " 'buckle',\n",
1015
+ " 'horse_tail',\n",
1016
+ " 'two-tone_background',\n",
1017
+ " 'full_moon',\n",
1018
+ " 'eye_contact',\n",
1019
+ " 'pink_flower',\n",
1020
+ " 'tsurime',\n",
1021
+ " 'yellow_bow',\n",
1022
+ " 'gift',\n",
1023
+ " 'seiza',\n",
1024
+ " 'upskirt',\n",
1025
+ " 'blue_bikini',\n",
1026
+ " 'pink_nails',\n",
1027
+ " 'santa_hat',\n",
1028
+ " 'genderswap_(mtf)',\n",
1029
+ " 'lens_flare',\n",
1030
+ " 'skin_fang',\n",
1031
+ " 'spikes',\n",
1032
+ " 'armlet',\n",
1033
+ " 'hand_on_own_face',\n",
1034
+ " 'desk',\n",
1035
+ " 'between_legs',\n",
1036
+ " 'brown_gloves',\n",
1037
+ " 'side_slit',\n",
1038
+ " 'handgun',\n",
1039
+ " 'camisole',\n",
1040
+ " 'wading',\n",
1041
+ " 'faceless',\n",
1042
+ " 'low_ponytail',\n",
1043
+ " 'restrained',\n",
1044
+ " 'pendant',\n",
1045
+ " 'plate',\n",
1046
+ " 'dual_persona',\n",
1047
+ " 'masturbation',\n",
1048
+ " 'highleg_leotard',\n",
1049
+ " 'spoken_heart',\n",
1050
+ " 'curvy',\n",
1051
+ " 'green_bow',\n",
1052
+ " 'maid_apron',\n",
1053
+ " 'alcohol',\n",
1054
+ " 'after_sex',\n",
1055
+ " 'grey_skirt',\n",
1056
+ " 'handjob',\n",
1057
+ " 'sleeves_rolled_up',\n",
1058
+ " 'red_gloves',\n",
1059
+ " 'o-ring',\n",
1060
+ " 'heavy_breathing',\n",
1061
+ " 'abyssal_ship',\n",
1062
+ " 'eyeshadow',\n",
1063
+ " 'ribbed_sweater',\n",
1064
+ " 'drinking_glass',\n",
1065
+ " 'hair_scrunchie',\n",
1066
+ " 'cowgirl_position',\n",
1067
+ " 'cross-laced_footwear',\n",
1068
+ " 'blue_headwear',\n",
1069
+ " 'broom',\n",
1070
+ " 'ball',\n",
1071
+ " 'puffy_long_sleeves',\n",
1072
+ " 'sleeves_past_fingers',\n",
1073
+ " 'clenched_hands',\n",
1074
+ " 'hood_up',\n",
1075
+ " 'cropped_legs',\n",
1076
+ " 'floating',\n",
1077
+ " 'wide_hips',\n",
1078
+ " 'forest',\n",
1079
+ " 'low-tied_long_hair',\n",
1080
+ " 'breast_hold',\n",
1081
+ " 'smoke',\n",
1082
+ " 'zipper',\n",
1083
+ " 'dress_lift',\n",
1084
+ " 'tray',\n",
1085
+ " 'personification',\n",
1086
+ " 'headwear_removed',\n",
1087
+ " 'high_heel_boots',\n",
1088
+ " 'partially_submerged',\n",
1089
+ " 'headset',\n",
1090
+ " 'halloween',\n",
1091
+ " 'hair_rings',\n",
1092
+ " 'legs_up',\n",
1093
+ " 'half_updo',\n",
1094
+ " 'doujin_cover',\n",
1095
+ " 'pink_skirt',\n",
1096
+ " 'starry_sky',\n",
1097
+ " 'colored_sclera',\n",
1098
+ " 'pencil_skirt',\n",
1099
+ " 'strapless_leotard',\n",
1100
+ " 'single_glove',\n",
1101
+ " 'machinery',\n",
1102
+ " 'clothed_sex',\n",
1103
+ " 'blue_nails',\n",
1104
+ " 'backlighting',\n",
1105
+ " 'freckles',\n",
1106
+ " 'tearing_up',\n",
1107
+ " 'reflection',\n",
1108
+ " 'tanlines',\n",
1109
+ " 'fish',\n",
1110
+ " 'sweater_vest',\n",
1111
+ " 'holding_book',\n",
1112
+ " 'arm_behind_back',\n",
1113
+ " 'arm_at_side',\n",
1114
+ " 'santa_costume',\n",
1115
+ " 'large_pectorals',\n",
1116
+ " 'spot_color',\n",
1117
+ " 'flying',\n",
1118
+ " 'white_bra',\n",
1119
+ " 'asymmetrical_legwear',\n",
1120
+ " 'brown_background',\n",
1121
+ " 'panties_under_pantyhose',\n",
1122
+ " 'nontraditional_miko',\n",
1123
+ " 'red_bikini',\n",
1124
+ " 'happy_birthday',\n",
1125
+ " 'cropped_jacket',\n",
1126
+ " 'long_fingernails',\n",
1127
+ " '!',\n",
1128
+ " 'kemonomimi_mode',\n",
1129
+ " 'sailor_dress',\n",
1130
+ " 'clothed_female_nude_male',\n",
1131
+ " 'walking',\n",
1132
+ " 'fingering',\n",
1133
+ " 'science_fiction',\n",
1134
+ " 'rain',\n",
1135
+ " 'white_pantyhose',\n",
1136
+ " 'garter_belt',\n",
1137
+ " 'frilled_bikini',\n",
1138
+ " 'dual_wielding',\n",
1139
+ " '6+boys',\n",
1140
+ " 'pink_ribbon',\n",
1141
+ " 'cuffs',\n",
1142
+ " 'red-framed_eyewear',\n",
1143
+ " 'dragon_horns',\n",
1144
+ " 'epaulettes',\n",
1145
+ " 'black_wings',\n",
1146
+ " 'bubble',\n",
1147
+ " 'demon_wings',\n",
1148
+ " 'thong',\n",
1149
+ " 'legs_apart',\n",
1150
+ " 'teacup',\n",
1151
+ " 'condom',\n",
1152
+ " 'veins',\n",
1153
+ " 'crossdressing',\n",
1154
+ " 'ribbon-trimmed_sleeves',\n",
1155
+ " 'holding_phone',\n",
1156
+ " 'gym_uniform',\n",
1157
+ " 'short_ponytail',\n",
1158
+ " 'arm_behind_head',\n",
1159
+ " 'cake',\n",
1160
+ " 'out_of_frame',\n",
1161
+ " 'innertube',\n",
1162
+ " 'oni_horns',\n",
1163
+ " 'contrapposto',\n",
1164
+ " 'naughty_face',\n",
1165
+ " 'green_background',\n",
1166
+ " 'alternate_breast_size',\n",
1167
+ " 'purple_background',\n",
1168
+ " 'black-framed_eyewear',\n",
1169
+ " 'rape',\n",
1170
+ " 'beads',\n",
1171
+ " 'knee_up',\n",
1172
+ " 'hat_ornament',\n",
1173
+ " 'one-hour_drawing_challenge',\n",
1174
+ " 'fur_collar',\n",
1175
+ " 'blue_shorts',\n",
1176
+ " 'outside_border',\n",
1177
+ " 'thighband_pantyhose',\n",
1178
+ " 'meme',\n",
1179
+ " 'bowl',\n",
1180
+ " 'toenails',\n",
1181
+ " 'cumdrip',\n",
1182
+ " 'blue_flower',\n",
1183
+ " 'denim_shorts',\n",
1184
+ " 'curly_hair',\n",
1185
+ " 'track_jacket',\n",
1186
+ " 'black_sailor_collar',\n",
1187
+ " 'light_blush',\n",
1188
+ " 'school_bag',\n",
1189
+ " 'pocket',\n",
1190
+ " 'spread_pussy',\n",
1191
+ " 'toned',\n",
1192
+ " 'pink_shirt',\n",
1193
+ " 'doggystyle',\n",
1194
+ " 'white_sleeves',\n",
1195
+ " ':q',\n",
1196
+ " 'hand_in_own_hair',\n",
1197
+ " 'spoken_ellipsis',\n",
1198
+ " 'empty_eyes',\n",
1199
+ " 'purple_skirt',\n",
1200
+ " 'crying_with_eyes_open',\n",
1201
+ " 'goggles_on_head',\n",
1202
+ " 'green_dress',\n",
1203
+ " '4boys',\n",
1204
+ " 'bulge',\n",
1205
+ " 'sun_hat',\n",
1206
+ " 'cum_in_mouth',\n",
1207
+ " 'lolita_fashion',\n",
1208
+ " 'shiny_clothes',\n",
1209
+ " 'pauldrons',\n",
1210
+ " 'outline',\n",
1211
+ " 'buruma',\n",
1212
+ " \"hand_on_another's_head\",\n",
1213
+ " 'futanari',\n",
1214
+ " 'topless_male',\n",
1215
+ " 'under-rim_eyewear',\n",
1216
+ " 'frilled_apron',\n",
1217
+ " 'white_pupils',\n",
1218
+ " 'skull',\n",
1219
+ " 'jitome',\n",
1220
+ " 'gold_trim',\n",
1221
+ " 'long_legs',\n",
1222
+ " 'sunset',\n",
1223
+ " 'monster',\n",
1224
+ " 'frilled_shirt_collar',\n",
1225
+ " 'emphasis_lines',\n",
1226
+ " 'hands_on_hips',\n",
1227
+ " 'high-waist_skirt',\n",
1228
+ " 'new_year',\n",
1229
+ " 'shield',\n",
1230
+ " 'aged_up',\n",
1231
+ " 'animal_hands',\n",
1232
+ " 'mole_on_breast',\n",
1233
+ " 'spear',\n",
1234
+ " 'asymmetrical_hair',\n",
1235
+ " 'female_masturbation',\n",
1236
+ " 'v_arms',\n",
1237
+ " 'single_earring',\n",
1238
+ " 'running',\n",
1239
+ " 'dog',\n",
1240
+ " 'angel_wings',\n",
1241
+ " 'long_skirt',\n",
1242
+ " 'breasts_squeezed_together',\n",
1243
+ " 'competition_swimsuit',\n",
1244
+ " 'watch',\n",
1245
+ " 'dog_tail',\n",
1246
+ " 'black_belt',\n",
1247
+ " 'black_serafuku',\n",
1248
+ " 'faceless_male',\n",
1249
+ " 'legs_together',\n",
1250
+ " 'ice',\n",
1251
+ " 'white_skin',\n",
1252
+ " 'blue_footwear',\n",
1253
+ " 'o_o',\n",
1254
+ " '#ERROR!',\n",
1255
+ " ...]"
1256
+ ]
1257
+ },
1258
+ "execution_count": 54,
1259
+ "metadata": {},
1260
+ "output_type": "execute_result"
1261
+ }
1262
+ ],
1263
+ "source": [
1264
+ "exclude = pd.read_csv('exclude_tags.csv')\n",
1265
+ "exclude\n",
1266
+ "undesired_tags_list = exclude[exclude['exclude'] == 1]['name'].tolist()\n",
1267
+ "undesired_tags_list"
1268
+ ]
1269
+ },
1270
+ {
1271
+ "cell_type": "code",
1272
+ "execution_count": 55,
1273
+ "id": "8ed9d1f3",
1274
+ "metadata": {},
1275
+ "outputs": [],
1276
+ "source": [
1277
+ "class ImageLabeler:\n",
1278
+ " def __init__(\n",
1279
+ " self,\n",
1280
+ " model_path: Optional[PathLike] = None,\n",
1281
+ " general_threshold: float = 0.35,\n",
1282
+ " character_threshold: float = 0.35,\n",
1283
+ " undesired_tags: Optional[List[str]] = None,\n",
1284
+ " ):\n",
1285
+ " # save model path if provided\n",
1286
+ " self._model_path = Path(model_path) if model_path is not None else None\n",
1287
+ "\n",
1288
+ " # create some object attributes for convenience\n",
1289
+ " self.general_threshold = general_threshold\n",
1290
+ " self.character_threshold = character_threshold\n",
1291
+ " self.undesired_tags = undesired_tags or []\n",
1292
+ "\n",
1293
+ " # actually load the model\n",
1294
+ " logging.info(f\"Loading model from path: {self._model_path}\")\n",
1295
+ " self.model = rt.InferenceSession(\n",
1296
+ " str(model_path.joinpath(\"model.onnx\")),\n",
1297
+ " providers=[(\"CUDAExecutionProvider\", {}), \"CPUExecutionProvider\"],\n",
1298
+ " )\n",
1299
+ "\n",
1300
+ " # Get input dimensions\n",
1301
+ " _, self.height, self.width, _ = self.model.get_inputs()[0].shape\n",
1302
+ " logging.info(f\"Model loaded, input dimensions {self.height}x{self.width}\")\n",
1303
+ "\n",
1304
+ " # load labels\n",
1305
+ " self.labels = load_labels(self._model_path)\n",
1306
+ " self.labels.general = [i for i in self.labels.general if i not in undesired_tags]\n",
1307
+ " self.labels.character = [i for i in self.labels.character if i not in undesired_tags]\n",
1308
+ " logging.info(f\"Loaded labels from {self._model_path.joinpath('selected_tags.csv')}\")\n",
1309
+ "\n",
1310
+ " @property\n",
1311
+ " def input_size(self) -> Tuple[int, int]:\n",
1312
+ " return (self.height, self.width)\n",
1313
+ "\n",
1314
+ " @property\n",
1315
+ " def input_name(self) -> str:\n",
1316
+ " return self.model.get_inputs()[0].name if self.model is not None else None\n",
1317
+ "\n",
1318
+ " @property\n",
1319
+ " def output_name(self) -> str:\n",
1320
+ " return self.model.get_outputs()[0].name if self.model is not None else None\n",
1321
+ "\n",
1322
+ " def label_image(self, images: np.ndarray) -> ImageLabels:\n",
1323
+ " # Run the ONNX model\n",
1324
+ " probs = [self.model.run([self.output_name], {self.input_name: x}) for x in images]\n",
1325
+ " # Convert to labels\n",
1326
+ " results = []\n",
1327
+ " for prob in list(probs):\n",
1328
+ " labels = list(zip(self.labels.names, prob[0][0].astype(float)))\n",
1329
+ "\n",
1330
+ " # First 4 labels are actually ratings: pick one with argmax\n",
1331
+ " rating_labels = dict([labels[i] for i in self.labels.rating])\n",
1332
+ " rating = max(rating_labels, key=rating_labels.get)\n",
1333
+ "\n",
1334
+ " # General labels, pick any where prediction confidence > threshold\n",
1335
+ " gen_labels = [labels[i] for i in self.labels.general]\n",
1336
+ " gen_labels = dict([x for x in gen_labels if x[1] > self.general_threshold])\n",
1337
+ " gen_labels = dict(sorted(gen_labels.items(), key=lambda item: item[1], reverse=True))\n",
1338
+ "\n",
1339
+ " # Convert to a string suitable for use as a training caption\n",
1340
+ " caption = \", \".join([x for x in gen_labels])\n",
1341
+ "\n",
1342
+ " booru = caption.replace(\"_\", \" \").replace(\"(\", \"\\(\").replace(\")\", \"\\)\")\n",
1343
+ "\n",
1344
+ " # return output\n",
1345
+ " results.append(\n",
1346
+ " ImageLabels(\n",
1347
+ " caption=caption,\n",
1348
+ " booru=booru,\n",
1349
+ " rating=rating,\n",
1350
+ " general=gen_labels,\n",
1351
+ " character={}, # returning an empty dictionary for character labels\n",
1352
+ " ratings=rating_labels,\n",
1353
+ " )\n",
1354
+ " )\n",
1355
+ "\n",
1356
+ " return results\n",
1357
+ "\n",
1358
+ " def __call__(self, images: List[Image.Image]) -> ImageLabels:\n",
1359
+ " # if not a list, just label the image\n",
1360
+ " for x in images:\n",
1361
+ " yield self.label_image(x)"
1362
+ ]
1363
+ },
1364
+ {
1365
+ "cell_type": "code",
1366
+ "execution_count": 56,
1367
+ "id": "b476a2f9",
1368
+ "metadata": {},
1369
+ "outputs": [],
1370
+ "source": [
1371
+ "def main(\n",
1372
+ " images_dir: str = \"/home/irakli/foxtagger/inputs\",\n",
1373
+ " base_model: str = \"convnextv2\",\n",
1374
+ " models_dir: str = \"/home/irakli/foxtagger/models\",\n",
1375
+ " force_download: bool = False,\n",
1376
+ " recursive: bool = True,\n",
1377
+ " undesired_tags: List[str] = undesired_tags_list,\n",
1378
+ " caption_extension: str = \".txt\",\n",
1379
+ " frequency_tags: bool = False,\n",
1380
+ " max_data_loader_n_workers: int = 4,\n",
1381
+ " remove_underscore: bool = True,\n",
1382
+ " thresh: float = 0.35,\n",
1383
+ " general_threshold: float = None,\n",
1384
+ " character_threshold: float = None,\n",
1385
+ " debug: bool = False,\n",
1386
+ "):\n",
1387
+ " base_model = base_model\n",
1388
+ " models_dir = Path(models_dir) if models_dir is not None else Path.cwd().joinpath(\"models\")\n",
1389
+ " images_dir = Path(images_dir)\n",
1390
+ " force_download = force_download or False\n",
1391
+ " # Specify the name of your model file\n",
1392
+ " model_filename = 'model.onnx'\n",
1393
+ "\n",
1394
+ " recursive = recursive\n",
1395
+ " undesired_tags = set(undesired_tags)\n",
1396
+ " caption_extension = str(caption_extension).lower()\n",
1397
+ " frequency_tags = frequency_tags\n",
1398
+ " max_data_loader_n_workers = max_data_loader_n_workers\n",
1399
+ "\n",
1400
+ " remove_underscore = remove_underscore\n",
1401
+ " general_threshold = general_threshold or thresh\n",
1402
+ " character_threshold = character_threshold or thresh\n",
1403
+ " debug = debug\n",
1404
+ "\n",
1405
+ " # turn base model into a repo id and model path\n",
1406
+ " repo_id: str = get_model_repo(base_model)\n",
1407
+ " model_dir = models_dir.joinpath(repo_id.split(\"/\")[-1])\n",
1408
+ " model_path = model_dir / model_filename # This is the path to the model file\n",
1409
+ " \n",
1410
+ "\n",
1411
+ " # download the model if it doesn't exist, or if force_download is True\n",
1412
+ " print(f\"Checking for {base_model}-based tagger in {model_dir}...\")\n",
1413
+ " if not model_dir.is_dir() or force_download is True:\n",
1414
+ " print(f\"Downloading {base_model}-based tagger from '{repo_id}'\")\n",
1415
+ " snapshot_download(\n",
1416
+ " repo_id,\n",
1417
+ " local_dir_use_symlinks=False,\n",
1418
+ " local_dir=models_dir,\n",
1419
+ " cache_dir=CACHE_DIR,\n",
1420
+ " allow_patterns=[\"*.onnx\", \"*.csv\"],\n",
1421
+ " )\n",
1422
+ " else:\n",
1423
+ " print(\"Found existing tagger model, skipping download.\")\n",
1424
+ "\n",
1425
+ " # instantiate the dataset\n",
1426
+ " print(f\"Loading images from {images_dir}...\", end=\" \")\n",
1427
+ " if recursive:\n",
1428
+ " image_paths = list(Path(images_dir).rglob(\"*.*\"))\n",
1429
+ " else:\n",
1430
+ " image_paths = list(Path(images_dir).glob(\"*.*\"))\n",
1431
+ " image_paths = [p for p in image_paths if p.suffix.lower() in IMAGE_EXTENSIONS]\n",
1432
+ " print(f\"found {len(image_paths)} images to process.\")\n",
1433
+ " dataset = ImageDataset(image_paths)\n",
1434
+ "\n",
1435
+ " # Create the data loader\n",
1436
+ " dataloader = DataLoader(\n",
1437
+ " dataset,\n",
1438
+ " batch_size=1,\n",
1439
+ " shuffle=False,\n",
1440
+ " num_workers=max_data_loader_n_workers,\n",
1441
+ " collate_fn=collate_fn_remove_corrupted,\n",
1442
+ " drop_last=False,\n",
1443
+ " )\n",
1444
+ "\n",
1445
+ " # Create the image labeler\n",
1446
+ " labeler: ImageLabeler = ImageLabeler(\n",
1447
+ " model_path=models_dir,\n",
1448
+ " character_threshold=character_threshold,\n",
1449
+ " general_threshold=general_threshold,\n",
1450
+ " undesired_tags=undesired_tags,\n",
1451
+ " )\n",
1452
+ "\n",
1453
+ " # object to save tag frequencies\n",
1454
+ " tag_freqs = {}\n",
1455
+ " \n",
1456
+ " # Specify the name of your CSV output file\n",
1457
+ " csv_filename = 'output.csv'\n",
1458
+ " \n",
1459
+ " with open(csv_filename, 'w', newline='') as csvfile:\n",
1460
+ " fieldnames = ['filename', 'tags:probabilities']\n",
1461
+ " writer = csv.DictWriter(csvfile, fieldnames=fieldnames)\n",
1462
+ "\n",
1463
+ " # Write the header\n",
1464
+ " writer.writeheader()\n",
1465
+ "\n",
1466
+ " # iterate\n",
1467
+ " for batch in tqdm(dataloader, ncols=100):\n",
1468
+ " images = [x[0] for x in batch]\n",
1469
+ " paths = [x[1] for x in batch]\n",
1470
+ "\n",
1471
+ " # label the images\n",
1472
+ " batch_labels = labeler.label_image(np.asarray(images))\n",
1473
+ "\n",
1474
+ " for image_labels, image_path in zip(batch_labels, paths):\n",
1475
+ " # save the labels\n",
1476
+ " caption = image_labels.caption\n",
1477
+ " if remove_underscore is True:\n",
1478
+ " caption = caption.replace(\"_\", \" \")\n",
1479
+ " \n",
1480
+ " # filter out undesired tags\n",
1481
+ " tags = caption.split(\", \")\n",
1482
+ " tags = [tag for tag in tags if tag not in undesired_tags]\n",
1483
+ " caption = \", \".join(tags)\n",
1484
+ " \n",
1485
+ " # Get the relative path of the image file\n",
1486
+ " relative_path = Path(image_path).relative_to(images_dir)\n",
1487
+ " Path(image_path).with_suffix(caption_extension).write_text(caption + \"\\n\", encoding=\"utf-8\")\n",
1488
+ " \n",
1489
+ " # Write the filename, tag and probability to the CSV file in a single row\n",
1490
+ " general_tags_probs = ', '.join([f\"{tag}:{prob}\" for tag, prob in image_labels.general.items() if tag not in undesired_tags])\n",
1491
+ " writer.writerow({'filename': relative_path, 'tags:probabilities': general_tags_probs})\n",
1492
+ "\n",
1493
+ "\n",
1494
+ " # save the tag frequencies\n",
1495
+ " if frequency_tags is True:\n",
1496
+ " for tag in tags: # here we use filtered tags\n",
1497
+ " if tag not in tag_freqs:\n",
1498
+ " tag_freqs[tag] = 0\n",
1499
+ " tag_freqs[tag] += 1\n",
1500
+ "\n",
1501
+ " # debug\n",
1502
+ " if debug is True:\n",
1503
+ " print(\n",
1504
+ " \"\\n\".join([\n",
1505
+ " f\"{image_path}:\",\n",
1506
+ " f\" Character tags: {image_labels.character}\",\n",
1507
+ " f\" General tags: {image_labels.general}\",\n",
1508
+ " ])\n",
1509
+ " )\n",
1510
+ "\n",
1511
+ " if frequency_tags:\n",
1512
+ " sorted_tags = sorted(tag_freqs.items(), key=lambda x: x[1], reverse=True)\n",
1513
+ " print(\"\\nTag frequencies:\")\n",
1514
+ " for tag, freq in sorted_tags:\n",
1515
+ " print(f\"{tag}: {freq}\")\n",
1516
+ "\n",
1517
+ " print(\"done!\")"
1518
+ ]
1519
+ },
1520
+ {
1521
+ "cell_type": "code",
1522
+ "execution_count": 57,
1523
+ "id": "e0a42c4c",
1524
+ "metadata": {},
1525
+ "outputs": [
1526
+ {
1527
+ "name": "stdout",
1528
+ "output_type": "stream",
1529
+ "text": [
1530
+ "Checking for convnextv2-based tagger in /home/irakli/foxtagger/models/wd-v1-4-convnextv2-tagger-v2...\n",
1531
+ "Found existing tagger model, skipping download.\n",
1532
+ "Loading images from /home/irakli/foxtagger/inputs... "
1533
+ ]
1534
+ },
1535
+ {
1536
+ "name": "stderr",
1537
+ "output_type": "stream",
1538
+ "text": [
1539
+ "INFO:root:Loading model from path: /home/irakli/foxtagger/models\n"
1540
+ ]
1541
+ },
1542
+ {
1543
+ "name": "stdout",
1544
+ "output_type": "stream",
1545
+ "text": [
1546
+ "found 10856 images to process.\n"
1547
+ ]
1548
+ },
1549
+ {
1550
+ "name": "stderr",
1551
+ "output_type": "stream",
1552
+ "text": [
1553
+ "2023-05-16 00:58:07.823512985 [W:onnxruntime:Default, onnxruntime_pybind_state.cc:541 CreateExecutionProviderInstance] Failed to create CUDAExecutionProvider. Please reference https://onnxruntime.ai/docs/reference/execution-providers/CUDA-ExecutionProvider.html#requirements to ensure all dependencies are met.\n",
1554
+ "INFO:root:Model loaded, input dimensions 448x448\n",
1555
+ "INFO:root:Loaded labels from /home/irakli/foxtagger/models/selected_tags.csv\n"
1556
+ ]
1557
+ },
1558
+ {
1559
+ "data": {
1560
+ "application/vnd.jupyter.widget-view+json": {
1561
+ "model_id": "a50ccecd857a49f79ac2fcd11cc8c8a0",
1562
+ "version_major": 2,
1563
+ "version_minor": 0
1564
+ },
1565
+ "text/plain": [
1566
+ " 0%| | 0/10856 [00:00<?, ?it/s]"
1567
+ ]
1568
+ },
1569
+ "metadata": {},
1570
+ "output_type": "display_data"
1571
+ },
1572
+ {
1573
+ "name": "stdout",
1574
+ "output_type": "stream",
1575
+ "text": [
1576
+ "done!\n"
1577
+ ]
1578
+ }
1579
+ ],
1580
+ "source": [
1581
+ "main()"
1582
+ ]
1583
+ },
1584
+ {
1585
+ "cell_type": "code",
1586
+ "execution_count": null,
1587
+ "id": "51d14c6b",
1588
+ "metadata": {},
1589
+ "outputs": [],
1590
+ "source": []
1591
+ }
1592
+ ],
1593
+ "metadata": {
1594
+ "kernelspec": {
1595
+ "display_name": "Python 3 (ipykernel)",
1596
+ "language": "python",
1597
+ "name": "python3"
1598
+ },
1599
+ "language_info": {
1600
+ "codemirror_mode": {
1601
+ "name": "ipython",
1602
+ "version": 3
1603
+ },
1604
+ "file_extension": ".py",
1605
+ "mimetype": "text/x-python",
1606
+ "name": "python",
1607
+ "nbconvert_exporter": "python",
1608
+ "pygments_lexer": "ipython3",
1609
+ "version": "3.10.10"
1610
+ }
1611
+ },
1612
+ "nbformat": 4,
1613
+ "nbformat_minor": 5
1614
+ }
Vodka_v3_tagger/models/model.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e91daa19cd9e8725125b7d70702d1560855fb687f8d8c4218eddaa821f41834a
3
+ size 388479878
Vodka_v3_tagger/models/selected_tags.csv ADDED
The diff for this file is too large to render. See raw diff
 
Vodka_v3_tagger/output.csv ADDED
The diff for this file is too large to render. See raw diff
 
Vodka_v3_tagger/requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ huggingface-hub>=0.14.0
2
+ numpy>=1.23.5
3
+ onnxruntime-gpu>=1.14.1
4
+ pandas>=2.0.0
5
+ Pillow>=9.5.0
6
+ torch>=2.0.0
7
+ torchvision>=0.15.1
8
+ tqdm>=4.65.0
Vodka_v3_tagger/tag_counts.csv ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag,count
2
+ solo,5550
3
+ outdoors,3040
4
+ looking_at_viewer,2921
5
+ realistic,2914
6
+ blurry,1951
7
+ cloud,1630
8
+ simple_background,1353
9
+ upper_body,1311
10
+ jewelry,1213
11
+ blurry_background,1188
12
+ indoors,1083
13
+ day,1044
14
+ water,1015
15
+ dark_skin,690
16
+ white_background,689
17
+ monochrome,624
18
+ multiple_girls,609
19
+ closed_eyes,596
20
+ food,551
21
+ full_body,458
22
+ greyscale,454
23
+ from_behind,427
24
+ blue_sky,403
25
+ dark-skinned_female,348
26
+ artist_name,315
27
+ signature,294
28
+ book,281
29
+ from_side,272
30
+ solo_focus,244
31
+ gradient,143
32
+ english_text,138
33
+ gradient_background,127
34
+ military,121
35
+ pillow,111
36
+ painting_(medium),96
37
+ nude,93
38
+ shiny,72
39
+ surreal,69
40
+ painting_(object),69
41
+ photo_background,52
42
+ indian_style,52
43
+ wet,47
44
+ sepia,47
45
+ real_world_location,44
46
+ motion_blur,28
47
+ looking_to_the_side,25
48
+ retro_artstyle,23
49
+ blurry_foreground,22
50
+ photo_(object),20
51
+ comic,20
52
+ looking_back,15
53
+ chibi,12
54
+ real_life_insert,10
55
+ twitter_username,7
56
+ paint,7
57
+ dated,7
58
+ painting_(action),6
59
+ concept_art,6
60
+ 1980s_(style),6
61
+ sketch,4
62
+ censored,2
63
+ shiny_skin,1
64
+ photo_inset,1
65
+ two_side_up,1
Vodka_v3_tagger/tag_counts_high_prob.csv ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ tag,count
2
+ solo,4987
3
+ outdoors,2320
4
+ looking_at_viewer,2154
5
+ realistic,2029
6
+ blurry,1426
7
+ cloud,1307
8
+ jewelry,1022
9
+ simple_background,975
10
+ blurry_background,783
11
+ indoors,714
12
+ water,682
13
+ day,655
14
+ upper_body,629
15
+ monochrome,565
16
+ white_background,562
17
+ dark_skin,548
18
+ multiple_girls,533
19
+ closed_eyes,477
20
+ food,458
21
+ greyscale,425
22
+ from_behind,283
23
+ dark-skinned_female,263
24
+ blue_sky,248
25
+ book,213
26
+ full_body,196
27
+ solo_focus,130
28
+ signature,125
29
+ from_side,99
30
+ artist_name,82
31
+ military,78
32
+ english_text,75
33
+ pillow,74
34
+ gradient,68
35
+ gradient_background,62
36
+ painting_(medium),56
37
+ nude,51
38
+ indian_style,36
39
+ painting_(object),35
40
+ shiny,29
41
+ surreal,28
42
+ photo_background,27
43
+ wet,24
44
+ sepia,24
45
+ real_world_location,24
46
+ retro_artstyle,14
47
+ motion_blur,12
48
+ chibi,11
49
+ comic,9
50
+ photo_(object),9
51
+ blurry_foreground,7
52
+ looking_back,7
53
+ sketch,4
54
+ looking_to_the_side,4
55
+ 1980s_(style),4
56
+ real_life_insert,3
57
+ twitter_username,2
58
+ paint,2
59
+ concept_art,2
60
+ censored,2
61
+ painting_(action),2
62
+ dated,1
63
+ two_side_up,1