{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\nimport math, os, random, cv2\nimport numpy as np, pandas as pd\nimport matplotlib.pyplot as plt","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"#took form:https://www.kaggle.com/ihelon/monet-eda\ndef vis(path, n_images, is_random=True, figsize=(16, 16)):\n    plt.figure(figsize=figsize)\n    \n    w = int(n_images ** .5)\n    h = math.ceil(n_images / w)\n    \n    image_names = os.listdir(path)\n    \n    for i in range(n_images):\n        image_name = image_names[i]\n        if is_random:\n            image_name = random.choice(image_names)\n            \n        img = cv2.imread(os.path.join(path, image_name))\n        plt.subplot(h, w, i + 1)\n        plt.imshow(img)\n        plt.title(os.path.basename(os.path.normpath(path)))\n        plt.xticks([])\n        plt.yticks([])\n    \n    plt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"BASE_PATH = '../input/wikiart-gangogh-creating-art-gan/'\nabstract_paint        = os.path.join(BASE_PATH, 'abstract')\nanimal_paint          = os.path.join(BASE_PATH, 'animal-painting')\ncityspace_paint       = os.path.join(BASE_PATH, 'cityscape')\nfigurative_paint      = os.path.join(BASE_PATH, 'figurative')\nflower_paint_paint    = os.path.join(BASE_PATH, 'flower-painting')\ngenre_painting_paint  = os.path.join(BASE_PATH, 'genre-painting')\nlandscape_paint       = os.path.join(BASE_PATH, 'landscape')\nmarina_paint          = os.path.join(BASE_PATH, 'marina')\nmyth_paint_paint      = os.path.join(BASE_PATH, 'mythological-painting')\nnude_paint_paint      = os.path.join(BASE_PATH, 'nude-painting-nu')\nportrait_paint        = os.path.join(BASE_PATH, 'portrait')\nreligious_paint_paint = os.path.join(BASE_PATH, 'religious-painting')\nstill_life_paint      = os.path.join(BASE_PATH, 'still-life')\nsymbolic_paint        = os.path.join(BASE_PATH, 'symbolic-painting')\n\nprint(f'Abstract images      : {len(os.listdir(abstract_paint))}')\nprint(f'Animal images        : {len(os.listdir(animal_paint))}')\nprint(f'Cityspace images     : {len(os.listdir(cityspace_paint))}')\nprint(f'Figurative images    : {len(os.listdir(figurative_paint))}')\nprint(f'Flower images        : {len(os.listdir(flower_paint_paint))}')\nprint(f'Genre images         : {len(os.listdir(genre_painting_paint))}')\nprint(f'Landscape images     : {len(os.listdir(landscape_paint))}')\nprint(f'Marina images        : {len(os.listdir(marina_paint))}')\nprint(f'Mythological images  : {len(os.listdir(myth_paint_paint))}')\nprint(f'Nude images          : {len(os.listdir(nude_paint_paint))}')\nprint(f'Portrait images      : {len(os.listdir(portrait_paint))}')\nprint(f'Religious images     : {len(os.listdir(religious_paint_paint))}')\nprint(f'Still Life images    : {len(os.listdir(still_life_paint))}')\nprint(f'Symbolic images      : {len(os.listdir(symbolic_paint))}')","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"vis(abstract_paint, 12, is_random=True)","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"vis(flower_paint_paint, 12, is_random=True)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"vis(landscape_paint, 12, is_random=True)","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"vis(still_life_paint, 12, is_random=True)","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true},"cell_type":"code","source":"vis(figurative_paint, 12, is_random=True)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Meta Informatin","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"def getImageMetaData(file_path):\n    with Image.open(file_path) as img:\n        img_hash = imagehash.phash(img)\n        return img.size, img.mode, str(img_hash), file_path","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"### Landscape Images","execution_count":null},{"metadata":{"trusted":true},"cell_type":"code","source":"from joblib import Parallel, delayed\nfrom PIL import Image\nimport imagehash, glob, psutil, zipfile, cv2, math, random, warnings, os\n\nimg_meta_land = Parallel(n_jobs=psutil.cpu_count(), verbose=1)(\n    (delayed(getImageMetaData)(fp) for fp in glob.glob('../input/wikiart-gangogh-creating-art-gan/landscape/*.jpg'))\n)\nimg_meta_land = pd.DataFrame(np.array(img_meta_land))\nimg_meta_land.columns = ['Size', 'Mode', 'Hash', 'Path']","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"print(img_meta_land.shape)\nimg_meta_land.head()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"**Work In Progress**","execution_count":null}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":4}