This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Sat Apr 16 00:59:57 2022 | |
| @author: Ibrahim Kovan | |
| https://ibrahimkovan.medium.com/ | |
| """ | |
| import tensorflow as tf | |
| import numpy as np | |
| import tensorflow.keras.preprocessing.image as process_im |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| @author: Ibrahim Kovan | |
| https://ibrahimkovan.medium.com/ | |
| """ | |
| #%% Libraries | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from sklearn.preprocessing import StandardScaler | |
| from sklearn import preprocessing | |
| from sklearn.model_selection import train_test_split |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| @author: Ibrahim Kovan | |
| https://ibrahimkovan.medium.com/ | |
| """ | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from sklearn.preprocessing import StandardScaler | |
| from sklearn import preprocessing | |
| from sklearn.model_selection import train_test_split | |
| from sklearn.metrics import accuracy_score |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """14""" | |
| fig, ax = plt.subplots(5, 4, figsize = (16,20)) | |
| for i in range(0,5): | |
| test_img_number = random.randint(0, len(x_test)) | |
| test_img = x_test[test_img_number] | |
| ground_truth=y_test_argmax[test_img_number] | |
| test_img_input=np.expand_dims(test_img, 0) | |
| prediction = (model.predict(test_img_input)) | |
| predicted_img=np.argmax(prediction, axis=3)[0,:,:] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #%% pre-trained model | |
| """10""" | |
| BACKBONE = 'resnet34' | |
| preprocess_input = sm.get_preprocessing(BACKBONE) | |
| # preprocess input | |
| x_train_new = preprocess_input(x_train) | |
| x_test_new = preprocess_input(x_test) | |
| # define model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #%% pre-trained model | |
| """10""" | |
| BACKBONE = 'resnet34' | |
| preprocess_input = sm.get_preprocessing(BACKBONE) | |
| # preprocess input | |
| x_train_new = preprocess_input(x_train) | |
| x_test_new = preprocess_input(x_test) | |
| # define model |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #%% U-Net | |
| """6""" | |
| img_height = x_train.shape[1] | |
| img_width = x_train.shape[2] | |
| img_channels = x_train.shape[3] | |
| metrics=['accuracy', jacard] | |
| def get_model(): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| @author: Ibrahim Kovan | |
| https://ibrahimkovan.medium.com/ | |
| dataset: http://www.dronedataset.icg.tugraz.at/ | |
| dataset link: https://www.kaggle.com/awsaf49/semantic-drone-dataset | |
| License: CC0: Public Domain | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| @author: Ibrahim Kovan | |
| https://ibrahimkovan.medium.com/ | |
| """ | |
| from tensorflow.keras.models import Model | |
| from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, UpSampling2D, concatenate, Conv2DTranspose, BatchNormalization, Dropout, Lambda | |
| from tensorflow.keras import backend as K | |
| def multiclass_unet_architecture(n_classes=2, height=256, width=256, channels=3): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| """ | |
| @author: Ibrahim Kovan | |
| https://ibrahimkovan.medium.com/ | |
| License: CC0: Public Domain | |
| Dataset: https://www.kaggle.com/francoisraucent/western-europe-power-consumption | |
| """ | |
| """ [1] """ | |
| import pandas as pd |
NewerOlder