Skip to content

Commit

Permalink
Severity Prediction of Knee Osteoarthritis
Browse files Browse the repository at this point in the history
Knee Osteoarthritis (OA) is a condition that affects the joints, including the knee joint, due to the significant weight-bearing of the body. The disease results in degeneration and rupture of the cartilage elements in the knee joint, which causes severe pain. Unfortunately, the prevalence of OA has been increasing globally, with a 113.25% increase in cases from 1990 to 2019. Currently, more than 350 million people globally suffer from arthritis, and it is estimated that by 2040, about 78 million US adults will have the condition. The diagnosis of OA is primarily carried out by evaluating symptoms and comparing plain radiographs, which can be subjective. However, deep learning techniques, such as Convolution Neural Networks (CNNs), have emerged as a promising solution to medical problems in recent years. Therefore, the goal of this study is to develop and implement a classification system that can aid doctors in reducing their workload and assist radiologists in assessing the severity of the pain accurately. Furthermore, this will enable them to make the  best diagnosis and recommend the most appropriate treatment. One of the methods used in detecting knee OA is transfer learning with fine-tuning, which leverages deep learning techniques to improve the accuracy of diagnosis and classification. By using this method, doctors and radiologists can make informed decisions on the severity of the condition, which can lead to better treatment outcomes for patients.

The following are the goals of the study:
1. The primary objective of this research is to analyze the degree of severity of knee x-ray images.
2. To assist Rheumatologists, in identifying the severity of the disease after the medication, thus reducing the time taken and lengthy treatments.
3. For monitoring and implementing early treatments to sustain good health in patients who pose a concern.
4. To check how accurately, the degree of severity of knee x-ray photographs is estimated by the deep learning algorithm.

The following are the social causes of the study:
1. To assist Rheumatologists, in identifying the severity of the disease after the medication, thus reducing the time taken and lengthy treatments.
2. To reduce the medical and travelling expenses.
3. To overcome the manual mistakes made by the doctor sometimes.
4.  If any person got medication before , so he can check his disease in our webpage rather than consulting any doctor.
  • Loading branch information
balamurali333 authored May 2, 2023
1 parent c073e19 commit f664514
Show file tree
Hide file tree
Showing 9 changed files with 973 additions and 0 deletions.
143 changes: 143 additions & 0 deletions about.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- basic -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- mobile metas -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<!-- site metas -->
<title>About</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="author" content="">
<!-- bootstrap css -->
<link rel="stylesheet" href="../static/css/bootstrap.min.css">
<!-- style css -->
<link rel="stylesheet" href="../static/css/style.css">
<!-- Responsive-->
<link rel="stylesheet" href="../static/css/responsive.css">
<!-- fevicon -->
<link rel="icon" href="../static/images/fevicon.png" type="image/gif" />
<!-- Scrollbar Custom CSS -->
<link rel="stylesheet" href="../static/css/jquery.mCustomScrollbar.min.css">
<!-- Tweaks for older IEs-->
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css">
<!-- owl stylesheets -->
<link rel="stylesheet" href="../static/css/owl.carousel.min.css">
<link rel="stylesheet" href="../static/css/owl.theme.default.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.css" media="screen">
</head>
<body>
<!-- header section start -->
<div class="header_section">
<nav class="destop_header navbar navbar-expand-lg navbar-light bg-light">
<div class="logo"></div>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/doctor">Causes</a>
</li>
<li class="nav-item">
<a class="logo_main" href="/"><img src="../static/images/logo.png"></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/departments">symptoms</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/blog">treatment</a>
</li>
</ul>
</div>
</nav>
<nav class="mobile_header navbar navbar-expand-lg navbar-light bg-light">
<div class="logo"><a href="index.html"><img src="images/logo.png"></a></div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent2" aria-controls="navbarSupportedContent2" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent2">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/doctor">Causes</a>
</li>
<li class="nav-item">
<a class="logo_main" href="/"><img src="../static/images/logo.png"></a>
</li>
<li class="nav-item">
<a class="nav-link" href="/departments">symptoms</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/blog">treatment</a>
</li>

<li class="nav-item">
<a class="nav-link" href="#"><img src="../static/images/search-icon.png"></a>
</li>
<li class="nav-item active">
<a class="nav-link" href="#">LOGIN</a>
</li>
</ul>
</div>
</nav>
</div>
<!-- header section end -->
<!-- about section start -->
<div class="about_section layout_padding">
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<div class="about_taital">
<h1 class="about_text">ABOUT</h1>
<h1 style="text-align:justify;">
<p class="lorem_text"><b>Our project focuses on the prediction of knee osteoarthritis using enhanced deep learning CNN models. Knee osteoarthritis is a prevalent condition that causes significant pain and disability for many individuals. Deep learning CNN models are a type of machine learning that can be used to make predictions with high accuracy. We used mobile net includes preprocessing and enhancements to these models to improve their performance, which were developed and tested using a digital knee x-ray dataset. We obtained promising results that demonstrate the potential of our approach to improve the diagnosis and treatment of knee osteoarthritis.</b></p></h1>

