0% found this document useful (0 votes)
18 views36 pages

Part 1

The project report focuses on 'Lung Cancer Detection Using Machine Learning Techniques,' aiming to improve early detection of lung cancer through advanced image analysis of X-ray and CT scan data. Utilizing deep learning methods like convolutional neural networks, the project seeks to enhance the sensitivity and specificity of detection, addressing the high mortality rates associated with late diagnoses. The report includes a comprehensive overview of the project's objectives, methodology, and acknowledgments, highlighting the significance of timely diagnosis in improving patient outcomes.

Uploaded by

Devaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views36 pages

Part 1

The project report focuses on 'Lung Cancer Detection Using Machine Learning Techniques,' aiming to improve early detection of lung cancer through advanced image analysis of X-ray and CT scan data. Utilizing deep learning methods like convolutional neural networks, the project seeks to enhance the sensitivity and specificity of detection, addressing the high mortality rates associated with late diagnoses. The report includes a comprehensive overview of the project's objectives, methodology, and acknowledgments, highlighting the significance of timely diagnosis in improving patient outcomes.

Uploaded by

Devaraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 36

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

Jnana Sangama, Belagavi, Karnataka – 590018

A
Project Report
on

“LUNG CANCER DETECTION USING MACHINE LEARNING


TECHNIQUES”
Submitted in partial fulfillment of the requirement for the award of the degree of

BACHELOR OF ENGINEERING
in
DEPARTMENT OF INFORMATION SCIENCE AND ENGINEERING

Bhaskar Jha (1KT21IS007)


Dheekshitha J S (1KT21IS014)
Khushi Chauhan (1KT21IS020)

Shylaja M (1KT22IS406)

Under the Guidance of


Dr Hemalatha K L
Professor and HOD
Dept of ISE, SKIT

SRI KRISHNA INSTITUTE OF TECHNOLOGY


(Affiliated to Visvesvaraya Technological University, Belgaum)
#57, Chimney Hills, Hesaraghatta Main Road, Chimney hills, Chikkabanavara P.O.,
Bengaluru – 560090
2024-2025
SRI KRISHNA INSTITUTE OF TECHNOLOGY
#57, Chimney Hills, Hesaraghatta Main Road, Chimney hills, Chikkabanavara P.O, Bengaluru –560090
DEPARTMENT OF INFORMATION SCIENCE AND
ENGINEERING

CERTIFICATE
Certified that the project work prescribed in 21ISP76 entitled “LUNG CANCER DETECTION
USING MACHINE LEARNING TECHNIQUES” is a Bonafide work carried out by BHASKAR
JHA(1KT21IS007), DHEEKSHITHA J S(1KT21IS014), KHUSHI CHAUHAN (1KT21IS020)
and SHYLAJA M(1KT22IS406) , students of Sri Krishna Institute of Technology, Bengaluru in
partial fulfilment for the award of Bachelor of Engineering Information Science and Engineering of
the Visvesvaraya Technological University Belagavi during the year 2024-25. It is certified that all
corrections / suggestions indicated for Internal Assessment have been incorporated in the project report
deposited in the departmental library. The project report has been approved as it satisfies the academic
requirements with respect to project work prescribed for the said Bachelor of Engineering Degree.

Signature of the Co-Ordinator Signature of the Guide Signature of the HOD


Mrs. Ragini Krishna Dr. Hemalatha K.L Dr. Hemalatha K.L
Assistant Professor Professor and HOD Professor and
Dept of ISE, SKIT Dept of ISE, SKIT HOD Dept of ISE,
SKIT
ABSTRACT

In today’s world, rising health issues are leading to an urgent need for effective diagnostic tools, with
cancer remaining one of the most formidable challenges. Lung cancer, in particular, is a significant
public health problem due to its high mortality rate, which is largely attributed to diagnoses often
occurring at an advanced stage. Research shows that early detection is essential for improving
survival rates, as it allows for timely and potentially less aggressive treatment interventions. Our
project seeks to address this issue by utilizing advanced image analysis techniques on X-ray and CT
scan data to detect lung cancer at earlier stages.

We are implementing a robust machine learning framework that combines deep learning and
computer vision methods to analyze medical images with high precision. Techniques such as
convolutional neural networks (CNNs) are applied to detect patterns and anomalies that may indicate
early signs of lung cancer, even when these signs are not easily discernible to the human eye.
Additionally, by training our models on extensive datasets, we aim to improve the sensitivity and
specificity of lung cancer detection.

