Skip to content
ModelListedExternal
Download

Beit Image Orientation Onnx

Export ONNX de amaye15/Beit-Base-Image-Orientation-Fixer (BEiT-base fine-tuné, classification d'orientation d'image en 4 classes). Le modèle d'origine n'est publié qu'en safetensors ; cet export permet de l'exécuter...

KindOtherBase modelamaye15/Beit-Base-Image-Orientation-FixerVersionRevision 6fdd52e

Model source

Kind
Other
File size
330 MB
Base model
amaye15/Beit-Base-Image-Orientation-Fixer
Version
vRevision 6fdd52e
Updated
Sep 28, 2026
Downloads
0
Source
Hugging Face

Source description

BEiT Image Orientation — ONNX

Export ONNX de amaye15/Beit-Base-Image-Orientation-Fixer (BEiT-base fine-tuné, classification d'orientation d'image en 4 classes). Le modèle d'origine n'est publié qu'en safetensors ; cet export permet de l'exécuter avec onnxruntime / transformers.js (Node, CPU, sans PyTorch).

Tout le crédit du modèle revient à @amaye15. Licence Apache-2.0, identique au modèle d'origine.

Tâche

Prédit la rotation horaire à appliquer pour redresser une image :

ClasseSignification
0image déjà droite
90tourner de 90° (horaire)
180tourner de 180°
270tourner de 270° (= 90° anti-horaire)

Entrée / sortie

  • Entrée pixel_values : float32 [1, 3, 384, 384], RGB, redimensionné en 384×384, normalisé (x/255 - 0.5) / 0.5.
  • Sortie logits : float32 [1, 4] → softmax puis argmax = classe.

Usage (onnxruntime-node)

import ort from 'onnxruntime-node';
import sharp from 'sharp';

const session = await ort.InferenceSession.create('model.onnx');
const S = 384, MEAN = 0.5, STD = 0.5;
const { data } = await sharp(path).rotate() // applique l'EXIF d'abord
  .removeAlpha().resize(S, S, { fit: 'fill' }).raw().toBuffer({ resolveWithObject: true });
const N = S * S, f = new Float32Array(3 * N);
for (let i = 0; i < N; i++) for (let c = 0; c < 3; c++) f[c * N + i] = (data[i * 3 + c] / 255 - MEAN) / STD;
const out = await session.run({ pixel_values: new ort.Tensor('float32', f, [1, 3, S, S]) });
const logits = Array.from(out.logits.data);
// softmax + argmax → [0, 90, 180, 270][cls] degrés horaires

Conseil de précision

Le modèle est bien calibré : confiance ~0.999 sur un cas franchement tourné, plus basse sur les images à orientation indéfinie (textures, murs, gros plans matière). Pour de l'auto-correction sûre, n'appliquer la rotation que si la confiance ≥ 0.99 (haute précision, ~zéro faux positif).

Conversion

Voir scripts/convert-orientation-onnx.py (torch + dynamo=False, opset 14).

Sources

1 source
Hugging FacePrimaryVersion 6fdd52e501fbff03f1867d2c8d0e1ee57746b1b0
huggingface.co/poutche/beit-image-orientation-onnx/tree/6fdd52e501fbff03f1867d2c8d0e1ee57746b1b0

Verified Sep 28

Model artifacts

1 artifact

model.onnx

onnx · 330 MB · SHA-256 859e531e8418…46d3 · Hugging Face

Download

Source excerpts

2 excerpts

--- license: apache-2.0 base_model: amaye15/Beit-Base-Image-Orientation-Fixer pipeline_tag: image-classification library_name: onnxruntime tags: - orientation - rotation - onnx - image-classification - beit --- # BEiT Image Orientation — ONNX Export **ONNX** de [`amaye15/Beit-Base-Image-Orientation-Fixer`](https://huggingface.co/amaye15/Beit-Base-Image-Orientation-Fixer) (BEiT-base fine-tuné, classification d'orientation d'image en 4 classes). Le modèle d'origine n'est publié qu'en `safetensors` ; cet export permet de l'exécuter avec **onnxruntime** / **transformers.js** (Node, CPU, sans PyTorch). Tout le crédit du modèle revient à [@amaye15](https://huggingface.co/amaye15). Licence Apache-2.0, identique au modèle d'origine. ## Tâche Prédit la rotation **horaire** à appliquer pour redresser une image : | Classe | Signification | |--------|---------------| | `0` | image déjà droite | | `90` | tourner de 90° (horaire) | | `180` | tourner de 180° | | `270` | tourner de 270° (= 90° anti-horaire) | ## Entrée / sortie - **Entrée** `pixel_values` : `float32 [1, 3, 384, 384]`, RGB, redimensionné en 384×384, normalisé `(x/255 - 0.5) / 0.5`. - **Sortie** `logits` : `float32 [1, 4]` → `softmax` puis `argmax` = classe. ## Usage (onnxruntime-node) ```js import ort from 'onnxruntime-node'; import sharp from 'sharp'; const session = await ort.InferenceSession.create('model.onnx'); const S = 384, MEAN = 0.5, STD = 0.5; const { data } = await sharp(path).rotate() // applique l'EXIF d'abord .removeAlpha().resize(S, S, { fit: 'fill' }).raw().toBuffer({ resolveWithObject: true }); const N = S * S, f = new Float32Array(3 * N); for (let i = 0; i < N; i++) for (let c = 0; c < 3; c++) f[c * N + i] = (data[i * 3 + c] / 255 - MEAN) / STD; const out = await session.run({ pixel_values: new ort.Tensor('float32', f, [1, 3, S, S]) }); const logits = Array.from(out.logits.data); // softmax + argmax → [0, 90, 180, 270][cls] degrés horaires ``` ## Conseil de précision Le modèle est **bien calibré** : confiance ~0.999 sur un cas franchement tourné, plus basse sur les images à orientation indéfinie (textures, murs, gros plans matière). Pour de l'auto-correction sûre, n'appliquer la rotation que si la confiance ≥ **0.99** (haute précision, ~zéro faux positif). ## Conversion Voir `scripts/convert-orientation-onnx.py` (torch + `dynamo=False`, opset 14).

Source context: 0 downloads · 0 likes · Pipeline image-classification · Library onnxruntime · Repo poutche/beit-image-orientation-onnx