StarNet
StarNet (Ma et al. 2024; S1 to S4, ImageNet-1k): a small convolutional classifier whose blocks multiply two branches element-wise. Apache-2.0.
experimental Fork of huggingface/pytorch-image-models@0df212b · backends: portable, kernels
- Paper Rewrite the Stars CVPR 2024 · first released 29 Mar 2024
- Authors’ code ma-xu/Rewrite-the-Stars (PyTorch), not the code forked here: timm carries the architecture and the converted authors' checkpoints in its own, simpler API.
Paper 2024 Added in 0.2.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install "fastforks-core[timm]"
from fastforks import classification
model = classification.load("starnet_s1.in1k") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.logits
result.backend # what ran: mode, device, dtype, kernels fastforks bench starnet_s1.in1k Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
Input: synthetic, 224x224 (the task’s standard size)
| Backend | dtype | Time per call (ms) | vs original fp32 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 4.57 | – | 51 MiB/58 MiB | 2.8 | 0.30 |
| Original fp16torch.autocast(float16) around the call | fp16 | 7.29 | 0.63× | 51 MiB/60 MiB | 0.2 | 0.26 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 3.88 | 1.2× | 41 MiB/52 MiB | 1.6 | 0.24 |
| Kernels | fp16 | 0.683 | 6.7× | 41 MiB/56 MiB | 2.2 | 0.21 |
| Portable + torch.compile | 2.41 | 1.9× | 73 MiB/92 MiB | 6 (build) | – | |
| TensorRT fp16 | fp16 | 0.774 | 5.9× | 34 MiBenginenot comparable | 24 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-11. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-14 | Original | fp32 | 13.0 | 436 MiB process | – | 224x224 |
| Portable | fp16 | 14.0 | 400 MiB process | matches | 224x224 | |
| Portable | fp32 | 8.33 | 424 MiB process | matches | 224x224 | |
| Kernels | fp16 | not implemented | – | 224x224 | ||
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
- Code
- Apache-2.0
- Weights
- Apache-2.0 source
- Training data
-
- ImageNet-1k (ILSVRC 2012 classification) noncommercial, non-commercial
Our reading of the licences, not legal advice.
Weights
starnet_s1.in1k.safetensors 11.5 MB· hosted on Hugging Facefastforks downloads and checks these files on first use (fastforks download starnet_s1.in1k).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
ImageNet-1k val
5000 random images, top-1 / top-5 %
| Run | dtype | top-1 % ↑ | top-5 % ↑ | Δ top-1 % vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 74.50 | 91.94 | reference | 5000 | 0.534 |
| Original fp16 | fp16 | 74.50 | 91.96 | ±0.00 | 5000 | 0.411 |
| Portable fp32 | fp32 | 74.48 | 91.92 | −0.02 | 5000 | 0.931 |
| Portable | fp16 | 74.48 | 91.92 | −0.02 | 5000 | 0.646 |
| Kernels | fp16 | 74.52 | 91.92 | +0.02 | 5000 | 0.324 |
fastforks: the model's own resize / crop on the GPU; original: the library's pretrained loader and its PIL eval transform. Original = the authors’ code, same checkpoint and protocol. Measured on original fp32, original fp16: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11; portable fp32: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6f0a70e1, 2026-11-17; portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks 9e68b313, 2026-11-11.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 1.1e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0035 and p99 <= 0.012 (absolute error of the output logits).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.000011 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.0035 | 0.00142 |
| GPU default dtypes, p99 |diff| | ≤ 0.012 | 0.00462 |
Recorded for starnet_s1.in1k on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-11, with these kernels: cudnn_haccfvm_convfvm_extrafvm_mbfvm_r3
Details
StarNet (Ma et al. 2024, Rewrite the Stars): a small convolutional classifier whose blocks multiply two branches element-wise (the star operation).
- Input / output
- Input: one RGB image. Output: ImageNet-1k class logits.
- Input size
- fixed 224x224: the input is resized (short side 256) and centre-cropped to it; tested up to 224x224 (41 MiB allocated)
- Outputs
logits- Checkpoint
arch="starnet_s1.in1k"- CUDA kernels
cudnn_haccconvolutions with fp16 accumulation (cuDNN)fvm_convfused convolutions for image classifiersfvm_extrafused transformer row operations (rotary split, SwiGLU with LayerNorm)fvm_mbfused MBConv blocks (MobileNet and EfficientNet families)fvm_r3further fused classifier blocks
- Apple (MPS)
- fp32, fp16
Full reference, generated from the repository
StarNet (Ma et al. 2024; S1 to S4, ImageNet-1k): a small convolutional classifier whose blocks multiply two branches element-wise. Apache-2.0.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
starnet_s1.in1k | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 4.57 7.29 3.88 0.683 2.41 0.774 | 51 / 58 51 / 60 41 / 52 41 / 56 73 / 92 73 / 86 |
starnet_s2.in1k | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 3.64 5.63 3.02 0.578 1.96 0.622 | 56 / 80 55 / 64 43 / 54 43 / 58 75 / 94 74 / 88 |
starnet_s3.in1k | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 4.96 7.67 4.19 0.715 2.60 0.878 | 64 / 88 67 / 76 47 / 60 47 / 64 79 / 100 80 / 96 |
starnet_s4.in1k | synthetic (224x224) | original (fp32) original portable kernels portable + torch.compile TensorRT fp16 | 6.84 11.3 5.63 0.912 3.37 1.18 | 71 / 94 77 / 86 50 / 66 51 / 72 82 / 106 85 / 104 |
Details
- Original code: https://github.com/huggingface/pytorch-image-models at
0df212b369a5 - Code licence: Apache-2.0 (permissive); files:
- Weights licence: Apache-2.0
- Licence evidence: https://huggingface.co/timm/starnet_s1.in1k/blob/e3fbe6d1e24b6293fa6e7b897f380bd62f77e01f/README.md
- Training data: ImageNet-1k (ILSVRC 2012 classification)
- Kernel libraries:
cudnn_hacc,fvm_conv,fvm_extra,fvm_mb,fvm_r3 - Variants:
starnet_s1.in1k(default ofstarnet_s1),starnet_s2.in1k(default ofstarnet_s2),starnet_s3.in1k(default ofstarnet_s3),starnet_s4.in1k(default ofstarnet_s4) - Outputs: logits; label_set:
imagenet-1k - Input size: fixed 224x224: the input is resized (short side 256) and centre-cropped to it
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
starnet_s1.in1k224x224 (0.0 GiB peak allocated, 0.1 reserved);starnet_s2.in1k224x224 (0.0 GiB peak allocated, 0.1 reserved);starnet_s3.in1k224x224 (0.0 GiB peak allocated, 0.1 reserved);starnet_s4.in1k224x224 (0.0 GiB peak allocated, 0.1 reserved) starnet_s1.in1k224x224, first call: portable + torch.compile 6 s (cold Inductor cache), TensorRT fp16 24 s (ONNX + engine).starnet_s2.in1k224x224, first call: portable + torch.compile 6 s (cold Inductor cache), TensorRT fp16 25 s (ONNX + engine).starnet_s3.in1k224x224, first call: portable + torch.compile 6 s (cold Inductor cache), TensorRT fp16 28 s (ONNX + engine).starnet_s4.in1k224x224, first call: portable + torch.compile 7 s (cold Inductor cache), TensorRT fp16 28 s (ONNX + engine).starnet_s1.in1koriginal 224x224: torch.autocast(float16) around the callstarnet_s2.in1koriginal 224x224: torch.autocast(float16) around the callstarnet_s3.in1koriginal 224x224: torch.autocast(float16) around the callstarnet_s4.in1koriginal 224x224: torch.autocast(float16) around the callstarnet_s1.in1kload / first call: original 0.18 s / 0.26 s, portable 1.6 s / 0.241 s, kernels 2.2 s / 0.214 sstarnet_s2.in1kload / first call: original 0.17 s / 0.021 s, portable 1.62 s / 0.24 s, kernels 1.86 s / 0.06 sstarnet_s3.in1kload / first call: original 0.3 s / 0.01 s, portable 1.6 s / 0.239 s, kernels 1.82 s / 0.052 sstarnet_s4.in1kload / first call: original 0.21 s / 0.013 s, portable 1.66 s / 0.245 s, kernels 2.0 s / 0.051 s- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
fastforks: the model's own resize / crop on the GPU; original: the library's pretrained loader and its PIL eval transform. Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | original fp16 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|---|
starnet_s1.in1k | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 74.50 / 91.94 | 74.50 / 91.96 | 74.48 / 91.92 | 74.48 / 91.92 | 74.52 / 91.92 | |
starnet_s2.in1k | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 75.82 / 92.14 | 75.84 / 92.12 | 75.84 / 92.10 | 75.82 / 92.10 | 75.88 / 92.12 | |
starnet_s3.in1k | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 78.08 / 93.72 | 78.14 / 93.74 | 78.10 / 93.80 | 78.06 / 93.82 | 78.06 / 93.80 | |
starnet_s4.in1k | ImageNet-1k val, 5000 random images, top-1 / top-5 % | 80.08 / 94.56 | 80.06 / 94.56 | 79.98 / 94.58 | 79.98 / 94.58 | 79.92 / 94.58 |
Measured on portable: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 9e68b313, 2026-11-11; portable32: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 6f0a70e1, 2026-11-17; kernels: NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks 9e68b313, 2026-11-11.
Parity
CPU, float32: max |diff| <= 1.1e-05 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.0035 and p99 <= 0.012 (absolute error of the output logits).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
starnet_s1.in1k | 0.00142 / 0.00462 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120 |
starnet_s2.in1k | 0.00143 / 0.00519 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120 |
starnet_s3.in1k | 0.00187 / 0.00719 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120 |
starnet_s4.in1k | 0.00229 / 0.00742 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400, fvm_conv@f1d064e539e1:sm_120, fvm_extra@3208ce525a91:sm_120, fvm_mb@720dd3f29bf7:sm_120, fvm_r3@f54eb890e23c:sm_120 |
Example output
One fixed input through this checkpoint, the same for every model of the task (kernels · float16 · NVIDIA GeForce RTX 5060 Ti).
Top 5
Input: Chelsea the cat, Stéfan van der Walt (CC0).