<jupyter_start><jupyter_text>Train your Unet with membrane datamembrane data is in folder membrane/, it is a binary classification task.The input shape of image and mask are the same :(batch_size,rows,cols,channel = 1)  Train with data generator<jupyter_code>data_gen_args = dict(rotation_range=0.2,
                    width_shift_range=0.05,
                    height_shift_range=0.05,
                    shear_range=0.05,
                    zoom_range=0.05,
                    horizontal_flip=True,
                    fill_mode='nearest')

myGene = trainGenerator(8,'data/membrane/train','image','label',data_gen_args,save_to_dir = None)

model = unet()

model_checkpoint = ModelCheckpoint('unet_membrane.hdf5', monitor='loss',verbose=1, save_best_only=True)
reduceLROnPlateau = keras.callbacks.ReduceLROnPlateau(monitor='loss', factor=0.2, patience=3, verbose=0, 
                                                      mode='auto', min_delta=0.0001, cooldown=0, min_lr=0) 
earlyStopping = keras.callbacks.EarlyStopping(monitor='loss',min_delta=0.005,patience=5,verbose=0, mode='auto') 

#fit_generator(generator, steps_per_epoch=None, epochs=1, verbose=1, callbacks=None, validation_data=None, validation_steps=None, validation_freq=1, class_weight=None, max_queue_size=10, workers=1, use_multiprocessing=False, shuffle=True, initial_epoch=0)

model.fit_generator(generator=myGene,steps_per_epoch=2000,epochs=25,
                    #validation_data=myGeneTest, validation_steps=2000,
                    callbacks=[model_checkpoint,reduceLROnPlateau,earlyStopping])<jupyter_output>Epoch 1/25
Found 30 images belonging to 1 classes.
Found 30 images belonging to 1 classes.
2000/2000 [==============================] - 368s 184ms/step - loss: 0.1852 - acc: 0.9185

Epoch 00001: loss improved from inf to 0.18520, saving model to unet_membrane.hdf5
Epoch 2/25
2000/2000 [==============================] - 358s 179ms/step - loss: 0.1020 - acc: 0.9555

Epoch 00002: loss improved from 0.18520 to 0.10203, saving model to unet_membrane.hdf5
Epoch 3/25
2000/2000 [==============================] - 357s 179ms/step - loss: 0.0797 - acc: 0.9654

Epoch 00003: loss improved from 0.10203 to 0.07973, saving model to unet_membrane.hdf5
Epoch 4/25
2000/2000 [==============================] - 357s 179ms/step - loss: 0.0689 - acc: 0.9701

Epoch 00004: loss improved from 0.07973 to 0.06886, saving model to unet_membrane.hdf5
Epoch 5/25
2000/2000 [==============================] - 358s 179ms/step - loss: 0.0621 - acc: 0.9730

Epoch 00005: loss improved from 0.06886 to 0.06204, saving model t[...]<jupyter_text>Train with npy file<jupyter_code>#imgs_train,imgs_mask_train = geneTrainNpy("data/membrane/train/aug/","data/membrane/train/aug/")
#model.fit(imgs_train, imgs_mask_train, batch_size=2, nb_epoch=10, verbose=1,validation_split=0.2, shuffle=True, callbacks=[model_checkpoint])<jupyter_output><empty_output><jupyter_text>test your model and save predicted results<jupyter_code>testGene = testGenerator("data/membrane/test")
model = unet()
model.load_weights("unet_membrane.hdf5")
results = model.predict_generator(testGene,30,verbose=1)
saveResult("data/membrane/test",results)<jupyter_output>/gpfs/groups/gc056/APPRANTI/cj3272/anaconda3/envs/PY36/lib/python3.6/site-packages/skimage/transform/_warps.py:105: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.
  warn("The default mode, 'constant', will be changed to 'reflect' in "
/gpfs/groups/gc056/APPRANTI/cj3272/anaconda3/envs/PY36/lib/python3.6/site-packages/skimage/transform/_warps.py:110: UserWarning: Anti-aliasing will be enabled by default in skimage 0.15 to avoid aliasing artifacts when down-sampling images.
  warn("Anti-aliasing will be enabled by default in skimage 0.15 to "
{'fraction_non_alphanumeric': 0.14689564068692207, 'fraction_numerical': 0.08586525759577279, 'mean_word_length': 4.642324888226527, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '639611', 'license': 'MIT', 'n_tokens_mistral': 1516, 'n_tokens_neox': 1245, 'n_words': 270, 'path': 'trainUnet.ipynb', 'repo_name': 'luccauchon/unet', 'size': '3785'}