marciahon29 / Ryerson_MRP

Alzheimer's Classification Using Convolutional Neural Networks
35 stars 12 forks source link

Help #1

Open czainab opened 6 years ago

czainab commented 6 years ago

Hi I am interested in your research work and trying to execute it but didn't find any main file. Can you please guide me how to run it. It will be really nice of you!

marciahon29 commented 6 years ago

Hello,

To have the files run, you need to have the data folder within the same directory as the python script.

To run the python scripts, do: python script_name.py

For example:

python VGG16_bottleneck_data_00.py

Now, for all of this to work, you need to have the correct environment. I listed the steps I took in the readme.

czainab commented 6 years ago

Thank you I was able to run those files, but still got a problem, didn't able to find 'bottleneck_features_train.npy' and 'bottleneck_features_validation.npy' files in the folder. Please help me again

marciahon29 commented 6 years ago

Please forward the script you where it is missing.

On Sat, Apr 21, 2018 at 3:54 AM, czainab notifications@github.com wrote:

Thank you I was able to run those files, but still got a problem, didn't able to find 'bottleneck_features_train.npy' and 'bottleneck_features_validation.npy' files in the folder. Please help me again

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-383275903, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvpiaBpVnb0gAs0Pgg4N-9Wxfe13bks5tquWYgaJpZM4TZei4 .

czainab commented 6 years ago

I have attached a script kindly guide me about the 'bottleneck_features_train.npy' and 'bottleneck_features_validation.npy' files because I didn't find them anywhere in the folders.

On Sunday, April 22, 2018 8:02 PM, marciahon29 <notifications@github.com> wrote:

Please forward the script you where it is missing.

On Sat, Apr 21, 2018 at 3:54 AM, czainab notifications@github.com wrote:

Thank you I was able to run those files, but still got a problem, didn't able to find 'bottleneck_features_train.npy' and 'bottleneck_features_validation.npy' files in the folder. Please help me again

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-383275903, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvpiaBpVnb0gAs0Pgg4N-9Wxfe13bks5tquWYgaJpZM4TZei4 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

import numpy as np from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Dropout, Flatten, Dense from keras import applications

dimensions of our images.

img_width, img_height = 224, 224

top_model_weights_path = 'bottleneck_VGG19_00.h5' train_data_dir = 'data_00/train' validation_data_dir = 'data_00/validation' nb_train_samples = 5120 nb_validation_samples = 1280 epochs = 100 batch_size = 40

def save_bottlebeck_features(): datagen = ImageDataGenerator(rescale=1. / 255)

# build the VGG16 network
model = applications.VGG19(include_top=False, weights='imagenet')

generator = datagen.flow_from_directory(
    train_data_dir,
    target_size=(img_width, img_height),
    batch_size=batch_size,
    class_mode=None,
    shuffle=False)