<p class="about_text">How Is Osteoarthritis of the Knee Diagnosed?</b></p>
<h1 style="text-align:justify;">
<p class="lorem_text"><b>The diagnosis of knee osteoarthritis will begin with a physical exam by your doctor. Your doctor will also take your medical history and note any symptoms. Make sure to note what makes the pain worse or better to help your doctor determine if osteoarthritis, or something else, may be causing your pain. Also find out if anyone else in your family has arthritis. Your doctor may order additional testing, including:</b></p></h1>
<h1 style="text-align:justify;">
<p class="lorem_text"><b><b> X-rays</b>, which can show bone and cartilage damage as well as the presence of bone spurs</b></p></h1>
<p class="lorem_text"><b><b> magnetic resonance imaging (MRI) scans </b></b></p>
</div>
</div>
<div class="col-md-6">
<div class="image_2" href="#"><img src="../static/images/img-2.png"></div>
</div>
</div>
</div>
</div>
<!-- about section end -->
<!-- footer section start -->
<!-- info section -->

<!-- end info section -->
<!-- footer section end -->
<!-- copyright section start -->

<!-- copyright section end -->
<!-- Javascript files-->
<script src="..static/js/jquery.min.js"></script>
<script src="..static/js/popper.min.js"></script>
<script src="..static/js/bootstrap.bundle.min.js"></script>
<script src="..static/js/jquery-3.0.0.min.js"></script>
<script src="..static/js/plugin.js"></script>
<!-- sidebar -->
<script src="..static/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script src="..static/js/custom.js"></script>
<!-- javascript -->
<script src="..static/js/owl.carousel.js"></script>
<script src="https:cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.min.js"></script>
</body>
</html>
156 changes: 156 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
'''from flask import Flask,render_template,Response
from flask_wtf import FlaskForm
from wtforms import FileField , SubmitField , FloatField ,IntegerField
from wtforms.validators import InputRequired
import joblib
import numpy as np
app = Flask(__name__)
app.config['SECRET_KEY'] = 'supersecretkey'
knn_from_joblib = joblib.load('model.pkl')
class UploadFileForm(FlaskForm):
x1 = IntegerField('val1', validators=[InputRequired()])
x2 = IntegerField('val2', validators=[InputRequired()])
x3 = IntegerField('val3', validators=[InputRequired()])
x4 = FloatField('val4', validators=[InputRequired()])
x5 = FloatField('val5', validators=[InputRequired()])
x6 = FloatField('val6', validators=[InputRequired()])
x7 = FloatField('val7', validators=[InputRequired()])
submit = SubmitField("Crop")
@app.route('/',methods = ["GET","POST"])
@app.route('/home',methods = ["GET","POST"])
def home():
return render_template('home.html')
@app.route('/about',methods = ["GET","POST"])
def about():
return render_template('about.html')
@app.route('/contact',methods = ["GET","POST"])
def contact():
return render_template('contact.html')
@app.route('/form',methods = ["GET","POST"])
def form():
form = UploadFileForm()
if form.validate_on_submit():
x1 = form.x1.data
x2 = form.x2.data
x3 = form.x3.data
x4 = form.x4.data
x5 = form.x5.data
x6 = form.x6.data
x7 = form.x7.data
data = np.array([[x1,x2,x3,x4,x5,x6,x7]])
my_prediction = knn_from_joblib.predict(data)
final_prediction = my_prediction[0]
final_prediction = final_prediction.capitalize()
pa = './static/css/cropes/'+final_prediction+'.jpg'
return render_template('sample.html',imgpath = pa,text = final_prediction)
return render_template('index.html',form = form)
if __name__ == '__main__':
app.run(debug=True)'''

# from flask import render_template,jsonify, Flask
from flask import Flask,render_template,Response, redirect, url_for, request ,jsonify
from flask_wtf import FlaskForm
from wtforms import FileField , SubmitField
from werkzeug.utils import secure_filename
import os
from tensorflow.keras.preprocessing import image
from wtforms.validators import InputRequired

import random
import os
import numpy as np
from keras.models import Model
from keras.layers import Dense
from keras.applications.mobilenet import MobileNet
# from keras.preprocessing import image
from keras.applications.mobilenet import preprocess_input, decode_predictions
from keras.models import model_from_json
import keras
from keras import backend as K

app = Flask(__name__)
# app = Flask(__name__)
app.config['SECRET_KEY'] = 'supersecretkey'


CLASSES = {
0: 'Doubtful',
1: 'Mild',
2: 'Moderate',
3: 'Normal',
4: 'Severe'

}


class UploadFileForm(FlaskForm):
file = FileField("File",validators=[InputRequired()])
submit = SubmitField("Upload File")


@app.route('/')
def index():
return render_template('index.html', title='Home')

@app.route('/about')
def about():
return render_template('about.html')

@app.route('/blog')
def blog():
return render_template('blog.html')

@app.route('/doctor')
def doctor():
return render_template('doctor.html')

@app.route('/departments')
def departments():
return render_template('depatments.html')

@app.route('/uploaded', methods = ['GET', 'POST'])
def upload_file():
form = UploadFileForm()
if form.validate_on_submit():
f = form.file.data
directory = f.filename
path='./static/'+f.filename
f.save(path)
j_file = open('modeljson.json', 'r')
loaded_json_model = j_file.read()
j_file.close()
model = model_from_json(loaded_json_model)
model.load_weights('model_1.h5')
img1 = image.load_img(path, target_size=(128,128))
img1 = np.array(img1)
img1 = img1.reshape((1,128,128,3))
img1 = img1/255
prediction = model.predict(img1)
pred = np.argmax(prediction)
# print(pred)
disease = CLASSES[pred]
accuracy = prediction[0][pred]
# print(disease,accuracy)
K.clear_session()
return render_template('uploaded.html',imgpath = path,text = disease)
return render_template('knee.html', form = form)

if __name__ == "__main__":
app.run(debug=True)
Loading

0 comments on commit f664514

Please sign in to comment.