<jupyter_start><jupyter_text><jupyter_code>import tensorflow as tf
from tensorflow import keras 
from tensorflow.keras.preprocessing import image
from tensorflow.keras.preprocessing.image import ImageDataGenerator
tf.__version__
train_datagen= ImageDataGenerator( rescale=1./255,
                                  shear_range=0.2,
                                  zoom_range=0.2,
                                  horizontal_flip=True )
training_set=train_datagen.flow_from_directory("..\\Users\\BLRCSEL511PC14\\skin cancer\\data\\test",
                                                 target_size = (64, 64),
                                                 batch_size = 10,
                                                 class_mode = 'binary')
test_datagen = ImageDataGenerator(rescale = 1./255)
test_set = test_datagen.flow_from_directory("..\\Users\\BLRCSEL511PC14\\skin cancer\\data\\train",
                                            target_size = (64, 64),
                                            batch_size = 10,
                                            class_mode = 'binary')
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=32,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,validation_data=test_set,epochs=50)
print(training_set.class_indices)
import numpy as np

test_image= image.load_img("..\\Users\\BLRCSEL511PC14\\skin cancer\\data-malignant-vs-benign//test//benign//335.jpg',target_size=(64,64))
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:
  print('malignant')
else:
  print('benign')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.131002331002331, 'fraction_numerical': 0.03496503496503497, 'mean_word_length': 2.7848324514991183, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '165947', 'license': 'Apache-2.0', 'n_tokens_mistral': 726, 'n_tokens_neox': 684, 'n_words': 73, 'path': 'Untitled29.ipynb', 'repo_name': 'Thanush20/training-data-analyst', 'size': '2145'}