This project was developed as part of the AgarVision hackathon hosted by Novo Nordisk at ITU (Denmark). There are two subtasks.
first subtask: binary classification of agar plates to determine whether they are empty or not
Utilizing a pre-trained DenseNet-121 model, originally trained on ImageNet, the project adapts the model for a binary classification task by modifying the last layer. This approach achieved a score of 0.98 (98%) on the final test set based on a combined metric of accuracy and recall.
second subtask: how many colonies are on each agar plates
Utilizing a pre-trained YOLOv8 model, the project adapts the model for object detection and localization. The model achieved a score of 0.054 on the final test set based on mean squared log error.
- Clone this repository.
- Install the required packages by running
poetry install
. - Download the dataset [https://agar.neurosys.com/]
Open the binary_classifier.ipynb
notebook and it will go through loading data, preprocessing, model training, and evaluation.
The primary goal of the model was to minimize false negatives to ensure that agar plates with bacteria are accurately identified, avoiding the risk of misclassifying contaminated plates as clean. In the validation set, out of 198 agar plates that were truly empty, the model correctly identified 187, resulting in 11 false negatives. This translates to an approximately 4% misclassification rate for the empty class.
Install the required packages
pip install ultralytics
Since we run models on a cluster, we have to submit jobs to the cluster. The following scripts are used to submit jobs to the cluster. You might need to change the paths to the data and the model as well as the required resources in the bash scripts.
- Process the data: We turn all the images into grayscale and resize them since they are in different lighting conditions and sizes.
sbatch data.sh
- Train the model: you might need to change the setting in
novo.yaml
.
sbatch sbatch.sh
- Evaluate the model
sbatch eval.sh