Downloads · 30 days
3
1% of all-time downloads
yolac/BacterialMorphologyClassification
BacterialMorphologyClassification is a image classification model from yolac. Use it when you need a label for an image. It is set up for keras. The card lists the license as cc-by-4.0.
This model classifies bacterial images into three morphological categories: cocci, bacilli, and spirilla.
Downloads · 30 days
3
1% of all-time downloads
All-time downloads
255
Public
Repo size
11.6 MB
Likes
0
Public
Click a slice to open those files.
.keras11.6 MB · 100%
From the Hugging Face model README
This model classifies bacterial images into three morphological categories: cocci, bacilli, and spirilla.
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.
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.
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.
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.
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.
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}")
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.
All images were resized to 224x224 and normalized by dividing pixel values by 255. Image augmentation was not applied during this training.
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.
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
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.
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.
email: yolac@umich.edu