i
ACKNOWLEDGEMENT

The completion of Project Work brings with a sense of satisfaction, but it is never complete without
thanking the persons responsible for its successful completion.

At the outset, we express our most sincere grateful acknowledgment to the holy sanctum “Sri
Krishna Institute of Technology”, the temple of learning, for giving us an opportunity to pursue
the degree course in Information Science and Engineering and thus helping us in shaping our career.

We extend our deep sense of sincere gratitude to our Dr. Mahesha K, Principal, Sri Krishna
Institute of Technology, Bangalore, for providing us an opportunity.

We express our heartfelt sincere gratitude to our guide and HOD, Dr. Hemalatha K.L,
Department of Information Science and Engineering, Sri Krishna Institute of Technology,
Bangalore, for her valuable suggestions and support.

We extend our special in-depth, heartfelt, sincere gratitude to our Project Coordinator Mrs. Ragini
Krishna, Assistant Professor, Department of Information Science and Engineering, Sri
Krishna Institute of Technology, Bangalore, for her constant support and valuable guidance for
completion of the project work.

We would like to thank all the teaching and non-teaching staff members in our Department of
Information Science and Engineering, Sri Krishna Institute of Technology, Bangalore, for their
support.

Finally, we would like to thank all our friends and family members for their constant support,
guidance and encouragement.

Bhaskar Jha (1KT21IS007)


Dheekshitha J S (1KT21IS014)
Khushi Chauhan (1KT22IS020)
Shylaja M (1KT22IS406)

ii
TABLE OF CONTENTS

Abstract i
Acknowledgement ii
Table of Contents iii

CHAPTER NO. CHAPTER NAME PAGE NO.


1 INTRODUCTION 1
1.1 INTRODUCTION TO MODULES 4
1.2 PROBLEM STATEMENT 5
1.3 OBJECTIVES 5
1.4 CHAPTER SUMMARY 5
2 LITERATURE REVIEW 6
2.1 EXISTING SYSTEM 6
2.2 GAPS IDENTIFIED 10
3 REQUIREMENTS 11
3.1 FUNCTIONAL REQUIREMENTS 11
3.2 FUNCTIONAL REQUIREMENTS 11
3.3 HARDWARE REQUIREMENTS 11
3.4 SOFTWARE REQUIREMENTS 12
4 METHODOLOGY 13
4.1 ARCHITECTIRE DIAGRAM 13
4.2 USE CASE 14
4.3 SEQUENCE DIAGRAM 15
4.4 CHAPTER SUMMARY 16
5 IMPLEMENTATION 17
5.1 ALGORITHM 17
5.2 PSEUDOCODE 18
5.3 CHAPTER SUMMARY

iii
6 TESTING 19

7 RESULTS 21

7.1 RESULTS 21

8 23
CONCLUSION AND
FUTURE ENHANCEMENT 23
8.1 CONCLUSION
8.2 FUTURE ENHANCEMENT 23

BIBLIOGRAPHY
APPENDIX

iv
TABLE OF FIGURES

FIGURE NO. FIGURE NAME PAGE NO

4.1 Architecture Diagram 13


4.2 Use Case Diagram 14
4.3 Sequence Diagram 15
6.1 Classification Report for Lung Disease Detection 19
A1 Lung Cancer Detection System 24
A2 Lung Health Detection System 24
A3 Lung Squamous Cell Carcinoma Detection Tool 25
CHAPTER 1
INTRODUCTION

Forest fires are a serious environmental hazard, with devastating impacts on biodiversity, human
life, and economic resources. These fires not only lead to the loss of flora and fauna but also
contribute significantly to air pollution and greenhouse gas emissions, accelerating climate change.

The frequency and intensity of forest fires have increased due to factors such as rising global
temperatures and prolonged droughts, creating an urgent need for effective monitoring and
management solutions.

Traditional methods for detecting and managing forest fires rely heavily on satellite imagery and
ground surveillance, which often suffer from limitations in spatial resolution, delayed response
times, and difficulty in monitoring remote areas.

These limitations make it challenging to detect fires at an early stage, especially in dense or rugged
forest environments where rapid response is crucial to containment. Furthermore, predicting the
spread of fires based on weather patterns and environmental conditions is complex, requiring real-
time data integration and advanced forecasting models.

