- Python 3.6: https://www.python.org/downloads/release/python-3615/
- TensorFlow 2: https://www.tensorflow.org/install/
- Pillow: https://pillow.readthedocs.io/en/stable/installation.html
- NumPy: https://www.numpy.org/
- Matplotlib: https://matplotlib.org/install.html
- Pandas: https://pandas.pydata.org/pandas-docs/stable/install.html
- Jupyter Notebook: https://jupyter.org/install.html
-
Download and install all software dependencies listed above.
-
Clone and navigate to our git repository here.
-
To run the demonstration code GUI, run the following command:
$ app/app.sh
-
To view and perform model training and evaluation, run the code in
fyp-models/poc_tl_all_cv.ipynb
andfyp-models/gen_results.py
by navigating tofyp-models
and typing the command:$ jupyter notebook
This is a software script that runs the GUI. It is modelled as a class and allows the customisation of:
- The image being selected in either JPG or PNG format
- The version of the model being used: baseline (unperturbed) or debiased
- The model architecture: ResNet50, DenseNet, or MobileNet
- The filter to apply: No filter, glasses filter, makeup filter, and N95 mask filter
An image can be loaded with the "Choose an image" button on the left of the screen and classified with the "Classify" button on the right of the screen.
For detailed documentation for the specific methods and variables used, please
refer to the documentation in app/app.py
.
This notebook is focused on model creation, model training, and model evaluation.
- Import libraries and initialise global variables
- Load data
- Data augmentation
- Load base models
- Model creation using transfer learning
- Base models from step 4 are used here
- Model training
- Model analysis
- Get model statistics
- Findings and results
This Python script stores useful functions that allow us to perform useful actions, which include:
- Adding a filter to a specific image
- Making a single prediction with a confidence score for a specific image
Function | Description |
---|---|
gen_metrics |
Generates classification report and confusion matrix (sklearn.metrics). Used by gen_save_cr_cm function. |
gen_save_cr_cm |
Generates, saves and returns classification reports and confusion matrix. Used in poc_tl_all_cv.ipynb . |
apply_filter |
Applies a filter to a specific image. Used by the GUI to apply a filter to a specific image and store it in a target file path. |
make_pred |
Returns predicted class and confidence for a single image. Used by the GUI to get a prediction for a specified image. |