# AI-ML-Project-Embryo-Analysis-to-Improve-Success-Rate-of-IVF
**This project is a recreation of the STORK repository [Github Link to STORK](https://github.com/ih-lab/STORK) used for embryo classification.**
---
## π Table of Contents
Table of Contents
1. [About the Project](#about-the-project)
2. [Prerequisites](#prerequisites)
3. [Dataset](#dataset)
4. [Data Pipeline](#data-pipeline)
5. [Methodology](#methodology)
6. [Results and Discussion](#results-and-discussion)
7. [References](#references)
8. [Contributors](#contributors)
9. [Steps To Follow](#steps-to-follow)
---
## βοΈ About The Project
Infertility is a clinical condition characterized by an inability to conceive after one year or longer of unprotected sex. In vitro fertilization (IVF) is a type of assistive reproductive technology (ART) for infertility treatment and surrogacy.
This project aims to use machine learning to classify embryos as "good" or "poor" based on their quality, improving IVF success rates and reducing human error in embryo selection.
---
## π΄ Prerequisites
This project requires Python and Conda for setting up the environment.
### Installation Steps:
1. **Clone the repository:**
```bash
git clone https://huggingface.co/saikAIML/ivf
cd ivf
```
2. **Install Conda (if not already installed).**
Follow the instructions at [Miniconda Installation](https://docs.conda.io/en/latest/miniconda.html).
3. **Create and activate the Conda environment:**
```bash
conda create -n embryo-env python=3.7
conda init
conda activate embryo-env
```
4. **Install required dependencies:**
```bash
pip install -r requirements.txt
```
---
βΆοΈ Steps to Follow
### **Training the Model (Optional):**
> The model is already trained on Inception-V1 with the dataset and the weights are available at scripts/slim/result this is if you want use a different model
1. Download **pre-trained Inception-V1** models from [TensorFlow Pretrained Models](https://github.com/wenwei202/terngrad/tree/master/slim#pre-trained-models).
2. Create the process directory :
```bash
python convert.py ../Images/train process/ 0
```
4. Modify `load_inception_v1.sh` to set correct paths.
5. Run the script:
```bash
./run/load_inception_v1.sh
```
OR use Python:
```bash
python train_image_classifier.py --train_dir=scripts/result --dataset_name=embryo --dataset_split_name=train --dataset_dir=scripts/process --model_name=inception_v1 --checkpoint_path=run/checkpoint/inception_v1.ckpt --checkpoint_exclude_scopes=InceptionV1/Logits --max_number_of_steps=5000 --batch_size=32 --learning_rate=0.01 --save_interval_secs=100 --save_summaries_secs=100 --log_every_n_steps=300 --optimizer=rmsprop --weight_decay=0.00004 --clone_on_cpu=True
```
### **Testing the Model:**
1. **Navigate to the `slim` directory:**
```bash
cd scripts/slim
```
2. **Run the test script:**
```bash
python tst.py
```
3. **To test different images, modify `tst.py`:**
- Open `tst.py` in a text editor.
- Locate the line with `predict_image_label`.
- Change the file path to a different embryo image.
Example:
```python
from pred import predict_image_label
print("**************", predict_image_label("result", "../../Images/test/good_23765483_-15_3AA.jpg", "v1"), "**************")
```
- Save the file and rerun:
```bash
python tst.py
```
## π Dataset
- **Source:** STORK Framework
- **Training Images:** 42 Good, 42 Poor
- **Test Images:** 14
- **Total Images:** 98 (JPG format)
---
## π― Data Pipeline
---
## π Methodology
We use a **Deep Neural Network (DNN)** for embryo image analysis based on Googleβs **Inception-V1** architecture. The pre-trained STORK framework helps classify embryos into **good** or **poor** categories.
The dataset is divided as follows:
- **85% (84 images) for training**
- **15% (14 images) for testing**
---
## π Results and Discussion
- The model achieved **100% accuracy** on the test set (14 images).
- Using this model could **reduce IVF cycles and costs** by selecting the best embryo.
- A web interface allows users to upload an embryo image and check its quality.
---
## π References
1. Muhammad et al. (2020) - [NIH Article](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8877842/)
2. Kirillova et al. (2020) - "Should we transfer poor quality embryos?"
3. PFCLA - [IVF Overview](https://www.pfcla.com/services/in-vitro-fertilization/overview)
4. STORK GitHub - [STORK Framework](https://github.com/ih-lab/STORK/tree/master/scripts)
---
## βοΈ Contributors
π©βπ **Anjana Padikkal Veetil**
π§ AP202@myscc.ca | [GitHub](https://github.com/anjanapv)
π©βπ **Nobin Ann Mathew**
π§ NM91@myscc.ca | [GitHub](https://github.com/NobinMath)
π¨βπ **Santosh Kumar Kantimahanti Lakshmi**
π§ SK602@myscc.ca | [GitHub](https://github.com/santoshkumarklv)
π¨βπ **Amal Mathew**
π§ AM252@myscc.ca | [GitHub](https://github.com/Amalmathew5)
π― **Final Notes:**
- The model is pre-trained, so **only testing is required** unless you want to retrain it.
- Modify `tst.py` to test with different images.
π‘ This project was developed as part of the **Data Analytics for Business (May 2021)** course at **St. Clair College**.