EcoGuard is designed to address these challenges by integrating Internet of Things (IoT)


technology and Artificial Intelligence (AI) for comprehensive forest fire monitoring and
management. The system utilizes IoT-enabled environmental sensors and advanced AI algorithms
to detect early signs of fire based on temperature, humidity, smoke levels, and other environmental
factors.

EcoGuard’s real-time data collection and analysis capabilities enable precise fire detection, spread
prediction, and timely alerts to relevant authorities, enhancing response effectiveness. This
introduction outlines the importance of the problem, the limitations of existing methods, and how
EcoGuard offers an innovative solution. It sets the context for the rest of the report by highlighting
the project's goals and impact.
Ecoguard Introduction

1.1 Introduction of modules

1.Sensor Module
 Initialize sensors (Humidity, Temperature, Gas sensors)
 Read sensors value continuously
 Send data to processing module
2. Data Preprocessing
 Normalize sensor data
 Remove anomalies and noise
 Forward cleaned data to ML model
3. Machine Learning (TensorFlow Lite)
 Load TensorFlow Lite model
 Input data into model
 Output anomaly status (0=Normal, 1=Anomaly)
4. Visualization and Alerting
 Update real-time charts (temperature, humidity, gas level)
 Display anomaly status on dashboard
 Send email alerts if anomaly detected

Dept of ISE, SKIT 2 2024-2025


Ecoguard Introduction

1.2 PROBLEM STATEMENT


Eco Guard aims to provide a scalable, IoT- and AI-driven solution for rapid detection, real-time
monitoring, and accurate fire spread prediction to improve response effectiveness and
conservation efforts

1.3 OBJECTIVES

The Objectives of this proposed project are:

• To provide multi-level alert systems based on fire intensity (e.g., yellow alert for minor risks,
Red alert for high risks).

• To collect data to continuously improve the accuracy of the AI model through machine
learning.

• To collaborate with forest management authorities to facilitate data-driven decision making.

1.4 CHAPTER SUMMARY

The project "EcoGuard," a system aimed at tackling forest fires through advanced technology.
EcoGuard integrates IoT sensors, such as those for temperature, humidity, and smoke, with AI
algorithms to detect, predict, and manage forest fires in real-time. The project's goal is to
address the limitations of traditional methods like satellite imagery and manual ground
surveillance, which are slow and less effective in remote areas. By providing early detection,
spread prediction, and timely alerts, EcoGuard aims to enhance firefighting response, protect
biodiversity, and mitigate economic losses. This includes a literature review of related
technologies, identifies gaps like the need for real-time data integration and dynamic fire spread
prediction, and sets objectives to refine AI accuracy and collaboration with forest management.

Dept of ISE, SKIT 3 2024-2025


CHAPTER 2
LITERATURE REVIEW
A literature review is a detailed summary of previous research on a particular topic. It helps new
studies by giving background information and showing what we know and what we still need to
learn.

2.1 Existing System

[1] ASHRAF ZAHER, AHMED AI-FAQSH, HASAN ABDULREDHA, HUSAIN AI-


QUDAIHI, MOHAMAD TOAUBE, “A Fire Prevention/Monitoring Smart System”.

The paper titled presents a smart system designed to detect and monitor fires, smoke, and gas
leaks, with a focus on regions like the GCC where oil and gas leaks pose significant risks. The
proposed system uses solar panels as a renewable energy source, integrating various sensors for
real- time fire and gas detection, and notifying relevant authorities. Additionally, it allows
continuous monitoring of buildings or areas under fire through desktop or mobile devices. Key
features include automatic fire extinguishing mechanisms, redundancy through multiple sensors for
improved accuracy, and an automatic cleaning system for the solar panels to maintain efficiency in
dusty environments like Kuwait. The system architecture uses a PC instead of a microcontroller to
enhance computational power, making it highly suitable for the environment of the GCC. The paper
concludes by highlighting the advantages of the system, including its scalability and reliability,
while also acknowledging limitations such as the need for further integration of wireless
communication and IoT for future improvements

[2] SANTHIYA M, SIVA RATHNAM M, RADHA KRISHNAN T, AND NISHANTH S,


