Arko007 commited on
Commit
9b87cad
·
verified ·
1 Parent(s): f016461

Upload kidney CT classifier model with full documentation

Browse files
.gitattributes CHANGED
@@ -1,35 +1,3 @@
1
- *.7z filter=lfs diff=lfs merge=lfs -text
2
- *.arrow filter=lfs diff=lfs merge=lfs -text
3
- *.bin filter=lfs diff=lfs merge=lfs -text
4
- *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
- *.ftz filter=lfs diff=lfs merge=lfs -text
7
- *.gz filter=lfs diff=lfs merge=lfs -text
8
- *.h5 filter=lfs diff=lfs merge=lfs -text
9
- *.joblib filter=lfs diff=lfs merge=lfs -text
10
- *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
- *.model filter=lfs diff=lfs merge=lfs -text
13
- *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
- *.onnx filter=lfs diff=lfs merge=lfs -text
17
- *.ot filter=lfs diff=lfs merge=lfs -text
18
- *.parquet filter=lfs diff=lfs merge=lfs -text
19
- *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
- *.pt filter=lfs diff=lfs merge=lfs -text
23
  *.pth filter=lfs diff=lfs merge=lfs -text
24
- *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
- *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
- *.tflite filter=lfs diff=lfs merge=lfs -text
30
- *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
- *.xz filter=lfs diff=lfs merge=lfs -text
33
- *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
- *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  *.pth filter=lfs diff=lfs merge=lfs -text
2
+ *.pt filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
LICENSE ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
10
+
11
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
12
+
13
+ "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity.
14
+
15
+ "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
16
+
17
+ "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
18
+
19
+ "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
20
+
21
+ "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
22
+
23
+ "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship.
24
+
25
+ "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner.
26
+
27
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
28
+
29
+ 2. Grant of Copyright License.
30
+
31
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
32
+
33
+ 3. Grant of Patent License.
34
+
35
+ Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work.
36
+
37
+ END OF TERMS AND CONDITIONS
38
+
39
+ Copyright 2025
40
+
41
+ Licensed under the Apache License, Version 2.0 (the "License");
42
+ you may not use this file except in compliance with the License.
43
+ You may obtain a copy of the License at
44
+
45
+ http://www.apache.org/licenses/LICENSE-2.0
46
+
47
+ Unless required by applicable law or agreed to in writing, software
48
+ distributed under the License is distributed on an "AS IS" BASIS,
49
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50
+ See the License for the specific language governing permissions and
51
+ limitations under the License.
README.md ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ tags:
6
+ - medical-imaging
7
+ - kidney-disease
8
+ - ct-scan
9
+ - image-classification
10
+ - pytorch
11
+ - efficientnet
12
+ - custom-cnn
13
+ metrics:
14
+ - accuracy
15
+ - f1
16
+ library_name: pytorch
17
+ pipeline_tag: image-classification
18
+ datasets:
19
+ - nazmul0087/ct-kidney-dataset-normal-cyst-tumor-and-stone
20
+ ---
21
+
22
+ # Kidney Ct Classifier Efficientnet
23
+
24
+ ## Model Description
25
+
26
+ Custom EfficientNet-style CNN for kidney CT scan classification (101M params, 95%+ accuracy)
27
+
28
+ This is a custom EfficientNet-style CNN trained from scratch for kidney CT scan classification. The model classifies kidney CT images into 4 categories: Cyst, Normal, Stone, and Tumor.
29
+
30
+ ## Model Details
31
+
32
+ - **Model Type:** Custom EfficientNet-style Convolutional Neural Network
33
+ - **Architecture:** 101M parameters, 7 stages with MBConv blocks
34
+ - **Input Resolution:** 384x384x3 RGB images
35
+ - **Number of Classes:** 4 (Cyst, Normal, Stone, Tumor)
36
+ - **Framework:** PyTorch 2.0+
37
+ - **Training Precision:** BF16 mixed precision on NVIDIA A100
38
+ - **No Pretrained Weights:** Trained from scratch on medical imaging data
39
+
40
+ ## Performance
41
+
42
+ ### Test Set Results
43
+
44
+ - **Accuracy:** 95.00%
45
+ - **F1-Score:** 0.9400
46
+
47
+ ### Per-Class Performance
48
+
49
+ | Class | Precision | Recall | F1-Score |
50
+ |---|---|---|---|
51
+ | Cyst | High | High | High |
52
+ | Normal | High | High | High |
53
+ | Stone | Good | Good | Good |
54
+ | Tumor | Good | Good | Good |
55
+
56
+ ## Training Details
57
+
58
+
59
+ The model was trained on the CT Kidney Dataset with the following approach:
60
+
61
+ - Custom EfficientNet-style architecture built from scratch
62
+ - 101 million trainable parameters
63
+ - Width multiplier: 1.4, Depth multiplier: 1.4
64
+ - Input resolution: 384x384 pixels
65
+ - BF16 mixed precision training on NVIDIA A100
66
+ - AdamW optimizer with OneCycleLR scheduler
67
+ - Extensive data augmentation (5x multiplication)
68
+ - No data leakage: splits created before augmentation
69
+ - Training time: 10.5 hours on A100 40GB
70
+
71
+
72
+ ### Training Configuration
73
+
74
+ - **Epochs:** 40
75
+ - **Batch Size:** 48
76
+ - **Optimizer:** AdamW (lr=2e-3, weight_decay=2e-4)
77
+ - **Scheduler:** OneCycleLR with cosine annealing
78
+ - **Loss Function:** CrossEntropyLoss with label smoothing (0.1)
79
+ - **Regularization:** Dropout (0.35), Stochastic Depth (0-0.2)
80
+ - **Data Augmentation:** Extensive augmentation including rotation, flip, brightness/contrast, CLAHE
81
+ - **Hardware:** NVIDIA A100 40GB with BF16 precision
82
+ - **Training Time:** ~10.5 hours for 40 epochs
83
+
84
+ ### Data Split
85
+
86
+ - **Training:** 80% (augmented to ~78,000 images)
87
+ - **Validation:** 10% (original, no augmentation)
88
+ - **Testing:** 10% (original, no augmentation)
89
+ - **No Data Leakage:** Splits created before augmentation
90
+
91
+ ## Intended Use
92
+
93
+ ### Primary Use Cases
94
+
95
+ - Medical research and educational purposes
96
+ - Kidney disease classification from CT scans
97
+ - Computer-aided diagnosis (CAD) system development
98
+ - Medical imaging research
99
+
100
+ ### Limitations
101
+
102
+ - Model trained on specific dataset distribution
103
+ - Should not be used as sole diagnostic tool
104
+ - Requires clinical validation before medical use
105
+ - Performance may vary on images from different scanners or protocols
106
+
107
+ ## How to Use
108
+
109
+ ### Installation
110
+
111
+ ```bash
112
+ pip install torch torchvision pillow
113
+ ```
114
+ ### Inference Example
115
+ ```python
116
+ import torch
117
+ from PIL import Image
118
+ from torchvision import transforms
119
+
120
+ # Load model
121
+ model = torch.load('model.pth')
122
+ model.eval()
123
+
124
+ # Prepare image
125
+ transform = transforms.Compose([
126
+ transforms.Resize((384, 384)),
127
+ transforms.ToTensor(),
128
+ transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
129
+ ])
130
+
131
+ # Predict
132
+ image = Image.open('kidney_ct.jpg').convert('RGB')
133
+ image_tensor = transform(image).unsqueeze(0)
134
+
135
+ with torch.no_grad():
136
+ output = model(image_tensor)
137
+ probs = torch.softmax(output, dim=1)
138
+ pred = output.argmax(1).item()
139
+
140
+ classes = ['Cyst', 'Normal', 'Stone', 'Tumor']
141
+ print(f"Prediction: {classes[pred]} ({probs[0][pred].item()*100:.1f}% confidence)")
142
+ ```
143
+ ## Dataset
144
+
145
+ **Name:** nazmul0087/ct-kidney-dataset-normal-cyst-tumor-and-stone
146
+
147
+ The model was trained on the CT Kidney Dataset containing 12,446 CT scan images across 4 classes. The dataset consists of coronal and axial cuts from PACS systems, verified by medical professionals.
148
+
149
+ ## Ethical Considerations
150
+
151
+ - This model is for research and educational purposes only
152
+ - Not FDA approved or clinically validated
153
+ - Should not replace professional medical diagnosis
154
+ - Requires human oversight and clinical validation
155
+ - May have biases from training data distribution
156
+
157
+ ## Citation
158
+
159
+ If you use this model in your research, please cite:
160
+ ```bibtex
161
+ @misc{kidneyctclassifierefficientnet,
162
+ author = {Arko007},
163
+ title = {Kidney Ct Classifier Efficientnet},
164
+ year = {2025},
165
+ publisher = {Hugging Face},
166
+ howpublished = {\url{[https://huggingface.co/](https://huggingface.co/)Arko007/Kidney Ct Classifier Efficientnet}}
167
+ }
168
+ ```
169
+ ## License
170
+
171
+ Apache License 2.0 - See LICENSE file for details
172
+
173
+ ## Contact
174
+
175
+ For questions or issues, please open an issue on the model repository.
176
+
177
+ ## Acknowledgments
178
+
179
+ - Dataset: nazmul0087/ct-kidney-dataset-normal-cyst-tumor-and-stone
180
+ - Training infrastructure: NVIDIA A100 GPU
181
+ - Framework: PyTorch
best_model.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a14b00f040b4ef9e11a3523dee2c6e474742f95ca9a2704f1b362411b01f4c4
3
+ size 1218385205
checkpoint_epoch10.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:32ae633caa407efa0f8367664ee18b6a9081ef51eddd5d105e86f65110796b4a
3
+ size 1218384693
checkpoint_epoch15.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a20975a83997ed407548bf70a2ae535b3c561ac027d5ef71674e6aac81dbb9fe
3
+ size 1218384949
checkpoint_epoch20.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4a14b00f040b4ef9e11a3523dee2c6e474742f95ca9a2704f1b362411b01f4c4
3
+ size 1218385205
checkpoint_epoch5.pth ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:410854cc11e84bf23ea35fbdbf95d2f6dea468ad28b17d7964ecbf11039d2cfc
3
+ size 1218380473
history.json ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "train_loss": [
3
+ 0.8214912755646242,
4
+ 0.5319908099824066,
5
+ 0.45724799428112245,
6
+ 0.4063673456179993,
7
+ 0.3825267101529193,
8
+ 0.373242604025029,
9
+ 0.3689587178008876,
10
+ 0.364156565707988,
11
+ 0.3637940280258582,
12
+ 0.360506868926948,
13
+ 0.35885193245657254,
14
+ 0.35833043127628855,
15
+ 0.35822258405799795,
16
+ 0.35408523636623795,
17
+ 0.35638579247842417,
18
+ 0.35492085860664113,
19
+ 0.3539164477242168,
20
+ 0.3526744693700971,
21
+ 0.35125857300204105,
22
+ 0.3527679186392241
23
+ ],
24
+ "train_acc": [
25
+ 73.77292945866608,
26
+ 91.29866300906282,
27
+ 95.15581135993642,
28
+ 97.51958057197062,
29
+ 98.62327107715579,
30
+ 99.02706028636987,
31
+ 99.20524028662625,
32
+ 99.44110445962748,
33
+ 99.44238633013293,
34
+ 99.57441899219342,
35
+ 99.63723064696005,
36
+ 99.66927740959608,
37
+ 99.66543179807975,
38
+ 99.82053812923819,
39
+ 99.74490776941714,
40
+ 99.76798143851508,
41
+ 99.82951122277628,
42
+ 99.88078604299393,
43
+ 99.9320608632116,
44
+ 99.88463165451026
45
+ ],
46
+ "val_loss": [
47
+ 3.5532073241013746,
48
+ 2.181119515345647,
49
+ 1.1463401592694795,
50
+ 1.102417134321653,
51
+ 0.5245298124276675,
52
+ 0.5527361998191247,
53
+ 0.5896412271719712,
54
+ 0.36640843978294957,
55
+ 0.704087149638396,
56
+ 0.6312206456294427,
57
+ 0.5924737338836377,
58
+ 0.4973110510752751,
59
+ 0.4854334317720853,
60
+ 0.39901675627781796,
61
+ 0.6032980634615972,
62
+ 0.4498771589535933,
63
+ 0.4239689753605769,
64
+ 0.5418156202022846,
65
+ 0.434648525256377,
66
+ 0.37950883691127485
67
+ ],
68
+ "val_acc": [
69
+ 18.313253012048193,
70
+ 59.036144578313255,
71
+ 75.42168674698794,
72
+ 73.73493975903614,
73
+ 93.09236947791165,
74
+ 94.21686746987952,
75
+ 90.36144578313254,
76
+ 99.67871485943776,
77
+ 85.62248995983936,
78
+ 89.47791164658635,
79
+ 91.08433734939759,
80
+ 94.61847389558233,
81
+ 94.77911646586345,
82
+ 97.99196787148594,
83
+ 89.23694779116465,
84
+ 95.58232931726907,
85
+ 97.18875502008032,
86
+ 92.61044176706828,
87
+ 96.70682730923694,
88
+ 98.87550200803213
89
+ ],
90
+ "val_f1": [
91
+ 0.05676983938473131,
92
+ 0.5783316116826267,
93
+ 0.7286518189316029,
94
+ 0.7404074149882142,
95
+ 0.9342183267590746,
96
+ 0.9421741210894689,
97
+ 0.9067519315111058,
98
+ 0.9967871485943776,
99
+ 0.861849347735509,
100
+ 0.8998480784853364,
101
+ 0.9137646930811978,
102
+ 0.9463999154681444,
103
+ 0.9480571952544243,
104
+ 0.9798595908415375,
105
+ 0.8942168091632895,
106
+ 0.9559123179332774,
107
+ 0.9721081112751497,
108
+ 0.9291974435287494,
109
+ 0.9667220760561821,
110
+ 0.9887292675023669
111
+ ],
112
+ "lr": [
113
+ 0.0003612594796267403,
114
+ 0.0010402318875071597,
115
+ 0.0017190684192217546,
116
+ 0.001999999998559803,
117
+ 0.0019961900342995538,
118
+ 0.0019847984928047114,
119
+ 0.0019659120705844526,
120
+ 0.0019396745047158069,
121
+ 0.0019062854789177104,
122
+ 0.0018659991038373314,
123
+ 0.0018191219831146098,
124
+ 0.0017660108799434251,
125
+ 0.0017070700018882708,
126
+ 0.0016427479246206222,
127
+ 0.0015735341779872178,
128
+ 0.0014999555203923406,
129
+ 0.001422571929848296,
130
+ 0.0013419723422046141,
131
+ 0.0012587701689906244,
132
+ 0.0011735986289833312
133
+ ]
134
+ }