Floranet is a deep learning notebook focused on classifying flowers from the Oxford Flower Dataset. By leveraging
transfer learning with VGG16, DenseNet121, and InceptionV3, Floranet explores techniques like layer freezing and data
augmentation to achieve high classification accuracy with minimal error. In this README.md
file you will find quick
instructions on how to run the notebook correctly in your local development environment.
- Prerequisites
- Dataset Download and Preparation
- Code Execution Guide
- Skip Training Option
- Libraries Used
- File Structure
- Python: version 3.11 or higher
- Environment: code tested on Google Colab and local environments.
Make sure to install the required libraries before running the code. You can install the dependencies using the following command:
pip install -r requirements.txt
Recommendation: For an optimal experience, we recommend using a Google Colab environment. When utilizing Colab, all required dependencies will already be pre-installed
The dataset used in this project consists of images of flowers and their corresponding labels. The code automatically downloads and preprocesses the dataset. No manual intervention is required. A deep dive on how the code handles the process is as follows:
-
The following resources are retrieved:
-
The resources are extracted into the
Data
folder:- Images are stored in
Data/images
- Segmented images are stored in
Data/segmented_images
- Labels are processed and saved in
Data/train_set.csv
,Data/valid_set.csv
, andData/test_set.csv
- Images are stored in
- Clone or download the repository containing the code.
- Ensure all prerequisites are installed.
- Run the notebook or script sequentially.
- Trained models and results will be saved in the
Models
directory.
If you want to skip the (long) training process and directly use pre-trained models:
- Download the pre-trained models, which are available exclusively for members of Università degli Studi di Milano-Bicocca.
- Unzip the
Floranet Models.zip
file, and paste its content into theModels
directory. If the folder doesn't already exist, create it. The directory structure should align with the example provided in the File Structure section.
Additionally, you may skip the generation of the results.csv file by completing the following steps:
- Download the results.csv file, which is available to everyone on my personal GitHub repository.
- Paste the file into the
Models
directory. If the folder doesn't already exist, create it. The directory structure should align with the example provided in the File Structure section.
The project relies on the following main libraries:
- Pathlib | 1.0.1
- Requests | 2.31.0
- Pandas | 2.0.3
- Seaborn | 0.13.2
- Matplotlib | 3.10.0
- Tensorflow | 2.16.2
- Numpy | 1.26.4
- Scipy | 1.11.1
- Pillow | 11.0.0
- Scikit-learn | 1.5.2
- iPython | 8.15.0
- Protobuf | 4.23.4
Note: The code has been tested with these library versions. Compatibility with other versions is not guaranteed.
Project Directory
|
|-- Data/ # Contains processed datasets
| |-- images/ # Contains Original images
| |-- segmented_images/ # Contains Segmented images
| |-- imagelabels.mat # Image labels
| |-- train_set.csv # Training data
| |-- valid_set.csv # Validation data
| |-- test_set.csv # Test data
|
|-- Export/ # Contains KeyNote presentations
|
|-- Images/ # Contains images used by the LaTeX report
|
|-- Models/ # Contains models and reports
| |-- model_densenet1/ # Contains 1st DenseNet experiment
| |-- model_densenet2/ # Contains 2nd DenseNet experiment
| |-- model_densenet3/ # Contains 3rd DenseNet experiment
| |-- model_densenet4/ # Contains 4th DenseNet experiment
| |-- model_inception1/ # Contains 1st Inception experiment
| |-- model_inception2/ # Contains 2nd Inception experiment
| |-- model_inception3/ # Contains 3rd Inception experiment
| |-- model_inception4/ # Contains 4th Inception experiment
| |-- model_vgg1/ # Contains 1st VGG experiment
| |-- model_vgg2/ # Contains 2nd VGG experiment
| |-- model_vgg3/ # Contains 3rd VGG experiment
| |-- model_vggg4/ # Contains 4th VGG experiment
| |-- results.csv # Contains experiment results dataframe
|
|-- Report/
| |-- Floranet.tex # LaTeX Report of the project
| |-- Floranet.pdf # PDF Report of the project
|
|-- Floranet.ipynb # Main notebook
|-- requirements.txt # List of required libraries
|-- README.md # The file you're reading right now
For any issues or questions, please contact us at [email protected] and [email protected].