An IoT-Enabled Deep Learning Framework for Autonomous Environmental Monitoring and Toxicity Classification in Smart Mushroom Cultivation Systems | Research Square window.SnipcartSettings = { analytics: { enabled: false } }; (function() { var accessVector = localStorage.getItem('access_vector') || ''; window.dataLayer = window.dataLayer || []; if (accessVector) { window.dataLayer.push({ user: { profile: { profileInfo: { snid: accessVector } } } }); } })(); (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-K279D39R'); Browse Preprints In Review Journals COVID-19 Preprints AJE Video Bytes Research Tools Research Promotion AJE Professional Editing AJE Rubriq About Preprint Platform In Review Editorial Policies Our Team Advisory Board Help Center Sign In Submit a Preprint Cite Share Download PDF Research Article An IoT-Enabled Deep Learning Framework for Autonomous Environmental Monitoring and Toxicity Classification in Smart Mushroom Cultivation Systems Md Imtiaz Aftab Shadin, Sakib Nesar Ratul, Md. Azizul Haque This is a preprint; it has not been peer reviewed by a journal. https://doi.org/ 10.21203/rs.3.rs-6338090/v1 This work is licensed under a CC BY 4.0 License Status: Posted Version 1 posted You are reading this latest preprint version Abstract Monitoring and controlling the weather is an essential aspect of mushroom development, particularly the effects of temperature, humidity, light intensity and the amount of carbon dioxide. The traditional method of mushroom farming is quite challenging because there is little control over the weather and cultivation process, and poisonous mushrooms frequently grow. Hence, a sensor based self-regulating Internet of Things framework will be relatively more convenient than any conventional system for monitoring and controlling the farming environment. Mushroom farming traditionally faces challenges due to its dependence on weather conditions and the risk of cultivating poisonous varieties. To address these issues, we propose a smart mushroom farming system integrating Internet of Things (IoT) devices and Deep Learning (DL) models, including DenseNet169, ResNet50V2, and MobileNet. This system enables remote monitoring, automated cultivation, and mushroom classification. IoT components such as microcontrollers, sensors, and actuators facilitate intelligent monitoring and automation. DL algorithms classify mushrooms as edible, inedible, or poisonous, with preprocessing techniques like Contrast Limited Adaptive Histogram Equalization (CLAHE) and the Laplacian Filter enhancing classification accuracy. Using DenseNet169, our model achieves a maximum test accuracy of 95.21%. Internet of Things (IoT) Smart farming Mushroom Deep Learning Classification Figures Figure 1 Figure 2 Figure 3 Figure 4 Figure 5 Figure 6 Figure 7 Figure 8 Figure 9 Figure 10 Figure 11 Figure 12 Figure 13 Figure 14 Figure 15 Figure 16 Figure 17 Figure 18 I. Introduction The global economy is significantly influenced by agriculture. This is one of the reasons that the cultivation system should be efficient and effective so that the production rate becomes high without affecting the quality. Many poor populations depend on wild mushrooms as a significant source of food and revenue, and they are also valuable to recreational foragers. The conventional approach of mushroom farming is very time consuming and manual labor based. Because of this, it is imperative to create a system that can automate every step of the farming process, thereby reducing physical work and increasing efficiency [1]. The fleshy fruit body of many fungi attached to Basidiomycetes growing on a ground surface is known as a mushroom. Not all mushrooms, nevertheless, are edible. While certain mushrooms can treat cancer, other varieties may harbor viruses that spread contagious illnesses [2]. Essential benefits of edible mushrooms include their ability to fight against infections, cancer cells, and other diseases and strengthen the immune system. Some woody rack mushrooms are inedible due to their extremity for chewing. They cannot be digested by humans and sometimes evict the digestive system. People also pass away after eating poisonous mushrooms due to ignorance [3]. So, it is essential to follow a proper way of cultivation to obtain mushrooms of the highest quality and steer clear of harmful ones. Mushroom farming is critical because it necessitates meticulous monitoring and management of the farming environment. Typically, farmers worldwide cultivate mushrooms in a dark environment [4]. It is not easy to grow mushrooms in a dark environment since the farmers must rigorously control the farm’s weather using specific parameters, such as temperature, humidity, CO2 level, and light intensity, which decide the amount of production [5]. Farmers usually manage these parameters manually, which is quite challenging and can hamper the production rate. Moreover, the farmers must ensure the proper classes of mushrooms to identify the edible ones before marketing. Thus, monitoring and controlling the farming environment of mushrooms and selecting suitable mushrooms are the crucial issues associated with mushroom cultivation. The conventional mushroom cultivation process is arduous due to the limited control over the weather and growing process and the frequent occurrence of toxic mushrooms. Most farmers, especially in developing and underdeveloped nations, follow the traditional approach, which is time-consuming, error-prone, and tedious. Thus, a sensor-based self-regulating IoT framework will be more convenient than any conventional approach for monitoring and controlling the farming environment [4], [5], [6], [7], [8]. Hence, creating a system that can automate every step of the farming process is imperative, reducing physical labor and increasing efficiency. The cultivation system should be efficient and effective so that the production rate becomes high without affecting the quality. Thus, monitoring and controlling the cultivation environment is of utmost importance for properly producing agricultural commodities. Developing an IoT-based automated system for remote monitoring and controlling the environment to produce mushrooms efficiently is the demand of the time. Besides, it is indispensable to identify edible mushrooms. Consequently, before marketing the mushrooms, a faster and more accurate classification of edible, inedible, and poisonous mushrooms is crucial because the manual job is not easy and probably fallible. Therefore, an automated framework for monitoring, controlling, and classifying mushrooms is necessary for efficient and sustainable farming. In this paper, we propose an autonomous system that combines IoT with DL technologies to provide effective methods for the production and classification of mushrooms. This method can raise farm productivity by utilizing the structural framework of IoT-enabled farms created by using microcontrollers, sensors, and actuators. In addition, the research has mechanized the farm to control the weather and used IoT technology for remote monitoring utilizing intelligent devices. At the same time, the DL model assists us in avoiding poisonous mushrooms by classifying them into different classes. Significant contributions of this work are as follows: First, propose to design an automated framework for cultivating mushrooms under extreme weather conditions. In particular, the designed framework can monitor and control the farming environment while capable of detecting poisonous mushrooms for assisting the farmers from cultivation damage. Second, develop and implement the proposed IoT-based framework by assembling numerous sensors, actuators, and microcontrollers for effectively monitoring and controlling the mushroom farm remotely through smart devices. Third, to deal with harmful mushrooms, we adopt existing deep learning mechanisms for classifying mushrooms into edible, inedible, and poisonous. Thus, integrate such a scheme on top of the developed framework for an autonomous, quick, and reliable mushroom health examination. Finally, evaluate the performance of the developed IoT-based smart mushroom farming system by generating several test case scenarios in terms of operational efficiency and classification accuracy. II. LITERATURE REVIEW In the last few years, the automation process has been increasing significantly while the use of smart IoT devices in mushroom farming [6] becomes an automated system for growing mushrooms in a more effective way. In particular, due to the significant maintenance capabilities of IoT systems, the farmer can hold the optimum conditions inside the farm. An interconnected network of computing devices known as IoT allows data to transfer without needing human interaction. In the realm of contemporary computing, IoT technology is now increasingly common. The IoT in modern agriculture enables farmers to monitor the state of their farms in real-time from anywhere by using sensors that connect them to their farms. The usage of IoT in the agriculture sector is expected to grow $ 48,714 million by 2025 [9]. Besides, with the development of Computer Vision, Artificial Intelligence (AI), and Machine Learning (ML), it is now within our hands to create computerized models for classifying objects conveniently. Various ML techniques like Support Vector Machine (SVM), K-Nearest Neighbor (KNN), Random Forest (RF), etc., are used for the automated detection of various entities. However, most of the imperative features need to be specified by domain specialists to lower the complexity of the data and create patterns more perceptible to the algorithms in traditional ML techniques. Deep Learning (DL), a branch of ML, is becoming more popular in the last few years due to its ability to automatically learn features from high-dimensional data such as images, videos, etc. It reduces our burden for performing complex tasks like pattern recognition [10], image classification [11], disease detection [12], and so on. Recently, DL has also been rigorously used in the Agri-domain, especially for controlled environment agriculture [13], plant disease detection [14], plant classification [15], crop yield prediction [16], etc. It has recently been engaged in resolving the mushroom labeling problem [17]. We divided the rest of the related work into the following subsections: 1) Automation for Mushroom Cultivation, and 2) Machine Learning for Mushroom Classification. The authors in [18] designed an intelligent system to keep track of the environmental conditions of a mushroom farm. The system uses the appropriate sensors to measure the CO2 level, light, humidity, and temperature. The extracted data was used to control the nursing room’s environment with additional equipment like an air conditioner, water pump, light bulb, and exhaust fan. In the paper [19], the authors proposed a Wireless Sensor Network (WSN) based IoT system for mushroom cultivation by considering Oyster mushroom cultivation. This work controls a humid climate and a temperature value between 16 and 30°C and developed a remote monitoring system. The authors in [20] presented a partially automated environment control system for mushroom farming. The authors of the paper [21] suggested a system that describes the development of a prototype for controlling temperature and humidity based on an IoT network. In particular, DHT-11 sensor, the Arduino Uno microcontroller, the MCU ESP-8266, and the Cayenne IoT platform are used for control. By continuously monitoring remotely, the temperature is kept between 22°C and 28°C, and the humidity is between 60% and 80%. The work in [22] developed a system for tracking a mushroom farm’s environmental conditions that allow a user to keep an eye on important elements like temperature, humidity, and light intensity of a mushroom farm. The ideal temperature and humidity for growing white button mushrooms are 22 to 25°C and 70–90%, respectively. However, these works [18], [19], [20], [21], [22] do not design the entire framework that may assist the farmer in autonomous monitoring and controlling the cultivation environment, nor do they discuss the dynamic adaptation of temperature, humidity, and light in mushroom cultivation. The authors in [23] proposed a classification method for classifying the mushroom dataset into edible and inedible, where ANFIS outperforms on ANN and Naïve Bayes schemes. In work [24], the authors developed a feature-based classification system using the texture of the mushrooms. This work used an SVM-based machine-learning scheme. The authors in [25] proposed a system to classify five species of mushrooms found in Thailand using CNN and RCNN. They considered the accuracy and testing time of some transfer learning models, including AlexNet, ResNet-50, and GoogLeNet, and came up with a solution for distinguishing between edible and poisonous mushrooms. The work in [3] adopted DL algorithms such as VGG16, InceptionV3, and Resnet50 to classify mushrooms according to their category. The authors in [4] suggested an ensemble learning model for the classification of mushrooms into six categories. A Multi-Layer ANN model was designed in [26] to train and differentiate mushrooms between edible and harmful. The authors in [27] developed a CNN-based smartphone application to identify different varieties of mushrooms from field-collected images. Although other researchers have already carried out numerous studies, most of them used automation or classification but not both. The major goal of our study is to close this gap by developing a system that makes use of both IoT and Deep Learning technology. The farming system is automated with the use of IoT, which also includes remote monitoring and managing the farm environment. Additionally, DL is utilized to quickly distinguish between edible, inedible, and poisonous varieties of mushrooms. Although other researchers have already carried out numerous studies, most of them used automation [18], [19], [20], [21], [22] or classification [23], [24], [25], [26], [27] but not both. The major goal of our study is to close this gap by developing a system that makes use of both IoT and DL technology. The farming system is automated with the use of IoT, which also includes remote monitoring and managing the farm environment. Additionally, Deep Learning is utilized to quickly distinguish between edible, inedible, and poisonous varieties of mushrooms. III. IOT-BASED SMART MUSHROOM FARMING AUTOMATION The system comprises three components: 1) IoT-based Smart Monitoring, 2) Farm Automation, and 3) DL-based Mushroom Classification. Figure 1 illustrates the system architecture of the proposed solution. Figure 1 demonstrates the overall ecosystem of the proposed IoT-based smart mushroom farming system, while Table I outlines the hardware components used in developing the testbed. At the core of the configuration is a microcontroller responsible for the IoT-based monitoring and automation system. The architecture integrates modules for monitoring temperature, humidity, light intensity, and carbon dioxide, all coupled with the ESP32 microcontroller to facilitate proper farm automation. Data collected by the microcontroller are transmitted to the IoT server, enabling remote monitoring, and parameter values can also be manually checked on an LCD. A camera module captures images of mushrooms and uploads them to online storage, providing input for the classifier during the classification task. A. Smart Monitoring The primary factors of mushroom growth are temperature, humidity, carbon dioxide level, and light intensity. Monitoring these conditions inside the farm from any distant location is essential. For this study, three sensors inside the farm sense the four critical factors. The DHT-22 digital sensor measures temperature and humidity, while the MH-Z19B Infrared CO₂ sensor module detects CO₂ gas levels. The BH-1750 digital light intensity sensor is used to measure the farm’s light intensity. The microcontroller is coupled with these sensors to monitor the parameters, and an LCD is connected for manual parameter monitoring. Sensor data are recorded and utilized for remote monitoring and control. The ESP32 DevkitV1 is employed for data visualization by reading sensor data from the sensing modules. Subsequently, the sensor data are uploaded to the Blynk server. Users can monitor data from the server in real time through the Blynk application, with the desired data displayed immediately. Any user connected to the end application can check the status of the farm from anywhere in the world. The operation of the IoT-based smart monitoring system is depicted in Fig. 2 . B. Farm Automation Farm automation includes the steps taken after monitoring the condition of the farm. Four external devices are connected to the microcontroller in this research to regulate the atmosphere TABLE I HARDWARE COMPONENT OF THE DEVELOPED TESTBED Components Remarks ESP32 Devkit V1 Microcontroller ESP32-CAM Camera Module DHT-22 Digital Temperature and Humidity Sensor MH-Z19B Infrared CO 2 Gas Sensor BH-1750 Digital Light Intensity Sensor 12V 60W TEC1-12715 Thermoelectric Cooler Peltier Mist Maker Fogger Humidifier Atomizer As an Actuator to humidify DC 12V 4” Exhaust Fan Expelling the air from the inside to the outside 220V 100W AC Bulb The purpose of lighting a dark environment and generating heat inside the prototype LCDDisplay (16X2) For real-time monitoring 4 Channel 5V Relay Board Module As a voltage breaker 12V, 20A DC Power Supply For supplying 12V DC to operate the actuators of the farm. The farm’s temperature, humidity, CO₂ level, and light intensity are controlled, respectively, using a Peltier air conditioner, a mist maker fogger humidifier, an exhaust fan, and a light bulb. The controlling operation of the farm can be done both manually and automatically. The microcontroller is programmed with the ideal range of parameter values for automatic control. The ESP32 microcontroller combines predetermined input data from the user with real-time sensor data from sensing modules to automate all the equipment. A Peltier air conditioner is employed to maintain the required temperature because of its low power consumption. The Peltier air conditioner automatically turns on and off depending on whether the temperature rises or falls. If the humidity level falls while the humidifier monitors the data, it activates and raises the humidity to the optimum level. Even in a dark environment, mushrooms need a small amount of light to develop. For lighting purposes, a bulb is used that automatically turns on and off based on the amount of light required. Lastly, an exhaust fan engages and mechanically expels the gas from inside when the CO₂ level reaches the predetermined limit. All the controlling operations can also be performed manually by the farmer from anywhere by using the Blynk application, which is an IoT platform for remotely monitoring and controlling the farm weather. Figure 3 shows the operational process of the farm automation system. B. Deep Learning-based Mushroom Classification The system uses an ESP32-CAM camera module connected to the microcontroller to capture images in the first stage (as seen in Fig. 4 ). Because mushrooms require darkness to grow properly, taking images of them in dim or gloomy environments is exceedingly challenging. Several AC light bulbs, managed by relay modules, are used as a camera flash. These bulbs only flash while taking images. Following the acquisition of the images, the system processes the data and feeds it to the Deep Learning model. The data is then forwarded for analysis, and afterward, the decision is provided by the prebuilt model based on the analyzed data. 1) Collection of Data To train the DL model, we consider a dataset consisting of 22,979 mushroom images with 140 different species [28]. Out of them, one-third are edible, one-third are inedible, and the remaining are poisonous. Images are collected mainly from two resources. The first one is a mushroom classification research paper where the authors have classified 106 different species of mushrooms. They used two Sources to prepare their data, namely the 2018 FGVCx Fungi Classification Challenge dataset and images from [28]. The second one is the iNaturalist website, which is a joint initiative of the California Academy of Sciences and the National Geographic Society. They have gathered trustworthy images from many nations and farms suitable for research-grade [29]. Figures 5 , 6 , and 7 categorically show some samples of the mushroom species used in this study. 2) Data Preprocessing and Augmentation The collected images are noisy and require adjustments in size and color. To address these issues and mitigate overfitting, we have applied various data augmentation techniques, including rotation, scaling, flipping, translation, and shearing. Figure 8 presents some samples of the augmented images. Additionally, CLAHE is employed to improve image quality. It is an image enhancement technique that enhances contrast to make images clearer. However, after applying contrast enhancement, the edges of the images are not correctly visible, necessitating a filtering method to sharpen them. To achieve this, we have used the Laplacian Filter as a sharpening strategy following the CLAHE operation, making the images more suitable for classification models. Figure 9 illustrates samples of images after applying preprocessing techniques. 3) Transfer Learning Transfer learning is a term in machine learning that refers to using a previously learned model on a different issue. A machine can more accurately predict results for future tasks by using data from previous tasks through the process of transfer learning [30]. In this study, we have used CNN models based on transfer learning for classification. Pretrained CNN models are more frequently used than training models with randomly added weights since they are simpler and faster. In addition, new layers are transferred using the fine-tuning technique depending on the classification task rather than using the final layers of the predefined networks. 4) CNN Architectures: DenseNet169 : DenseNet169 is a Convolutional Neural Network architecture from the DenseNet family which has 169 layers. It is a frequently used Deep Learning model for classification. Compared to other DenseNet architectures with fewer layers, it has a significantly smaller set of trainable parameters. DenseNet169, along with the other DenseNet architectures, is a family of very reliable Deep Learning architectures. They have some unique characteristics, including the ability to resolve the vanishing gradient problem, a strong feature propagation approach, a limited set of trainable parameters, and the utilization of feature reuse. Figure 10 shows the layers of DenseNet169 architecture. Figure 10 shows the architecture’s basic components: convolutional layers, maxpool layers, fully connected layers (dense layers), and transition layers. Only the final layer of the model utilizes the SoftMax activation function, and the rest of the architecture uses the ReLU activation function. The convolutional layers extract features from the images, and the maxpool layers reduce the dimensionality of the input images. The flatten layer is followed by fully connected layers that use the flatten layer’s single array input to function as an Artificial Neural Network (ANN). The final activation function uses those flattened data to classify images [32], [31]. ResNet50V2: ResNet50V2 is a Convolutional Neural Network architecture that contains the same layers as ResNet50 but significantly differs in the working process. It works based on version 2 of the ResNet module, which is about using weight layers’ preactivation instead of post-activation. ResNet Version 1 performs the convolution operation first, then Batch Normalization and ReLU activation functions as well, whereas ResNet Version 2 uses these two activation functions to the input before the convolution operation [33]. The working procedure of the ResNet module version 2 architecture is shown in Fig. 11 . The ResNet50V2 architecture contains 48 convolutional layers, one fully connected layer, and 16 bottleneck building blocks. It requires input images with a dimension of 224 × 224 x 3. In bottleneck building blocks 1 through 3, convolution layers can be found with 64 filters having a filter size of 1 x 1, 64 filters having a filter size of 3 x 3, and 256 filters having a filter size of 1 x 1. Building blocks 4 through 7 are constructed with one convolution layer that has 512 filters of size 1 x 1 and two convolution layers, each of which includes 128 filters with filter sizes of 1 x 1 and 3 x 3. There is a total of three layers in building blocks 8 to 13. Two of them are convolution layers, each having 256 filters with a filter size of 1 x 1 and 3 x 3. The other layer has 1024 filters, where the filter size is 1 x 1. Building block numbers 14 through 16 feature two convolution layers with 512 filters, each with a filter size of 1 x 1 and 3 x 3, as well as another layer with 2048 filters, all with a 1 x 1 filter size [34], [35]. Figure 12 depicts the internal structure of the ResNet50V2 model. MobileNet MobileNet, uses a more straightforward construction to produce lightweight deep neural networks utilizing depth wise separable convolutions. It considerably lowers the number of parameters in comparison to a network having traditional convolutions of the same depth in the nets. MobileNet has a total of 28 layers, 27 of which are convolution layers, including one fully connected layer, one softmax layer, one average pool layer, and 13 depth wise convolution layers. The standard MobileNet model has 4.2 million parameters, compared to lower MobileNet variations that have 1.32 million. The MobileNet structure is made up of depth wise separable convolutions, but its first layer is an exception because it is a full convolution, as was discussed in the preceding section. All layers in a MobileNet architecture are followed by a Batch Norm and ReLU nonlinearity, except for the final fully connected layer, which has no nonlinearity and feeds into a softmax layer for classification. Both the first layer and the depth wise convolutions manage down sampling using strided convolution. There is an average pooling layer in the final phase of the network. This layer is placed before the fully connected layer and reduces the spatial resolution to 1 [36]. Classification Process : Initially, the collected images are augmented, and two preprocessing techniques are applied. Thus, two datasets are created: one with the collected raw images and another with the preprocessed images. After that, the entire dataset is split into two sections: training data and testing data. With the help of the random splitting technique, the model is trained using 80% of the training data and validated using the remaining 20% of the images. Then, the data are fed to the proper DL framework for building the classification model. During the testing phase, 3003 new images are utilized to assess the trained model’s performance, with about equal numbers of images in each class. This entire methodology is applied to both the raw and the preprocessed images. Categorical cross-entropy is employed as the loss function throughout the transfer learning process that is used to train all models. With the Adam optimizer, the learning rate is set to 0.0001, and SoftMax is utilized as the activation function for all architectures. All the experiments are done using the python programming language on a Kaggle Notebook with 13 GB of RAM, 16 GB of GPU memory, and 73 GB of disk space. Figure 13 shows the entire working process of the classification system. The proposed structure includes multiple stages, including image acquisition and dataset preparation, image preprocessing, application of Deep Learning techniques, classification of mushrooms into distinct categories, and result in analysis using performance evaluation metrics. Categorical cross-entropy was employed as the loss function throughout the transfer learning process that was used to train all the models. Categorical cross entropy calculates the loss using the predicted value and true value where the number of nodes in the output layer is more than one. With the Adam optimizer, the learning rate was set to 0.0001 and Softmax was utilized as the activation function along with a batch size of 32 for efficient training. To develop CNN models, we have used TensorFlow and Keras library. To train each of the CNN models, the number of epochs has been set for 100. We have also used early stopping with a patience value 60, so that we could save time and reduce training time. It will stop training when a monitored metric has stopped improving. During training, we have monitored the validation accuracy with maximum mode. We have saved the best model as h5 files in for further testing and performance evaluation. The process begins with the collection of images from multiple resources. Following the image collection, we prepared the entire dataset and preprocessed the images using several methods. With three different CNN architectures, features are retrieved from images. In this work, the Deep Learning models DenseNet169, Resnet50V2, and MobileNet are considered. IV. EXPERIMENTAL RESULTS AND DISCUSSION A. Experimental Results of the IoT-based Monitoring and Automation System TABLE II EXPERIMENTAL RESULTS OF IOT-BASED MONITORING AND AUTOMATION SYSTEM DHT-22 Sensor Data MH-Z19B Sensor Data BH-1750 Sensor Data Actuators Temperature H (°C) Humidity (%) CO2 Level (ppm) Light Intensity (Lux) Peltier AC Mist Maker Humidifier Exhaust Fan Light Bulb 22–30 CO2 Level (ppm) 800–1500 200–300 OFF OFF OFF OFF > 30 800–1500 800–1500 200–300 ON ON OFF OFF 22–30 800–1500 > 1500 30 > 1500 > 1500 < 200 ON ON ON ON The ideal temperature range for mushroom cultivation is 22–30°C. Mushrooms also require a high humidity level that is consistent for healthy development. A humidifier is needed for this to maintain a consistent relative humidity of 80–90%. In addition to these, the light intensity for mushroom farms should be between 200 and 300 lux [37] and a CO2 level of 800 to 1500 ppm is needed [38] because excessive CO2 and inappropriate light intensity might result in abnormal growth of mushrooms. In this study, experimental results were obtained by observing how actuators, such as Peltier air conditioner, mist maker humidifier, exhaust fan and light bulb responded to the changes in the weather at the mushroom farm. Table II summarizes the results of the experiments at different conditions. In this research, a prototype of the system has been developed. The hardware equipment, including the sensors, actuators, microcontroller, and relay module, was configured during the development process. The dashboard design is then completed on the IoT cloud server. The experimental observations on the prototype for some of the conditions indicated in Table II with the corresponding parameter values from the monitoring system in the Blynk application are shown in Figs. 14 , 15 , 16, and 17 . Figure 14 depicts an experiment when all actuator components are off because the farm’s temperature, humidity, CO2 level, and light intensity are suitable with their setpoint values. Figure 15 illustrates a snapshot of the experiment in which the Peltier air conditioner activates to decrease the farm temperature when the temperature approaches the upper limit. The mist maker humidifier increases the humidity when it tends to be below the lower limit. Figure 16 provides an image of the experiment when the CO2 level reaches the predetermined value, and the light intensity is not ideal. To maintain the setpoint, the system activates the bulb to raise the light intensity and turns the exhaust fan on to lower the CO2 level. Figure 17 represents a scenario where all the actuators are turned on because no parameters are optimum. B. Mushroom Classification Approach using Deep Learning In this experiment, a transfer learning approach is used to implement multiple CNN architectures for classifying mushrooms. Initially, the experiment is conducted using raw images, but the outcomes are unsatisfactory. Later, preprocessed images are substituted for the original raw images, which produce the best results. The study uses several CNN architectures, including DenseNet169, ResNet50V2, and MobileNet. ResNet50V2 shows the best test accuracy of 84.43% among all considered models when using the raw images, followed by DenseNet169 with 81.26% and MobileNet with 77.14%. Contrarily, with a preprocessed dataset, DenseNet169 outperforms all other architectures, with an accuracy of 95.21%, followed by ResNet50V2 with 90.41% and MobileNet with 86.37%. A confusion matrix (CM) is an instrument used for assessing the accuracy of predictions made by machine learning algorithms and we also use it to judge the test efficacy. Figure 18 depicts the basic confusion matrix for classification problems and the confusion matrices for all three models implemented in this research using preprocessed images. TABLE III PERFORMANCE METRICES OF CNN MODELS USING RAW IMAGES Architectures Accuracy Precision Recall F1 Score DenseNet169 0.95 0.95 0.95 0.95 ResNet50V2 0.90 0.91 0.90 0.90 MobileNet 0.86 0.86 0.85 0.85 TABLE IV PERFORMANCE METRICES OF CNN MODELS USING PREPROCESSED IMAGES Architectures Accuracy Precision Recall DenseNet169 0.81 0.81 0.82 ResNet50V2 0.84 0.82 0.84 MobileNet 0.77 0.77 0.75 Confusion matrices offer a systematic framework for evaluating the predictive performance of machine learning models by comparing model outputs with the known ground truth. A confusion matrix was employed to assess the test efficacy of each architecture. As illustrated in Fig. 19, the true class represents the known labels from the dataset, while the predicted class corresponds to the classification model's output. The matrix is composed of true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN). V. COMPARISON By comparing our proposed system with the others already in place, it is possible to determine why it is better than the others. To measure the significance of the proposed approach, we compare our work with others, as shown in Table V. True positive (TP), true negative (TN), false positive (FP), and false negative (FN) values are the components of a CM. The values in the CM’s diagonal position show how accurately the models predicted the data. Evaluation metrices, including accuracy, precision, recall, and F1-score, are calculated based on the confusion matrix by using the following equations: $$\:\:\:\:\:\:\:\:\:\:\:\:\:\:\text{A}\text{c}\text{c}\text{u}\text{r}\text{a}\text{c}\text{y}\:=\frac{\text{T}\text{P}\:+\:\text{T}\text{N}}{\text{T}\text{P}\:+\:\text{T}\text{N}\:+\:\text{F}\text{P}\:+\:\text{F}\text{N}}\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\left(1\right)$$ $$\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\text{P}\text{r}\text{e}\text{c}\text{i}\text{s}\text{i}\text{o}\text{n}\:=\frac{\text{T}\text{P}}{\text{T}\text{P}\:+\:\text{F}\text{P}}\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\left(2\right)$$ $$\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\text{R}\text{e}\text{c}\text{a}\text{l}\text{l}\:=\frac{\text{T}\text{P}}{\text{T}\text{P}\:+\:\text{F}\text{N}}\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\left(3\right)$$ $$\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\:\text{F}1-\text{S}\text{c}\text{o}\text{r}\text{e}\:=2\:\times\:\:\frac{\text{P}\text{r}\text{e}\text{c}\text{i}\text{s}\text{i}\text{o}\text{n}\:\times\:\:\text{R}\text{e}\text{c}\text{a}\text{l}\text{l}}{\text{P}\text{r}\text{e}\text{c}\text{i}\text{s}\text{i}\text{o}\text{n}+\:\text{R}\text{e}\text{c}\text{a}\text{l}\text{l}}\:\:\:\:\:\:\:\:\:\:\:\:\left(4\right)$$ At first, the values of the performance metrics, such as accuracy, precision, recall, and F1-score, are computed for each Deep Learning model. The results of the evaluation metrics for the raw and preprocessed images are shown in Tables III and IV, respectively. Table IV shows that using the raw images, ResNet50V2 outperforms the other two CNN models in terms of output quality. But according to Table V, DenseNet169 generates the best results of all CNN architectures when employing the preprocessed images. The authors in the paper [19], [20] used IoT technology but did not utilize machine learning or Deep Learning to classify mushrooms. The works in [3], [23], [24] include Machine Learning or Deep Learning techniques to categorize different mushrooms, but they did not consider the automation of mushroom farms. Our proposed system consists of both IoT and Deep Learning technology. We have considered each of the four essential elements required for mushroom farming. Moreover, we have also implemented an image-based TABLE V COMPARATIVE ANALYSIS Reference IoT Approach DL Approach Farm Automation Mushroom Classification Weather Factors Image Based Classification Predicted Class Maximum Accuracy [19] YES NO YES NO 2 NO N/A N/A [20] YES NO YES NO 2 NO N/A N/A [3] NO YES NO YES N/A YES 3 88.40 [23] NO YES NO YES N/A NO 2 80.00% [24] NO NO NO YES N/A NO 2 76.60% Proposed YES YES YES YES 4 YES 3 95.21% mushroom classification model with an accuracy of 95.21%, making the proposed system more precise and effective than the others. VI. CONCLUSION Most farmers produce mushrooms using traditional farming methods because mushroom farming is currently very promising. However, some adverse effects of certain weather factors can also cause the growth of poisonous mushrooms. Farm automation can therefore be a good solution to this issue. Smart farming can also minimize physical labor and monitor real time data. This study presents an architecture for smart mushroom farming based on IoT and Deep Learning. This study presents an architecture for smart mushroom farming based on IoT and Deep Learning. There are three main components to the proposed methodology. The first component is remote monitoring and control, which allows the user to keep track of the weather conditions of the farm, which are crucial to the development of mushrooms. This system uses a DHT-22 sensor to measure the temperature and humidity, a BH-1750 sensor to measure the light intensity, and an MH-Z19B Infrared CO2 gas sensor module to get the CO2 level of the farm. The second section focuses on automating the suggested model using a microcontroller, which is connected to the sensors to guarantee consistent irrigation and a comfortable level of temperature, humidity, light intensity, and CO2 on the farm. The Deep Learning-based mushroom classification system is the third component of our work. We have used a variety of algorithms, such as MobileNet, ResNet50V2, and DenseNet169, to distinguish between edible, inedible, and poisonous mushrooms. Further, a preprocessing technique is used, combining the CLAHE and Laplacian Filter to increase the test accuracy. DenseNet169 outperforms ResNet50V2 and MobileNet in terms of accuracy, scoring 95.21%. In the future, we will work to make the monitoring and management system more efficient for accurate weather control. We will also use more varieties of mushroom images in the dataset to increase the accuracy of the classification model. However, the suggested approach can significantly influence the automation of real-world mushroom farms. Declarations Conflict of Interest The authors declare no competing interests. Funding Authors do not receive any funding for this research. References H. Li, Y. Tian, N. Menolli Jr, L. Ye, S. C. Karunarathna, J. Perez- Moreno, M. M. Rahman, M. H. Rashid, P. Phengsintham, L. Rizal et al., “Reviewing the world’s edible mushroom species: A new evidence- based classification system,” Comprehensive Reviews in Food Science and Food Safety, vol. 20, no. 2, pp. 1982–2014, 2021. S. Ismail, A. R. Zainal, and A. Mustapha, “Behavioural features for mushroom classification,” pp. 412–415, 2018. N. Zahan, M. Z. Hasan, M. A. Malek, and S. S. Reya, “A deep learning-based approach for edible, inedible and poisonous mushroom classification,” pp. 440–444, 2021. H. Rahman, M. O. Faruq, T. B. A. Hai, W. Rahman, M. M. Hossain, M. Hasan, S. Islam, M. I. Moinuddin, M. Tarequl, and M. M. Azad,“Iot enabled mushroom farm automation with machine learning to classify toxic mushrooms in bangladesh,” Journal of Agriculture and Food Research, vol. 7, p. 100267, 2022. L. Chen, L. Qian, X. Zhang, J. Li, Z. Zhang, and X. Chen, “Research progress on indoor environment of mushroom factory,” International Journal of Agricultural and Biological Engineering, vol. 15, no. 1, pp. 25–32, 2022. N. Aggarwal and D. Singh, “A review on usage of internet of things (iot) technologies in mushroom cultivation,” ECS Transactions, vol. 107, no. 1, p. 9739, 2022. J. L. Chong, K. W. Chew, A. P. Peter, H. Y. Ting, and P. L. Show,“Internet of things (iot)-based environmental monitoring and control system for home-based mushroom cultivation,” Biosensors, vol. 13, no. 1, p. 98, 2023. V. Moysiadis, G. Kokkonis, S. Bibi, I. Moscholios, N. Maropoulos, and P. Sarigiannidis, “Monitoring mushroom growth with machine learning,” Agriculture, vol. 13, no. 1, p. 223, 2023. “Agriculture iot market size is projected to reach usd 48,714 million by 2025 - valuates reports,” 2020, last accessed: 25.12.2022. [Online]. Available: https://www.prnewswire.com/in/news-releases/agriculture-iot-market-size-is-projected-to-reach-usd-48-714-million-by-2025-valuates-reports-869979448.html S. Jindal, M. Sachdeva, and A. K. S. Kushwaha, “Deep learning for video based human activity recognition: Review and recent developments,” pp. 71–83, 2022. S. Sharma and K. Guleria, “Deep learning models for image classification: comparison and applications,” pp. 1733–1738, 2022. M. Masud, N. Sikder, A.-A. Nahid, A. K. Bairagi, and M. A. AlZain,“A machine learning approach to diagnosing lung and colon cancer using a deep learning-based classification framework,” p. 748, 2021. M. O. Ojo and A. Zahid, “Deep learning in controlled environment agriculture: A review of recent advancements, challenges and prospects,”Sensors, vol. 22, no. 20, p. 7965, 2022. T. K. Nayak and A. Rao, “Recent advances in deep learning cnn models for plant disease detection,” Advances in Agricultural and Industrial Microbiology, pp. 247–263, 2022. M. Litvak, S. Divekar, and I. Rabaev, “Urban plants classification using deep-learning methodology: A case study on a new dataset,” vol. 3, no. 3. MDPI, 2022, pp. 524–534. A. Oikonomidis, C. Catal, and A. Kassahun, “Deep learning for crop yield prediction: a systematic literature review,” New Zealand Journal of Crop and Horticultural Science, pp. 1–26, 2022. N. J. Ria, S. S. I. Badhon, S. A. Khushbu, S. Akter, and S. A. Hossain,“State of art research in edible and poisonous mushroom recognition,” pp. 01–05, 2021. A. A. Shakir, F. Hakim, M. Rasheduzzaman, S. Chakraborty, T. U. Ahmed, and S. Hossain, “Design and implementation of sensep ack: An iot based mushroom cultivation monitoring system,” pp. 1–6, 2019. T. H. Nasution, M. Yasir, S. Soeharwinto et al., “Designing an iot system for monitoring and controlling temperature and humidity in mushroom cultivation fields,” pp. 326–331, 2019. K. Bunluewong et al., “Semi-automated mushroom cultivation house using internet of things,” Engineering Access, vol. 7, no. 2, pp. 181 188, 2021. A. D. E. N. U. K. Najmurrokhman, Asep and b. p. y. o. Hasbi Ridhatama, journal=Health policy and planning, “Development of temperature and humidity control system in internet-of-things based oyster mushroom cultivation.” A. Subedi, A. Luitel, M. Baskota, and T. D. Acharya, “Iot based mon itoring system for white button mushroom farming,” Multidisciplinary Digital Publishing Institute Proceedings, vol. 42, no. 1, p. 46, 2019. S. Verma and M. Dutta, “Mushroom classification using ann and anfis algorithm,” IOSR Journal of Engineering (IOSRJEN), vol. 8, no. 01, pp. 94–100, 2018. P. Maurya and N. P. Singh, “Mushroom classification using feature based machine learning approach,” in Proceedings of 3rd International Conference on Computer Vision and Image Processing. Springer, 2020, pp. 197–206. W. Ketwongsa, S. Boonlue, and U. Kokaew, “A new deep learning model for the classification of poisonous and edible mushrooms based on improved alexnet convolutional neural network,” Applied Sciences, vol. 12, no. 7, p. 3409, 2022. A. Sameh, M. Moghayer, G. Mohanad, and A. Mohammad, “Classification of mushroom using artificial neural network.” International Journal of Academic and Applied Research (IJAAR), vol. 3, no. 2, 2020. J. J. Lee, M. C. Aime, B. Rajwa, and E. Bae, “Machine learning-based classification of mushrooms using a smartphone application,” Applied Sciences, vol. 12, no. 22, p. 11685, 2022. N. Kiss and L. Cz´uni, “Mushroom image classification with cnns: A case-study of different learning strategies,” in 2021 12th International Symposium on Image and Signal Processing and Analysis (ISPA). IEEE, 2021, pp. 165–170. “inaturalist-observations,” last accessed: 01.01.2023. [Online]. Available: https://www.inaturalist.org “Understandinging,” able: last transfer accessed: learning 01.01.2023. For deep [online]. https://www.analyticsvidhya.com/blog/2021/10/understanding transfer-learning-for-deep-learning. G. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger, “Densely connected convolutional networks,” in Proceedings of the IEEE conference on computer vision and pattern recognition, 2017, pp. 4700–4708. B. Zhou, Y. Li, and J. Wang, “A weakly supervised adaptive densenet for classifying thoracic diseases and identifying abnormalities,” arXiv preprint arXiv:1807.01257, 2018. K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016, pp. 770–778. “Detailed guide to understand and implement resnets”, Available: https://cv tricks.com/keras/understand-implement-resnets L. Ali, F. Alnajjar, H. A. Jassmi, M. Gocho, W. Khan, and M. A.Serhani, “Performance evaluation of deep cnn-based crack detection and localization techniques for concrete structures,” Sensors, vol. 21, no. 5, p. 1688, 2021. A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam, “Mobilenets: Efficient convolutional neural networks for mobile vision applications,” arXiv preprint arXiv:1704.04861, 2017. O. Firmansyah, Maulani, A. M. Ridwan, Sumiati, E. A. Z. Hamidi, and P. D. Fitriani, “Prototype of temperature and humidity control system for oyster mushroom cultivation using arduino uno based on the internet of things,” in 2022 8th International Conference on Wireless and Telematics (ICWT), 2022, pp. 1–4. “Role of co2 monitoring in mushroom farming,” last accessed: 01.01.2023. [Online]. Available: https://www.pranaair.com/blog/co2 monitoring-in-mushroom-farming Additional Declarations No competing interests reported. Cite Share Download PDF Status: Posted Version 1 posted You are reading this latest preprint version Research Square lets you share your work early, gain feedback from the community, and start making changes to your manuscript prior to peer review in a journal. As a division of Research Square Company, we’re committed to making research communication faster, fairer, and more useful. We do this by developing innovative software and high quality services for the global research community. Our growing team is made up of researchers and industry professionals working together to solve the most critical problems facing scientific publishing. Also discoverable on Platform About Our Team In Review Editorial Policies Advisory Board Help Center Resources Author Services Accessibility API Access RSS feed Manage Cookie Preferences © Research Square 2026 | ISSN 2693-5015 (online) Privacy Policy Terms of Service Do Not Sell My Personal Information {"props":{"pageProps":{"initialData":{"identity":"rs-6338090","acceptedTermsAndConditions":true,"allowDirectSubmit":true,"archivedVersions":[],"articleType":"Research Article","associatedPublications":[],"authors":[{"id":442225762,"identity":"c0d9e4c4-5de9-4c78-946d-fb3aeb44ca2f","order_by":0,"name":"Md Imtiaz Aftab Shadin","email":"","orcid":"","institution":"Daffodil International University","correspondingAuthor":false,"prefix":"","firstName":"Md","middleName":"Imtiaz Aftab","lastName":"Shadin","suffix":""},{"id":442225763,"identity":"27659b60-858c-479a-ac90-ea4626852873","order_by":1,"name":"Sakib Nesar Ratul","email":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyAQMAAABI0h/eAAAABlBMVEX///8AAABVwtN+AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAA+0lEQVRIiWNgGAWjYFACNobDDD/+McgzMx848IFNAiRkwMDYwIxfC2PPAQbD9rbEhzOI1cLMwHaAgeHMGWNjHjYGwlrk248lHi7gucPAOCMtTdqmzCKxgb15mwTjDmucWgzOpB04PMPiGQO7RPIx6ZxzEokNPMfKJBjPpOPWwpDecJiHh7m+EWRLbhtQi0SOmQRj22HcDut/DtTCBnT5jRwzaUuQFvk3+LUw3AA6jIftMMT7jGBbePBrMbjxLOHwzJ40SCD3nJMwbuNJK7ZIxOMX+f40488FP2wgUfmjrE62n/3wxhsf8YQYJgBHTQIJGkbBKBgFo2AUYAIARORW15I/848AAAAASUVORK5CYII=","orcid":"","institution":"Daffodil International University","correspondingAuthor":true,"prefix":"","firstName":"Sakib","middleName":"Nesar","lastName":"Ratul","suffix":""},{"id":442225764,"identity":"442461f7-00a0-4faf-aa6a-636c2d9a5c9e","order_by":2,"name":"Md. Azizul Haque","email":"","orcid":"","institution":"Daffodil International University","correspondingAuthor":false,"prefix":"","firstName":"Md.","middleName":"Azizul","lastName":"Haque","suffix":""}],"badges":[],"createdAt":"2025-03-30 11:08:10","currentVersionCode":1,"declarations":"","doi":"10.21203/rs.3.rs-6338090/v1","doiUrl":"https://doi.org/10.21203/rs.3.rs-6338090/v1","draftVersion":[],"editorialEvents":[],"editorialNote":"","failedWorkflow":false,"files":[{"id":81618322,"identity":"11c5746e-c0f1-400c-a58f-f737ed528f52","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":1,"title":"Figure 1","display":"","copyAsset":false,"role":"figure","size":527824,"visible":true,"origin":"","legend":"\u003cp\u003eSystem architecture of the proposed IoT-based smart mushroom farming system.\u003c/p\u003e","description":"","filename":"1.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/92b75eed4773689eac46ecb1.png"},{"id":81618338,"identity":"6d5e6093-7917-4637-9713-a02a4a887f85","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":2,"title":"Figure 2","display":"","copyAsset":false,"role":"figure","size":387507,"visible":true,"origin":"","legend":"\u003cp\u003eSmart monitoring system based on IoT\u003c/p\u003e","description":"","filename":"2.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/ac05780e6fa846a8003abc1c.png"},{"id":81618330,"identity":"72cfc6fd-4843-45ba-b414-dacf73d58f02","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":3,"title":"Figure 3","display":"","copyAsset":false,"role":"figure","size":408503,"visible":true,"origin":"","legend":"\u003cp\u003eFarm automation system\u003c/p\u003e","description":"","filename":"3.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/f2f66d298f75e93a05b912be.png"},{"id":81618726,"identity":"63d2173b-41a0-4e9f-8b3c-c45120d11bbf","added_by":"auto","created_at":"2025-04-29 08:51:30","extension":"png","order_by":4,"title":"Figure 4","display":"","copyAsset":false,"role":"figure","size":427593,"visible":true,"origin":"","legend":"\u003cp\u003eMushroom classification system.\u003c/p\u003e","description":"","filename":"4.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/5fe2ad713bbf4234aef44739.png"},{"id":81618371,"identity":"22478cbe-42a8-4925-a099-d6183c44a336","added_by":"auto","created_at":"2025-04-29 08:43:34","extension":"png","order_by":5,"title":"Figure 5","display":"","copyAsset":false,"role":"figure","size":199943,"visible":true,"origin":"","legend":"\u003cp\u003eSample of edible mushroom from the dataset\u003c/p\u003e","description":"","filename":"5.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/de2b803048af25ba7c254076.png"},{"id":81618328,"identity":"861f6399-02c4-4952-a51f-4f38d72c4594","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":6,"title":"Figure 6","display":"","copyAsset":false,"role":"figure","size":250428,"visible":true,"origin":"","legend":"\u003cp\u003eSamples of inedible mushroom from the dataset\u003c/p\u003e","description":"","filename":"6.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/19375a318350bf781410aa7d.png"},{"id":81618325,"identity":"d55b57c8-08a6-40d2-b0d2-bdb150e76935","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":7,"title":"Figure 7","display":"","copyAsset":false,"role":"figure","size":202073,"visible":true,"origin":"","legend":"\u003cp\u003eSamples of poisonous mushroom from the dataset\u003c/p\u003e","description":"","filename":"7.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/fa9fde6b89e13cc3183d0ab2.png"},{"id":81618323,"identity":"f47644e2-adb4-4102-8b15-44f74431d5c2","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":8,"title":"Figure 8","display":"","copyAsset":false,"role":"figure","size":4493,"visible":true,"origin":"","legend":"\u003cp\u003eSamples of the augmented images.\u003c/p\u003e","description":"","filename":"7.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/bcb496354c440266a6f8fc64.png"},{"id":81618332,"identity":"97e6ffd7-9334-4cd9-a48b-c74d7051c7d4","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":9,"title":"Figure 9","display":"","copyAsset":false,"role":"figure","size":4493,"visible":true,"origin":"","legend":"\u003cp\u003eSamples of images after applying preprocessing techniques.\u003c/p\u003e","description":"","filename":"8.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/64f18c03354b95228de9a678.png"},{"id":81618736,"identity":"472f2c82-9077-45e6-b59a-4be659297325","added_by":"auto","created_at":"2025-04-29 08:51:30","extension":"png","order_by":10,"title":"Figure 10","display":"","copyAsset":false,"role":"figure","size":213558,"visible":true,"origin":"","legend":"\u003cp\u003eLayers of DenseNet169 architecture [31].\u003c/p\u003e","description":"","filename":"10.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/22bdda028c5f718f889f1cb5.png"},{"id":81618339,"identity":"0fba209d-186a-4e75-a8f1-8e6c886dbd06","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":11,"title":"Figure 11","display":"","copyAsset":false,"role":"figure","size":398649,"visible":true,"origin":"","legend":"\u003cp\u003eThe architecture of the ResNet module version 2 [34].\u003c/p\u003e","description":"","filename":"11.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/15acf7002dd4cd4780b3ddb5.png"},{"id":81618342,"identity":"e29766ab-be1c-474d-a9ac-f0961f33a106","added_by":"auto","created_at":"2025-04-29 08:43:30","extension":"png","order_by":12,"title":"Figure 12","display":"","copyAsset":false,"role":"figure","size":276237,"visible":true,"origin":"","legend":"\u003cp\u003eThe internal structure of the ResNet50V2 model [34].\u003c/p\u003e","description":"","filename":"12.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/3f6b36d0cdb7888d2474fb81.png"},{"id":81618345,"identity":"3d3da1ee-f6ac-418e-9898-27ac18be4dba","added_by":"auto","created_at":"2025-04-29 08:43:31","extension":"png","order_by":13,"title":"Figure 13","display":"","copyAsset":false,"role":"figure","size":841771,"visible":true,"origin":"","legend":"\u003cp\u003eWorkflow of the proposed classification method\u003c/p\u003e","description":"","filename":"13.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/1a0dde128f2102d69470ff0f.png"},{"id":81618740,"identity":"d5d390f1-9274-4a17-8cfe-55de5bd4f280","added_by":"auto","created_at":"2025-04-29 08:51:31","extension":"png","order_by":14,"title":"Figure 14","display":"","copyAsset":false,"role":"figure","size":566273,"visible":true,"origin":"","legend":"\u003cp\u003eA snapshot of the experiment when all the parameters are at the optimum level.\u003c/p\u003e","description":"","filename":"14.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/8a9a9ac5bd6196b849eb45a2.png"},{"id":81618346,"identity":"461612dc-9f7c-44e4-a541-fc7325329aff","added_by":"auto","created_at":"2025-04-29 08:43:31","extension":"png","order_by":15,"title":"Figure 15","display":"","copyAsset":false,"role":"figure","size":572462,"visible":true,"origin":"","legend":"\u003cp\u003eA snapshot of the automation experiment when exceeding the temperature limit and beneath the humidity limit\u003c/p\u003e","description":"","filename":"15.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/84df2bd4dae6c21192d68f7f.png"},{"id":81618748,"identity":"5d83e3d7-4431-4eef-8dd4-1997d745da99","added_by":"auto","created_at":"2025-04-29 08:51:32","extension":"png","order_by":16,"title":"Figure 16","display":"","copyAsset":false,"role":"figure","size":567250,"visible":true,"origin":"","legend":"\u003cp\u003eA snapshot of the experiment when CO2 level exceeds the upper limit the light intensity exceeds the lower limit\u003c/p\u003e","description":"","filename":"16.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/05b5467fa7eb8b3b687f0437.png"},{"id":81618352,"identity":"33d45596-acaf-4b7c-90ae-18983af81dac","added_by":"auto","created_at":"2025-04-29 08:43:31","extension":"png","order_by":17,"title":"Figure 17","display":"","copyAsset":false,"role":"figure","size":537550,"visible":true,"origin":"","legend":"\u003cp\u003eA snapshot of the experiment when no parameters are at the optimum level\u003c/p\u003e","description":"","filename":"17.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/3aecbfd1cbf086b1559da41b.png"},{"id":81618750,"identity":"52f7cdfd-bfe5-4bf2-8746-eac62a421042","added_by":"auto","created_at":"2025-04-29 08:51:34","extension":"png","order_by":18,"title":"Figure 18","display":"","copyAsset":false,"role":"figure","size":411862,"visible":true,"origin":"","legend":"\u003cp\u003eConfusion matrix of: (a) generalized classification problem; (b) Densenet169; (c) ResNet50V2; (d) MobileNet\u003c/p\u003e","description":"","filename":"18.png","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/0fc566bdbe85578ae1fbc0c8.png"},{"id":81620095,"identity":"58b0dd15-9b2b-4afc-b09e-369bfb3036a6","added_by":"auto","created_at":"2025-04-29 09:07:35","extension":"pdf","order_by":0,"title":"","display":"","copyAsset":false,"role":"manuscript-pdf","size":11986844,"visible":true,"origin":"","legend":"","description":"","filename":"manuscript.pdf","url":"https://assets-eu.researchsquare.com/files/rs-6338090/v1/2e2b4501-ae72-4f4b-bd61-749f554ef23c.pdf"}],"financialInterests":"No competing interests reported.","formattedTitle":"An IoT-Enabled Deep Learning Framework for Autonomous Environmental Monitoring and Toxicity Classification in Smart Mushroom Cultivation Systems","fulltext":[{"header":"I. Introduction","content":"\u003cp\u003eThe global economy is significantly influenced by agriculture. This is one of the reasons that the cultivation system should be efficient and effective so that the production rate becomes high without affecting the quality. Many poor populations depend on wild mushrooms as a significant source of food and revenue, and they are also valuable to recreational foragers. The conventional approach of mushroom farming is very time consuming and manual labor based. Because of this, it is imperative to create a system that can automate every step of the farming process, thereby reducing physical work and increasing efficiency [1]. The fleshy fruit body of many fungi attached to Basidiomycetes growing on a ground surface is known as a mushroom. Not all mushrooms, nevertheless, are edible. While certain mushrooms can treat cancer, other varieties may harbor viruses that spread contagious illnesses [2]. Essential benefits of edible mushrooms include their ability to fight against infections, cancer cells, and other diseases and strengthen the immune system. Some woody rack mushrooms are inedible due to their extremity for chewing. They cannot be digested by humans and sometimes evict the digestive system. People also pass away after eating poisonous mushrooms due to ignorance [3]. So, it is essential to follow a proper way of cultivation to obtain mushrooms of the highest quality and steer clear of harmful ones. Mushroom farming is critical because it necessitates meticulous monitoring and management of the farming environment. Typically, farmers worldwide cultivate mushrooms in a dark environment [4]. It is not easy to grow mushrooms in a dark environment since the farmers must rigorously control the farm\u0026rsquo;s weather using specific parameters, such as temperature, humidity, CO2 level, and light intensity, which decide the amount of production [5]. Farmers usually manage\u003c/p\u003e \u003cp\u003ethese parameters manually, which is quite challenging and can hamper the production rate. Moreover, the farmers must ensure the proper classes of mushrooms to identify the edible ones before marketing. Thus, monitoring and controlling the farming environment of mushrooms and selecting suitable mushrooms are the crucial issues associated with mushroom cultivation. The conventional mushroom cultivation process is arduous due to the limited control over the weather and growing process and the frequent occurrence of toxic mushrooms. Most farmers, especially in developing and underdeveloped nations, follow the traditional approach, which is time-consuming, error-prone, and tedious. Thus, a sensor-based self-regulating IoT framework will be more convenient than any conventional approach for monitoring and controlling the farming environment [4], [5], [6], [7], [8]. Hence, creating a system that can automate every step of the farming process is imperative, reducing physical labor and increasing efficiency. The cultivation system should be efficient and effective so that the production rate becomes high without affecting the quality. Thus, monitoring and controlling the cultivation environment is of utmost importance for properly producing agricultural commodities. Developing an IoT-based automated system for remote monitoring and controlling the environment to produce mushrooms efficiently is the demand of the time. Besides, it is indispensable to identify edible mushrooms. Consequently, before marketing the mushrooms, a faster and more accurate classification of edible, inedible, and poisonous mushrooms is crucial because the manual job is not easy and probably fallible. Therefore, an automated framework for monitoring, controlling, and classifying mushrooms is necessary for efficient and sustainable farming. In this paper, we propose an autonomous system that combines IoT with DL technologies to provide effective methods for the production and classification of mushrooms. This method can raise farm productivity by utilizing the structural framework of IoT-enabled farms created by using microcontrollers, sensors, and actuators. In addition, the research has mechanized the farm to control the weather and used IoT technology for remote monitoring utilizing intelligent devices. At the same time, the DL model assists us in avoiding poisonous mushrooms by classifying them into different classes. Significant contributions of this work are as follows:\u003c/p\u003e \u003cp\u003e \u003cul\u003e \u003cli\u003e \u003cp\u003eFirst, propose to design an automated framework for cultivating mushrooms under extreme weather conditions. In particular, the designed framework can monitor and control the farming environment while capable of detecting poisonous mushrooms for assisting the farmers from cultivation damage.\u003c/p\u003e \u003c/li\u003e \u003cli\u003e \u003cp\u003eSecond, develop and implement the proposed IoT-based framework by assembling numerous sensors, actuators, and microcontrollers for effectively monitoring and controlling the mushroom farm remotely through smart devices.\u003c/p\u003e \u003c/li\u003e \u003cli\u003e \u003cp\u003eThird, to deal with harmful mushrooms, we adopt existing deep learning mechanisms for classifying mushrooms into edible, inedible, and poisonous. Thus, integrate such a scheme on top of the developed framework for an autonomous, quick, and reliable mushroom health examination.\u003c/p\u003e \u003c/li\u003e \u003cli\u003e \u003cp\u003eFinally, evaluate the performance of the developed IoT-based smart mushroom farming system by generating several test case scenarios in terms of operational efficiency and classification accuracy.\u003c/p\u003e \u003c/li\u003e \u003c/ul\u003e \u003c/p\u003e"},{"header":"II.\tLITERATURE REVIEW","content":"\u003cp\u003eIn the last few years, the automation process has been increasing significantly while the use of smart IoT devices in mushroom farming [6] becomes an automated system for growing mushrooms in a more effective way. In particular, due to the significant maintenance capabilities of IoT systems, the farmer can hold the optimum conditions inside the farm. An interconnected network of computing devices known as IoT allows data to transfer without needing human interaction. In the realm of contemporary computing, IoT technology is now increasingly common. The IoT in modern agriculture enables farmers to monitor the state of their farms in real-time from anywhere by using sensors that connect them to their farms. The usage of IoT in the agriculture sector is expected to grow \u003cspan\u003e$\u003c/span\u003e48,714\u0026nbsp;million by 2025 [9]. Besides, with the development of Computer Vision, Artificial Intelligence (AI), and Machine Learning (ML), it is now within our hands to create computerized models for classifying objects conveniently. Various ML techniques like Support Vector Machine (SVM), K-Nearest Neighbor (KNN), Random Forest (RF), etc., are used for the automated detection of various entities. However, most of the imperative features need to be specified by domain specialists to lower the complexity of the data and create patterns more perceptible to the algorithms in traditional ML techniques. Deep Learning (DL), a branch of ML, is becoming more popular in the last few years due to its ability to automatically learn features from high-dimensional data such as images, videos, etc. It reduces our burden for performing complex tasks like pattern recognition [10], image classification [11], disease detection [12], and so on. Recently, DL has also been rigorously used in the Agri-domain, especially for controlled environment agriculture [13], plant disease detection [14], plant classification [15], crop yield prediction [16], etc. It has recently been engaged in resolving the mushroom labeling problem [17]. We divided the rest of the related work into the following subsections: 1) Automation for Mushroom Cultivation, and 2) Machine Learning for Mushroom Classification. The authors in [18] designed an intelligent system to keep track of the environmental conditions of a mushroom farm. The system uses the appropriate sensors to measure the CO2 level, light, humidity, and temperature. The extracted data was used to control the nursing room\u0026rsquo;s environment with additional equipment like an air conditioner, water pump, light bulb, and exhaust fan. In the paper [19], the authors proposed a Wireless Sensor Network (WSN) based IoT system for mushroom cultivation by considering Oyster mushroom cultivation. This work controls a humid climate and a temperature value between 16 and 30\u0026deg;C and developed a remote monitoring system. The authors in [20] presented a partially automated environment control system for mushroom farming. The authors of the paper [21] suggested a system that describes the development of a prototype for controlling temperature and humidity based on an IoT network. In particular, DHT-11 sensor, the Arduino Uno microcontroller, the MCU ESP-8266, and the Cayenne IoT platform are used for control. By continuously monitoring remotely, the temperature is kept between 22\u0026deg;C and 28\u0026deg;C, and the humidity is between 60% and 80%. The work in [22] developed a system for tracking a mushroom farm\u0026rsquo;s environmental conditions that allow a user to keep an eye on important elements like temperature, humidity, and light intensity of a mushroom farm. The ideal temperature and humidity for growing white button mushrooms are 22 to 25\u0026deg;C and 70\u0026ndash;90%, respectively. However, these works [18], [19], [20], [21], [22] do not design the entire framework that may assist the farmer in autonomous monitoring and controlling the cultivation environment, nor do they discuss the dynamic adaptation of temperature, humidity, and light in mushroom cultivation. The authors in [23] proposed a classification method for classifying the mushroom dataset into edible and inedible, where ANFIS outperforms on ANN and Na\u0026iuml;ve Bayes schemes. In work [24], the authors developed a feature-based classification system using the texture of the mushrooms. This work used an SVM-based machine-learning scheme. The authors in [25] proposed a system to classify five species of mushrooms found in Thailand using CNN and RCNN. They considered the accuracy and testing time of some transfer learning models, including AlexNet, ResNet-50, and GoogLeNet, and came up with a solution for distinguishing between edible and poisonous mushrooms. The work in [3] adopted DL algorithms such as VGG16, InceptionV3, and Resnet50 to classify mushrooms according to their category. The authors in [4] suggested an ensemble learning model for the classification of mushrooms into six categories. A Multi-Layer ANN model was designed in [26] to train and differentiate mushrooms between edible and harmful. The authors in [27] developed a CNN-based smartphone application to identify different varieties of mushrooms from field-collected images. Although other researchers have already carried out numerous studies, most of them used automation or classification but not both. The major goal of our study is to close this gap by developing a system that makes use of both IoT and Deep Learning technology. The farming system is automated with the use of IoT, which also includes remote monitoring and managing the farm environment. Additionally, DL is utilized to quickly distinguish between edible, inedible, and poisonous varieties of mushrooms. Although other researchers have already carried out numerous studies, most of them used automation [18], [19], [20], [21], [22] or classification [23], [24], [25], [26], [27] but not both. The major goal of our study is to close this gap by developing a system that makes use of both IoT and DL technology. The farming system is automated with the use of IoT, which also includes remote monitoring and managing the farm environment. Additionally, Deep Learning is utilized to quickly distinguish between edible, inedible, and poisonous varieties of mushrooms.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e"},{"header":"III.\tIOT-BASED SMART MUSHROOM FARMING AUTOMATION","content":"\u003cp\u003eThe system comprises three components: 1) IoT-based Smart Monitoring, 2) Farm Automation, and 3) DL-based Mushroom Classification. Figure \u003cspan class=\"InternalRef\"\u003e1\u003c/span\u003e illustrates the system architecture of the proposed solution.\u003c/p\u003e\n\u003cp\u003eFigure \u003cspan class=\"InternalRef\"\u003e1\u003c/span\u003e demonstrates the overall ecosystem of the proposed IoT-based smart mushroom farming system, while Table I outlines the hardware components used in developing the testbed. At the core of the configuration is a microcontroller responsible for the IoT-based monitoring and automation system. The architecture integrates modules for monitoring temperature, humidity, light intensity, and carbon dioxide, all coupled with the ESP32 microcontroller to facilitate proper farm automation. Data collected by the microcontroller are transmitted to the IoT server, enabling remote monitoring, and parameter values can also be manually checked on an LCD. A camera module captures images of mushrooms and uploads them to online storage, providing input for the classifier during the classification task.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003e\u003cstrong\u003eA. Smart Monitoring\u003c/strong\u003e\u003cbr\u003e\u003c/span\u003e\u003c/p\u003e\n\u003cp\u003eThe primary factors of mushroom growth are temperature, humidity, carbon dioxide level, and light intensity. Monitoring these conditions inside the farm from any distant location is essential. For this study, three sensors inside the farm sense the four critical factors. The DHT-22 digital sensor measures temperature and humidity, while the MH-Z19B Infrared CO₂ sensor module detects CO₂ gas levels. The BH-1750 digital light intensity sensor is used to measure the farm\u0026rsquo;s light intensity. The microcontroller is coupled with these sensors to monitor the parameters, and an LCD is connected for manual parameter monitoring. Sensor data are recorded and utilized for remote monitoring and control. The ESP32 DevkitV1 is employed for data visualization by reading sensor data from the sensing modules. Subsequently, the sensor data are uploaded to the Blynk server. Users can monitor data from the server in real time through the Blynk application, with the desired data displayed immediately. Any user connected to the end application can check the status of the farm from anywhere in the world. The operation of the IoT-based smart monitoring system is depicted in Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e2\u003c/span\u003e.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eB. Farm Automation\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eFarm automation includes the steps taken after monitoring the condition of the farm. Four external devices are connected to the microcontroller in this research to regulate the atmosphere\u003c/p\u003e\n\u003cp\u003eTABLE I\u003c/p\u003e\n\u003cp\u003eHARDWARE COMPONENT OF THE DEVELOPED TESTBED\u003c/p\u003e\n\u003cdiv\u003e\n \u003ctable id=\"Taba\" border=\"1\"\u003e\n \u003cthead\u003e\n \u003ctr\u003e\n \u003cth align=\"left\"\u003eComponents\u003cbr\u003e\u003c/th\u003e\n \u003cth align=\"left\"\u003eRemarks\u003cbr\u003e\u003c/th\u003e\n \u003c/tr\u003e\n \u003c/thead\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003eESP32 Devkit V1\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eMicrocontroller\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003eESP32-CAM\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eCamera Module\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003eDHT-22\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eDigital Temperature and Humidity Sensor\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003eMH-Z19B\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eInfrared\u0026nbsp;\u003cem\u003eCO\u003c/em\u003e2 Gas Sensor\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003eBH-1750\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eDigital Light Intensity Sensor\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e12V 60W TEC1-12715\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eThermoelectric Cooler Peltier\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003eMist Maker Fogger Humidifier Atomizer\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eAs an Actuator to humidify\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003eDC 12V 4\u0026rdquo; Exhaust Fan\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eExpelling the air from the inside to the outside\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e220V 100W AC Bulb\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eThe purpose of lighting a dark environment and generating heat inside the prototype\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003eLCDDisplay (16X2)\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eFor real-time monitoring\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e4 Channel 5V Relay Board Module\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eAs a voltage breaker\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e12V, 20A DC Power Supply\u003cbr\u003e\u003c/td\u003e\n \u003ctd align=\"left\"\u003eFor supplying 12V DC to operate the actuators\u003cbr\u003e\u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003c/table\u003e\n\u003c/div\u003e\n\u003cp\u003eof the farm. The farm\u0026rsquo;s temperature, humidity, CO₂ level, and light intensity are controlled, respectively, using a Peltier air conditioner, a mist maker fogger humidifier, an exhaust fan, and a light bulb. The controlling operation of the farm can be done both manually and automatically. The microcontroller is programmed with the ideal range of parameter values for automatic control. The ESP32 microcontroller combines predetermined input data from the user with real-time sensor data from sensing modules to automate all the equipment. A Peltier air conditioner is employed to maintain the required temperature because of its low power consumption. The Peltier air conditioner automatically turns on and off depending on whether the temperature rises or falls. If the humidity level falls while the humidifier monitors the data, it activates and raises the humidity to the optimum level. Even in a dark environment, mushrooms need a small amount of light to develop. For lighting purposes, a bulb is used that automatically turns on and off based on the amount of light required. Lastly, an exhaust fan engages and mechanically expels the gas from inside when the CO₂ level reaches the predetermined limit. All the controlling operations can also be performed manually by the farmer from anywhere by using the Blynk application, which is an IoT platform for remotely monitoring and controlling the farm weather. Figure\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e3\u003c/span\u003e shows the operational process of the farm automation system.\u003c/p\u003e\n\u003cp\u003e\u003cspan\u003e\u003cstrong\u003eB. Deep Learning-based Mushroom Classification\u003c/strong\u003e\u003cbr\u003e\u003c/span\u003e\u003c/p\u003e\n\u003cp\u003eThe system uses an ESP32-CAM camera module connected to the microcontroller to capture images in the first stage (as seen in Fig.\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e4\u003c/span\u003e). Because mushrooms require darkness to grow properly, taking images of them in dim or gloomy environments is exceedingly challenging. Several AC light bulbs, managed by relay modules, are used as a camera flash. These bulbs only flash while taking images. Following the acquisition of the images, the system processes the data and feeds it to the Deep Learning model. The data is then forwarded for analysis, and afterward, the decision is provided by the prebuilt model based on the analyzed data.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e1) Collection of Data\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eTo train the DL model, we consider a dataset consisting of 22,979 mushroom images with 140 different species [28]. Out of them, one-third are edible, one-third are inedible, and the remaining are poisonous. Images are collected mainly from two resources. The first one is a mushroom classification research paper where the authors have classified 106 different species of mushrooms. They used two Sources to prepare their data, namely the 2018 FGVCx Fungi Classification Challenge dataset and images from [28]. The second one is the iNaturalist website, which is a joint initiative of the California Academy of Sciences and the National Geographic Society. They have gathered trustworthy images from many nations and farms suitable for research-grade [29]. Figures\u0026nbsp;\u003cspan class=\"InternalRef\"\u003e5\u003c/span\u003e, \u003cspan class=\"InternalRef\"\u003e6\u003c/span\u003e, and \u003cspan class=\"InternalRef\"\u003e7\u003c/span\u003e categorically show some samples of the mushroom species used in this study.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e2) Data Preprocessing and Augmentation\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eThe collected images are noisy and require adjustments in size and color. To address these issues and mitigate overfitting, we have applied various data augmentation techniques, including rotation, scaling, flipping, translation, and shearing. Figure\u0026nbsp;8 presents some samples of the augmented images. Additionally, CLAHE is employed to improve image quality. It is an image enhancement technique that enhances contrast to make images clearer. However, after applying contrast enhancement, the edges of the images are not correctly visible, necessitating a filtering method to sharpen them. To achieve this, we have used the Laplacian Filter as a sharpening strategy following the CLAHE operation, making the images more suitable for classification models. Figure\u0026nbsp;9 illustrates samples of images after applying preprocessing techniques.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e3) Transfer Learning\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eTransfer learning is a term in machine learning that refers to using a previously learned model on a different issue. A machine can more accurately predict results for future tasks by using data from previous tasks through the process of transfer learning [30]. In this study, we have used CNN models based on transfer learning for classification. Pretrained CNN models are more frequently used than training models with randomly added weights since they are simpler and faster. In addition, new layers are transferred using the fine-tuning technique depending on the classification task rather than using the final layers of the predefined networks.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003e4) CNN Architectures: DenseNet169\u003c/strong\u003e: DenseNet169 is a Convolutional Neural Network architecture from the DenseNet family which has 169 layers. It is a frequently used Deep Learning model for classification. Compared to other DenseNet architectures with fewer layers, it has a significantly smaller set of trainable parameters. DenseNet169, along with the other DenseNet architectures, is a family of very reliable Deep Learning architectures. They have some unique characteristics, including the ability to resolve the vanishing gradient problem, a strong feature propagation approach, a limited set of trainable parameters, and the utilization of feature reuse. Figure \u003cspan class=\"InternalRef\"\u003e10\u003c/span\u003e shows the layers of DenseNet169 architecture. Figure \u003cspan class=\"InternalRef\"\u003e10\u003c/span\u003e shows the architecture\u0026rsquo;s basic components: convolutional layers, maxpool layers, fully connected layers (dense layers), and transition layers. Only the final layer of the model utilizes the SoftMax activation function, and the rest of the architecture uses the ReLU activation function. The convolutional layers extract features from the images, and the maxpool layers reduce the dimensionality of the input images. The flatten layer is followed by fully connected layers that use the flatten layer\u0026rsquo;s single array input to function as an Artificial Neural Network (ANN). The final activation function uses those flattened data to classify images [32], [31].\u003c/p\u003e\n\u003cp\u003eResNet50V2: ResNet50V2 is a Convolutional Neural Network architecture that contains the same layers as ResNet50 but significantly differs in the working process. It works based on version 2 of the ResNet module, which is about using weight layers\u0026rsquo; preactivation instead of post-activation. ResNet Version 1 performs the convolution operation first, then Batch Normalization and ReLU activation functions as well, whereas ResNet Version 2 uses these two activation functions to the input before the convolution operation [33]. The working procedure of the ResNet module version 2 architecture is shown in Fig. \u003cspan class=\"InternalRef\"\u003e11\u003c/span\u003e. The ResNet50V2 architecture contains 48 convolutional layers, one fully connected layer, and 16 bottleneck building blocks. It requires input images with a dimension of 224 \u0026times; 224 x 3. In bottleneck building blocks 1 through 3, convolution layers can be found with 64 filters having a filter size of 1 x 1, 64 filters having a filter size of 3 x 3, and 256 filters having a filter size of 1 x 1. Building blocks 4 through 7 are constructed with one convolution layer that has 512 filters of size 1 x 1 and two convolution layers, each of which includes 128 filters with filter sizes of 1 x 1 and 3 x 3. There is a total of three layers in building blocks 8 to 13. Two of them are convolution layers, each having 256 filters with a filter size of 1 x 1 and 3 x 3. The other layer has 1024 filters, where the filter size is 1 x 1. Building block numbers 14 through 16 feature two convolution layers with 512 filters, each with a filter size of 1 x 1 and 3 x 3, as well as another layer with 2048 filters, all with a 1 x 1 filter size [34], [35]. Figure \u003cspan class=\"InternalRef\"\u003e12\u003c/span\u003e depicts the internal structure of the ResNet50V2 model.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eMobileNet\u003c/strong\u003e\u003c/p\u003e\n\u003cp\u003eMobileNet, uses a more straightforward construction to produce lightweight deep neural networks utilizing depth wise separable convolutions. It considerably lowers the number of parameters in comparison to a network having traditional convolutions of the same depth in the nets. MobileNet has a total of 28 layers, 27 of which are convolution layers, including one fully connected layer, one softmax layer, one average pool layer, and 13 depth wise convolution layers. The standard MobileNet model has 4.2 million parameters, compared to lower MobileNet variations that have 1.32 million. The MobileNet structure is made up of depth wise separable convolutions, but its first layer is an exception because it is a full convolution, as was discussed in the preceding section. All layers in a MobileNet architecture are followed by a Batch Norm and ReLU nonlinearity, except for the final fully connected layer, which has no nonlinearity and feeds into a softmax layer for classification. Both the first layer and the depth wise convolutions manage down sampling using strided convolution. There is an average pooling layer in the final phase of the network. This layer is placed before the fully connected layer and reduces the spatial resolution to 1 [36].\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eClassification Process\u003c/strong\u003e: Initially, the collected images are augmented, and two preprocessing techniques are applied. Thus, two datasets are created: one with the collected raw images and another with the preprocessed images. After that, the entire dataset is split into two sections: training data and testing data. With the help of the random splitting technique, the model is trained using 80% of the training data and validated using the remaining 20% of the images. Then, the data are fed to the proper DL framework for building the classification model. During the testing phase, 3003 new images are utilized to assess the trained model\u0026rsquo;s performance, with about equal numbers of images in each class. This entire methodology is applied to both the raw and the preprocessed images. Categorical cross-entropy is employed as the loss function throughout the transfer learning process that is used to train all models. With the Adam optimizer, the learning rate is set to 0.0001, and SoftMax is utilized as the activation function for all architectures. All the experiments are done using the python programming language on a Kaggle Notebook with 13 GB of RAM, 16 GB of GPU memory, and 73 GB of disk space. Figure \u003cspan class=\"InternalRef\"\u003e13\u003c/span\u003e shows the entire working process of the classification system. The proposed structure includes multiple stages, including image acquisition and dataset preparation, image preprocessing, application of Deep Learning techniques, classification of mushrooms into distinct categories, and result in analysis using performance evaluation metrics. Categorical cross-entropy was employed as the loss function throughout the transfer learning process that was used to train all the models. Categorical cross entropy calculates the loss using the predicted value and true value where the number of nodes in the output layer is more than one. With the Adam optimizer, the learning rate was set to 0.0001 and Softmax was utilized as the activation function along with a batch size of 32 for efficient training. To develop CNN models, we have used TensorFlow and Keras library. To train each of the CNN models, the number of epochs has been set for 100. We have also used early stopping with a patience value 60, so that we could save time and reduce training time. It will stop training when a monitored metric has stopped improving. During training, we have monitored the validation accuracy with maximum mode. We have saved the best model as h5 files in for further testing and performance evaluation. The process begins with the collection of images from multiple resources. Following the image collection, we prepared the entire dataset and preprocessed the images using several methods. With three different CNN architectures, features are retrieved from images. In this work, the Deep Learning models DenseNet169, Resnet50V2, and MobileNet are considered.\u003c/p\u003e"},{"header":"IV.\tEXPERIMENTAL RESULTS AND DISCUSSION","content":"\u003cp\u003e\u003cstrong\u003eA. Experimental Results of the IoT-based Monitoring and Automation System\u003c/strong\u003e\u003c/p\u003e\n\u003cdiv\u003e\n \u003ctable id=\"Tabb\" border=\"1\"\u003e\n \u003cthead\u003e\n \u003ctr\u003e\n \u003cth align=\"left\" colspan=\"8\"\u003e\n \u003cp\u003eTABLE II\u003c/p\u003e\n \u003cp\u003eEXPERIMENTAL RESULTS OF IOT-BASED MONITORING AND AUTOMATION SYSTEM\u003c/p\u003e\n \u003c/th\u003e\n \u003c/tr\u003e\n \u003c/thead\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\" colspan=\"2\"\u003e\n \u003cp\u003e\u003cstrong\u003eDHT-22 Sensor Data\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eMH-Z19B Sensor Data\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eBH-1750\u003c/strong\u003e\u003c/p\u003e\n \u003cp\u003e\u003cstrong\u003eSensor Data\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\u0026nbsp;\u003c/td\u003e\n \u003ctd align=\"left\" colspan=\"2\"\u003e\n \u003cp\u003e\u003cstrong\u003eActuators\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\u0026nbsp;\u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eTemperature H (\u0026deg;C)\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eHumidity (%)\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eCO2 Level (ppm)\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eLight Intensity (Lux)\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003ePeltier AC\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eMist Maker Humidifier\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eExhaust Fan\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u003cstrong\u003eLight Bulb\u003c/strong\u003e\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e22\u0026ndash;30\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eCO2 Level (ppm)\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e800\u0026ndash;1500\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e200\u0026ndash;300\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eOFF\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eOFF\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eOFF\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eOFF\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u0026gt;\u0026thinsp;30\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e800\u0026ndash;1500\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e800\u0026ndash;1500\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e200\u0026ndash;300\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eON\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eON\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eOFF\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eOFF\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e22\u0026ndash;30\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e800\u0026ndash;1500\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u0026gt;\u0026thinsp;1500\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u0026lt;\u0026thinsp;200\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eOFF\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eOFF\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eON\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eON\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u0026gt;\u0026thinsp;30\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u0026gt;\u0026thinsp;1500\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u0026gt;\u0026thinsp;1500\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003e\u0026lt;\u0026thinsp;200\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eON\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eON\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eON\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eON\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003c/table\u003e\n\u003c/div\u003e\n\u003cp\u003eThe ideal temperature range for mushroom cultivation is 22\u0026ndash;30\u0026deg;C. Mushrooms also require a high humidity level that is consistent for healthy development. A humidifier is needed for this to maintain a consistent relative humidity of 80\u0026ndash;90%. In addition to these, the light intensity for mushroom farms should be between 200 and 300 lux [37] and a CO2 level of 800 to 1500 ppm is needed [38] because excessive CO2 and inappropriate light intensity might result in abnormal growth of mushrooms. In this study, experimental results were obtained by observing how actuators, such as Peltier air conditioner, mist maker humidifier, exhaust fan and light bulb responded to the changes in the weather at the mushroom farm. Table II summarizes the results of the experiments at different conditions. In this research, a prototype of the system has been developed. The hardware equipment, including the sensors, actuators, microcontroller, and relay module, was configured during the development process. The dashboard design is then completed on the IoT cloud server. The experimental observations on the prototype for some of the conditions indicated in Table II with the corresponding parameter values from the monitoring system in the Blynk application are shown in Figs. \u003cspan class=\"InternalRef\"\u003e14\u003c/span\u003e, \u003cspan class=\"InternalRef\"\u003e15\u003c/span\u003e, 16, and \u003cspan class=\"InternalRef\"\u003e17\u003c/span\u003e. Figure \u003cspan class=\"InternalRef\"\u003e14\u003c/span\u003e depicts an experiment when all actuator components are off because the farm\u0026rsquo;s temperature, humidity, CO2 level, and light intensity are suitable with their setpoint values. Figure \u003cspan class=\"InternalRef\"\u003e15\u003c/span\u003e illustrates a snapshot of the experiment in which the Peltier air conditioner activates to decrease the farm temperature when the temperature approaches the upper limit. The mist maker humidifier increases the humidity when it tends to be below the lower limit. Figure 16 provides an image of the experiment when the CO2 level reaches the predetermined value, and the light intensity is not ideal. To maintain the setpoint, the system activates the bulb to raise the light intensity and turns the exhaust fan on to lower the CO2 level. Figure \u003cspan class=\"InternalRef\"\u003e17\u003c/span\u003e represents a scenario where all the actuators are turned on because no parameters are optimum.\u003c/p\u003e\n\u003cp\u003e\u003cspan type=\"BoldItalicSmallCaps\" class=\"BoldItalicSmallCaps\" name=\"Emphasis\"\u003eB. Mushroom Classification Approach using Deep Learning\u003c/span\u003e\u003c/p\u003e\n\u003cp\u003eIn this experiment, a transfer learning approach is used to implement multiple CNN architectures for classifying mushrooms. Initially, the experiment is conducted using raw images, but the outcomes are unsatisfactory. Later, preprocessed images are substituted for the original raw images, which produce the best results. The study uses several CNN architectures, including DenseNet169, ResNet50V2, and MobileNet. ResNet50V2 shows the best test accuracy of 84.43% among all considered models when using the raw images, followed by DenseNet169 with 81.26% and MobileNet with 77.14%. Contrarily, with a preprocessed dataset, DenseNet169 outperforms all other architectures, with an accuracy of 95.21%, followed by ResNet50V2 with 90.41% and MobileNet with 86.37%. A confusion matrix (CM) is an instrument used for assessing the accuracy of predictions made by machine learning algorithms and we also use it to judge the test efficacy. Figure \u003cspan class=\"InternalRef\"\u003e18\u003c/span\u003e depicts the basic confusion matrix for classification problems and the confusion matrices for all three models implemented in this research using preprocessed images.\u003c/p\u003e\n\u003cp\u003eTABLE III\u003c/p\u003e\n\u003cp\u003ePERFORMANCE METRICES OF CNN MODELS USING RAW IMAGES\u003c/p\u003e\n\u003cdiv\u003e\n \u003ctable id=\"Tabc\" border=\"1\"\u003e\n \u003cthead\u003e\n \u003ctr\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003eArchitectures\u003c/p\u003e\n \u003c/th\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003eAccuracy\u003c/p\u003e\n \u003c/th\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003ePrecision\u003c/p\u003e\n \u003c/th\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003eRecall\u003c/p\u003e\n \u003c/th\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003eF1 Score\u003c/p\u003e\n \u003c/th\u003e\n \u003c/tr\u003e\n \u003c/thead\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eDenseNet169\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.95\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.95\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.95\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.95\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eResNet50V2\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.90\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.91\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.90\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.90\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eMobileNet\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.86\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.86\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.85\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.85\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003c/table\u003e\n\u003c/div\u003e\n\u003cp\u003eTABLE IV\u003c/p\u003e\n\u003cp\u003ePERFORMANCE METRICES OF CNN MODELS USING PREPROCESSED IMAGES\u003c/p\u003e\n\u003cdiv\u003e\n \u003ctable id=\"Tabd\" border=\"1\"\u003e\n \u003cthead\u003e\n \u003ctr\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003eArchitectures\u003c/p\u003e\n \u003c/th\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003eAccuracy\u003c/p\u003e\n \u003c/th\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003ePrecision\u003c/p\u003e\n \u003c/th\u003e\n \u003cth align=\"left\"\u003e\n \u003cp\u003eRecall\u003c/p\u003e\n \u003c/th\u003e\n \u003c/tr\u003e\n \u003c/thead\u003e\n \u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eDenseNet169\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.81\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.81\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.82\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eResNet50V2\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.84\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.82\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.84\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003ctr\u003e\n \u003ctd align=\"left\"\u003e\n \u003cp\u003eMobileNet\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.77\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.77\u003c/p\u003e\n \u003c/td\u003e\n \u003ctd align=\"char\"\u003e\n \u003cp\u003e0.75\u003c/p\u003e\n \u003c/td\u003e\n \u003c/tr\u003e\n \u003c/tbody\u003e\n \u003c/table\u003e\n\u003c/div\u003e\n\u003cp\u003eConfusion matrices offer a systematic framework for evaluating the predictive performance of machine learning models by comparing model outputs with the known ground truth. A confusion matrix was employed to assess the test efficacy of each architecture. As illustrated in Fig.\u0026nbsp;19, the true class represents the known labels from the dataset, while the predicted class corresponds to the classification model\u0026apos;s output. The matrix is composed of true positives (TP), true negatives (TN), false positives (FP), and false negatives (FN).\u003c/p\u003e"},{"header":"V. COMPARISON","content":"\u003cp\u003eBy comparing our proposed system with the others already in place, it is possible to determine why it is better than the others. To measure the significance of the proposed approach, we compare our work with others, as shown in Table V. True positive (TP), true negative (TN), false positive (FP), and false negative (FN) values are the components of a CM. The values in the CM\u0026rsquo;s diagonal position show how accurately the models predicted the data. Evaluation metrices, including accuracy, precision, recall, and F1-score, are calculated based on the confusion matrix by using the following equations:\u003cdiv id=\"Equa\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equa\" name=\"EquationSource\"\u003e\n$$\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\text{A}\\text{c}\\text{c}\\text{u}\\text{r}\\text{a}\\text{c}\\text{y}\\:=\\frac{\\text{T}\\text{P}\\:+\\:\\text{T}\\text{N}}{\\text{T}\\text{P}\\:+\\:\\text{T}\\text{N}\\:+\\:\\text{F}\\text{P}\\:+\\:\\text{F}\\text{N}}\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\left(1\\right)$$\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"Equb\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equb\" name=\"EquationSource\"\u003e\n$$\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\text{P}\\text{r}\\text{e}\\text{c}\\text{i}\\text{s}\\text{i}\\text{o}\\text{n}\\:=\\frac{\\text{T}\\text{P}}{\\text{T}\\text{P}\\:+\\:\\text{F}\\text{P}}\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\left(2\\right)$$\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"Equc\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equc\" name=\"EquationSource\"\u003e\n$$\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\text{R}\\text{e}\\text{c}\\text{a}\\text{l}\\text{l}\\:=\\frac{\\text{T}\\text{P}}{\\text{T}\\text{P}\\:+\\:\\text{F}\\text{N}}\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\left(3\\right)$$\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\"Equd\" class=\"Equation\"\u003e\u003cdiv format=\"TEX\" class=\"mathdisplay\" id=\"FileID_Equd\" name=\"EquationSource\"\u003e\n$$\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\text{F}1-\\text{S}\\text{c}\\text{o}\\text{r}\\text{e}\\:=2\\:\\times\\:\\:\\frac{\\text{P}\\text{r}\\text{e}\\text{c}\\text{i}\\text{s}\\text{i}\\text{o}\\text{n}\\:\\times\\:\\:\\text{R}\\text{e}\\text{c}\\text{a}\\text{l}\\text{l}}{\\text{P}\\text{r}\\text{e}\\text{c}\\text{i}\\text{s}\\text{i}\\text{o}\\text{n}+\\:\\text{R}\\text{e}\\text{c}\\text{a}\\text{l}\\text{l}}\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\:\\left(4\\right)$$\u003c/div\u003e\u003c/div\u003e\u003c/p\u003e \u003cp\u003eAt first, the values of the performance metrics, such as accuracy, precision, recall, and F1-score, are computed for each Deep Learning model. The results of the evaluation metrics for the raw and preprocessed images are shown in Tables III and IV, respectively. Table IV shows that using the raw images, ResNet50V2 outperforms the other two CNN models in terms of output quality. But according to Table V, DenseNet169 generates the best results of all CNN architectures when employing the preprocessed images. The authors in the paper [19], [20] used IoT technology but did not utilize machine learning or Deep Learning to classify mushrooms. The works in [3], [23], [24] include Machine Learning or Deep Learning techniques to categorize different mushrooms, but they did not consider the automation of mushroom farms. Our proposed system consists of both IoT and Deep Learning technology. We have considered each of the four essential elements required for mushroom farming. Moreover, we have also implemented an image-based\u003c/p\u003e \u003cp\u003e \u003cdiv class=\"gridtable\"\u003e\u003ctable float=\"No\" id=\"Tabe\" border=\"1\"\u003e \u003ccolgroup cols=\"9\"\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c1\" colnum=\"1\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c2\" colnum=\"2\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c3\" colnum=\"3\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c4\" colnum=\"4\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c5\" colnum=\"5\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c6\" colnum=\"6\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c7\" colnum=\"7\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c8\" colnum=\"8\"\u003e\u003c/div\u003e \u003cdiv align=\"left\" class=\"colspec\" colname=\"c9\" colnum=\"9\"\u003e\u003c/div\u003e \u003cthead\u003e \u003ctr\u003e \u003cth align=\"left\" colspan=\"9\" nameend=\"c9\" namest=\"c1\"\u003e \u003cp\u003eTABLE V\u003c/p\u003e \u003cp\u003eCOMPARATIVE ANALYSIS\u003c/p\u003e \u003c/th\u003e \u003c/tr\u003e \u003c/thead\u003e \u003ctbody\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e\u003cb\u003eReference\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003e\u003cb\u003eIoT Approach\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003e\u003cb\u003eDL Approach\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003e\u003cb\u003eFarm Automation\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003e\u003cb\u003eMushroom Classification\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e\u003cb\u003eWeather Factors\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003e\u003cb\u003eImage Based Classification\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c8\"\u003e \u003cp\u003e\u003cb\u003ePredicted Class\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c9\"\u003e \u003cp\u003e\u003cb\u003eMaximum Accuracy\u003c/b\u003e\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e[19]\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e2\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c8\"\u003e \u003cp\u003eN/A\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c9\"\u003e \u003cp\u003eN/A\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e[20]\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e2\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c8\"\u003e \u003cp\u003eN/A\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c9\"\u003e \u003cp\u003eN/A\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e[3]\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003eN/A\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c8\"\u003e \u003cp\u003e3\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c9\"\u003e \u003cp\u003e88.40\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e[23]\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003eN/A\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c8\"\u003e \u003cp\u003e2\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c9\"\u003e \u003cp\u003e80.00%\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003e[24]\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003eN/A\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003eNO\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c8\"\u003e \u003cp\u003e2\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c9\"\u003e \u003cp\u003e76.60%\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003ctr\u003e \u003ctd align=\"left\" colname=\"c1\"\u003e \u003cp\u003eProposed\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c2\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c3\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c4\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c5\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c6\"\u003e \u003cp\u003e4\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c7\"\u003e \u003cp\u003eYES\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c8\"\u003e \u003cp\u003e3\u003c/p\u003e \u003c/td\u003e \u003ctd align=\"left\" colname=\"c9\"\u003e \u003cp\u003e95.21%\u003c/p\u003e \u003c/td\u003e \u003c/tr\u003e \u003c/tbody\u003e \u003c/colgroup\u003e \u003c/table\u003e\u003c/div\u003e \u003c/p\u003e \u003cp\u003emushroom classification model with an accuracy of 95.21%, making the proposed system more precise and effective than the others.\u003c/p\u003e \u003cp\u003e \u003c/p\u003e"},{"header":"VI. CONCLUSION","content":"\u003cp\u003eMost farmers produce mushrooms using traditional farming methods because mushroom farming is currently very promising. However, some adverse effects of certain weather factors can also cause the growth of poisonous mushrooms. Farm automation can therefore be a good solution to this issue.\u003c/p\u003e \u003cp\u003eSmart farming can also minimize physical labor and monitor real time data. This study presents an architecture for smart mushroom farming based on IoT and Deep Learning. This study presents an architecture for smart mushroom farming based on IoT and Deep Learning. There are three main components to the proposed methodology. The first component is remote monitoring and control, which allows the user to keep track of the weather conditions of the farm, which are crucial to the development of mushrooms. This system uses a DHT-22 sensor to measure the temperature and humidity, a BH-1750 sensor to measure the light intensity, and an MH-Z19B Infrared CO2 gas sensor module to get the CO2 level of the farm. The second section focuses on automating the suggested model using a microcontroller, which is connected to the sensors to guarantee consistent irrigation and a comfortable level of temperature, humidity, light intensity, and CO2 on the farm. The Deep Learning-based mushroom classification system is the third component of our work. We have used a variety of algorithms, such as MobileNet, ResNet50V2, and DenseNet169, to distinguish between edible, inedible, and poisonous mushrooms. Further, a preprocessing technique is used, combining the CLAHE and Laplacian Filter to increase the test accuracy. DenseNet169 outperforms ResNet50V2 and MobileNet in terms of accuracy, scoring 95.21%. In the future, we will work to make the monitoring and management system more efficient for accurate weather control. We will also use more varieties of mushroom images in the dataset to increase the accuracy of the classification model. However, the suggested approach can significantly influence the automation of real-world mushroom farms.\u003c/p\u003e"},{"header":"Declarations","content":"\u003cp\u003e\u003cstrong\u003eConflict of Interest\u003c/strong\u003e The authors declare no competing interests.\u003c/p\u003e\n\u003cp\u003e\u003cstrong\u003eFunding\u0026nbsp;\u003c/strong\u003eAuthors do not receive any funding for this research.\u003c/p\u003e"},{"header":"References","content":"\u003col\u003e\n\u003cli\u003eH. Li, Y. Tian, N. Menolli Jr, L. Ye, S. C. Karunarathna, J. Perez- Moreno, M. M. Rahman, M. H. Rashid, P. Phengsintham, L. Rizal et al., \u0026ldquo;Reviewing the world\u0026rsquo;s edible mushroom species: A new evidence- based classification system,\u0026rdquo; Comprehensive Reviews in Food Science and Food Safety, vol. 20, no. 2, pp. 1982\u0026ndash;2014, 2021.\u003c/li\u003e\n\u003cli\u003eS. Ismail, A. R. Zainal, and A. Mustapha, \u0026ldquo;Behavioural features for mushroom classification,\u0026rdquo; pp. 412\u0026ndash;415, 2018.\u003c/li\u003e\n\u003cli\u003eN. Zahan, M. Z. Hasan, M. A. Malek, and S. S. Reya, \u0026ldquo;A deep learning-based approach for edible, inedible and poisonous mushroom classification,\u0026rdquo; pp. 440\u0026ndash;444, 2021.\u003c/li\u003e\n\u003cli\u003eH. Rahman, M. O. Faruq, T. B. A. Hai, W. Rahman, M. M. Hossain, M. Hasan, S. Islam, M. I. Moinuddin, M. Tarequl, and M. M. Azad,\u0026ldquo;Iot enabled mushroom farm automation with machine learning to classify toxic mushrooms in bangladesh,\u0026rdquo; Journal of Agriculture and Food Research, vol. 7, p. 100267, 2022.\u003c/li\u003e\n\u003cli\u003eL. Chen, L. Qian, X. Zhang, J. Li, Z. Zhang, and X. Chen, \u0026ldquo;Research progress on indoor environment of mushroom factory,\u0026rdquo; International Journal of Agricultural and Biological Engineering, vol. 15, no. 1, pp. 25\u0026ndash;32, 2022.\u003c/li\u003e\n\u003cli\u003eN. Aggarwal and D. Singh, \u0026ldquo;A review on usage of internet of things (iot) technologies in mushroom cultivation,\u0026rdquo; ECS Transactions, vol. 107, no. 1, p. 9739, 2022.\u003c/li\u003e\n\u003cli\u003eJ. L. Chong, K. W. Chew, A. P. Peter, H. Y. Ting, and P. L. Show,\u0026ldquo;Internet of things (iot)-based environmental monitoring and control system for home-based mushroom cultivation,\u0026rdquo; Biosensors, vol. 13, no. 1, p. 98, 2023.\u003c/li\u003e\n\u003cli\u003eV. Moysiadis, G. Kokkonis, S. Bibi, I. Moscholios, N. Maropoulos, and P. Sarigiannidis, \u0026ldquo;Monitoring mushroom growth with machine learning,\u0026rdquo; Agriculture, vol. 13, no. 1, p. 223, 2023.\u003c/li\u003e\n\u003cli\u003e\u0026ldquo;Agriculture iot market size is projected to reach usd 48,714 million by 2025 - valuates reports,\u0026rdquo; 2020, last accessed: 25.12.2022. [Online]. Available: https://www.prnewswire.com/in/news-releases/agriculture-iot-market-size-is-projected-to-reach-usd-48-714-million-by-2025-valuates-reports-869979448.html\u003c/li\u003e\n\u003cli\u003eS. Jindal, M. Sachdeva, and A. K. S. Kushwaha, \u0026ldquo;Deep learning for video based human activity recognition: Review and recent developments,\u0026rdquo; pp. 71\u0026ndash;83, 2022.\u003c/li\u003e\n\u003cli\u003eS. Sharma and K. Guleria, \u0026ldquo;Deep learning models for image classification: comparison and applications,\u0026rdquo; pp. 1733\u0026ndash;1738, 2022.\u003c/li\u003e\n\u003cli\u003eM. Masud, N. Sikder, A.-A. Nahid, A. K. Bairagi, and M. A. AlZain,\u0026ldquo;A machine learning approach to diagnosing lung and colon cancer using a deep learning-based classification framework,\u0026rdquo; p. 748, 2021.\u003c/li\u003e\n\u003cli\u003eM. O. Ojo and A. Zahid, \u0026ldquo;Deep learning in controlled environment agriculture: A review of recent advancements, challenges and prospects,\u0026rdquo;Sensors, vol. 22, no. 20, p. 7965, 2022.\u003c/li\u003e\n\u003cli\u003eT. K. Nayak and A. Rao, \u0026ldquo;Recent advances in deep learning cnn models for plant disease detection,\u0026rdquo; Advances in Agricultural and Industrial Microbiology, pp. 247\u0026ndash;263, 2022.\u003c/li\u003e\n\u003cli\u003eM. Litvak, S. Divekar, and I. Rabaev, \u0026ldquo;Urban plants classification using deep-learning methodology: A case study on a new dataset,\u0026rdquo; vol. 3, no. 3. MDPI, 2022, pp. 524\u0026ndash;534.\u003c/li\u003e\n\u003cli\u003eA. Oikonomidis, C. Catal, and A. Kassahun, \u0026ldquo;Deep learning for crop yield prediction: a systematic literature review,\u0026rdquo; New Zealand Journal of Crop and Horticultural Science, pp. 1\u0026ndash;26, 2022.\u003c/li\u003e\n\u003cli\u003eN. J. Ria, S. S. I. Badhon, S. A. Khushbu, S. Akter, and S. A. Hossain,\u0026ldquo;State of art research in edible and poisonous mushroom recognition,\u0026rdquo; pp. 01\u0026ndash;05, 2021.\u003c/li\u003e\n\u003cli\u003eA. A. Shakir, F. Hakim, M. Rasheduzzaman, S. Chakraborty, T. U. Ahmed, and S. Hossain, \u0026ldquo;Design and implementation of sensep ack: An iot based mushroom cultivation monitoring system,\u0026rdquo; pp. 1\u0026ndash;6, 2019.\u003c/li\u003e\n\u003cli\u003eT. H. Nasution, M. Yasir, S. Soeharwinto et al., \u0026ldquo;Designing an iot system for monitoring and controlling temperature and humidity in mushroom cultivation fields,\u0026rdquo; pp. 326\u0026ndash;331, 2019.\u003c/li\u003e\n\u003cli\u003eK. Bunluewong et al., \u0026ldquo;Semi-automated mushroom cultivation house using internet of things,\u0026rdquo; Engineering Access, vol. 7, no. 2, pp. 181 188, 2021.\u003c/li\u003e\n\u003cli\u003eA. D. E. N. U. K. Najmurrokhman, Asep and b. p. y. o. Hasbi Ridhatama, journal=Health policy and planning, \u0026ldquo;Development of temperature and humidity control system in internet-of-things based oyster mushroom cultivation.\u0026rdquo;\u003c/li\u003e\n\u003cli\u003eA. Subedi, A. Luitel, M. Baskota, and T. D. Acharya, \u0026ldquo;Iot based mon itoring system for white button mushroom farming,\u0026rdquo; Multidisciplinary Digital Publishing Institute Proceedings, vol. 42, no. 1, p. 46, 2019.\u003c/li\u003e\n\u003cli\u003eS. Verma and M. Dutta, \u0026ldquo;Mushroom classification using ann and anfis algorithm,\u0026rdquo; IOSR Journal of Engineering (IOSRJEN), vol. 8, no. 01, pp. 94\u0026ndash;100, 2018.\u003c/li\u003e\n\u003cli\u003eP. Maurya and N. P. Singh, \u0026ldquo;Mushroom classification using feature based machine learning approach,\u0026rdquo; in Proceedings of 3rd International Conference on Computer Vision and Image Processing. Springer, 2020, pp. 197\u0026ndash;206.\u003c/li\u003e\n\u003cli\u003eW. Ketwongsa, S. Boonlue, and U. Kokaew, \u0026ldquo;A new deep learning model for the classification of poisonous and edible mushrooms based on improved alexnet convolutional neural network,\u0026rdquo; Applied Sciences, vol. 12, no. 7, p. 3409, 2022.\u003c/li\u003e\n\u003cli\u003eA. Sameh, M. Moghayer, G. Mohanad, and A. Mohammad, \u0026ldquo;Classification of mushroom using artificial neural network.\u0026rdquo; International Journal of Academic and Applied Research (IJAAR), vol. 3, no. 2, 2020.\u003c/li\u003e\n\u003cli\u003eJ. J. Lee, M. C. Aime, B. Rajwa, and E. Bae, \u0026ldquo;Machine learning-based classification of mushrooms using a smartphone application,\u0026rdquo; Applied Sciences, vol. 12, no. 22, p. 11685, 2022.\u003c/li\u003e\n\u003cli\u003eN. Kiss and L. Cz\u0026acute;uni, \u0026ldquo;Mushroom image classification with cnns: A case-study of different learning strategies,\u0026rdquo; in 2021 12th International Symposium on Image and Signal Processing and Analysis (ISPA). IEEE, 2021, pp. 165\u0026ndash;170.\u003c/li\u003e\n\u003cli\u003e\u0026ldquo;inaturalist-observations,\u0026rdquo; last accessed: 01.01.2023. [Online]. Available: https://www.inaturalist.org\u003c/li\u003e\n\u003cli\u003e\u0026ldquo;Understandinging,\u0026rdquo; able: last transfer accessed: learning 01.01.2023. For deep [online]. https://www.analyticsvidhya.com/blog/2021/10/understanding transfer-learning-for-deep-learning.\u003c/li\u003e\n\u003cli\u003eG. Huang, Z. Liu, L. Van Der Maaten, and K. Q. Weinberger, \u0026ldquo;Densely connected convolutional networks,\u0026rdquo; in Proceedings of the IEEE conference on computer vision and pattern recognition, 2017, pp. 4700\u0026ndash;4708.\u003c/li\u003e\n\u003cli\u003eB. Zhou, Y. Li, and J. Wang, \u0026ldquo;A weakly supervised adaptive densenet for classifying thoracic diseases and identifying abnormalities,\u0026rdquo; arXiv preprint arXiv:1807.01257, 2018.\u003c/li\u003e\n\u003cli\u003eK. He, X. Zhang, S. Ren, and J. Sun, \u0026ldquo;Deep residual learning for image recognition,\u0026rdquo; in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016, pp. 770\u0026ndash;778.\u003c/li\u003e\n\u003cli\u003e\u0026ldquo;Detailed guide to understand and implement resnets\u0026rdquo;, Available: https://cv tricks.com/keras/understand-implement-resnets\u003c/li\u003e\n\u003cli\u003eL. Ali, F. Alnajjar, H. A. Jassmi, M. Gocho, W. Khan, and M. A.Serhani, \u0026ldquo;Performance evaluation of deep cnn-based crack detection and localization techniques for concrete structures,\u0026rdquo; Sensors, vol. 21, no. 5, p. 1688, 2021.\u003c/li\u003e\n\u003cli\u003eA. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam, \u0026ldquo;Mobilenets: Efficient convolutional neural networks for mobile vision applications,\u0026rdquo; arXiv preprint arXiv:1704.04861, 2017.\u003c/li\u003e\n\u003cli\u003eO. Firmansyah, Maulani, A. M. Ridwan, Sumiati, E. A. Z. Hamidi, and P. D. Fitriani, \u0026ldquo;Prototype of temperature and humidity control system for oyster mushroom cultivation using arduino uno based on the internet of things,\u0026rdquo; in 2022 8th International Conference on Wireless and Telematics (ICWT), 2022, pp. 1\u0026ndash;4.\u003c/li\u003e\n\u003cli\u003e\u0026ldquo;Role of co2 monitoring in mushroom farming,\u0026rdquo; last accessed: 01.01.2023. [Online]. Available: https://www.pranaair.com/blog/co2 monitoring-in-mushroom-farming\u003c/li\u003e\n\u003c/ol\u003e"}],"fulltextSource":"","fullText":"","funders":[],"hasAdminPriorityOnWorkflow":false,"hasManuscriptDocX":true,"hasOptedInToPreprint":true,"hasPassedJournalQc":"","hasAnyPriority":false,"hideJournal":true,"highlight":"","institution":"","isAcceptedByJournal":false,"isAuthorSuppliedPdf":false,"isDeskRejected":"","isHiddenFromSearch":false,"isInQc":false,"isInWorkflow":false,"isPdf":false,"isPdfUpToDate":true,"isWithdrawnOrRetracted":false,"journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true},"keywords":"Internet of Things (IoT), Smart farming, Mushroom, Deep Learning, Classification","lastPublishedDoi":"10.21203/rs.3.rs-6338090/v1","lastPublishedDoiUrl":"https://doi.org/10.21203/rs.3.rs-6338090/v1","license":{"name":"CC BY 4.0","url":"https://creativecommons.org/licenses/by/4.0/"},"manuscriptAbstract":"\u003cp\u003eMonitoring and controlling the weather is an essential aspect of mushroom development, particularly the effects of temperature, humidity, light intensity and the amount of carbon dioxide. The traditional method of mushroom farming is quite challenging because there is little control over the weather and cultivation process, and poisonous mushrooms frequently grow. Hence, a sensor based self-regulating Internet of Things framework will be relatively more convenient than any conventional system for monitoring and controlling the farming environment. Mushroom farming traditionally faces challenges due to its dependence on weather conditions and the risk of cultivating poisonous varieties. To address these issues, we propose a smart mushroom farming system integrating Internet of Things (IoT) devices and Deep Learning (DL) models, including DenseNet169, ResNet50V2, and MobileNet. This system enables remote monitoring, automated cultivation, and mushroom classification. IoT components such as microcontrollers, sensors, and actuators facilitate intelligent monitoring and automation. DL algorithms classify mushrooms as edible, inedible, or poisonous, with preprocessing techniques like Contrast Limited Adaptive Histogram Equalization (CLAHE) and the Laplacian Filter enhancing classification accuracy. Using DenseNet169, our model achieves a maximum test accuracy of 95.21%.\u003c/p\u003e","manuscriptTitle":"An IoT-Enabled Deep Learning Framework for Autonomous Environmental Monitoring and Toxicity Classification in Smart Mushroom Cultivation Systems","msid":"","msnumber":"","nonDraftVersions":[{"code":1,"date":"2025-04-29 08:43:25","doi":"10.21203/rs.3.rs-6338090/v1","editorialEvents":[{"type":"communityComments","content":0}],"status":"published","journal":{"display":true,"email":"
[email protected]","identity":"researchsquare","isNatureJournal":false,"hasQc":true,"allowDirectSubmit":true,"externalIdentity":"","sideBox":"","snPcode":"","submissionUrl":"/submission","title":"Research Square","twitterHandle":"researchsquare","acdcEnabled":true,"dfaEnabled":false,"editorialSystem":"","reportingPortfolio":"","inReviewEnabled":false,"inReviewRevisionsEnabled":true}}],"origin":"","ownerIdentity":"6d8b1849-4513-409d-b7a0-387c2ce52dd3","owner":[],"postedDate":"April 29th, 2025","published":true,"recentEditorialEvents":[],"rejectedJournal":[],"revision":"","amendment":"","status":"posted","subjectAreas":[],"tags":[],"updatedAt":"2025-07-23T11:23:47+00:00","versionOfRecord":[],"versionCreatedAt":"2025-04-29 08:43:25","video":"","vorDoi":"","vorDoiUrl":"","workflowStages":[]},"version":"v1","identity":"rs-6338090","journalConfig":"researchsquare"},"__N_SSP":true},"page":"/article/[identity]/[[...version]]","query":{"redirect":"/article/rs-6338090","identity":"rs-6338090","version":["v1"]},"buildId":"8U1c8b4HqxoKbykW_rLl7","isFallback":false,"isExperimentalCompile":false,"dynamicIds":[84888],"gssp":true,"scriptLoader":[]}
Text is read by the "Ask this paper" AI Q&A widget below.
Extraction quality varies by source — PMC NXML preserves structure
cleanly, OA-HTML may include some navigation residue, and OA-PDF can
have broken hyphenation. The publisher copy
(via DOI)
is the canonical version.