From 75d62a8fe7edb25a724b2b8a1c116dbbc01e0027 Mon Sep 17 00:00:00 2001 From: Tan342 <97234833+Tan342@users.noreply.github.com> Date: Fri, 19 May 2023 04:08:24 +0700 Subject: [PATCH 1/4] Update model.py --- model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model.py b/model.py index 7df5b6889..a852e7914 100644 --- a/model.py +++ b/model.py @@ -52,7 +52,7 @@ def unet(pretrained_weights = None,input_size = (256,256,1)): conv9 = Conv2D(2, 3, activation = 'relu', padding = 'same', kernel_initializer = 'he_normal')(conv9) conv10 = Conv2D(1, 1, activation = 'sigmoid')(conv9) - model = Model(input = inputs, output = conv10) + model = Model(inputs, conv10) model.compile(optimizer = Adam(lr = 1e-4), loss = 'binary_crossentropy', metrics = ['accuracy']) From 20c5aa48762ac73fcee6a5b4c80b61c925470433 Mon Sep 17 00:00:00 2001 From: Tan342 <97234833+Tan342@users.noreply.github.com> Date: Fri, 19 May 2023 04:16:08 +0700 Subject: [PATCH 2/4] Update main.py --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index f6041b875..e183149f0 100644 --- a/main.py +++ b/main.py @@ -18,5 +18,5 @@ model.fit_generator(myGene,steps_per_epoch=300,epochs=1,callbacks=[model_checkpoint]) testGene = testGenerator("data/membrane/test") -results = model.predict_generator(testGene,30,verbose=1) -saveResult("data/membrane/test",results) \ No newline at end of file +results = model.predict(testGene,30,verbose=1) +saveResult("data/membrane/test",results) From f184784a1fe8a25bd0e8f7884781d97840385cd9 Mon Sep 17 00:00:00 2001 From: Tan342 <97234833+Tan342@users.noreply.github.com> Date: Fri, 19 May 2023 04:26:04 +0700 Subject: [PATCH 3/4] Update data.py --- data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data.py b/data.py index 956497d3f..0d7f1ff01 100644 --- a/data.py +++ b/data.py @@ -5,6 +5,7 @@ import glob import skimage.io as io import skimage.transform as trans +from skimage import img_as_uint Sky = [128,128,128] Building = [128,0,0] @@ -121,4 +122,4 @@ def labelVisualize(num_class,color_dict,img): def saveResult(save_path,npyfile,flag_multi_class = False,num_class = 2): for i,item in enumerate(npyfile): img = labelVisualize(num_class,COLOR_DICT,item) if flag_multi_class else item[:,:,0] - io.imsave(os.path.join(save_path,"%d_predict.png"%i),img) \ No newline at end of file + io.imsave(os.path.join(save_path,"%d_predict.png"%i),img_as_uint(img)) From bbfc979ac926c2527bcb705358723363f7fb1e4a Mon Sep 17 00:00:00 2001 From: Tan342 <97234833+Tan342@users.noreply.github.com> Date: Fri, 19 May 2023 04:44:51 +0700 Subject: [PATCH 4/4] Update main.py --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index e183149f0..4a9c7bf84 100644 --- a/main.py +++ b/main.py @@ -15,7 +15,7 @@ model = unet() model_checkpoint = ModelCheckpoint('unet_membrane.hdf5', monitor='loss',verbose=1, save_best_only=True) -model.fit_generator(myGene,steps_per_epoch=300,epochs=1,callbacks=[model_checkpoint]) +model.fit_generator(myGene,steps_per_epoch=300,epochs=10,callbacks=[model_checkpoint]) testGene = testGenerator("data/membrane/test") results = model.predict(testGene,30,verbose=1)