“Smart Forest Fire Identification and Notification System Using IoT-Based Wireless Sensor
Networks”
The paper "Smart Forest Fire Identification and Notification System Using IoT-Based Wireless
Sensor Networks" proposes an IoT-based solution for early detection of forest fires. It uses a variety
of sensors, including temperature, smoke, and PIR sensors, interfaced with a Raspberry Pi.The
system is designed to notify authorities quickly via SMS and provide precise fire locations to reduce
response time. This early detection system is aimed at minimizing the environmental and ecological
impact of wildfires. The paper concludes that the proposed system is more efficient and cost-
effective compared to existing forest fire detection technologies.
Ecoguard Literature Review

[3] MOUNIR GRARI, IDRISS IDRISSI, MOHAMMED BOUKABOUS, OMAR


MOUSSAOUI, MOSTAFA AZIZI AND MIMOUN MOUSSAOUI, “Early Wildfire Detection
Using Machine Learning Model Deployed in the Fog/Edge Layers of IoT”
The paper presents a system for predicting wildfires using machine learning (ML) models
integrated into IoT devices. The study utilizes NASA's FIRMS dataset, which includes satellite data
for detecting fires, to train a regression model that predicts fire radiative power. Various ML
algorithms, such as Extra Trees, Gradient Boosting, and Random Forest, are evaluated, with Extra
Trees showing the best performance. The system's goal is to deploy this model on IoT devices like
drones or cameras, enabling real-time, edge-layer fire predictions. This approach allows faster
detection and notification, improving response times for firefighting efforts. The study highlights
that using ensemble learning techniques significantly enhances wildfire prediction accuracy,
offering a robust solution for mitigating the devastating impact of forest fires.

[4] MOUNIR GRARI, IDRISS IDRISSI, MOHAMMED BOUKABOUS, OMAR


MOUSSAOUI, MOSTAFA AZIZI AND MIMOUN MOUSSAOUI, “Using IoT and ML for
Forest Fire Detection, Monitoring, and Prediction: A Literature Review”

The document "Using IoT and ML for Forest Fire Detection, Monitoring, and Prediction: A
Literature Review" explores the use of Internet of Things (IoT) and machine learning (ML) for
detecting, monitoring, and predicting wildfires. Forest fires are major hazards that cause
deforestation, environmental damage, and air pollution. The paper emphasizes the importance of
early-warning systems and evaluates existing literature on leveraging IoT and deep learning
technologies to address forest fires. It discusses various sensors, including temperature, humidity,
and CO detectors, that monitor environmental data to detect potential fire outbreaks. IoT systems
collect data, which is then analyzed using ML models for accurate fire prediction and early
response. The review categorizes existing approaches into image-based and sensor-based detection,
comparing their effectiveness and technological requirements. Overall, it highlights the potential of
integrating IoT and AI for more efficient wildfire management, prevention, and response strategies
[5] MURUGAPERUMAL KRISHNAMOORTHY, Md ASIF, IIHAMI COLAK, “A Design
and Development of the Smart Forest Alert Monitoring System Using IoT”
The paper discusses the design and development of a Smart Forest Alert Monitoring System
using IoT. The system aims to detect and mitigate forest fires and unlawful deforestation activities
in real-time by employing wireless sensor networks (WSNs) integrated with IoT. Key components
include temperature, humidity, smoke, and vibration sensors to monitor environmental parameters,
detect fire, and identify human activities such as tree cutting.

Dept of ISE, SKIT 5 2024-2025


Ecoguard Literature Review

The data collected is transmitted to a cloud server using 4G/LTE for real-time monitoring by
authorities. The system automatically activates preventive actions like water sprinkling or CO2 fire
extinguishers upon detecting hazardous events. A case study conducted in Hyderabad demonstrates
the system's effectiveness in early wildfire detection and forest protection. The study highlights the
accuracy, quick response, and scalability of the system for forest fire prevention, with potential
applications in industrial, park, and urban settings.

[6] GUILHERME BORBA NEUMANN, VITOR PINHEIRO DE ALMEIDA, AND MARKUS


ENDLER “Smart Forests: Fire Detection Service”

