<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(2,'data/train','image','label',data_gen_args, image_color_mode = "rgb",
                        target_size = (256,256), save_to_dir = "data/train/aug") #"data/train/aug"
model = unet()
model_checkpoint1 = ModelCheckpoint('unet_rgb_256.hdf5', monitor='loss',verbose=1, save_best_only=True)
model.fit_generator(myGene,steps_per_epoch=2000,epochs=5,callbacks=[model_checkpoint1])<jupyter_output>WARNING:tensorflow:From /local-scratch/anaconda/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:4070: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.

WARNING:tensorflow:From /local-scratch/anaconda/lib/python3.7/site-packages/tensorflow/python/ops/nn_impl.py:180: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where<jupyter_text>Train with npy file<jupyter_code>imgs_train,imgs_mask_train = geneTrainNpy("data/train/aug/","data/train/aug/", image_as_gray = False)
model_checkpoint3 = ModelCheckpoint('unet_rgb_val .hdf5', monitor='val_acc',verbose=1, save_best_only=True)
model.fit(imgs_train, imgs_mask_train, batch_size=2, nb_epoch=5, verbose=1,validation_split=0.2, shuffle=True, callbacks=[model_checkpoint3])<jupyter_output>/local-scratch/anaconda/lib/python3.7/site-packages/ipykernel_launcher.py:3: UserWarning: The `nb_epoch` argument in `fit` has been renamed `epochs`.
  This is separate from the ipykernel package so we can avoid doing imports until<jupyter_text>test your model and save predicted results<jupyter_code>testGene = testGenerator("data/test2",target_size = (256,256), as_gray = False)
model = unet()
model.load_weights("unet_rgb_256.hdf5")
results = model.predict_generator(testGene,12,verbose=1)

saveResult("data/test",results)<jupyter_output>12/12 [==============================] - 0s 34ms/step
{'fraction_non_alphanumeric': 0.12330407023144453, 'fraction_numerical': 0.03232242617717478, 'mean_word_length': 5.205445544554456, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '75153', 'license': 'MIT', 'n_tokens_mistral': 885, 'n_tokens_neox': 830, 'n_words': 155, 'path': 'trainUnet.ipynb', 'repo_name': 'dorsadadjoo/Grape_Segmentation', 'size': '2506'}