NVASAIKUMAR commited on
Commit
3c927bc
·
1 Parent(s): 6e4fdaf

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +12 -12
model.py CHANGED
@@ -14,23 +14,23 @@ def classify(img):
14
  if a==0:
15
  return "Enter the medical Image"
16
  if a==1:
17
- c = bone_net(img)
18
  if a==2:
19
- c = brain_net(img)
20
  if a==3:
21
- c = Eye_net(img)
22
  if a==4:
23
- c = kidney_net(img)
24
  if a==5:
25
- c = chest_net(img)
26
  if a==6:
27
- c = skin_net(img)
28
  return c
29
 
30
 
31
 
32
  def bone_net(img):
33
- img = cv2.resize(img,(224,224))
34
  model = tf.keras.models.load_model("Fracture.h5",compile=False)
35
  result = model.predict(np.array([img]))
36
  op=""
@@ -42,7 +42,7 @@ def bone_net(img):
42
 
43
  def brain_net(img):
44
  lt = ['pituitary', 'notumor', 'meningioma', 'glioma']
45
- img = cv2.resize(img,(52,52))
46
  model = tf.keras.models.load_model("brain.h5",compile=False)
47
  result = model.predict(np.array([img]))
48
  ans = np.argmax(result)
@@ -50,7 +50,7 @@ def brain_net(img):
50
 
51
  def chest_net(img):
52
  lt = ['PNEUMONIA', 'NORMAL']
53
- img = cv2.resize(img,(224,224))
54
  model = tf.keras.models.load_model("chest.h5",compile=False)
55
  result = model.predict(np.array([img]))
56
  ans = np.argmax(result)
@@ -58,7 +58,7 @@ def chest_net(img):
58
 
59
  def Eye_net(img):
60
  lt = ['glaucoma', 'normal', 'diabetic_retinopathy', 'cataract']
61
- img = cv2.resize(img,(224,224))
62
  model = tf.keras.models.load_model("eye.h5",compile=False)
63
  result = model.predict(np.array([img]))
64
  ans = np.argmax(result)
@@ -66,7 +66,7 @@ def Eye_net(img):
66
 
67
  def kidney_net(img):
68
  lt = ['Cyst', 'Tumor', 'Stone', 'Normal']
69
- img = cv2.resize(img,(224,224))
70
  model = tf.keras.models.load_model("kidney.h5",compile=False)
71
  result = model.predict(np.array([img]))
72
  ans = np.argmax(result)
@@ -74,7 +74,7 @@ def kidney_net(img):
74
 
75
  def skin_net(img):
76
  lt = ['pigmented benign keratosis', 'melanoma', 'vascular lesion', 'actinic keratosis', 'squamous cell carcinoma', 'basal cell carcinoma', 'seborrheic keratosis', 'dermatofibroma', 'nevus']
77
- img = cv2.resize(img,(224,224))
78
  model = tf.keras.models.load_model("skin_cancer.h5",compile=False)
79
  result = model.predict(np.array([img]))
80
  ans = np.argmax(result)
 
14
  if a==0:
15
  return "Enter the medical Image"
16
  if a==1:
17
+ c = bone_net(im)
18
  if a==2:
19
+ c = brain_net(im)
20
  if a==3:
21
+ c = Eye_net(im)
22
  if a==4:
23
+ c = kidney_net(im)
24
  if a==5:
25
+ c = chest_net(im)
26
  if a==6:
27
+ c = skin_net(im)
28
  return c
29
 
30
 
31
 
32
  def bone_net(img):
33
+ # img = cv2.resize(img,(224,224))
34
  model = tf.keras.models.load_model("Fracture.h5",compile=False)
35
  result = model.predict(np.array([img]))
36
  op=""
 
42
 
43
  def brain_net(img):
44
  lt = ['pituitary', 'notumor', 'meningioma', 'glioma']
45
+ # img = cv2.resize(img,(52,52))
46
  model = tf.keras.models.load_model("brain.h5",compile=False)
47
  result = model.predict(np.array([img]))
48
  ans = np.argmax(result)
 
50
 
51
  def chest_net(img):
52
  lt = ['PNEUMONIA', 'NORMAL']
53
+ # img = cv2.resize(img,(224,224))
54
  model = tf.keras.models.load_model("chest.h5",compile=False)
55
  result = model.predict(np.array([img]))
56
  ans = np.argmax(result)
 
58
 
59
  def Eye_net(img):
60
  lt = ['glaucoma', 'normal', 'diabetic_retinopathy', 'cataract']
61
+ # img = cv2.resize(img,(224,224))
62
  model = tf.keras.models.load_model("eye.h5",compile=False)
63
  result = model.predict(np.array([img]))
64
  ans = np.argmax(result)
 
66
 
67
  def kidney_net(img):
68
  lt = ['Cyst', 'Tumor', 'Stone', 'Normal']
69
+ # img = cv2.resize(img,(224,224))
70
  model = tf.keras.models.load_model("kidney.h5",compile=False)
71
  result = model.predict(np.array([img]))
72
  ans = np.argmax(result)
 
74
 
75
  def skin_net(img):
76
  lt = ['pigmented benign keratosis', 'melanoma', 'vascular lesion', 'actinic keratosis', 'squamous cell carcinoma', 'basal cell carcinoma', 'seborrheic keratosis', 'dermatofibroma', 'nevus']
77
+ # img = cv2.resize(img,(224,224))
78
  model = tf.keras.models.load_model("skin_cancer.h5",compile=False)
79
  result = model.predict(np.array([img]))
80
  ans = np.argmax(result)