According to Brandenburg and Ward (Mycologia, 2018), in the years between 1999 and 2016 there were approximately 7428 cases of mushroom exposure. Mushroom poisoning is remarkably dangerous and enabling foragers to detect the particular species of a mushroom is a powerful tool for ensuring the safety of those who go out into nature and anyone with interests in fungi more broadly.
The aim of the current project is to utilize machine learning frameworks in PyTorch in order to implement a neural network classifier capable of computer vision in order to define the species of mushroom from tensors of pixel data.
Moreover, this project uses transfer learning in order to leverage ResNet-18 to create more sophisticated and accurate neural nets than those made from scratch.
With these methods, we are capable of generating a performant model capable of mushroom prediction.
see mushroom_vision.ipynb for performance metrics
Mushroom classification - Common genus's images
- mushroom_vision.ipynb:
the main notebook. See how the data was processed, how the PyTorch Model was built, and model performance. - utils:
a python package containing utility functions - requirements.txt:
all dependencies - .gitignore
- LICENSE
I recommend creating a virtual environment, in this case I call it "mushroom_vision".
In terminal:
python -m venv mushroom_vision
Activate venv in terminal
source mushroom_vision/bin/activate
side note: can deactivate venv with
deactivate
Install all requirements by first going to the directory where requirements.txt is (e.g. project root directory)
cd name/of/root/directory
and then typing in terminal:
pip install -r requirements.txt
Now you are ready to run the Jupyter notebooks mushroom_vision.ipynb using your favorite IDE or
jupyter lab
Step through the notebook sequentially to gain an understanding of my workflow and the neural network that I generated.
See full list of requirements with exact versions to recreate my development environment in requirements.txt
Key Requirements:
- kaggle
- jupyter
- matplotlib
- numpy
- pandas
- pillow
- scikit-learn
- seaborn
- torch
- torchinfo
- torchvision
Miguel A. Diaz-Acevedo at [email protected]