File size: 2,917 Bytes
68977dd
 
a6067f8
 
 
 
 
 
 
 
 
b40ea99
 
7f8c2f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8416c6b
 
7f8c2f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0834441
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
license: mit
datasets:
- zh-plus/tiny-imagenet
pipeline_tag: image-classification
library_name: transformers
tags:
- Squeeze
- New
- Image
- Clf
metrics:
- accuracy
---

# SqueezeNet-SwiGLU (Modernized SqueezeNet Architecture)

**SqueezeNet-SwiGLU** is a modernized, ultra-lightweight Convolutional Neural Network (CNN) architecture based on the original SqueezeNet v1.1 design. It incorporates state-of-the-art deep learning architectural enhancements, including **SwiGLU gated activations**, **FP32 Layer Normalization**, and **residual block scaling**, delivering superior feature representation while maintaining a minimal parameter footprint.

---

## Key Architectural Improvements (vs. Original SqueezeNet)

Compared to the legacy SqueezeNet v1.1 (Iandola et al., 2016), this model introduces several architectural modernizations:

| Feature | Legacy SqueezeNet v1.1 | **SqueezeNet-SwiGLU (This Model)** |
| :--- | :--- | :--- |
| **Activation Function** | Standard ReLU | **Residual-Scaled SwiGLU Gated Activation** |
| **Normalization** | Batch Normalization | **FP32 Layer Normalization (`GroupNorm(1, C)`)** |
| **Batch Size Dependency** | High (sensitive to batch stats & EMA lag) | **Zero (Inference identical across any batch size)** |
| **Gradient Flow** | Standard Fire Connections | **Residual Fire Block Skip Connections & Scaling** |
| **Activation Variance** | Prone to un-bounded drift | **Strictly bounded via LayerNorm & FP32 Precision** |

---

## Benchmark & Evaluation

- **Evaluation Dataset**: ImageNet 200-Class Test Split (Tiny-ImageNet Categories)
- **Input Resolution**: 64 × 64 pixels (native) / 224 × 224 (interpolated)
- **Top-1 Accuracy**: 50.51%
- **Top-5 Accuracy**: 75.06%

---

## Target Usecases & Applications

Due to its ultra-compact size and high throughput, **SqueezeNet-SwiGLU** is optimized for resource-constrained deployment environments:

1. **Edge & IoT Intelligence**: Microcontrollers, Raspberry Pi, NVIDIA Jetson, and embedded vision hardware.
2. **Mobile AI Applications**: On-device real-time visual classification (iOS CoreML / Android ONNX).
3. **High-FPS Video Analytics**: Lightweight feature backbone for real-time surveillance, robotics, and drone navigation.
4. **Microservice Backends**: Serving high-throughput image classification with minimal memory overhead per GPU/CPU node.

---

## How to Use

### Fast Inference with Hugging Face `pipeline`

```python
from transformers import pipeline

# Initialize the classification pipeline (requires trust_remote_code=True)
classifier = pipeline(
    "image-classification",
    model="kd13/Modern-SqueezeNet",  
    trust_remote_code=True
)

# Run prediction on an image URL or local PIL Image
results = classifier("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")

for pred in results:
    print(f"Label: {pred['label']} | Score: {pred['score']:.4f}")