Poisonous Mushroom Detection Using Graph Neural Networks
Poisonous Mushroom Detection Using Graph Neural Networks
Networks
D.P.C.H Pathirana R.M.T.U. Rajapaksha H.M. Samadhi Chathuranga
Faculty of Computing Faculty of Computing Rathnayake
Sri Lanka Institute of Information Sri Lanka Institute of Information Faculty of Computing
Technogy Technogy Sri Lanka Institute of Information
Sri Lanka Sri Lanka Technology
it20161088@my.sliit.lk it20155698@my.sliit.lk Sri Lanka
samadhi.r@sliit.lk
Kosala Sirisena Udara Samarathunga
Faculty of Technology Faculty of Computing
University of Colombo Sri Lanka Institute of Information
Sri Lanka Technology
kosala@et.cmb.ac.lk Sri Lanka
udara.s@sliit.lk
2023 5th International Conference on Advancements in Computing (ICAC) | 979-8-3503-5813-1/23/$31.00 ©2023 IEEE | DOI: 10.1109/ICAC60630.2023.10417353
Abstract— This study delves into the use of Graph Neural inherent graph structure of mushroom images to build a
Networks (GNNs) for the classification of poisonous and edible robust and accurate classification model. Our proposed
mushrooms based on image data, aiming to address the approach involves converting each mushroom image into a
limitations of manual identification methods. Three GNN graph representation, where pixels are treated as nodes and
architectures, Graph Convolutional Network (GCN),
their spatial relationships as edges. This graph-based
GraphSAGE, and Graph Isomorphism Network (GIN), are
examined, with a comparison of the Adam and Stochastic representation enables us to exploit the rich structural
Gradient Descent (SGD) optimizers within each. The results information present in the images.
underscore GNNs' effectiveness in discerning toxic mushrooms
by capturing nuanced pixel relationships, offering a valuable We compare our GNN-based approach against traditional
contribution to the fields of biology and toxicology, with machine learning methods and other deep learning
practical implications for mushroom toxicity prevention. architectures. To achieve this, we employ the PyTorch
Geometric library, which provides specialized tools for
Keywords— Mushroom classification, Graph Neural Networks, working with graph data and GNNs. Our experimentation
Deep Learning, Poisonous Mushroom Detection, Image
Processing
involves implementing various GNN architectures, including
Graph Isomorphism Networks (GIN), and assessing their
I. INTRODUCTION performance on a real-world dataset of mushroom images.
In recent years, the application of Graph Neural Networks
(GNNs) has attracted substantial interest across various The remainder of the paper is structured as follows:
domains due to their effectiveness in modelling structured Section 2 gives a thorough summary of related work in the
data. Graph Neural Networks are a subset of deep learning fields of mushroom classification and GNNs. Section 3
models designed specifically to handle data structured as describes the dataset used for our experiments and the
graphs, where objects are represented as nodes and preprocessing steps involved in preparing the data for GNN
connections between them are represented as edges. One such training. Section 4 presents the methodology, detailing the
application of GNNs is in the field of image classification, GNN architectures employed and the training process. In
where graphs can be used to represent images and their Section 5, we present the experimental results and
features. In this study, we explore the use of GNNs to identify performance comparisons. Finally, Sections 6 and 7
poisonous and edible mushrooms based on photographs of summarize our results, discuss their implications, and offer
their morphological characteristics. potential directions for future research.
Classifying mushrooms into poisonous and edible In summary, this study provides an important contribution
categories is of paramount importance in ensuring public to the mushroom classification field by exploring the
safety and preventing accidental ingestion of toxic application of Graph Neural Networks to image-based
mushrooms [1] [2]. Traditional approaches to mushroom mushroom classification. By harnessing the power of GNNs,
classification rely heavily on feature engineering and hand- we aim to develop a more accurate and efficient approach to
crafted extraction methods, which may not be able to capture differentiating between edible and poisonous mushrooms,
the intricate relationships and patterns present within the data. enhancing public safety, and advancing the capabilities of
In contrast, Graph Neural Networks offer a data-driven image classification techniques.
approach that can automatically learn relevant features and
relationships from the graph representation of the data.
329
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
IV. METHODOLOGY
In this section, we elaborate on the methodology adopted 3) Graph Isomorphism Network (GIN): The GIN
for our research project, focusing on the detection of architecture employs multiple GINConv layers that
poisonous mushrooms using Graph Neural Networks (GNNs). iteratively update node features by aggregating information
We delve into the GNN architectures applied, optimization from neighboring nodes. GINConv layers use multi-layer
techniques employed, the process of converting images into perceptron to capture and propagate graph structure
graph representations, model training procedures, and the information.
evaluation metrics used to gauge model performance.
C. Optimizers
330
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
• Recall: The ratio of true positive predictions to the
total actual positives.
• F1 Score: The harmonic mean of precision and
recall, indicating the trade-off between the two
metrics.
V. RESULTS
In this section, we present the outcomes of our
experiments conducted to classify poisonous and edible
mushrooms using a Graph Convolutional Network (GCN).
We evaluated the performance of different optimizers, Fig. 7. Accuracy Graph (GraphSage Model)
including Adam and SGD, in terms of accuracy. Our dataset
was split into training and testing sets, with a test size of 20%
and a random seed of 42 for reproducibility.
TABLE II- MODEL ACCURACY (USING ADAM OPTIMIZER) Fig. 8. Precision, Recall and F1 Score Variations (GraphSage Model)
Accuracy GNN Architecture
Comparison GCN GraphSage GIN
Accuracy% 49.74 50.26 52
331
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
the SGD optimizer. GraphSAGE consistently outperformed
both GCN and GIN, achieving the highest accuracy among As “GNNs are often considered as black-box models,”
the tested models. Although accuracy is an important metric, future work could focus on developing techniques to interpret
precision, recall, and F1 score give a fuller picture of model and explain the models' decisions. This is particularly
performance. important in applications like toxicology, where
understanding the reasoning behind model predictions is
Across all architectures, the SGD optimizer yielded better crucial for trust and accountability.
results compared to Adam. This could be attributed to SGD's
adaptability to varying learning rates for different model In conclusion, our research project serves as a
parameters, resulting in faster convergence and improved foundational exploration into the realm of poisonous
performance. mushroom detection using GNNs. Addressing the limitations
and pursuing the outlined future directions could lead to more
sophisticated, accurate, and practical solutions for
VI. CONCLUSION AND IMPLICATATION automating mushroom toxicity assessment, enhancing food
The results indicate that the GraphSAGE architecture, safety, and safeguarding human health.
combined with the SGD optimizer, offers the most promising
approach for detecting poisonous mushrooms. The accuracy ACKNOWLEDGEMENT
achieved is significant, considering the complexity of We extend our sincere gratitude to our dedicated
distinguishing between the two classes. Our findings suggest supervisors for their invaluable guidance and faithful support
that the GraphSAGE architecture's ability to aggregate throughout this research project. Their insightful feedback,
information from local neighborhoods is particularly encouragement, and expertise have been instrumental in
beneficial for this task. shaping the direction and quality of this study. We would like
to express our heartfelt appreciation to our supervisor Mr.
Further analysis and comparison of precision, recall, and Samadhi Chathuranga Rathnayake co-supervisor Mr. Udara
F1 score provide a nuanced understanding of the models' Samarathunga, and our external supervisor, Dr. Kosala
strengths and weaknesses, informing potential adjustments Sirisena, for their valuable inputs, mentorship, and valuable
for improved performance. Moreover, the learning trends contributions that have enriched the depth and scope of our
over epochs offer insights into the models' convergence research. Our gratitude also extends to "Samal Mushroom
behavior and potential points of intervention to prevent Farm" in Divlapitiya for graciously providing the essential
overfitting. data that formed the foundation of this study. The
collaboration with the farm has been integral to our research's
In summary, our experimentation reveals that the success. We would also like to extend our thanks to the
GraphSAGE architecture with the Adam optimizer is well- farmers who generously participated in our surveys, sharing
suited for poisonous mushroom detection, showcasing their insights and experiences, which contributed to the
promising accuracy and a balanced trade-off between empirical basis of our work. We would like to acknowledge
precision and recall. These results have implications for the the support of our friends and family for their encouragement,
advancement of automated toxicological analysis and understanding, and patience during the various phases of this
highlight the potential of graph-based deep learning research journey. Their unwavering belief in our abilities has
approaches in similar domains. been a constant source of motivation. Lastly, we appreciate
the collective efforts of everyone who has played a role, no
VII. LIMITATIONS AND FUTURE WORKS matter how small, in the realization of this research. Your
support has been invaluable, and we are profoundly grateful
While our research project provides valuable insights into for your contributions.
the application of Graph Neural Networks (GNNs) for the
detection of poisonous mushrooms, certain limitations, and REFERENCES
areas for future exploration warrant consideration.
[1] J. D. H. Z. X. Y. Yingying Wang, "Mushroom Toxicity Recognition
One of the primary limitations of our study is Based on Multigrained Cascade Forest," Scientific Programming,
hyperparameter tuning. Although we performed 2020.
hyperparameter tuning to some extent, a more exhaustive [2] B. L. Y.-G. F. R. D. C. G. Y. Z. E. T. Xiaomei XIE, "Identification of
search of hyperparameters could yield further performance Gyromitra infula: A Rapid and Visual Method Based on Loop-
improvements. Exploring various learning rates, activation Mediated Isothermal Amplification," METHODS , 2022.
functions, and layer configurations could lead to enhanced [3] A. L. J. Huu H Tran, "Mushroom Toxity," National Institute of Health,
USA.
model accuracy and convergence behavior.
[4] R. K. I. C. M. K. Kemal Tutuncu, "Edible and Poisonous Mushrooms
Classification by Machine Learning Algorithms," Mediterranean
Our models currently rely solely on pixel intensities for Conference on Embedded Computing (MECO), 2022.
graph construction. Incorporating structural information, [5] Y. Z. Z. L. Baiming Zhang, "USING DEEP CONVOLUTIONAL
such as mushroom shape and spatial relationships between NEURAL NETWORKS TO CLASSIFY POISONOUS AND
various parts, could enhance the models' ability to capture EDIBLE MUSHROOMS FOUND IN CHINA," ResearchGate, 22
October 2022.
critical features. This could involve more sophisticated graph
construction methods that consider the hierarchical structure [6] A. P. Gupta, "Classification Of Mushrooms Using Artificial Neural
Networks," Creative Commons, 03 September 2022.
of mushrooms.
332
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
[7] S. G. P. M. Pradhyumna P, "Graph Neural Network (GNN) in Image [8] M. B. M. T. I. L. X. Varun Vasudevan, "Image classification using
and Video Understanding Using Deep Learning for Computer Vision graph neural network and multiscale wavelet superpixels," 2023.
Applications," 2021.
333
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.