Image Classification Implementation
July 10, 2025 ยท View on GitHub
Setup
conda create -n tinynext python=3.9
conda activate tinynext
pip install -r requirements.txt
Image Classification for ImageNet-1K:
| Model | Top-1 accuracy | #params | MACs | Latency | Logs |
|---|---|---|---|---|---|
| TinyNeXt-M | 75.3% | 2.3M | 475M | 19.4ms | M |
| TinyNeXt-S | 72.7% | 1.3M | 304M | 14.3ms | S |
| TinyNeXt-T | 71.5% | 1.0M | 259M | 12.7ms | T |
Latency is measured on Nvidia Jetson Nano.
Training
Dataset Preparation
Download the ImageNet-1K dataset and structure the data as follows:
/path/to/imagenet-1k/
train/
class1/
img1.jpeg
class2/
img2.jpeg
validation/
class1/
img3.jpeg
class2/
img4.jpeg
Train TinyNeXt-M with 8 GPUs in one node:
python -m torch.distributed.launch --nproc_per_node=8 --master_port 29501 --use_env main.py --model 'tinynext_m' --data-path '/data/imagenet' --reprob 0.0 --aa="" --mixup 0 --cutmix 0.0
Train TinyNeXt-S with 8 GPUs in one node:
python -m torch.distributed.launch --nproc_per_node=8 --master_port 29501 --use_env main.py --model 'tinynext_s' --data-path '/data/imagenet' --reprob 0.0 --aa="" --mixup 0 --cutmix 0.0
Train TinyNeXt-T with 8 GPUs in one node:
python -m torch.distributed.launch --nproc_per_node=8 --master_port 29501 --use_env main.py --model 'tinynext_t' --data-path '/data/imagenet' --reprob 0.0 --aa="" --mixup 0 --cutmix 0.0
Evaluation
TinyNeXt-M
Test with 8 GPUs in one node:
python -m torch.distributed.launch --nproc_per_node=8 --master_port 29501 --use_env \
main.py --model 'tinynext_m' --data-path '/data/imagenet' --eval --resume "logs/tinynext_m/tinynext_m.pth"
This should give * eval loss: 1.0679 top1: 75.28 top5: 92.24
TinyNeXt-S
Test with 8 GPUs in one node:python -m torch.distributed.launch --nproc_per_node=8 --master_port 29501 --use_env \
main.py --model 'tinynext_s' --data-path '/data/imagenet' --eval --resume "logs/tinynext_s/tinynext_s.pth"
This should give * eval loss: 1.1817 top1: 72.70 top5: 90.93
TinyNeXt-T
Test with 8 GPUs in one node:python -m torch.distributed.launch --nproc_per_node=8 --master_port 29501 --use_env \
main.py --model 'tinynext_t' --data-path '/data/imagenet' --eval --resume "logs/tinynext_t/tinynext_t.pth"
This should give * eval loss: 1.2419 top1: 71.54 top5: 90.24