The paper "Smart Forests: Fire Detection Service" explores a fire detection system within the
context of Smart Forests using IoT. The focus is on Edge Computing through Mobile Hubs (M-Hubs)
to improve cost-efficiency and scalability. These hubs collect and process data from Bluetooth Low
Energy sensors installed in forests to monitor temperature and humidity. By utilizing ContextNet
middleware, the system analyzes environmental data and detects potential fire hazards in real-time.
The architecture supports up to 1,500 connected mobile objects, enabling rapid notifications to
authorities like fire departments. The system’s low-cost infrastructure, relying on mobile devices
carried by forest guards and visitors, enhances early detection and response to wildfires. The research
demonstrates scalability and efficiency in fire detection, proposing future improvements like
integrating solar-powered sensors and drone support for data collection.

2.2 GAPS IDENTIFIED

Some of the gaps identified are:


 Limited Integration of Real-Time Data Sources
 Challenges in Early-Stage Fire Detection
 Dynamic Fire Spread Prediction
 Lack of Model Generalization Across Regions
 Visualization and Alerts
 Improve Real-Time Monitoring
 Accuracy in Early Detection

Dept of ISE, SKIT 6 2024-2025


CHAPTER 3
REQUIREMENTS

3.1 Functional Requirements


1. Real-Time Monitoring: Continuously capture environmental data (temperature, humidity, and
gas levels) using IoT sensors (DHT22 and MQ135).

2. Data Visualization: Display sensor data on an interactive web-based interface.

3. Anomaly Detection: Use AI/ML models for detecting unusual environmental conditions.

4. Email Alerts: Send alerts based on detected anomalies such as high fire risk.

5. Collaboration Tools: Enable data sharing with forest management authorities for decision-
making.

3.2 Non-Functional Requirements

1. Scalability: Support integration with additional sensors or platforms like AWS IoT and
Google Cloud.

2. Energy Efficiency: Optimize ESP32 microcontroller for long-term deployment in remote


areas.

3. Reliability: Ensure continuous and accurate monitoring to prevent false alarms.

4. User Experience: Provide an intuitive interface for real-time data analysis and alerts.

5. Portability: Include future support for mobile apps for on-the-go monitoring.

3.3 Hardware Requirements

1. ESP32 Microcontrollers: For integrating IoT capabilities and environmental sensors.

2. Environmental Sensors: Includes temperature, humidity, and smoke sensors to monitor


real-time data.

3. Power Supply: Battery packs or renewable energy sources like solar panels for
uninterrupted power.

4. Network Modules: Wi-Fi or GSM modules for data transmission.

5. Edge Devices: Drones or cameras for enhanced coverage and real-time monitoring.
Ecoguard Reqiurements

3.4 Software Requirements

1. Programming Environment: Arduino IDE for programming microcontrollers.

2. AI Frameworks: TensorFlow or PyTorch for developing and deploying machine learning models.

3. Database Management: Cloud-based databases like Firebase or AWS for data storage and retrieval.

4. Visualization Tools: Dashboard software for real-time monitoring and alerting.

5. Communication Protocols: MQTT or HTTP for data exchange between sensors and servers.

Dept of ISE, SKIT 8


2024-2025

CHAPTER 4
METHODOLOGY

4.1 ARCHITECTURE DIAGRAM

Fig 4.1: Architecture Diagram

• The process starts with input images, such as CT scans of the lungs, which serve as raw data for
the system.
• These input images go through a preprocessing step to enhance their quality and remove noise.
Techniques like resizing, normalization, and noise reduction are used to prepare the images for analysis.
• After preprocessing, the images are passed through Convolutional, ReLU, and Pooling layers of
a Convolutional Neural Network (CNN).
• Convolution extracts key features like edges, shapes, and patterns from the images.
• ReLU introduces non-linearity, allowing the network to learn complex relationships in the data.
• Pooling reduces the size of the feature maps, retaining important information while improving
computational efficiency.
• The extracted features are then sent to the Fully Connected Network (FCN) for training. At this stage,
the model learns to distinguish between "cancerous" and "non-cancerous" images.
• After training, the system generates a Trained Model that can analyze new, unseen lung images.
• During testing, new images are again preprocessed to match the format used in the training phase.
• The trained model then analyzes the new images to predict whether they indicate the presence of
lung cancer.
• Finally, the system produces a Result, which indicates whether the input image shows signs of lung
cancer or not.
Ecoguard Methodology

4.1 USE CASE DIAGRAM

Fig 4.2: Use Case Diagram

