ayalachn / HappyWhale

HappyWhale model implementation - Phase B

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HappyWhale

HappyWhale model implementation - Phase B

User Documentation

General Description

The purpose of our model is to accurately identify a dolphin or whale individual in a given image. Our model is implemented in Python (version 3.8.16) programming language, under the Pytorch framework (version 1.13.0+cu116) and GoogleColab is used as the platform to run our code.

Steps to run HappyWhale desktop application

Prequisitions:

  1. Open Spyder (Python 3.9) 5.1.5 IDE

  2. Inside Spider's terminal run the following line:

    pip install -r yolov5/requirements.txt

Running Code

  1. Open HappyWhaleApp.py in Spyder (Python 3.9) 5.1.5 IDE

  2. Click run button inside IDE to open the HappyWhaleApp application

Picture1

  1. Click “Upload” to choose a whale or dolphin image:

Picture2

Picture3

  1. Click “Detect” to find out the whale or dolphin individual ID:

Picture4

  1. Result:

Picture5

Steps to run HappyWhale model in GoogleColab

  1. Unzip project, you should have the following files/directories:
  • HappyWhale.ipynb
  • YOLOv5
  • dataset
  • dataset_images.csv
  1. Inside your google drive, create a project directory with the following path: /content/gdrive/MyDrive/Final_Project/Phase_B.

If you wish to create a different path for the project, go to the HappyWhale.ipynb and change the following line inside the Config() class:

Picture6

Make sure to change the project’s directory inside data.yaml (inside YOLOv5/data.yaml) to your personal directory path:

Picture7

  1. Create the following sub-folders inside the project directory in the following hierarchy:

Picture8

Under the project directory, create two sub-directories: FinalCode, YOLOv5. Under FinalCode, create five sub-directories: dataset, labeled_data, test, validation, train, yolov5_results.

  1. Insert given files and directories under directories in google drive: After creating directories and subdirectories (in previous step), insert the following files inside the directories you just made:

  2. Inside /content/gdrive/MyDrive/Final_Project/Phase_B/FinalCode/dataset insert images from given dataset directory. After this step, dataset directory in your google drive should look like this:

Picture9

Inside /content/gdrive/MyDrive/Final_Project/Phase_B/YOLOv5 insert files from the given YOLOv5 directory. After this step, YOLOv5 directory in your google drive should look like this:

Picture10

To train and test the HappyWhale model, open HappyWhale.ipynb in GoogleColab, and choose “run-all” in the Runtime tab.

Configuring model’s hyperparameters

In order to change the model’s hyperparameters, go to the Config() class:

In order to change YOLOv5 hyperparameters, change the following values:

Picture11

In order to change ResNet50 hyperparameters, change the following values:

Picture12

Note: After changing values inside Config(), be sure to run the class’ cell to update the model.

Results

Results of the HappyWhale model will be saved under labeled_data directory (/content/gdrive/MyDrive/Final_Project/Phase_B/FinalCode/labeled_data).

Each prediction of the HappyWhale model is saved under labeled_data in the following manner:

labeled_data/predicted_whale_id/{all images that the model predicted to belong to this individual whale}.

About

HappyWhale model implementation - Phase B

License:MIT License


Languages

Language:Jupyter Notebook 99.6%Language:Python 0.4%