In this project, we'll be building image classification models using CNN and transfer learning. The analysis can be accessed here.
The model is then deployed using Streamlit and you can try it out at https://firescope.streamlit.app/.
Author: Po-Hsun (Ben) Chen
In this project, we have a dataset that contains two types of images: fire images and non-fire images. Our objective is to be able to classify these images into their corresponding categories. To complete this task, we'll be building two of our own convolutional neural network (CNN), a simple one and a slightly more complicated one. At the very end, we'll compare the performance of our model to a pretrained model and see for ourselves the incredible power of transfer learning.
The dataset used in this analysis consists of 2 folders, each containing fire and non-fire images. In total, we have 755 outdoor fire images and 244 non-fire nature images. I've also gathered three random images from the internet to test the final capability of our model. The dataset is sourced from Kaggle and you can access the dataset here. The three images sourced from the internet for testing the model can be accssed here
All required dependencies are listed in this conda environment file.
-
Clone the Repository:
git clone https://github.com/phchen5/firescope.git cd firescope
-
Download the Dataset from the Source: You may need to register for a Kaggle account. After you've downloaded the dataset, place the
fire_images/
andnon_fire_images/
folder within adata/
folder located in the root. The three images for testing should also be placed in anothertest_images/
folder located in the root. You can choose to place these anywhere else in the repository as you like, but just be sure to edit the data source path within the analysis. -
Set Up and Activate Environment:
conda env create -f environment.yaml conda activate firescope
-
Open the Notebook:
jupyter lab analysis/firescope-cnn-and-tl-with-pytorch-98-acc.ipynb
-
Run the Cells and Have Fun Exploring!
analysis/firescope-cnn-and-tl-with-pytorch-98-acc.ipynb
: Jupyter notebook containing the EDA code.environment.yaml
: Conda environment file listing required dependencies.deployment/best_baseline_model.pth
: The saved model weights for the baseline CNN model.deployment/best_model_1.pth
: The saved model weights for the slightly more complicated CNN model.deployment/best_model_tl.pth
: The saved model weights for the model trained using transfer learning.deployment/app.py
: The app file for deployment on Streamlit.deployment/requirements.txt
: The file that contains the required dependencies for deployment on Streamlit.