, 700 000 ? , , , , . 70 % , , , , . 30 % . - ? ?
, , , β , .
. , . 70 % β . , . 30 % .
120! ( , , ). , , , !
, , . :
;
, ;
;
: , ;
;
;
;
;
;
, , ;
.
, - , ? , .
? , , . , , , .
, . ( ) β ! , . β , β¦ β !
β Jupyter Notebook. :
import tensorflow as tf
import numpy as np
from keras. preprocessing import image
from keras. preprocessing.image import ImageDataGenerator from matplotlib import pyplot as plt
from matplotlib import pyplot as plt
, Notebook, ! :
train_datagen = ImageDataGenerator(rescale = l*/255, shear_range = 0,2, zoom_range = 0.2, horizontal_flip = True)
flow_from_directory, , .
training_set = train_datagen.flow_from_directory('Location', target_size = (64,64), batch_size = 32, class_mode = 'binary')
Location . , ! cnn.add keras. , .
cnn = tf.keras. models.Sequential()
cnn.add(tf.keras.layers.Conv2D(filters=32, kernel_size = 3, activation= 'relu ', input_shape = [64, 64, 3]))
cnn.add(tf.keras.layers.MaxPool2D(pool_size = 2, strides = 2))
cnn.add(tf.keras.layers.Conv2D(filters=64, kernel_size=3, activation = 'relu'))
cnn.add(tf.keras.layers.MaxPool2D(pool_size=2, strides=2) ))
cnn.add (tf.keras.layers.Flatten())
cnn.add(tf.keras.layers.Dense (units=128, activation = 'relu'))
cnn.add(tf.keras.layers.Dense(units = 1, activation = 'sigmoid'))
!
cnn.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
cnn.fit(x = training_set, validationdata = test_set, epochs = 15)
, ! ( ) .
test_image = image.load_img('C:/Users/annah/Desktop/brain_tumor_dataset/training_set/Y2.jpg', target_size = (64, 64))
plt.imshow(test_image)
plt.title('Test Brain Image'), plt.xticks([]), plt.yticks([])
plt.show()
test_image = image.img_to_array(test_image)
test_image = np.expand_dims(test_image, axis = 0)
result = cnn.predict(test_image)
training_set.class_indices
if result[0][0] == 1:
prediction = 'brain tumor present'
else:
prediction = 'no brain tumor'
print(prediction)
.
, ! , , , .
, , . β . , , !
, - , β ! , , . , - (, ), "-" . ?
, , β . , , .
( , ) ( ) , .
, . , , , .
. , , . , , , .
( ) ( ) .
. . , .
, , , , . , , . , .
, , , . , , , , - .
? -, . Jupyter Notebook , . , .
, . , , . , , , .
. , , , ; , , .
, , . .
β , , . , . , "Machine Learning Deep Learning", , ML.