Skip to content

Explainable Detection of Microplastics using Transformer Neural Networks. Includes codes for a classification transformer aimed at classifying microplastic FTIR data.

License

Notifications You must be signed in to change notification settings

br3nr/microplastic-transformer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository provides supplementary material for the following publication:

M. Barker, M. Willans, D-S. Pham, A. Krishna, M. Hackett. Explainable Detection of Microplastics Using Transformer Neural Networks, in Proceedings of the Australasian Joint Conference on Artificial Intelligence (AJCAI), Perth December 2022.

Available in this repository:

  • Reflectance micro-FTIR spectral data for standard and marine polymers
  • Python code that implements the model

For more information about how the spectral data was collected I highly recommend reading the following: Development of a rapid detection protocol for microplastics using reflectance-FTIR spectroscopic imaging and multivariate classification.

If you find this useful, a citation is appreciated.

Setup and Execution

This code runs using pytorch-gpu which you can download from pytorch.org/.

Assuming pytorch is installed you can run the program with:

python3 run.py

Configuring

All of the variables that control the models hyperparameters are in run.py. I last tested this code on a GTX 1080ti, so you may be able to change certain hyperparameters.

Currently the dataloaders load the micro-FTIR datasets that contain polyethylene and polypropylene in the no_fp directory. There is however an alternative option to train the model with filter paper samples. This can be done by using the csv files in the with_fp directory. Otherwise, you can extract the entire datasets in the marine_polymers.csv and standard_polymers.csv in the data directory.

You will need to change the global variable LABEL_DICT if you wish to use the filter paper samples. This can be done by changing:

LABEL_DICT = {'PP': 0,'PE':1}

to

LABEL_DICT = {'PP': 0,'PE':1,'FP':2}

Figures

Reflectance Micro-FTIR Workflow

Raw Marine Polymer Data and First Order Difference

Best Performing Validation and Test Results

Baseline Model Comparison

About

Explainable Detection of Microplastics using Transformer Neural Networks. Includes codes for a classification transformer aimed at classifying microplastic FTIR data.

Topics

Resources

License

Stars

Watchers

Forks

Languages