1

Hello StackOverflow Community,

I hope you are all doing well. I am new to the Stack Overflow Community. Here is my question.

I have been recently trying to complete this Image Classification Tutorial found here (URL: https://iq.opengenus.org/basics-of-machine-learning-image-classification-techniques/).

I have taken a .DICOM file (Medical Image) and converted it to a .PNG file format. This is being done in Jupyter Notebook with Python the Anaconda Platform.

I have been able to perform the Image Pre-Processing Analysis after looking at Stack Overflow and GitHub. I have tried to do the same thing for the Support Vector Machine.

However, I am having trouble trying to define the X_train name for the following code below:

model = Sequential()
model.add(Conv2D(16,(5,5),padding='valid',input_shape = X_train.shape[1:])) # This is the line of code I am having a problem with.
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2,2),strides=2,padding = 'valid'))
model.add(Dropout(0.4))
model.add(Conv2D(32,(5,5),padding='valid'))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2,2),strides=2,padding = 'valid'))
model.add(Dropout(0.6))
model.add(Conv2D(64,(5,5),padding='valid'))
model.add(Activation('relu'))
model.add(Dropout(0.8))
model.add(Flatten())
model.add(Dense(2))
model.add(Activation('softmax'))

model_feat = Model(inputs=model.input,outputs=model.get_layer('dense_1').output)

feat_train = model_feat.predict(X_train)

I believe that the X_train is connected to the "Translation" code below:

img = cv2.warpAffine(img, np.float32([[1, 0, 84], [0, 1, 56]]), (img.shape[0], img.shape[1]),
borderMode=cv2.BORDER_CONSTANT,borderValue=(144, 159, 162))

If needed, I can provide more of the code I have compiled. Do you have any recommendations on what to use or do you recommend a better tutorial all together? Any help would be appreciated. Thank you so much!

Amit Joshi
  • 15,448
  • 21
  • 77
  • 141

0 Answers0