• The doctor or radiologist uploads the CT scan files to the system.


• The system unpacks the uploaded scan files into two formats: image files (for viewing) and .npy
files (numerical data for processing).
• The doctor can view the CT scan images to examine the raw scans.
• The system preprocesses the raw data to prepare it for analysis by the model.
• The pre-processed data is sent to a U-Net deep learning model, which processes the images and
makes predictions.
• The model generates an image mask that highlights areas that may contain cancerous regions.
• The system then applies the mask as a contour over the original CT scan image to show the areas
of interest.

Dept of ISE, SKIT 10


2024-2025
Ecoguard
Methodology

4.2 SEQUENCE DIAGRAM

Fig 4.3: Sequence Diagram

• The user requests to view sample images, and the Data Visualization Module displays these
sample images.
• The user uploads a lung tissue dataset, which is sent to the Data Preparation Module for
processing.
• The Data Preparation Module processes the data and returns the prepared dataset to the user.
• The prepared dataset is passed to the Training Module, which trains the machine learning model.
• The Training Module provides training progress updates back to the user.
• Once the model is trained, the user uploads an image for classification to the Prediction Module.
• The Prediction Module processes the image and returns the predicted class and an explanation
to the user.
• The user then requests model evaluation results, and the request is sent to the Evaluation Module.
• The Evaluation Module processes the request and returns the evaluation metrics to the user.
Dept of ISE, SKIT 11 2024-2025
Ecoguard Methodology

4.3 CHAPTER SUMMARY


In this chapter, a detailed workflow for lung tissue classification using machine learning techniques
has been presented. The process involves multiple modules, each handling a specific task to ensure
efficient and accurate classification.

The chapter begins with the user requesting to view sample images, which are displayed by the
Data Visualization Module. Next, the user uploads a lung tissue dataset, which is processed by the
Data Preparation Module to generate a prepared dataset for training. This prepared dataset is then
passed to the Training Module, where the machine learning model is trained, and progress updates
are provided to the user.

Once the training is complete, the user can upload an image for classification. The Prediction
Module processes the image and returns the predicted class along with an explanation. Finally, the
user can request evaluation results, which are processed by the Evaluation Module and returned as
performance metrics.

This structured approach ensures a seamless pipeline for viewing, preparing, training, predicting,
and evaluating lung tissue datasets, providing an accurate and explainable solution for lung disease
detection.

Dept of ISE, SKIT 12 2024-2025


CHAPTER 5

IMPLEMENTATION
5.1 ALGORITHM
The proposed Algorithm can be viewed as follows:

STEP 1: System Initialization:

 Initialize ESP32, sensors (DHT22 for temperature and humidity, MQ135 for gas
detection), and Wi-Fi connection.

 Configure email settings (SMTP server, sender, and recipient details).

 Start the web server to host sensor data endpoints.

STEP 2: Read Sensor Data:

 Collect sensor readings for: Temperature from DHT22, Humidity from DHT22,

Gas levels from MQ135.

STEP 3: Fuzzification of Sensor Readings:

 For each reading, calculate fuzzy membership values:

 Membership = 0.0 if value is below the range.

 Membership = 1.0 if value is above the range.

 Membership = (value - minRange) / (maxRange - minRange) if in range.

STEP 4: Evaluate Rule-Based Logic:

 Check predefined conditions:

 Rule 1: If Temperature > 30°C AND Gas Level > 2500 ppm, trigger an alert.

 Rule 2: If Humidity < 60% AND Gas Level > 2000 ppm, trigger an alert.

 Rule 3: If Temperature is 30–35°C, Humidity is 70–80%, AND Gas Level > 1500 ppm,
trigger an alert.

STEP 5: Anomaly Detection:

 Combine results of fuzzy logic and rule-based logic:

 If any rule OR fuzzy membership indicates a critical condition, classify it as an anomaly.


Ecoguard
Implementation

STEP 6: Send Email Alert:

 If an anomaly is detected AND no alert has been sent recently:

 Format the email body with the current temperature, humidity, and gas readings.

 Send the email alert to the recipient.

 Log the action.

STEP 7: Update Web Server:

 Serve real-time sensor data on the ESP32 web server through the following endpoints:

 temperature: Current temperature.

 humidity: Current humidity.

 gas: Current gas level.

 anomaly: Returns "1" if an anomaly is detected, otherwise "0."

