sheikh987 commited on
Commit
e287625
·
verified ·
1 Parent(s): 1af46b5

Uploaded model from Anwarkh1 to Sheikh987

Browse files
Files changed (4) hide show
  1. README.md +46 -0
  2. config.json +41 -0
  3. model.safetensors +3 -0
  4. preprocessor_config.json +41 -0
README.md ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ ---
4
+ # Skin Cancer Image Classification Model
5
+
6
+ ## Introduction
7
+
8
+ This model is designed for the classification of skin cancer images into various categories including benign keratosis-like lesions, basal cell carcinoma, actinic keratoses, vascular lesions, melanocytic nevi, melanoma, and dermatofibroma.
9
+
10
+ ## Model Overview
11
+
12
+ - Model Architecture: Vision Transformer (ViT)
13
+ - Pre-trained Model: Google's ViT with 16x16 patch size and trained on ImageNet21k dataset
14
+ - Modified Classification Head: The classification head has been replaced to adapt the model to the skin cancer classification task.
15
+
16
+ ## Dataset
17
+
18
+ - Dataset Name: Skin Cancer Dataset
19
+ - Source: [Marmal88's Skin Cancer Dataset on Hugging Face](https://huggingface.co/datasets/marmal88/skin_cancer)
20
+ - Classes: Benign keratosis-like lesions, Basal cell carcinoma, Actinic keratoses, Vascular lesions, Melanocytic nevi, Melanoma, Dermatofibroma
21
+
22
+ ## Training
23
+
24
+ - Optimizer: Adam optimizer with a learning rate of 1e-4
25
+ - Loss Function: Cross-Entropy Loss
26
+ - Batch Size: 32
27
+ - Number of Epochs: 5
28
+
29
+ ## Evaluation Metrics
30
+
31
+ - Train Loss: Average loss over the training dataset
32
+ - Train Accuracy: Accuracy over the training dataset
33
+ - Validation Loss: Average loss over the validation dataset
34
+ - Validation Accuracy: Accuracy over the validation dataset
35
+
36
+ ## Results
37
+
38
+ - Epoch 1/5, Train Loss: 0.7168, Train Accuracy: 0.7586, Val Loss: 0.4994, Val Accuracy: 0.8355
39
+ - Epoch 2/5, Train Loss: 0.4550, Train Accuracy: 0.8466, Val Loss: 0.3237, Val Accuracy: 0.8973
40
+ - Epoch 3/5, Train Loss: 0.2959, Train Accuracy: 0.9028, Val Loss: 0.1790, Val Accuracy: 0.9530
41
+ - Epoch 4/5, Train Loss: 0.1595, Train Accuracy: 0.9482, Val Loss: 0.1498, Val Accuracy: 0.9555
42
+ - Epoch 5/5, Train Loss: 0.1208, Train Accuracy: 0.9614, Val Loss: 0.1000, Val Accuracy: 0.9695
43
+ ## Conclusion
44
+
45
+ The model demonstrates good performance in classifying skin cancer images into various categories. Further fine-tuning or experimentation may improve performance on this task.
46
+
config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "google/vit-base-patch16-224-in21k",
3
+ "architectures": [
4
+ "ViTForImageClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "encoder_stride": 16,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.0,
10
+ "hidden_size": 768,
11
+ "id2label": {
12
+ "0": "benign_keratosis-like_lesions",
13
+ "1": "basal_cell_carcinoma",
14
+ "2": "actinic_keratoses",
15
+ "3": "vascular_lesions",
16
+ "4": "melanocytic_Nevi",
17
+ "5": "melanoma",
18
+ "6": "dermatofibroma"
19
+ },
20
+ "image_size": 224,
21
+ "initializer_range": 0.02,
22
+ "intermediate_size": 3072,
23
+ "label2id": {
24
+ "benign_keratosis-like_lesions": 0,
25
+ "basal_cell_carcinoma": 1,
26
+ "actinic_keratoses": 2,
27
+ "vascular_lesions": 3,
28
+ "melanocytic_Nevi": 4,
29
+ "melanoma": 5,
30
+ "dermatofibroma": 6
31
+ },
32
+ "layer_norm_eps": 1e-12,
33
+ "model_type": "vit",
34
+ "num_attention_heads": 12,
35
+ "num_channels": 3,
36
+ "num_hidden_layers": 12,
37
+ "patch_size": 16,
38
+ "qkv_bias": true,
39
+ "torch_dtype": "float32",
40
+ "transformers_version": "4.38.2"
41
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8136bbbdd085cc97f69bdef01bd0c4c54262cf3ba44f5a94ebc9c8c54e85d60
3
+ size 343239356
preprocessor_config.json ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "google/vit-base-patch16-224-in21k",
3
+ "architectures": [
4
+ "ViTForImageClassification"
5
+ ],
6
+ "attention_probs_dropout_prob": 0.0,
7
+ "encoder_stride": 16,
8
+ "hidden_act": "gelu",
9
+ "hidden_dropout_prob": 0.0,
10
+ "hidden_size": 768,
11
+ "id2label": {
12
+ "0": "benign_keratosis-like_lesions",
13
+ "1": "basal_cell_carcinoma",
14
+ "2": "actinic_keratoses",
15
+ "3": "vascular_lesions",
16
+ "4": "melanocytic_Nevi",
17
+ "5": "melanoma",
18
+ "6": "dermatofibroma"
19
+ },
20
+ "image_size": 224,
21
+ "initializer_range": 0.02,
22
+ "intermediate_size": 3072,
23
+ "label2id": {
24
+ "benign_keratosis-like_lesions": 0,
25
+ "basal_cell_carcinoma": 1,
26
+ "actinic_keratoses": 2,
27
+ "vascular_lesions": 3,
28
+ "melanocytic_Nevi": 4,
29
+ "melanoma": 5,
30
+ "dermatofibroma": 6
31
+ },
32
+ "layer_norm_eps": 1e-12,
33
+ "model_type": "vit",
34
+ "num_attention_heads": 12,
35
+ "num_channels": 3,
36
+ "num_hidden_layers": 12,
37
+ "patch_size": 16,
38
+ "qkv_bias": true,
39
+ "torch_dtype": "float32",
40
+ "transformers_version": "4.38.2"
41
+ }