AlexNet
AlexNet is the convolutional network that won ILSVRC 2012 and helped start the deep learning era in computer vision. LibreYOLO ships the single-tower, later revision of the architecture for image classification.
- Tasks
- classify
- Sizes
- b at 224 px
- Install
pip install libreyolo- Support tier
- Inference only, since v. Predict, validate and export only. Training features do not apply.
- Licenses
- Code BSD-3-Clause, weights BSD-3-Clause. Commercial use
Install
AlexNet needs no optional extra. Everything it imports is in the base install.
pip install libreyoloPredict
Weights download from Hugging Face on first use and are cached locally.
from libreyolo import LibreYOLO, SAMPLE_IMAGE model = LibreYOLO("LibreAlexNetb-cls.pt")result = model(SAMPLE_IMAGE, save=True) probs = result.probsprint(probs.top1, probs.top1conf)print(probs.top5, probs.top5conf)libreyolo predict model=LibreAlexNetb-cls.pt source=https://raw.githubusercontent.com/LibreYOLO/libreyolo/release/libreyolo/assets/parkour.jpg save=TrueA classifier returns result.probs instead of result.boxes: top1
and top5 give class indices, top1conf and top5conf give their
confidences. See prediction for sources, streaming and
result handling.
Variants
One size. The shipped graph is the later single-tower revision released by torchvision, with 64 first-layer filters and no local response normalization, not the original two-GPU 2012 architecture. LibreYOLO ships this family inference-only: prediction, ImageNet-style top-1/top-5 validation and export are supported, and fine-tuning is not implemented.
Validate
val() runs against an ImageFolder-style split (a directory with train/ and
val/ subfolders, one folder per class) and returns top-1 and top-5 accuracy.
from libreyolo import LibreYOLO model = LibreYOLO("LibreAlexNetb-cls.pt") # data is a directory root with train/ and val/ class-folder splits# (ImageFolder layout), not a dataset YAML.metrics = model.val(data="imagenet-1k/") print(metrics["metrics/accuracy_top1"])print(metrics["metrics/accuracy_top5"])libreyolo val model=LibreAlexNetb-cls.pt data=imagenet-1k/Export
| Task | ONNX | TorchScript | ExecuTorch | TensorRT | OpenVINO | Paddle | MNN | RKNN | ncnn | TFLite | CoreML | Core AI |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| classify | classify to ONNX: supported. | classify to TorchScript: supported. | classify to ExecuTorch: supported. | classify to TensorRT: supported. | classify to OpenVINO: supported. | classify to Paddle: not supported | classify to MNN: not supported | classify to RKNN: not supported | classify to ncnn: supported. | classify to TFLite: not supported | classify to CoreML: not supported | classify to Core AI: not supported |
An exported artifact loads back through LibreYOLO() on its file suffix, so a
.onnx or .engine file behaves like a checkpoint and returns the same
Results. Export lists the arguments every format accepts and
the extras a few of them add.
from libreyolo import LibreYOLO model = LibreYOLO("LibreAlexNetb-cls.pt")model.export(format="onnx")model.export(format="tensorrt", half=True)libreyolo export model=LibreAlexNetb-cls.pt format=onnxlibreyolo export model=LibreAlexNetb-cls.pt format=tensorrt half=Truefrom libreyolo import LibreYOLO, SAMPLE_IMAGE # The factory routes on the file suffix, so an exported artifact loads# like any checkpoint and returns the same Results object.model = LibreYOLO("LibreAlexNetb-cls.onnx")result = model(SAMPLE_IMAGE) print(result.probs.top1)Checkpoints
Every published weight file for this family.
| File | Input (px) | Weights license |
|---|---|---|
| classify | ||
| LibreAlexNetb-cls.pt | 224 | bsd-3-clause |
Every file above exists in the LibreYOLO org today and downloads on first use.
Licensing
Check the license on the Hugging Face repository of the specific weights you download. Every checkpoint in the LibreYOLO org carries one, and they are not always the same across a family. That repository is the authoritative source; the summary below describes what applied when this page was last verified.
This is a description of the licenses involved, not legal advice. If the answer matters commercially, read the licenses yourself and take your own counsel.
- Original work
- AlexNet, University of Toronto
- Upstream license
- BSD-3-Clause
- Upstream source
- github.com/pytorch/vision
- LibreYOLO code
- MIT
- Weights
- BSD-3-Clause, republished at huggingface.co/LibreYOLO
- Interpretation
- BSD-3-Clause is a permissive license, so these weights can be used in commercial and closed-source products. It asks you to keep the copyright notice, the list of conditions and the disclaimer with any copy you redistribute, and it forbids using the contributors' names to endorse a derived product without permission; it carries no explicit patent grant. LibreYOLO's code and the shipped checkpoint are both derived from torchvision's single-tower AlexNet, the later "one weird trick" graph, not the original two-GPU 2012 model, and no code from the 2012 paper's authors is republished here. Torchvision itself notes that BSD-3-Clause redistribution of a pretrained checkpoint is an implied basis rather than a grant written for that specific checkpoint, and that pretrained-model terms can depend on the data a model was trained on; LibreYOLO repeats that caveat on the hosted weights repository.