yolac commited on
Commit
3c46937
·
verified ·
1 Parent(s): dd5b8ec

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +115 -0
README.md ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ language:
4
+ - en
5
+ metrics:
6
+ - accuracy
7
+ - f1
8
+ pipeline_tag: image-classification
9
+ ---
10
+ # Model Card for Bacterial Morphology Classification
11
+
12
+ This model classifies bacterial images into three morphological categories: cocci, bacilli, and spirilla.
13
+
14
+ ## Model Details
15
+
16
+ ### Model Description
17
+
18
+ It leverages the MobileNetV2 architecture as a base for feature extraction, followed by custom dense layers for classification. The model was fine-tuned on a dataset of bacterial images with images preprocessed to ensure compatibility.
19
+
20
+ - **Developed by:** Yola Charara, University of Michigan-Flint, M.S Data Science-Student
21
+ - **Model type:** Image classification (multi-class)
22
+ - **Language(s) (NLP):** English
23
+ - **License:** CC BY 4.0
24
+ - **Finetuned from model:** MobileNetV2 (pre-trained on ImageNet)
25
+
26
+ ## Uses
27
+
28
+ ### Direct Use
29
+
30
+ This model is suitable for classifying bacterial morphology into three categories based on visual features in microscopy images. It is intended for educational and research purposes.
31
+
32
+ ### Out-of-Scope Use
33
+
34
+ The model is not intended for clinical diagnosis or medical decision-making. Misuse includes applying it to unrelated image classification tasks or using it with non-bacterial images.
35
+
36
+ ## Bias, Risks, and Limitations
37
+
38
+ The model was trained and validated on a specific dataset of bacterial images, which may not represent all possible imaging conditions or bacterial morphologies. It may perform poorly on data outside its training distribution, such as images from different microscopes, lighting conditions, or bacterial species not represented in the dataset.
39
+
40
+ ### Recommendations
41
+
42
+ Users should test the model on other datasets to ensure generalizability and account for variations in bacterial imaging conditions. Misclassification risks should be acknowledged, especially in critical applications.
43
+
44
+ ## How to Get Started with the Model
45
+
46
+ Here is a sample code snippet to use the model:
47
+
48
+ import tensorflow as tf
49
+ from tensorflow.keras.utils import load_img, img_to_array
50
+ import numpy as np
51
+
52
+ # Load and preprocess an image
53
+ img_path = 'path_to_image.jpg'
54
+ img = load_img(img_path, target_size=(224, 224))
55
+ img_array = img_to_array(img) / 255.0
56
+ img_array = np.expand_dims(img_array, axis=0)
57
+
58
+ # Predict with the model
59
+ prediction = model.predict(img_array)
60
+ predicted_class = prediction.argmax()
61
+ print(f"Predicted class: {predicted_class}")
62
+
63
+ ## Training Details
64
+
65
+ ### Training Data
66
+
67
+ The model was trained on the [BacterialMorphologyClassification Dataset] (https://huggingface.co/datasets/yolac/BacterialMorphologyClassification). The model was trained on a dataset of bacterial images with 360 training samples across three classes: cocci, bacilli, and spirilla. Images were preprocessed by resizing to 224x224 and normalized to pixel values between 0 and 1.
68
+
69
+ ### Training Procedure
70
+
71
+ Base Model: MobileNetV2 (frozen weights)
72
+ Optimizer: Adam (learning rate: 0.0001)
73
+ Loss Function: Categorical Crossentropy
74
+ Metrics: Accuracy
75
+ Regularization: Dropout layer with 50% dropout rate
76
+ Early Stopping: Monitored validation loss with a patience of 3 epochs
77
+
78
+ #### Preprocessing
79
+
80
+ All images were resized to 224x224 and normalized by dividing pixel values by 255. Image augmentation was not applied during this training.
81
+
82
+ #### Training Hyperparameters
83
+
84
+ Epochs: Up to 50 (early stopping applied)
85
+ Batch size: 32
86
+ Dropout: 0.5 on dense layers
87
+
88
+ ## Evaluation
89
+
90
+ ### Testing Data, Factors & Metrics
91
+
92
+ #### Testing Data
93
+
94
+ The test dataset included unseen images with filenames provided in a separate file. Images were resized and normalized in the same way as training and validation data.
95
+
96
+ #### Metrics
97
+
98
+ Accuracy: 0.85
99
+ F1 Score: 0.85
100
+
101
+ ### Results
102
+
103
+ The model achieved 0.85 accuracy and F1 score on the Codalab test set.
104
+
105
+ #### Summary
106
+
107
+ This bacterial morphology classification model effectively categorizes images into three classes: cocci, bacilli, and spirilla. Leveraging the MobileNetV2 architecture, the model achieves high performance with an accuracy and F1 score of 0.85 on the Codalab test set. It is efficient for educational and research purposes, though not suitable for diagnostic applications without further validation.
108
+
109
+ ### Model Architecture and Objective
110
+
111
+ The model uses the MobileNetV2 architecture with the top layers replaced for the classification task. The objective is to minimize categorical crossentropy loss for three classes.
112
+
113
+ ## Model Card Contact
114
+
115
+ email: yolac@umich.edu