Downloads · 30 days
0
dovaldev/lol-champions-onnx
lol-champions-onnx is a image classification model from dovaldev. Use it when you need a label for an image. It is set up for onnx. The card lists the license as mit.
Modelos ONNX para reconocer contenido visual de League of Legends. Este repositorio se genera desde el proyecto Astro y queda como paquete unificado para la web y el Space de Hugging Face.
Downloads · 30 days
0
Access
Public
Updated May 9, 2026
Repo size
76.3 MB
Likes
0
Public
Click a slice to open those files.
.data59.5 MB · 96%
From the Hugging Face model README
Modelos ONNX para reconocer contenido visual de League of Legends. Este repositorio se genera desde el proyecto Astro y queda como paquete unificado para la web y el Space de Hugging Face.
Demo: https://huggingface.co/spaces/dovaldev/lol-champions-demo
| Tarea | Backbone | Entrada | Clases | Archivo |
|---|---|---|---|---|
| champions | mobilenetv3_large_100 | 224x224 | 172 | champions.onnx |
| items | mobilenetv3_small_100 | 128x128 | 548 | items.onnx |
| summoner_spells | mobilenetv3_small_100 | 128x128 | 9 | summoner_spells.onnx |
| abilities | mobilenetv3_small_100 | 128x128 | 860 | abilities.onnx |
vision-manifest.json: índice canónico de modelos y archivos.*.labels.json: nombres, subtítulos y assets resueltos desde los manifiestos de Astro.champions.*: clasificador de campeones.items.*: clasificador de objetos.summoner_spells.*: clasificador de hechizos de invocador.abilities.*: clasificador de habilidades y pasivas.model.onnx, model.onnx.data y metadata.json: alias legacy del modelo de campeones para compatibilidad con integraciones antiguas.import json
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
from PIL import Image
REPO_ID = "dovaldev/lol-champions-onnx"
TASK = "champions" # champions, items, summoner_spells o abilities
manifest_path = hf_hub_download(REPO_ID, "vision-manifest.json")
manifest = json.load(open(manifest_path, "r", encoding="utf-8"))
model_info = manifest["models"][TASK]
onnx_path = hf_hub_download(REPO_ID, model_info["onnx_file"])
metadata_path = hf_hub_download(REPO_ID, model_info["metadata_file"])
if model_info.get("external_data_file"):
hf_hub_download(REPO_ID, model_info["external_data_file"])
metadata = json.load(open(metadata_path, "r", encoding="utf-8"))
classes = metadata["classes"]
size = int(metadata["input_size"])
mean = np.asarray(metadata.get("mean", [0.485, 0.456, 0.406]), dtype=np.float32)
std = np.asarray(metadata.get("std", [0.229, 0.224, 0.225]), dtype=np.float32)
def preprocess(img):
img = img.convert("RGB")
w, h = img.size
scale = max(size / w, size / h)
nw, nh = int(round(w * scale)), int(round(h * scale))
img = img.resize((nw, nh), Image.Resampling.BICUBIC)
left = (nw - size) // 2
top = (nh - size) // 2
img = img.crop((left, top, left + size, top + size))
arr = np.asarray(img, dtype=np.float32) / 255.0
arr = (arr - mean) / std
return np.expand_dims(np.transpose(arr, (2, 0, 1)), axis=0)
def softmax(x):
x = x - np.max(x, axis=1, keepdims=True)
exp = np.exp(x)
return exp / np.sum(exp, axis=1, keepdims=True)
session = ort.InferenceSession(onnx_path, providers=["CPUExecutionProvider"])
image = Image.open("sample.png")
logits = session.run(None, {session.get_inputs()[0].name: preprocess(image)})[0]
probs = softmax(logits)[0]
for index in np.argsort(-probs)[:5]:
print(classes[int(index)], float(probs[int(index)]))
Este paquete se mantiene sincronizado con la version de produccion del reconocedor. El manifiesto vision-manifest.json indica que archivos corresponden a cada tarea y permite cargar los modelos de forma programatica.