STEP 8: Repeat:

 Delay for 2 seconds.

 Repeat steps 2–7 in a continuous loop.

5.2 PROJECT CODE

1. Ardinouno code

#ifdef ESP32
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <LittleFS.h>
#else
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <LittleFS.h>
#endif
Dept of ISE, SKIT 14
2024-2025
Ecoguard Implementation
#include <DHT.h>
#include <ESP_Mail_Client.h>
// Define DHT parameters
#define DHTPIN 15 // GPIO pin for DHT22
#define DHTTYPE DHT22 // DHT22 sensor type
DHT dht(DHTPIN, DHTTYPE);
// Define MQ135 gas sensor parameters
#define MQ135PIN 34 // GPIO pin for MQ135 sensor

// Wi-Fi credentials
const char* ssid = "Akash";
const char* password = "9880528258";

// Email settings
SMTPSession smtp;
ESP_Mail_Session mailSession;
SMTP_Message message;

// Email credentials
const char* smtpHost = "smtp.gmail.com";
const int smtpPort = 465;
const char* emailSenderAccount = "akashs.ise@skit.org.in";
const char* emailSenderPassword = "dcuw xxev xbbw ydtl"; // Use app password if 2FA is enabled
const char* emailRecipient = "akashakshay062@gmail.com";

// Create server object


AsyncWebServer server(80);//
Threshold values
const float TEMP_THRESHOLD = 30.0; // Temperature threshold in °C
const float HUMIDITY_THRESHOLD = 100.0; // Humidity threshold in %
const float GAS_THRESHOLD = 3000; // Gas level threshold
bool alertSent = false; // To avoid repetitive alerts
// Function to read temperature
float readTemperature() {
return dht.readTemperature();
}

// Function to read humidity


float readHumidity() {
return dht.readHumidity();
}

Dept of ISE, SKIT 14 2024-2025


CHAPTER 6
TESTING

Testing ensures the functionality, reliability, and robustness of your project. Here are the testing
phases and their details:

1. Functional Testing

Objective: To verify the functionality of individual components (e.g., sensors, decision logic, and
email alerts).

Test Scenarios:

Sensor Accuracy: Verify that DHT22 provides correct temperature and humidity readings.

Check MQ135’s response to different gas concentrations.

Alert System: Ensure an alert is triggered when anomalies are detected.

Web Server: Test endpoints (/temperature, /humidity, /gas, /anomaly) for correct data output.

2. Boundary Testing
Objective: To validate the system behavior at or near threshold values.
Test Scenarios: Test for exact threshold values:
Temperature = 30°C, Humidity = 60%, Gas Level = 2500 ppm.
Test for values slightly above or below thresholds:
Temperature = 29.9°C, 30.1°C, Humidity = 59%, 61%, Gas Level = 2499 ppm, 2501 ppm

3. Stress Testing

Objective: To evaluate system stability under prolonged use or high-frequency readings.

Test Scenarios:

Run the system continuously for 24 hours and monitor:

 Sensor readings.

 Web server responsiveness.

 Email alert reliability.


Ecoguard Testing

4. Performance Testing

Objective: To measure the system’s responsiveness and efficiency.

Metrics:

Response Time: Time taken to detect anomalies after sensor readings.

Alert Delay: Time taken to send an email after an anomaly is detected.

Web Server Latency: Time taken to fetch sensor data from the web server.

5. Error Handling Testing

Objective: To verify system behavior under unexpected or invalid inputs.

Test Scenarios:

Simulate faulty sensor readings (e.g., NaN values or zero readings).

Disconnect Wi-Fi and check system behavior:

Alerts should not send, and errors should be logged.

Check system recovery after power loss.

7. Observations

Sensor Readings: Consistently accurate within the operating range.

Alert System: Triggered timely alerts under all anomaly conditions.

Web Server : Endpoints remained responsive with low latency.

Stability: System functioned reliably during stress tests.

8. Summary
The testing phase confirmed the system’s robustness and reliability. It successfully identified
anomalies, sent alerts, and provided real-time data without interruptions. Minor improvements could
focus on further optimizing response times and error handling.

Dept of ISE, SKIT 16 2024-2025


CHAPTER 7
RESULTS
7.1 RESULTS
1. Performance Metrics of the RNN Model
The performance of the RNN model is evaluated using precision, recall, F1-score, and accuracy
for classifying lung cancer types. The results are as follows:

