diff --git a/.idea/misc.xml b/.idea/misc.xml index a2e120d..ba24381 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,7 @@ + + \ No newline at end of file diff --git a/bin/Main/NeuralNetwork.py b/bin/Main/NeuralNetwork.py new file mode 100644 index 0000000..0b11600 --- /dev/null +++ b/bin/Main/NeuralNetwork.py @@ -0,0 +1,40 @@ +import matplotlib.pyplot as plt +import seaborn as sns + +import keras +from keras.models import Sequential +from keras.layers import Dense, Conv2D , MaxPool2D , Flatten , Dropout +from keras.preprocessing.image import ImageDataGenerator +from keras.optimizers import Adam + +from sklearn.metrics import classification_report,confusion_matrix + +import tensorflow as tf + +import cv2 +import os + +import numpy as np + + +def main(): + labels = ['house', 'other'] + img_size = 500 + + def get_data(data_dir): + data = [] + for label in labels: + path = os.path.join(data_dir, label) + class_num = labels.index(label) + for img in os.listdir(path): + try: + img_arr = cv2.imread(os.path.join(path, img))[..., ::-1] # Convert BGR to RGB format + resized_arr = cv2.resize(img_arr, (img_size, img_size)) # Reshaping images to preferred size + data.append([resized_arr, class_num]) + except Exception as e: + print(e) + return np.array(data) + + +if __name__ == '__main__': + main() diff --git a/bin/Main/temp.py b/bin/Main/temp.py new file mode 100644 index 0000000..6593a17 --- /dev/null +++ b/bin/Main/temp.py @@ -0,0 +1,14 @@ +import tensorflow as tf +from tensorflow import keras +import numpy as np +import pandas as pd +import matplotlib.pyplot as plt + +fashion_mnist = keras.datasets.fashion_mnist +(X_train_full, y_train_full), (X_test, y_test) = fashion_mnist.load_data() + +# 16777216 - because 24 bits color pixels = 2^24 +X_valid, X_train = X_train_full[:5000] / 16777216., X_train_full[5000:] / 16777216. +y_valid, y_train = y_train_full[:5000], y_train_full[5000:] +X_test = X_test / 16777216 +