bottleneck_features_train = model.predict_generator(
    generator, nb_train_samples // batch_size)
np.save(open('bottleneck_features_train.npy', 'w'),
        bottleneck_features_train)

generator = datagen.flow_from_directory(
    validation_data_dir,
    target_size=(img_width, img_height),
    batch_size=batch_size,
    class_mode=None,
    shuffle=False)
bottleneck_features_validation = model.predict_generator(
    generator, nb_validation_samples // batch_size)
np.save(open('bottleneck_features_validation.npy', 'w'),
        bottleneck_features_validation)

def train_top_model(): train_data = np.load(open('bottleneck_features_train.npy')) train_labels = np.array( [0] (nb_train_samples / 2) + [1] (nb_train_samples / 2))

validation_data = np.load(open('bottleneck_features_validation.npy'))
validation_labels = np.array(
    [0] * (nb_validation_samples / 2) + [1] * (nb_validation_samples / 2))

model = Sequential()
model.add(Flatten(input_shape=train_data.shape[1:]))
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model.compile(optimizer='rmsprop',
              loss='binary_crossentropy', metrics=['accuracy'])

model.fit(train_data, train_labels,
          epochs=epochs,
          batch_size=batch_size,
          validation_data=(validation_data, validation_labels))
model.save(top_model_weights_path)

save_bottlebeck_features() train_top_model()

marciahon29 commented 6 years ago

I believe you can download from here.

On Wed, Apr 25, 2018 at 4:22 AM, czainab notifications@github.com wrote:

I have attached a script kindly guide me about the 'bottleneck_features_train.npy' and 'bottleneck_features_validation.npy' files because I didn't find them anywhere in the folders.

On Sunday, April 22, 2018 8:02 PM, marciahon29 notifications@github.com wrote:

Please forward the script you where it is missing.

On Sat, Apr 21, 2018 at 3:54 AM, czainab notifications@github.com wrote:

Thank you I was able to run those files, but still got a problem, didn't able to find 'bottleneck_features_train.npy' and 'bottleneckfeatures validation.npy' files in the folder. Please help me again

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment- 383275903, or mute the thread https://github.com/notifications/unsubscribe- auth/AVyEvpiaBpVnb0gAs0Pgg4N-9Wxfe13bks5tquWYgaJpZM4TZei4 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

import numpy as np from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Dropout, Flatten, Dense from keras import applications

dimensions of our images.

img_width, img_height = 224, 224

top_model_weights_path = 'bottleneck_VGG19_00.h5' train_data_dir = 'data_00/train' validation_data_dir = 'data_00/validation' nb_train_samples = 5120 nb_validation_samples = 1280 epochs = 100 batch_size = 40

def save_bottlebeck_features(): datagen = ImageDataGenerator(rescale=1. / 255)

build the VGG16 network

model = applications.VGG19(include_top=False, weights='imagenet')

generator = datagen.flow_from_directory( train_data_dir, target_size=(img_width, img_height), batch_size=batch_size, class_mode=None, shuffle=False) bottleneck_features_train = model.predict_generator( generator, nb_train_samples // batch_size) np.save(open('bottleneck_features_train.npy', 'w'), bottleneck_features_train)

generator = datagen.flow_from_directory( validation_data_dir, target_size=(img_width, img_height), batch_size=batch_size, class_mode=None, shuffle=False) bottleneck_features_validation = model.predict_generator( generator, nb_validation_samples // batch_size) np.save(open('bottleneck_features_validation.npy', 'w'), bottleneck_features_validation)

def train_top_model(): train_data = np.load(open('bottleneck_features_train.npy')) train_labels = np.array( [0] (nb_train_samples / 2) + [1] (nb_train_samples / 2))

validation_data = np.load(open('bottleneck_features_validation.npy')) validation_labels = np.array( [0] (nb_validation_samples / 2) + [1] (nb_validation_samples / 2))

model = Sequential() model.add(Flatten(input_shape=train_data.shape[1:])) model.add(Dense(256, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(1, activation='sigmoid'))

model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy'])

model.fit(train_data, train_labels, epochs=epochs, batch_size=batch_size, validation_data=(validation_data, validation_labels)) model.save(top_model_weights_path)

save_bottlebeck_features() train_top_model()

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-384202474, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvof8b9oLDKPSy-uUabxxfAfQFUbqks5tsDJOgaJpZM4TZei4 .

marciahon29 commented 6 years ago

https://gitlab.centralesupelec.fr/anneix_ale/AI_DTY_fall_2017/tree/937885dcbd53fcaa152f91b3b949613f581a2119/alexis_anneix/Day1

On Wed, Apr 25, 2018 at 12:06 PM, Marcia Hon marcia.hon.29@gmail.com wrote:

I believe you can download from here.

On Wed, Apr 25, 2018 at 4:22 AM, czainab notifications@github.com wrote:

I have attached a script kindly guide me about the 'bottleneck_features_train.npy' and 'bottleneck_features_validation.npy' files because I didn't find them anywhere in the folders.

On Sunday, April 22, 2018 8:02 PM, marciahon29 notifications@github.com wrote:

Please forward the script you where it is missing.

On Sat, Apr 21, 2018 at 3:54 AM, czainab notifications@github.com wrote:

Thank you I was able to run those files, but still got a problem, didn't able to find 'bottleneck_features_train.npy' and 'bottleneck_features_validation.npy' files in the folder. Please help me again

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1# issuecomment-383275903, or mute the thread https://github.com/notifications/unsubscribe-auth/ AVyEvpiaBpVnb0gAs0Pgg4N-9Wxfe13bks5tquWYgaJpZM4TZei4 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

import numpy as np from keras.preprocessing.image import ImageDataGenerator from keras.models import Sequential from keras.layers import Dropout, Flatten, Dense from keras import applications

dimensions of our images.

img_width, img_height = 224, 224

top_model_weights_path = 'bottleneck_VGG19_00.h5' train_data_dir = 'data_00/train' validation_data_dir = 'data_00/validation' nb_train_samples = 5120 nb_validation_samples = 1280 epochs = 100 batch_size = 40

def save_bottlebeck_features(): datagen = ImageDataGenerator(rescale=1. / 255)

build the VGG16 network

model = applications.VGG19(include_top=False, weights='imagenet')

generator = datagen.flow_from_directory( train_data_dir, target_size=(img_width, img_height), batch_size=batch_size, class_mode=None, shuffle=False) bottleneck_features_train = model.predict_generator( generator, nb_train_samples // batch_size) np.save(open('bottleneck_features_train.npy', 'w'), bottleneck_features_train)

generator = datagen.flow_from_directory( validation_data_dir, target_size=(img_width, img_height), batch_size=batch_size, class_mode=None, shuffle=False) bottleneck_features_validation = model.predict_generator( generator, nb_validation_samples // batch_size) np.save(open('bottleneck_features_validation.npy', 'w'), bottleneck_features_validation)

def train_top_model(): train_data = np.load(open('bottleneck_features_train.npy')) train_labels = np.array( [0] (nb_train_samples / 2) + [1] (nb_train_samples / 2))

validation_data = np.load(open('bottleneck_features_validation.npy')) validation_labels = np.array( [0] (nb_validation_samples / 2) + [1] (nb_validation_samples / 2))

model = Sequential() model.add(Flatten(input_shape=train_data.shape[1:])) model.add(Dense(256, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(1, activation='sigmoid'))

model.compile(optimizer='rmsprop', loss='binary_crossentropy', metrics=['accuracy'])

model.fit(train_data, train_labels, epochs=epochs, batch_size=batch_size, validation_data=(validation_data, validation_labels)) model.save(top_model_weights_path)

save_bottlebeck_features() train_top_model()

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-384202474, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvof8b9oLDKPSy-uUabxxfAfQFUbqks5tsDJOgaJpZM4TZei4 .

czainab commented 6 years ago

Thank You I was able to run it. I want to ask another question that, did you convert the 3D images to 2D? If yes, then what mechanism did you follow?

marciahon29 commented 6 years ago

Hello

No I didn't use 3d... Instead I took 2d slices with the most information according to entropy...

On Sun, May 13, 2018, 4:50 PM czainab notifications@github.com wrote:

Thank You I was able to run it. I want to ask another question that, did you convert the 3D images to 2D? If yes, then what mechanism did you follow?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-388655054, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvmESbImN_KB1y3OKgBOuLbJiFDBlks5tyJyIgaJpZM4TZei4 .

czainab commented 6 years ago

Can you please share that code.

On Monday, May 14, 2018 1:52 AM, marciahon29 <notifications@github.com> wrote:

Hello

No I didn't use 3d... Instead I took 2d slices with the most information according to entropy...

On Sun, May 13, 2018, 4:50 PM czainab notifications@github.com wrote:

Thank You I was able to run it. I want to ask another question that, did you convert the 3D images to 2D? If yes, then what mechanism did you follow?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-388655054, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvmESbImN_KB1y3OKgBOuLbJiFDBlks5tyJyIgaJpZM4TZei4 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

czainab commented 6 years ago

Can you please share the test data

czainab commented 6 years ago

Can you please share the test data

Sent from Yahoo Mail on Android

On Mon, 14 May, 2018 at 11:06 AM, Zainab Iftikhar Chaudhryczainabiftikhar@yahoo.com wrote: Can you please share that code.

On Monday, May 14, 2018 1:52 AM, marciahon29 <notifications@github.com> wrote:

Hello

No I didn't use 3d... Instead I took 2d slices with the most information according to entropy...

On Sun, May 13, 2018, 4:50 PM czainab notifications@github.com wrote:

Thank You I was able to run it. I want to ask another question that, did you convert the 3D images to 2D? If yes, then what mechanism did you follow?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-388655054, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvmESbImN_KB1y3OKgBOuLbJiFDBlks5tyJyIgaJpZM4TZei4 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

marciahon29 commented 6 years ago

Hello,

Data is already there: https://github.com/marciahon29/Ryerson_MRP/tree/master/MRI_32_Images

I split into 5 data sets of train/val each.

On Sat, May 19, 2018 at 6:14 PM, czainab notifications@github.com wrote:

Can you please share the test data

Sent from Yahoo Mail on Android

On Mon, 14 May, 2018 at 11:06 AM, Zainab Iftikhar Chaudhry< czainabiftikhar@yahoo.com> wrote: Can you please share that code.

On Monday, May 14, 2018 1:52 AM, marciahon29 notifications@github.com wrote:

Hello

No I didn't use 3d... Instead I took 2d slices with the most information according to entropy...

On Sun, May 13, 2018, 4:50 PM czainab notifications@github.com wrote:

Thank You I was able to run it. I want to ask another question that, did you convert the 3D images to 2D? If yes, then what mechanism did you follow?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment- 388655054, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvmESbImN_ KB1y3OKgBOuLbJiFDBlks5tyJyIgaJpZM4TZei4 .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-390436138, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvpPmnlnf_L__QB6H70Mxq_N8lneIks5t0JlKgaJpZM4TZei4 .

czainab commented 6 years ago

Thank you for your continuous help I found the data but I couldn't find the MCI vs AD and MCI vs Normal data. Can you please help me. I really want to run on MCI images as well.

 is already there: https://github.com/marciahon29/Ryerson_MRP/tree/master/MRI_32_Images

I split into 5 data sets of train/val each.

On Sat, May 19, 2018 at 6:14 PM, czainab notifications@github.com wrote:

Can you please share the test data

Sent from Yahoo Mail on Android

On Mon, 14 May, 2018 at 11:06 AM, Zainab Iftikhar Chaudhry< czainabiftikhar@yahoo.com> wrote: Can you please share that code.

On Monday, May 14, 2018 1:52 AM, marciahon29 notifications@github.com wrote:

Hello

No I didn't use 3d... Instead I took 2d slices with the most information according to entropy...

On Sun, May 13, 2018, 4:50 PM czainab notifications@github.com wrote:

Thank You I was able to run it. I want to ask another question that, did you convert the 3D images to 2D? If yes, then what mechanism did you follow?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment- 388655054, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvmESbImN_ KB1y3OKgBOuLbJiFDBlks5tyJyIgaJpZM4TZei4 .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-390436138, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvpPmnlnf_L__QB6H70Mxq_N8lneIks5t0JlKgaJpZM4TZei4 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

marciahon29 commented 6 years ago

Hello,

For this project we only did Alzheimer's and Normal. We didn't do MCI.

On Thu, Jun 14, 2018 at 4:28 PM, czainab notifications@github.com wrote:

Thank you for your continuous help I found the data but I couldn't find the MCI vs AD and MCI vs Normal data. Can you please help me. I really want to run on MCI images as well.

is already there: https://github.com/marciahon29/Ryerson_MRP/tree/master/MRI_32_Images

I split into 5 data sets of train/val each.

On Sat, May 19, 2018 at 6:14 PM, czainab notifications@github.com wrote:

Can you please share the test data

Sent from Yahoo Mail on Android

On Mon, 14 May, 2018 at 11:06 AM, Zainab Iftikhar Chaudhry< czainabiftikhar@yahoo.com> wrote: Can you please share that code.

On Monday, May 14, 2018 1:52 AM, marciahon29 notifications@github.com wrote:

Hello

No I didn't use 3d... Instead I took 2d slices with the most information according to entropy...

On Sun, May 13, 2018, 4:50 PM czainab notifications@github.com wrote:

Thank You I was able to run it. I want to ask another question that, did you convert the 3D images to 2D? If yes, then what mechanism did you follow?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment- 388655054, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvmESbImN_ KB1y3OKgBOuLbJiFDBlks5tyJyIgaJpZM4TZei4 .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment- 390436138, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvpPmnlnf_L__ QB6H70Mxq_N8lneIks5t0JlKgaJpZM4TZei4

.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-397428009, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvnWk_SSRS6E2ADy9Ygx0ApFSNleNks5t8seJgaJpZM4TZei4 .

czainab commented 6 years ago

Did you work on MCI for any other project?

marciahon29 commented 6 years ago

MCI should be done the same as Alzheimer's (A) and Normal (N).

I'm working on a project at the moment that uses MCI. I will only release my info after I'm done.

I think you should do the following comparisons: MvA, MvN, AvN,

On Tue, Jun 19, 2018 at 12:26 AM, czainab notifications@github.com wrote:

Did you work on MCI for any other project?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-398270452, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvt_W6aEajtrY65l3tArxksyavssLks5t-H1ugaJpZM4TZei4 .

czainab commented 6 years ago

Hi, I want to ask one more question how can I run the  ALL_Epochs.sh file in windows? Is there any alternative to run this file? On Tuesday, June 19, 2018, 6:49:34 PM GMT+5, marciahon29 notifications@github.com wrote:

MCI should be done the same as Alzheimer's (A) and Normal (N).

I'm working on a project at the moment that uses MCI. I will only release my info after I'm done.

I think you should do the following comparisons: MvA, MvN, AvN,

On Tue, Jun 19, 2018 at 12:26 AM, czainab notifications@github.com wrote:

Did you work on MCI for any other project?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-398270452, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvt_W6aEajtrY65l3tArxksyavssLks5t-H1ugaJpZM4TZei4 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

marciahon29 commented 6 years ago

From my understanding, python is universal. So please try to convert this bash script to python.

Unless you are willing to install Linux (which is what i did)

On Sat, Jun 30, 2018 at 4:34 AM, czainab notifications@github.com wrote:

Hi, I want to ask one more question how can I run the ALL_Epochs.sh file in windows? Is there any alternative to run this file? On Tuesday, June 19, 2018, 6:49:34 PM GMT+5, marciahon29 < notifications@github.com> wrote:

MCI should be done the same as Alzheimer's (A) and Normal (N).

I'm working on a project at the moment that uses MCI. I will only release my info after I'm done.

I think you should do the following comparisons: MvA, MvN, AvN,

On Tue, Jun 19, 2018 at 12:26 AM, czainab notifications@github.com wrote:

Did you work on MCI for any other project?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment- 398270452, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvt_ W6aEajtrY65l3tArxksyavssLks5t-H1ugaJpZM4TZei4 .

— You are receiving this because you authored the thread.

Reply to this email directly, view it on GitHub, or mute the thread.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/marciahon29/Ryerson_MRP/issues/1#issuecomment-401526978, or mute the thread https://github.com/notifications/unsubscribe-auth/AVyEvkXvXhr_awWvhTEbA_cGEt8f-eofks5uBzgOgaJpZM4TZei4 .

zfy514 commented 3 years ago

Hi I am interested in your research work and trying to execute it but didn't find any main file. Can you please guide me how to run it. It will be really nice of you!

Hi I am also doing this research about Alzheimer,but I can‘t run this code.Please help me. Can you share your experience. I wil extremely appreciate it if you will give me help.