2c6829 commited on
Commit
db8e1bc
Β·
verified Β·
1 Parent(s): 9835abb

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +128 -0
README.md ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LiteCNNPro Model - Pure C++ Inference
2
+
3
+ **Ultra-lightweight CNN model for dog breed classification**
4
+
5
+ ## Model Details
6
+
7
+ - **Model**: LiteCNNPro (Pure C++ implementation)
8
+ - **Parameters**: 600K
9
+ - **Classes**: 120 (Stanford Dogs dataset)
10
+ - **Input**: 224Γ—224 RGB images
11
+ - **Framework**: PyTorch (training) β†’ Pure C++ (inference)
12
+ - **Memory**: 26MB total (4MB weights + 22MB runtime)
13
+
14
+ ## Architecture
15
+
16
+ ```
17
+ Stem: Conv2D(3β†’32) + BatchNorm + ReLU6
18
+ Features: 7Γ— Depthwise Separable Conv blocks
19
+ - Block 0: 32β†’64 (stride 2)
20
+ - Block 1: 64β†’128 (stride 2)
21
+ - Block 2-3: 128β†’256 (stride 2)
22
+ - Block 4-6: 256β†’512
23
+ - SE (Squeeze-Excitation) attention in each block
24
+ Classifier: AdaptiveAvgPool β†’ FC(512β†’256) β†’ FC(256β†’120)
25
+ ```
26
+
27
+ ## Usage
28
+
29
+ ### Download Model
30
+
31
+ ```bash
32
+ wget https://huggingface.co/2c6829/litecnn-pure-cpp/resolve/main/model_weights.bin
33
+ wget https://huggingface.co/2c6829/litecnn-pure-cpp/resolve/main/breed_classes.json
34
+ ```
35
+
36
+ ### Build and Run
37
+
38
+ ```bash
39
+ # Clone the inference server
40
+ git clone https://github.com/stupidcoderJung/litecnn-pure-cpp
41
+ cd litecnn-pure-cpp
42
+
43
+ # Place model files
44
+ mv model_weights.bin weights/
45
+ mv breed_classes.json .
46
+
47
+ # Build
48
+ mkdir -p build && cd build
49
+ cmake .. -DCMAKE_BUILD_TYPE=Release
50
+ make -j4
51
+
52
+ # Run server
53
+ ./litecnn_server --port 8080
54
+ ```
55
+
56
+ ### API Example
57
+
58
+ ```bash
59
+ # Health check
60
+ curl http://localhost:8080/health
61
+
62
+ # Predict
63
+ curl -X POST http://localhost:8080/predict \
64
+ -F "image=@dog.jpg"
65
+ ```
66
+
67
+ **Response**:
68
+ ```json
69
+ {
70
+ "predictions": [
71
+ {
72
+ "class_id": 81,
73
+ "score": 0.95,
74
+ "breed_en": "Border collie",
75
+ "breed_ko": "보더 콜리"
76
+ }
77
+ ]
78
+ }
79
+ ```
80
+
81
+ ## Performance
82
+
83
+ | Metric | Value |
84
+ |--------|-------|
85
+ | Memory (RSS) | 26 MB |
86
+ | Binary Size | 803 KB |
87
+ | Weights Size | 4.0 MB |
88
+ | Inference Time | <100ms (CPU) |
89
+
90
+ **Comparison**:
91
+ - PyTorch: 322 MB β†’ **92% reduction** βœ…
92
+ - LibTorch: 130 MB β†’ **80% reduction** βœ…
93
+ - ONNX Runtime: 102 MB β†’ **75% reduction** βœ…
94
+
95
+ ## Files
96
+
97
+ - `model_weights.bin` (4.0 MB) - Model weights in binary format
98
+ - `breed_classes.json` (7.4 KB) - 120 dog breeds (English + Korean)
99
+ - `extract_weights.py` - PyTorch checkpoint β†’ binary converter
100
+
101
+ ## Training
102
+
103
+ The model was trained on the Stanford Dogs dataset with:
104
+ - Optimizer: AdamW
105
+ - Learning rate: 1e-3
106
+ - Augmentation: Random flip, rotation, color jitter
107
+ - Epochs: 50
108
+ - Best validation accuracy: ~85%
109
+
110
+ ## License
111
+
112
+ MIT License
113
+
114
+ ## Citation
115
+
116
+ ```bibtex
117
+ @software{litecnn_pure_cpp_2026,
118
+ author = {LiteCNN Team},
119
+ title = {LiteCNN Pure C++ Inference Server},
120
+ year = {2026},
121
+ url = {https://github.com/stupidcoderJung/litecnn-pure-cpp}
122
+ }
123
+ ```
124
+
125
+ ## Contact
126
+
127
+ - Repository: https://github.com/stupidcoderJung/litecnn-pure-cpp
128
+ - Issues: https://github.com/stupidcoderJung/litecnn-pure-cpp/issues