<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/membrane/train','image','label',data_gen_args,save_to_dir = None)
gen = NpyGenerator("../../DIPL/FER-DIPL/out_s512/img", "../../DIPL/FER-DIPL/out_s512/ann", batch_size=2)
model = unet()
model_checkpoint = ModelCheckpoint('unet_membrane.hdf5', monitor='loss',verbose=1, save_best_only=True)
model.fit_generator(myGene,steps_per_epoch=2000,epochs=5,callbacks=[model_checkpoint])<jupyter_output>WARNING:tensorflow:From <ipython-input-7-78760b8359da>:12: Model.fit_generator (from tensorflow.python.keras.engine.training) is deprecated and will be removed in a future version.
Instructions for updating:
Please use Model.fit, which supports generators.
Epoch 1/5<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><empty_output>
{'fraction_non_alphanumeric': 0.12015086206896551, 'fraction_numerical': 0.029094827586206896, 'mean_word_length': 5.294915254237288, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '618310', 'license': 'MIT', 'n_tokens_mistral': 668, 'n_tokens_neox': 618, 'n_words': 102, 'path': 'trainUnet.ipynb', 'repo_name': 'frankocar/unet', 'size': '1856'}