Image Classification
PyTorch
timm
Safetensors
English
computer-vision
resnest
deepten
NBAmine commited on
Commit
18b9c0a
·
verified ·
1 Parent(s): 1cd6fbe

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +109 -0
README.md ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: en
3
+ library_name: pytorch
4
+ tags:
5
+ - image-classification
6
+ - computer-vision
7
+ - resnest
8
+ - deepten
9
+ - timm
10
+ - safetensors
11
+ datasets:
12
+ - mcimpoi/minc-2500_split_1
13
+ metrics:
14
+ - accuracy
15
+ ---
16
+
17
+ # DeepTen Image Classifier
18
+
19
+ This model is an image classifier based on the **DeepTen** architecture, utilizing a **ResNeSt50d** feature extractor (backbone) and a custom Encoding Layer to capture contextual image information.
20
+
21
+ ## Links
22
+
23
+ <div style="display: flex; justify-content: center; align-items: center; gap: 15px;">
24
+ <a href="https://wandb.ai/nbamine-fsdm/DeepTen/" target="_blank">
25
+ <img src="https://raw.githubusercontent.com/wandb/assets/main/wandb-github-badge-28.svg" alt="Visualize in W&B" style="margin: 0;">
26
+ </a>
27
+ <a href="https://github.com/NBAmine/deepten-resnest-texture-classification" target="_blank">
28
+ <img src="https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white" alt="Visualize in W&B" style="margin: 0;">
29
+ </a>
30
+ </div>
31
+
32
+ ## Model Details
33
+
34
+ * **Model Type:** Image Classification (Convolutional Neural Network)
35
+ * **Framework:** PyTorch
36
+ * **Weights Format:** `safetensors`
37
+
38
+ ## Technical Architecture
39
+
40
+ The model replaces the traditional Global Average Pooling with a Deep Ten approach:
41
+ 1. **Backbone:** `resnest50d` (via the `timm` library), instantiated without its original classification head.
42
+ 2. **Classification Head (DeepTen Head):**
43
+ * 1x1 Convolutional layer to reduce dimensionality to 128 channels.
44
+ * Encoding Layer learning a dictionary of $K=32$ codewords.
45
+ * L2 Normalization layer.
46
+ * Final Linear (Fully Connected) layer adapted to the dataset's number of classes.
47
+
48
+ ## Training and Evaluation
49
+
50
+ The training pipeline is designed for distributed execution (Distributed Data Parallel - DDP) and comprehensive tracking:
51
+
52
+ * **Validation:** 5-Fold Cross-Validation strategy.
53
+ * **Loss Function:** `CrossEntropyLoss`.
54
+ * **Optimizer:** SGD (with Momentum and Weight Decay).
55
+ * **Scheduler:** `ReduceLROnPlateau` based on validation loss.
56
+ * **Regularization:** Configurable Early Stopping (patience and min delta).
57
+ * **Experiment Tracking:** Metrics (Loss, Accuracy, Precision, Recall, F1-Score) and confusion matrices are logged via **Weights & Biases (W&B)**.
58
+
59
+ ## Preprocessing and Data Augmentation
60
+
61
+ * **Training:** Implements Principal Component Analysis-based color augmentation (`PCAColorAugmentation`) to modify RGB intensities using predefined eigenvectors and eigenvalues.
62
+ * **Validation / Testing:** Utilizes the **TenCrop** technique (extracting 10 sub-regions per image) with averaged predictions to maximize final evaluation robustness.
63
+
64
+ ## Performance
65
+
66
+ | Fold | Best Epoch | Val Accuracy (%) | Test Accuracy (%) |
67
+ | :---: | :---: | :---: | :---: |
68
+ | 1 | 46 | 79.42 | 79.71 |
69
+ | 2 | 54 | 81.02 | 81.50 |
70
+ | 3 | 43 | 80.78 | 82.11 |
71
+ | 4 | 58 | 80.47 | 80.25 |
72
+ | 5 | 56 | 80.88 | 79.79 |
73
+
74
+ ## Citations
75
+
76
+ **ResNeSt: Split-Attention Networks** [[arXiv]](https://arxiv.org/abs/2004.08955)
77
+ [Hang Zhang](http://hangzh.com/), Chongruo Wu, Zhongyue Zhang, Yi Zhu, Zhi Zhang, Haibin Lin, Yue Sun, Tong He, Jonas Muller, R. Manmatha, Mu Li and Alex Smola
78
+ ```
79
+ @article{zhang2020resnest,
80
+ title={ResNeSt: Split-Attention Networks},
81
+ author={Zhang, Hang and Wu, Chongruo and Zhang, Zhongyue and Zhu, Yi and Zhang, Zhi and Lin, Haibin and Sun, Yue and He, Tong and Muller, Jonas and Manmatha, R. and Li, Mu and Smola, Alexander},
82
+ journal={arXiv preprint},
83
+ year={2020}
84
+ }
85
+ ```
86
+
87
+ **Context Encoding for Semantic Segmentation** [[arXiv]](https://arxiv.org/pdf/1803.08904.pdf)
88
+ [Hang Zhang](http://hangzh.com/), [Kristin Dana](http://eceweb1.rutgers.edu/vision/dana.html), [Jianping Shi](http://shijianping.me/), [Zhongyue Zhang](http://zhongyuezhang.com/), [Xiaogang Wang](http://www.ee.cuhk.edu.hk/~xgwang/), [Ambrish Tyagi](https://scholar.google.com/citations?user=GaSWCoUAAAAJ&hl=en), [Amit Agrawal](http://www.amitkagrawal.com/)
89
+ ```
90
+ @InProceedings{Zhang_2018_CVPR,
91
+ author = {Zhang, Hang and Dana, Kristin and Shi, Jianping and Zhang, Zhongyue and Wang, Xiaogang and Tyagi, Ambrish and Agrawal, Amit},
92
+ title = {Context Encoding for Semantic Segmentation},
93
+ booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
94
+ month = {June},
95
+ year = {2018}
96
+ }
97
+ ```
98
+
99
+ **Deep TEN: Texture Encoding Network** [[arXiv]](https://arxiv.org/pdf/1612.02844.pdf)
100
+ [Hang Zhang](http://hangzh.com/), [Jia Xue](http://jiaxueweb.com/), [Kristin Dana](http://eceweb1.rutgers.edu/vision/dana.html)
101
+ ```
102
+ @InProceedings{Zhang_2017_CVPR,
103
+ author = {Zhang, Hang and Xue, Jia and Dana, Kristin},
104
+ title = {Deep TEN: Texture Encoding Network},
105
+ booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
106
+ month = {July},
107
+ year = {2017}
108
+ }
109
+ ```