text_plain_output_3.png text_plain_output_2.png text_plain_output_1.png
from sklearn.preprocessing import StandardScaler

import cv2

import glob

import numpy as np

import numpy as np # linear algebra

import os

import os

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import numpy as np
import pandas as pd
import os

submission_sumple = pd.read_csv('/kaggle/input/aiacademydeeplearning/sample_submission.csv')

train = pd.read_csv('/kaggle/input/aiacademydeeplearning/train.csv')
num_cols = ['bedrooms', 'bathrooms', 'area', 'zipcode']
target = ['price']
train[num_cols] = train[num_cols].fillna(-99999)
Scaler = StandardScaler()
train[num_cols] = Scaler.fit_transform(train[num_cols])

test = pd.read_csv('/kaggle/input/aiacademydeeplearning/test.csv')
test[num_cols] = test[num_cols].fillna(-99999)
Scaler = StandardScaler()
test[num_cols] = Scaler.fit_transform(test[num_cols])

def load_images(df, inputPath, size, roomType1, roomType2, roomType3, roomType4):
    images = []
    for i in df['id']:
        basePath1 = os.path.sep.join([inputPath, '{}_{}*'.format(i, roomType1)])
        basePath2 = os.path.sep.join([inputPath, '{}_{}*'.format(i, roomType2)])
        basePath3 = os.path.sep.join([inputPath, '{}_{}*'.format(i, roomType3)])
        basePath4 = os.path.sep.join([inputPath, '{}_{}*'.format(i, roomType4)])
        housePaths1 = sorted(list(glob.glob(basePath1)))
        housePaths2 = sorted(list(glob.glob(basePath2)))
        housePaths3 = sorted(list(glob.glob(basePath3)))
        housePaths4 = sorted(list(glob.glob(basePath4)))
        for housePath1 in housePaths1:
            image1 = cv2.imread(housePath1)
            image1 = cv2.cvtColor(image1, cv2.COLOR_BGR2RGB)
            image1 = cv2.resize(image1, (size, size))
        for housePath2 in housePaths2:
            image2 = cv2.imread(housePath2)
            image2 = cv2.cvtColor(image2, cv2.COLOR_BGR2RGB)
            image2 = cv2.resize(image2, (size, size))
        for housePath3 in housePaths3:
            image3 = cv2.imread(housePath3)
            image3 = cv2.cvtColor(image3, cv2.COLOR_BGR2RGB)
            image3 = cv2.resize(image3, (size, size))
        for housePath4 in housePaths4:
            image4 = cv2.imread(housePath4)
            image4 = cv2.cvtColor(image4, cv2.COLOR_BGR2RGB)
            image4 = cv2.resize(image4, (size, size))
        image1_2 = cv2.vconcat([image1, image2])
        image3_4 = cv2.vconcat([image3, image4])
        image_all = cv2.hconcat([image1_2, image1_2])
        images.append(image_all)
    return np.array(images) / 255.0
inputPath = '/kaggle/input/aiacademydeeplearning/train_images/'
size = 28
roomType1 = 'kitchen'
roomType2 = 'bathroom'
roomType3 = 'bedroom'
roomType4 = 'frontal'
train_images = load_images(train, inputPath, size, roomType1, roomType2, roomType3, roomType4)

inputPath_test = '/kaggle/input/aiacademydeeplearning/test_images/'
test_images = load_images(test, inputPath_test, size, roomType1, roomType2, roomType3, roomType4)
display(test_images.shape)
display(test_images[0][0][0])