Report of project
Report of project
2024-2025
IMPACT COLLEGE OF ENGINEERING AND APPLIED SCIENCES
Sahakarnagar, Banglore-560092
CERTIFICATE
This is to certify that the Project Work entitled "AI Powered Medical Diagnosis” carried out
by Monica K (1IC21CD002) is a bonafide student of Impact College of Engineering and
Applied Sciences Bangalore has been submitted in partial fulfilment of requirements of VII
semester Bachelor of Engineering degree in Computer Science & Engineering (Data
Science) as prescribed by VISVESVARAYA TECHNOLOGICAL UNIVERSITY during the
academic year of 2024-2025.
1. 1.
2. 2.
ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of any task would
be incomplete without the mention of the people who made it possible and whose constant
encouragement and guidance crowned my efforts with success.
I express my deep and sincere thanks to our Management and Principal, Dr. Jalumedi
Babu for their continuous support.
i
ABSTRACT
ii
CONTENTS
ACKNOWLEDGEMENT i
ABSTRACT ii
REFERENCES 39
LIST OF FIGURES
2 Activity Diagram 17
3 Activity Diagram for Text Generator 18
4 Architecture diagram 19
5 Home page 33
6 Home page of the modules 34
7 Detection of Brain Tumor 35
8 Detection of Bone Fracture 35
9 Detection of Lung Cancer 36
10 Text Generation 37
LIST OF TABLE
CHAPTER 1
INTRODUCTION
User-Friendly Interface:
Goal: Develop a user-friendly interface that allows for smooth interaction between users and
the AI doctor, prioritizing ease of use and intuitiveness.
User-Centric Design: With a focus on the end-user, prioritize the development of an interface
that enhances user experience, thereby facilitating the widespread acceptance of the AI-driven
healthcare solution.
Seamless Incorporation with Telemedicine Platforms:
Aim: Streamline the incorporation of current telemedicine systems to allow individuals to
connect with human medical experts for additional consultation.
Role of AI Doctor: The AI doctor plays a crucial role in the healthcare industry by serving as
an initial diagnostic tool. Its purpose is to streamline the diagnostic process for both patients
and healthcare providers. It facilitates a seamless transition between AI-powered diagnostics
and human expertise, ensuring efficient and effective healthcare delivery.
AI and M. Zhang, IEEE Computational 2024 Explores AI's Highly relevant for
Genomics: S. Gupta Biology role in analyzing integrating AI in
Predictive genomic data to genomic data
Models for predict disease analysis for
Disease Risk risk, particularly predictive
in personalized diagnostics.
medicine and
oncology.
2.4 Objectives
The initial step in developing an AI-based diagnostic model is to design and implement a
reliable system capable of detecting common acute disorders. To accomplish this, use machine
learning techniques such as decision trees or neural networks that have been trained on a broad
collection of medical data and symptoms. Using supervised learning approaches, the model
should learn to spot patterns and connections between symptoms and diseases. To develop an
AI-powered web application that assists in diagnosing diseases using medical imaging and
patient data. The system includes modules for brain tumor detection, lung cancer detection,
bone fracture prediction and a text generator for real-time assistance.
• Improved Accuracy: Enhance diagnostic accuracy by reducing human errors and
providing precise symptoms.
• Enhanced Accessibility: Provide medical expertise to remote and underserved
areas.
• Model Education: To train the AI model, use supervised learning approaches. By
including labeled instances in the training dataset, you may emphasize the
relationship between presented symptoms and accurate diagnoses.
• Measures for Evaluation: Define and monitor performance measures such as
accuracy, sensitivity, and specificity to assess the model's effectiveness in disease
diagnosis. Create a baseline for future comparison and improvement.
• Create a User-Friendly Interface: Create an intuitive and user-friendly interface
for individuals to interact with the AI-based diagnostic system.
• Specifications:
2. GPU Support
• Specifications:
➢ Support for parallel computing to reduce the time required for model
training and inference.
3. Storage Systems
• Specifications:
➢ High-capacity storage systems for managing extensive datasets.
➢ Fast I/O (Input/Output) operations to ensure quick read/write access to
databases.
• Specifications:
5. Internet Connection
• Specifications:
6. Monitor
• Specifications:
➢ Allows users to view text, images, videos and other form of visual data.
• Python 3.8 or Later: Serves as the backbone for backend logic, machine learning model
implementation, and data preprocessing.
• JavaScript (ES6): Used for creating dynamic and interactive frontend elements.
Frameworks and Libraries
1. Backend Development:
• Django/Flask: Frameworks that streamline the creation of RESTful APIs, manage
routing, and handle server-side requests efficiently.
2. Frontend Development:
• JavaScript: A powerful library for building responsive, modular, and dynamic user
interfaces.
• HTML: Used to structure the contents of the web page.
• CSS: Is a style sheet language used for specifying the presentation and styling a
document written in HTML.
3. Machine Learning:
• Scikit-learn: Essential for implementing the Random Forest algorithm and other
supervised learning techniques.
• Pandas & NumPy: Core libraries for handling data preprocessing, manipulation,
and numerical computations.
• TensorFlow/Keras: For building and training deep learning (CNNs for medical
image analysis).
• OpenCV: For image processing and manipulation of medical images.
• NLTK / spaCy: For NLP tasks like symptom analysis from text data.
• Visualization: Matplotlib, Seaborn: For visualization data, model performance and
results.
By leveraging these tools and technologies, the system achieves a balance between
performance, usability, and maintainability, ensuring it meets the demands of healthcare.
The Use Case Diagram for the AI-powered medical diagnosis illustrates the interactions
between the User and the Developer, showcasing the key functionalities and workflows that
define the system. It provides a visual representation of the system's design, highlighting how
the various components interact with the system to deliver the required output.
Data augmentation plays a vital role in improving model generalization by applying techniques
such as flipping, rotation, scaling, and intensity shifts. Training the model involves setting
appropriate batch sizes and epoch counts, leveraging frameworks like TensorFlow, PyTorch, or
Keras, and using data loaders for efficient
processing. Continuous monitoring of validation metrics helps avoid overfitting. Model
evaluation on unseen test data is essential for measuring performance, using tools like confusion
matrices for classification tasks or visual overlays for segmentation. Fine-tuning through
hyperparameter adjustments or transfer learning from pre-trained models often enhances
performance. Lastly, saving the model's weights and architecture ensures reusability and
facilitates deployment.
Testing the Model
Testing a trained model on MRI data is essential to assess its generalization and suitability for
real-world applications. The process begins by preparing a separate test dataset that was not
used during training or validation to ensure an unbiased evaluation. The test data must undergo
the same preprocessing steps as the training data, including intensity normalization, resizing to
required dimensions, and ensuring consistency in orientation and voxel size. The trained model
is then loaded by restoring its saved weights and architecture using a compatible framework
like TensorFlow or PyTorch, ensuring the model and test data formats align seamlessly.
Evaluating model performance involves running forward passes on the test data to generate
predictions. For classification tasks, this includes outputting probabilities or class labels, while
segmentation tasks produce region masks. Error analysis follows, focusing on incorrect
predictions or poorly segmented regions to identify common failure cases such as
underrepresented classes or noise sensitivity. This analysis can reveal insights for improving
the model through refined preprocessing, enhanced augmentation strategies, or modifications
to the model architecture for better performance and robustness.
A patient is the one who is receiving medical care or treatment from a health care provider.
2. Patient Medical Image
It is the image of patient’s medical report like MRI’s, X-rays, CT scans etc.
3. Medical Image Database
Medical image databases are essential resources for developing AI-powered diagnostic models.
They provide high-quality datasets of medical images, often annotated by experts, to facilitate
training, validation, and testing of algorithms.
4. Image Information
Image information provides information related to the patient’s report. It gives information
about the tumors, fracture. Image can be in the form of MRI’s, X-rays, CT scans
5. Preprocessing
Preprocessing in Medical Imaging is a crucial step that ensures the data is clean, standardized,
and suitable for training AI models. Medical images like MRI, CT, or X-rays often require
specialized techniques due to their complexity and the need for high accuracy in diagnosis.
6. Feature Extraction
Feature extraction in medical imaging is the process of identifying and isolating relevant
information from medical images to feed into machine learning models for tasks like
classification, segmentation, or diagnosis. It involves converting raw image data into
meaningful and discriminative features that represent patterns, structures, or abnormalities.
Classification in medical imaging involves categorizing medical images or their regions into
predefined classes based on features extracted from the data. It is a core task in AI-powered
medical diagnosis, used to identify conditions, detect abnormalities, and assist in decision-
making.
8. Output
Gives information related to the scanned reports and tells us if the patient is detected with brain
tumor, bone fracture, or lung cancer.
User
The user will ask the text generator to generate the texts that the patient will tell in the future
when the patient is unable to speak due to his medical conditions. The text will be generated
based on the patient’s previous documents like how patient speaks, what maybe the words
patients use, etc.,
Knowledge Base
A library which carries information about the patient’s previous records of medical conditions,
way of speech, what the patient might tell in the next few sentences. It stimulates human
conversation with a user, either through texts.
Server
Server also known as AI answers all the queries that are asked by the patient and helps the
patients.
2. Pre-processing
5. Prediction Model
The Prediction Model is the final output of the training process, designed to predict disease
labels for new, unseen data based on the patterns learned during training. The structure of
this model typically consists of several layers:
• Input Layer: This layer receives the feature vectors, which are the numerical
representations of symptoms, medical images, or other relevant data. It serves as the
entry point for the data to be processed by the model.
The implementation phase is the core of the system's development, detailing the technical
realization of its features and functionality. The following sections elaborate on the system's
various modules and how they interconnect:
The Brain Tumor Detection Workflow involves several key steps that ensure effective
identification and classification of brain tumors from medical images. Below is a breakdown of
the workflow:
1. Data Collection:
The first step in the workflow is to gather the necessary medical imaging data. The most
commonly used imaging techniques are:
• Normalization: Scale pixel values (e.g., between 0 and 1) for better model
performance and faster convergence.
• Segmentation: Extract regions of interest (ROI), such as the tumor area, from
surrounding brain tissue to isolate the tumor.
• Augmentation: Apply transformations such as rotation, flipping, and noise
addition to artificially expand the dataset and improve model generalization.
3. Feature Extraction:
Extract meaningful patterns that represent the tumor’s properties, which are crucial for
classification. These features include:
• Shape: Tumor size, boundary irregularities.
• Texture: Intensity variations in the tumor, helping differentiate between benign
and malignant tumors.
Dept. of CSE (CD) 2024-2025 22
AI Powered Medical Diagnosis
4. Model Building:
AI models are created to classify and segment brain tumors. Common techniques
include:
• Convolutional Neural Networks (CNNs), which are highly effective for image
classification and feature extraction from medical images.
• X-rays are the most common and widely used for detecting bone fractures.
• MRI is used when soft tissue damage is also present along with fractures,
offering detailed insights into surrounding structures.
• Image Resizing: Standardize image sizes (e.g., 224x224 pixels) for consistency,
especially for CNN models.
• Cropping: Focus on regions of interest (e.g., specific bones like the wrist,
elbow, or ankle) to reduce unnecessary background information.
• Edges and Contours: Detect sharp changes in bone structure that may indicate
fractures.
• Object Detection Models: Faster R-CNN or YOLO can be used to not only
detect fractures but also localize them within the image.
5. Model Training:
The AI model is trained using labeled datasets of bone images. The steps involved
include:
• Training the model with labels like "fracture" or "no fracture" and possibly
categorizing fractures into types (e.g., hairline, compound).
• Optimizing the model using appropriate loss functions, such as binary cross-
entropy for classification tasks.
7. Classification:
The final step involves classifying the images:
• The model may also classify the fracture type or its severity, aiding healthcare
professionals in
diagnosing and treating bone injuries.
• CT-Scans are considered the gold standard for detecting lung nodules, offering
detailed 3D views of the lungs.
• X-rays are often used for initial screenings but are less sensitive than CT scans
in detecting small or early-stage nodules.
2. Data Preprocessing
The purpose of this step is to improve image quality, standardize formats, and prepare
data for use by AI models:
• Normalization: Scale pixel intensities to a common range (e.g., 0-1) for better
model convergence and performance.
3. Feature Extraction
This step identifies key patterns in lung images that are indicative of cancer:
• Location: Nodules located near the bronchial tree or lung periphery may suggest
malignancy.
• Convolutional Neural Networks (CNNs) are commonly used for this task, as
they are effective at automatically extracting spatial features from medical
images, especially for tasks like classification or segmentation.
5. Training
AI models are trained using annotated datasets where nodules are labeled as benign or
malignant:
• The training process involves feeding labeled CT scans or X-rays into the model.
• The model is trained for classification tasks (distinguishing cancerous from non-
cancerous nodules) or segmentation tasks (identifying the exact boundaries of
the cancerous areas).
6. Testing and Validation
After training, the AI model is tested and validated using unseen data to assess its
generalization capability and performance. This step ensures the model’s reliability
when deployed for real-world use.
7. Classification
Once trained, the AI model classifies nodules into:
Text Generator
A text generator has been developed to assist patients who are unable to complete their
sentences due to certain medical conditions. It analyzes previous data to predict and generate
the next words in a sentence.
The typical workflow for text generation includes the following steps:
1. Data Collection from the Patient
Data collection ensures that the text generator adapts to the patient's communication
style, vocabulary, and medical context.
Once the LSTM model is trained, it can predict the next word or sequence of words
based on patient input.
• Input: The model receives a partially completed sentence from the patient.
• Processing: The LSTM generates probabilities for the possible next words.
• Output: The word with the highest probability is chosen and presented.
Frontend
The frontend is designed to offer users an intuitive and responsive interface, ensuring smooth
navigation and interaction.
HTML/CSS:
➢ HTML: Provides the structural foundation of the web pages. It defines the layout and
organizes
➢ elements like forms, tables, and buttons for user input and interaction.
➢ CSS: Enhances the visual appeal of the application by enabling styling and formatting.
It ensures the interface is not only aesthetically pleasing but also adaptable to various
screen sizes, making it responsive for mobile and desktop users.
Django Templates:
➢ A powerful feature of the Django framework, templates dynamically render web pages
based on the system's backend logic.
Python:
➢ Python is chosen for its versatility, extensive libraries, and ease of integration with
machine learning workflows.
➢ It handles various backend tasks.
Django Framework:
➢ Django simplifies the development process by offering built-in tools for routing, request
handling, and middleware integration.
➢ It ensures that the backend is robust, secure, and capable of handling high traffic without
performance degradation.
Machine Learning
Machine learning drives the system's predictive capabilities, enabling personalized insights for
users.
• Scikit-Learn:
➢ This library is used to build and train the Random Forest model.
➢ It also supports data preprocessing.
• Pandas and NumPy:
➢ Pandas: Handles structured data.
➢ NumPy: Optimizes numerical computations.
Together, these libraries streamline the preparation of training and testing datasets.
This well-integrated stack of tools and technologies ensures that the AI powered medical
diagnosis system is robust, scalable, and efficient. By leveraging modern development
practices, the system delivers a user-centric experience while giving correct prediction to the
diseases.
Testing is an essential part of the system development lifecycle, ensuring that the application is
robust, secure, and performs well under a variety of conditions. Below is an elaborated
explanation of the different types of tests conducted during the development and deployment of
the system:
1. Unit Testing
Unit testing involves testing individual components or functions of the system in isolation
to verify that each part of the system works correctly on its own.
• Purpose:
The primary goal of unit testing is to validate that each function, method, or component
produces the expected results given specific inputs, and that it handles edge cases or
error conditions properly. By isolating components, developers can identify issues at an
early stage, making them easier to fix.
• Implementation:
In this project, key functionalities, including the brain tumor detection, bone fracture
detection and lung cancer prediction, were subjected to unit tests. For example:
o Testing the system that stimulate tumors, fractures, nodules to create diverse test
cases. It also involves radiologists and medical professionals in test validation.
o Ensuring that the system handles invalid data inputs gracefully.
• Outcome:
This testing helped ensure that individual parts of the system were performing
correctly before they were integrated into the larger application.
2. Integration Testing
Integration testing focuses on verifying the interactions between different system
components to ensure that they work together seamlessly.
• Purpose:
This type of testing ensures that once the individual components of the system are
developed and unit tested, they can communicate and work together as expected. It
checks if APIs, databases, and the user interface are functioning as intended when
integrated.
• Implementation:
In this project, integration tests were performed to validate the communication between:
The frontend (user interface) and backend (logic layer), ensuring that data entered on
the frontend was correctly processed and reflected in the backend.
o The backend, confirming that data given by the user (e.g., images given for
detection) was properly saved, updated, and retrieved from the database.
• Purpose:
GUI testing verifies that the application’s interface is easy to navigate, functional, and
consistent. It also ensures that users can access all features without encountering bugs
or design flaws.
• Implementation:
Tests focused on the following:
o Usability: Ensuring that users can easily navigate the application, upload data, and
find out the detection of the diseases and even medical chatbot.
o Responsiveness: Verifying that the interface adapts to various screen sizes and
devices, including desktops, tablets, and smartphones.
o Visual Consistency: Ensuring that elements like buttons, forms, and fonts are
consistently displayed across different browsers and screen resolutions.
• Outcome:
GUI testing confirmed that the application was visually appealing, user-friendly, and
compatible with multiple devices and screen sizes.
4. Regression Testing
Regression testing ensures that new code changes, such as feature additions or bug fixes, do
not unintentionally disrupt the functionality of existing features.
• Purpose:
This type of testing is crucial to maintaining the stability of the application. As new
features or bug fixes are implemented, regression tests verify that the changes do not
introduce new issues or break existing workflows.
• Outcome:
Regression testing helped ensure that recent updates did not inadvertently break critical
features, maintaining the overall integrity of the application.
By performing these different types of tests, the development team ensured that the system was
functional, scalable, user-friendly, and secure. Each type of testing addressed specific areas of
concern, from the correctness of individual functions to the overall performance under high
loads, and ensured that the system met both user expectations and security standards.
CONCLUSION
An initiative to introduce an AI-based diagnostic tool in India has the potential to transform
healthcare access, especially in underserved areas that face ongoing challenges with limited
access to medical professionals. The intended outcomes include a broad set of improvements
that together will shape the healthcare landscape to be more inclusive and efficient.
Tackling the shortage of doctors and improving accessibility:
The main objective of the initiative is to improve access to health services, especially in remote
areas suffering from a lack of doctors. Offering a virtual "doctor”; The system aims to bridge
the gap in medical services by providing timely and accurate diagnostic knowledge to residents
of smaller towns and villages.
Quick and timely diagnosis for better health outcomes:
Quick and timely diagnosis of common illnesses such as colds and flu are a key component of
the initiative. This ensures that people receive prompt medical care that improves health
outcomes. Early intervention becomes a key preventive healthcare strategy that reduces disease
severity and reduces the overall burden on the healthcare system.
User-friendly user interfaces for comprehensive health communication:
User-friendly user interfaces for an AI-based diagnostic tool are crucial when health
communication is accessible to people at different levels. This inclusiveness ensures that a
broad user base can take advantage of the tool, encouraging widespread adoption and use. The
AI-Powered Medical Diagnosis System aims to simplify disease diagnosis and improve patient
care by leveraging AI.
[1]. S. Kaur et al., "Medical Diagnostic Systems Using Artificial Intelligence (AI) Algorithms:
Principles and Perspectives," in IEEE Access.
[2]. Vinod Kumar; Mohammed Ismail Iqbal; Rachna Rathore, "Natural Language Processing
(NLP) in Disease Detection.
[4]. G. K. Thakur, N. Khan, H. Anush and A. Thakur, "AI-Driven Predictive Models for Early
Disease Detection and Prevention," 2024 International Conference on Knowledge Engineering
and Communication Systems (ICKECS).
[5]. Thanoon MA, Zulkifley MA, Mohd Zainuri MAA, Abdani SR. A Review of Deep
Learning Techniques for Lung Cancer Screening and Diagnosis Based on CT Images.
[6]. M. Li, L. Kuang, S. Xu and Z. Sha, "Brain Tumor Detection Based on Multimodal
Information Fusion and Convolutional Neural Network," in IEEE Access.
[7]. Su, Z.; Adam, A.; Nasrudin, M.F.; Ayob, M.; Punganan, G. Skeletal Fracture Detection
with Deep Learning: A Comprehensive Review. Diagnostics 2023.
[8] K. T. Putra et al., "A Review on the Application of Internet of Medical Things in Wearable
Personal Health Monitoring: A Cloud-Edge Artificial Intelligence Approach," in IEEE
Access, vol. 12, pp. 21437-21452, 2024.
[9] Cè M, Irmici G, Foschini C, Danesini GM, Falsitta LV, Serio ML, Fontana A, Martinenghi
C, Oliva G, Cellina M. Artificial Intelligence in Brain Tumor Imaging: A Step toward
Personalized Medicine. Curr Oncol. 2023.
[10] Kutbi M. Artificial Intelligence-Based Applications for Bone Fracture Detection Using
Medical Images: A Systematic Review. Diagnostics (Basel). 2024.
[11] B. O'Sullivan, J. Brierley, D. Byrd, et al., The TNM classification of malignant tumours-
towards common understanding and reasonable expectations, 2017.
[12] Y. Xu, A. Hosny, R. Zeleznik, et al., Deep learning predicts lung cancer treatment
response from serial medical imaging, 2019