Table 7.1: Performance Metrics of RNN Model for Lung Cancer Detection
• Accuracy: 63%
• Macro Average: Precision: 0.49 | Recall: 0.64 | F1-Score: 0.53
• Weighted Average: Precision: 0.48 | Recall: 0.63 | F1-Score: 0.52

2. Confusion Matrix
The confusion matrix highlights the model's predictions and errors:

Table 7.2: Confusion Matrix for RNN Model Predictions on Lung Cancer Detection
The model correctly classified lung_aca and lung_n to some extent but failed to identify lung_scc
entirely.

3. Training and Validation Performance


Include the following:
 A loss vs epoch graph to show how the model's performance evolved during training.
 A training vs validation accuracy curve to demonstrate if overfitting occurred.
Ecoguard Results
4. Visualization
If applicable, add:
 ROC-AUC curve for multi-class evaluation.
 Bar graphs for precision, recall, and F1-scores for each class.

Fig 7.1: Classification Report for Lung Disease Detection


• The model is predicting three classes: lung_aca, lung_n, and lung_scc.
For lung_aca:
• The model correctly found all the actual lung_aca cases (recall = 1.00).
• However, only 47% of the predicted lung_aca cases were correct (precision = 0.47).
For lung_n:
• The model performed very well, with high precision (1.00) and recall (0.93).
• This means the model identified most lung_n cases
accurately. For lung_scc:
• The model could not identify this class at all.
• Both precision and recall are 0.00, meaning it completely failed to predict lung_scc.
• The overall accuracy of the model is 63%.
• This means 63% of all predictions were correct.
• The model works well for lung_n but struggles with lung_scc. It needs improvement for
better results.

Dept of ISE, SKIT 18 2024-2025


CHAPTER 8
CONCLUSION AND FUTURE ENHANCEMENT

8.1 CONCLUSION
The IoT-based Environmental Monitoring and Alert System successfully demonstrates the
integration of sensors, microcontrollers, and decision-making logic to monitor temperature,
humidity, and gas levels in real time. The system ensures timely detection of anomalies and
provides instant email alerts to users, enhancing safety and awareness. By leveraging ESP32 for
real-time data hosting and combining rule-based logic with flexible decision-making, the project
offers a reliable, scalable, and cost-effective solution for critical applications such as industrial
safety, fire detection, and environmental monitoring. This project highlights the potential of IoT
technology in creating smarter and safer environments.

8.2 FUTURE ENHANCEMENT


Advanced Machine Learning: Deploy advanced TensorFlow Lite models for anomaly detection and
predictive analytics to improve system accuracy and adaptability.

Integration with IoT Platforms: Connect the system to platforms like AWS IoT, Google Cloud, or
ThingSpeak for advanced data analysis, long-term storage, and remote access.

Mobile Application: Develop a mobile app for real-time monitoring, push notifications, and an
intuitive user interface.

Support for Additional Sensors: Include more sensors like flame detectors, smoke sensors, and
PM2.5 sensors for enhanced environmental monitoring capabilities.

Scalability: Implement a mesh network of ESP32 devices to monitor larger areas and aggregate data
from multiple nodes.

Renewable Energy Integration: Power the system using solar panels or other renewable energy
sources for long-term, off-grid operation.
BIBLIOGRAPHY
[1] Mpho Mokate, Vukoti Marinate, “A review and comparative study of cancer detection using
Machine Learning”, Vol.47, No. 5, pp. 42-46, Year 2022.
[2] R. Wulandari, R. Sight, and S. Warhan, "Automatic lung cancer detection using color
histogram calculation," Vol.2, No: 20, pp.45-46, Year 2024.

[3] Vani Rajshekar, S Premkumar, “Lung cancer disease prediction with CT scan and
histopathological images feature analysis using deep learning technology”, Vol. 46, No. 5, pp.
53-58, Year 2024.

[4] Imran Nazir, Mostafa Darshan, “Machine learning-based lung cancer detection using image
registration and fusion” Vol. 7, No.6, pp. 66-68, 5–8 , Year 2023.
APPENDIX

A1: Lung Cancer Detection System

A2: Lung Health Detection System


A2: Lung Squamous Cell Carcinoma Detection Tool

You might also like