File size: 4,663 Bytes
3c46937 703282b 3c46937 989ce9c 3c46937 d1da135 5f7e335 d1da135 3c46937 54e833a 3c46937 bf052f3 3c46937 2da0077 3c46937 506064f 3c46937 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
---
license: cc-by-4.0
language:
- en
metrics:
- accuracy
- f1
pipeline_tag: image-classification
---
# Model Card for Bacterial Morphology Classification
This model classifies bacterial images into three morphological categories: cocci, bacilli, and spirilla.
## Model Details
### Model Description
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.
- **Model Developed by:** Taraka Ram Donepudi, University of Michigan-Flint, Graduate Student
- **Model Card Author:** Yola Charara, University of Michigan-Flint, M.S Data Science-Student
- **Model type:** Image classification (multi-class)
- **Language(s) (NLP):** English
- **License:** CC BY 4.0
- **Finetuned from model:** MobileNetV2 (pre-trained on ImageNet)
## Uses
### Direct Use
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.
### Out-of-Scope Use
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.
## Bias, Risks, and Limitations
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.
### Recommendations
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.
## How to Get Started with the Model
**Here is a sample code snippet to use the model:**
* import tensorflow as tf
* from tensorflow.keras.utils import load_img, img_to_array
* import numpy as np
* Load and preprocess an image:
* img_path = 'path_to_image.jpg'
* img = load_img(img_path, target_size=(224, 224))
* img_array = img_to_array(img) / 255.0
* img_array = np.expand_dims(img_array, axis=0)
* Predict with the model:
* prediction = model.predict(img_array)
* predicted_class = prediction.argmax()
* print(f"Predicted class: {predicted_class}")
## Training Details
### Training Data
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.
### Training Procedure
* Base Model: MobileNetV2 (frozen weights)
* Optimizer: Adam (learning rate: 0.0001)
* Loss Function: Categorical Crossentropy
* Metrics: Accuracy
* Regularization: Dropout layer with 50% dropout rate
* Early Stopping: Monitored validation loss with a patience of 3 epochs
#### Preprocessing
All images were resized to 224x224 and normalized by dividing pixel values by 255. Image augmentation was not applied during this training.
#### Training Hyperparameters
* Epochs: Up to 50 (early stopping applied)
* Batch size: 32
* Dropout: 0.5 on dense layers
## Evaluation
### Testing Data, Factors & Metrics
#### Testing Data
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.
#### Metrics
* Accuracy
* F1 Score
### Results
The model achieved 0.85 accuracy and F1 score on the Codalab test set.
Codalab leaderboard: https://codalab.lisn.upsaclay.fr/competitions/20680?secret_key=b04da988-294a-4491-831c-3f4b55529a0b
#### Summary
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.
### Model Architecture and Objective
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.
## Model Card Contact
email: [email protected] |