Upload folder using huggingface_hub
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- README.md +39 -0
- validation/generate_index.py +23 -5
- validation/generate_thumbs.py +48 -0
- validation/thumbs/dark_01.png +0 -0
- validation/thumbs/dark_02.png +0 -0
- validation/thumbs/dark_03.png +0 -0
- validation/thumbs/dark_04.png +0 -0
- validation/thumbs/dark_05.png +0 -0
- validation/thumbs/dark_06.png +0 -0
- validation/thumbs/dark_07.png +0 -0
- validation/thumbs/dark_08.png +0 -0
- validation/thumbs/dark_09.png +0 -0
- validation/thumbs/dark_10.png +0 -0
- validation/thumbs/dark_11.png +0 -0
- validation/thumbs/dark_12.png +0 -0
- validation/thumbs/dark_13.png +0 -0
- validation/thumbs/dark_14.png +0 -0
- validation/thumbs/dark_15.png +0 -0
- validation/thumbs/dark_16.png +0 -0
- validation/thumbs/dark_17.png +0 -0
- validation/thumbs/dark_18.png +0 -0
- validation/thumbs/dark_19.png +0 -0
- validation/thumbs/dark_20.png +0 -0
- validation/thumbs/flat_01.png +0 -0
- validation/thumbs/flat_02.png +0 -0
- validation/thumbs/flat_03.png +0 -0
- validation/thumbs/flat_04.png +0 -0
- validation/thumbs/flat_05.png +0 -0
- validation/thumbs/flat_06.png +0 -0
- validation/thumbs/flat_07.png +0 -0
- validation/thumbs/flat_08.png +0 -0
- validation/thumbs/flat_09.png +0 -0
- validation/thumbs/flat_10.png +0 -0
- validation/thumbs/flat_11.png +0 -0
- validation/thumbs/flat_12.png +0 -0
- validation/thumbs/flat_13.png +0 -0
- validation/thumbs/flat_14.png +0 -0
- validation/thumbs/flat_15.png +0 -0
- validation/thumbs/flat_16.png +0 -0
- validation/thumbs/flat_17.png +0 -0
- validation/thumbs/flat_18.png +0 -0
- validation/thumbs/flat_19.png +0 -0
- validation/thumbs/flat_20.png +0 -0
- validation/thumbs/modern_01.png +0 -0
- validation/thumbs/modern_02.png +0 -0
- validation/thumbs/modern_03.png +0 -0
- validation/thumbs/modern_04.png +0 -0
- validation/thumbs/modern_05.png +0 -0
- validation/thumbs/modern_06.png +0 -0
- validation/thumbs/modern_07.png +0 -0
README.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Anime Style Classifier - EfficientNet-B0
|
| 2 |
|
| 3 |
A fine-tuned EfficientNet-B0 model for classifying anime/visual novel images into 6 distinct art styles.
|
|
@@ -274,3 +281,35 @@ If you want, I can prepare the git commands and a short final checklist and run
|
|
| 274 |
## Contact
|
| 275 |
|
| 276 |
For questions or feedback, please open an issue on the GitHub repository.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#
|
| 2 |
+
---
|
| 3 |
+
language: "en"
|
| 4 |
+
license: "mit"
|
| 5 |
+
tags: ["image-classification","anime","art-style","efficientnet-b0","pytorch","safetensors","multi-class"]
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
# Anime Style Classifier - EfficientNet-B0
|
| 9 |
|
| 10 |
A fine-tuned EfficientNet-B0 model for classifying anime/visual novel images into 6 distinct art styles.
|
|
|
|
| 281 |
## Contact
|
| 282 |
|
| 283 |
For questions or feedback, please open an issue on the GitHub repository.
|
| 284 |
+
|
| 285 |
+
## Published validation preview
|
| 286 |
+
|
| 287 |
+
Below is a compact thumbnail-based preview of a subset of the published validation images. Thumbnails link to the full-size images under `validation/images/`.
|
| 288 |
+
|
| 289 |
+
<!-- BEGIN VALIDATION GRID (generated) -->
|
| 290 |
+
|
| 291 |
+
```markdown
|
| 292 |
+
|
| 293 |
+
# Validation set visual grid
|
| 294 |
+
|
| 295 |
+
A compact birds-eye preview. Columns: modern | painterly | retro | moe | flat | dark
|
| 296 |
+
|
| 297 |
+
|
| 298 |
+
| Scene | Modern | Painterly | Retro | Moe | Flat | Dark |
|
| 299 |
+
|---|---|---|---|---|---|---|
|
| 300 |
+
| `scene133_fey_crossing_footbridge_retro_00001_.png` | | | <a href="validation/images/retro/retro_02.png"><img src="validation/thumbs/retro_02.png" alt="retro_02.png" style="width:150px;height:auto;margin:2px;"/></a> | | | |
|
| 301 |
+
| `scene16_rain_on_train_crossing_moe_00001_.png` | | | | <a href="validation/images/moe/moe_04.png"><img src="validation/thumbs/moe_04.png" alt="moe_04.png" style="width:150px;height:auto;margin:2px;"/></a> | | |
|
| 302 |
+
| `scene241_meteor_defense_bunker_moe_00001_.png` | | | | <a href="validation/images/moe/moe_07.png"><img src="validation/thumbs/moe_07.png" alt="moe_07.png" style="width:150px;height:auto;margin:2px;"/></a> | | |
|
| 303 |
+
| `scene257_holo_library_steps_painterly_00001_.png` | | <a href="validation/images/painterly/painterly_07.png"><img src="validation/thumbs/painterly_07.png" alt="painterly_07.png" style="width:150px;height:auto;margin:2px;"/></a> | | | | |
|
| 304 |
+
| `scene31_campus_courtyard_rain_flat_00001_.png` | | | | | <a href="validation/images/flat/flat_10.png"><img src="validation/thumbs/flat_10.png" alt="flat_10.png" style="width:150px;height:auto;margin:2px;"/></a> | |
|
| 305 |
+
| `scene31_campus_courtyard_rain_painterly_00001_.png` | | <a href="validation/images/painterly/painterly_08.png"><img src="validation/thumbs/painterly_08.png" alt="painterly_08.png" style="width:150px;height:auto;margin:2px;"/></a> | | | | |
|
| 306 |
+
| `scene31_campus_courtyard_rain_retro_00001_.png` | | | <a href="validation/images/retro/retro_10.png"><img src="validation/thumbs/retro_10.png" alt="retro_10.png" style="width:150px;height:auto;margin:2px;"/></a> | | | |
|
| 307 |
+
| `scene39_riverbank_spring_cycling_dark_00001_.png` | | | | | | <a href="validation/images/dark/dark_11.png"><img src="validation/thumbs/dark_11.png" alt="dark_11.png" style="width:150px;height:auto;margin:2px;"/></a> |
|
| 308 |
+
| `scene57_sky_garden_walkway_dark_00001_.png` | | | | | | <a href="validation/images/dark/dark_15.png"><img src="validation/thumbs/dark_15.png" alt="dark_15.png" style="width:150px;height:auto;margin:2px;"/></a> |
|
| 309 |
+
| `scene72_spirit_shrine_waterfall_modern_00001_.png` | <a href="validation/images/modern/modern_16.png"><img src="validation/thumbs/modern_16.png" alt="modern_16.png" style="width:150px;height:auto;margin:2px;"/></a> | | | | | |
|
| 310 |
+
| `scene99_town_square_clock_rain_flat_00001_.png` | | | | | <a href="validation/images/flat/flat_19.png"><img src="validation/thumbs/flat_19.png" alt="flat_19.png" style="width:150px;height:auto;margin:2px;"/></a> | |
|
| 311 |
+
| `scene99_town_square_clock_rain_modern_00001_.png` | <a href="validation/images/modern/modern_20.png"><img src="validation/thumbs/modern_20.png" alt="modern_20.png" style="width:150px;height:auto;margin:2px;"/></a> | | | | | |
|
| 312 |
+
|
| 313 |
+
```
|
| 314 |
+
|
| 315 |
+
<!-- END VALIDATION GRID -->
|
validation/generate_index.py
CHANGED
|
@@ -16,7 +16,7 @@ A compact birds-eye preview. Columns: modern | painterly | retro | moe | flat |
|
|
| 16 |
|
| 17 |
"""
|
| 18 |
|
| 19 |
-
CELL_HTML = '<img src="{img}" alt="{alt}" style="width:150px;height:auto;margin:2px;"
|
| 20 |
|
| 21 |
|
| 22 |
def load_annotations(path):
|
|
@@ -31,7 +31,7 @@ def build_scene_map(annotations):
|
|
| 31 |
return scene_map
|
| 32 |
|
| 33 |
|
| 34 |
-
def render_grid(scene_map, images_dir):
|
| 35 |
lines = [MD_HEADER]
|
| 36 |
# header row with style labels
|
| 37 |
header = '| Scene | ' + ' | '.join(s.capitalize() for s in STYLES) + ' |'
|
|
@@ -39,13 +39,30 @@ def render_grid(scene_map, images_dir):
|
|
| 39 |
lines.append(header)
|
| 40 |
lines.append(sep)
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
for scene, style_map in sorted(scene_map.items()):
|
| 43 |
cells = []
|
| 44 |
for s in STYLES:
|
| 45 |
if s in style_map:
|
| 46 |
fn = style_map[s]
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
else:
|
| 50 |
cells.append('')
|
| 51 |
scene_cell = f'`{scene}`'
|
|
@@ -59,11 +76,12 @@ def main():
|
|
| 59 |
parser.add_argument('--annotations', default='validation/annotations.json')
|
| 60 |
parser.add_argument('--out', default='validation/validation_grid.md')
|
| 61 |
parser.add_argument('--images-dir', default='validation/images')
|
|
|
|
| 62 |
args = parser.parse_args()
|
| 63 |
|
| 64 |
annotations = load_annotations(args.annotations)
|
| 65 |
scene_map = build_scene_map(annotations)
|
| 66 |
-
md = render_grid(scene_map, args.images_dir)
|
| 67 |
Path(args.out).write_text(md)
|
| 68 |
print(f"Wrote {args.out}")
|
| 69 |
|
|
|
|
| 16 |
|
| 17 |
"""
|
| 18 |
|
| 19 |
+
CELL_HTML = '<a href="{full}"><img src="{img}" alt="{alt}" style="width:150px;height:auto;margin:2px;"/></a>'
|
| 20 |
|
| 21 |
|
| 22 |
def load_annotations(path):
|
|
|
|
| 31 |
return scene_map
|
| 32 |
|
| 33 |
|
| 34 |
+
def render_grid(scene_map, images_dir, thumbs_dir=None):
|
| 35 |
lines = [MD_HEADER]
|
| 36 |
# header row with style labels
|
| 37 |
header = '| Scene | ' + ' | '.join(s.capitalize() for s in STYLES) + ' |'
|
|
|
|
| 39 |
lines.append(header)
|
| 40 |
lines.append(sep)
|
| 41 |
|
| 42 |
+
# helper to find a file by name under images_dir
|
| 43 |
+
from pathlib import Path
|
| 44 |
+
def find_file(fn):
|
| 45 |
+
p = Path(images_dir)
|
| 46 |
+
for cand in p.rglob(fn):
|
| 47 |
+
return str(cand)
|
| 48 |
+
return None
|
| 49 |
+
|
| 50 |
for scene, style_map in sorted(scene_map.items()):
|
| 51 |
cells = []
|
| 52 |
for s in STYLES:
|
| 53 |
if s in style_map:
|
| 54 |
fn = style_map[s]
|
| 55 |
+
full_path = find_file(fn) or f"{images_dir}/{fn}"
|
| 56 |
+
# prefer thumbnail if available (thumbs are flat)
|
| 57 |
+
if thumbs_dir:
|
| 58 |
+
thumb_path = Path(thumbs_dir) / fn
|
| 59 |
+
if not thumb_path.exists():
|
| 60 |
+
thumb_path = full_path
|
| 61 |
+
else:
|
| 62 |
+
thumb_path = str(thumb_path)
|
| 63 |
+
else:
|
| 64 |
+
thumb_path = full_path
|
| 65 |
+
cells.append(CELL_HTML.format(img=thumb_path, full=full_path, alt=fn))
|
| 66 |
else:
|
| 67 |
cells.append('')
|
| 68 |
scene_cell = f'`{scene}`'
|
|
|
|
| 76 |
parser.add_argument('--annotations', default='validation/annotations.json')
|
| 77 |
parser.add_argument('--out', default='validation/validation_grid.md')
|
| 78 |
parser.add_argument('--images-dir', default='validation/images')
|
| 79 |
+
parser.add_argument('--thumbs-dir', default=None)
|
| 80 |
args = parser.parse_args()
|
| 81 |
|
| 82 |
annotations = load_annotations(args.annotations)
|
| 83 |
scene_map = build_scene_map(annotations)
|
| 84 |
+
md = render_grid(scene_map, args.images_dir, thumbs_dir=args.thumbs_dir)
|
| 85 |
Path(args.out).write_text(md)
|
| 86 |
print(f"Wrote {args.out}")
|
| 87 |
|
validation/generate_thumbs.py
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Generate thumbnails for images in validation/images/ into validation/thumbs/.
|
| 3 |
+
|
| 4 |
+
Creates 256px-wide thumbnails (preserving aspect ratio).
|
| 5 |
+
"""
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
from PIL import Image
|
| 8 |
+
import argparse
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def make_thumb(src_path: Path, dst_path: Path, width: int = 256):
|
| 12 |
+
dst_path.parent.mkdir(parents=True, exist_ok=True)
|
| 13 |
+
with Image.open(src_path) as im:
|
| 14 |
+
w, h = im.size
|
| 15 |
+
if w <= width:
|
| 16 |
+
im.save(dst_path)
|
| 17 |
+
return
|
| 18 |
+
new_h = int(width * h / w)
|
| 19 |
+
im = im.resize((width, new_h), Image.LANCZOS)
|
| 20 |
+
im.save(dst_path)
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def main():
|
| 24 |
+
p = argparse.ArgumentParser()
|
| 25 |
+
p.add_argument('--images-dir', default='validation/images')
|
| 26 |
+
p.add_argument('--out-dir', default='validation/thumbs')
|
| 27 |
+
p.add_argument('--width', type=int, default=256)
|
| 28 |
+
args = p.parse_args()
|
| 29 |
+
|
| 30 |
+
images_dir = Path(args.images_dir)
|
| 31 |
+
out_dir = Path(args.out_dir)
|
| 32 |
+
if not images_dir.exists():
|
| 33 |
+
raise SystemExit(f"Images dir not found: {images_dir}")
|
| 34 |
+
|
| 35 |
+
exts = ('.png', '.jpg', '.jpeg', '.webp')
|
| 36 |
+
files = [p for p in images_dir.rglob('*') if p.suffix.lower() in exts]
|
| 37 |
+
if not files:
|
| 38 |
+
print('No images found')
|
| 39 |
+
return
|
| 40 |
+
|
| 41 |
+
for f in sorted(files):
|
| 42 |
+
dst = out_dir / f.name
|
| 43 |
+
make_thumb(f, dst, width=args.width)
|
| 44 |
+
print('Wrote', dst)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
if __name__ == '__main__':
|
| 48 |
+
main()
|
validation/thumbs/dark_01.png
ADDED
|
|
validation/thumbs/dark_02.png
ADDED
|
|
validation/thumbs/dark_03.png
ADDED
|
|
validation/thumbs/dark_04.png
ADDED
|
|
validation/thumbs/dark_05.png
ADDED
|
|
validation/thumbs/dark_06.png
ADDED
|
|
validation/thumbs/dark_07.png
ADDED
|
|
validation/thumbs/dark_08.png
ADDED
|
|
validation/thumbs/dark_09.png
ADDED
|
|
validation/thumbs/dark_10.png
ADDED
|
|
validation/thumbs/dark_11.png
ADDED
|
|
validation/thumbs/dark_12.png
ADDED
|
|
validation/thumbs/dark_13.png
ADDED
|
|
validation/thumbs/dark_14.png
ADDED
|
|
validation/thumbs/dark_15.png
ADDED
|
|
validation/thumbs/dark_16.png
ADDED
|
|
validation/thumbs/dark_17.png
ADDED
|
|
validation/thumbs/dark_18.png
ADDED
|
|
validation/thumbs/dark_19.png
ADDED
|
|
validation/thumbs/dark_20.png
ADDED
|
|
validation/thumbs/flat_01.png
ADDED
|
|
validation/thumbs/flat_02.png
ADDED
|
|
validation/thumbs/flat_03.png
ADDED
|
|
validation/thumbs/flat_04.png
ADDED
|
|
validation/thumbs/flat_05.png
ADDED
|
|
validation/thumbs/flat_06.png
ADDED
|
|
validation/thumbs/flat_07.png
ADDED
|
|
validation/thumbs/flat_08.png
ADDED
|
|
validation/thumbs/flat_09.png
ADDED
|
|
validation/thumbs/flat_10.png
ADDED
|
|
validation/thumbs/flat_11.png
ADDED
|
|
validation/thumbs/flat_12.png
ADDED
|
|
validation/thumbs/flat_13.png
ADDED
|
|
validation/thumbs/flat_14.png
ADDED
|
|
validation/thumbs/flat_15.png
ADDED
|
|
validation/thumbs/flat_16.png
ADDED
|
|
validation/thumbs/flat_17.png
ADDED
|
|
validation/thumbs/flat_18.png
ADDED
|
|
validation/thumbs/flat_19.png
ADDED
|
|
validation/thumbs/flat_20.png
ADDED
|
|
validation/thumbs/modern_01.png
ADDED
|
|
validation/thumbs/modern_02.png
ADDED
|
|
validation/thumbs/modern_03.png
ADDED
|
|
validation/thumbs/modern_04.png
ADDED
|
|
validation/thumbs/modern_05.png
ADDED
|
|
validation/thumbs/modern_06.png
ADDED
|
|
validation/thumbs/modern_07.png
ADDED
|
|