{"cells":[{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"f9168dcc-009c-e598-ece6-476b3d117b2c"},"outputs":[],"source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nfrom subprocess import check_output\nprint(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n\n# Any results you write to the current directory are saved as output.\n\nload_train_data()\nload_test_data()\ndata_preparing()\nfit_data()\nevaluate()\n\ndef load_train_data()\n    X_train = []\n    y_train = []\n    driver_id = []\n\n    driver_data = get_driver_data()\n\n    print('Read train images')\n    for j in range(10):\n        print('Load folder c{}'.format(j))\n        path = os.path.join('..', 'input', 'train', 'c' + str(j), '*.jpg')\n        files = glob.glob(path)\n        for fl in files:\n            flbase = os.path.basename(fl)\n            if type == 0:\n                img = get_im_cv2(fl, img_rows, img_cols, color_type)\n            elif type == 1:\n                img = get_im_skipy(fl, img_rows, img_cols, color_type)\n            else:\n                img = get_im_tf(fl, img_rows, img_cols, color_type)\n            X_train.append(img)\n            y_train.append(j)\n            driver_id.append(driver_data[flbase])\n\n    unique_drivers = sorted(list(set(driver_id)))\n    print('Unique drivers: {}'.format(len(unique_drivers)))\n    print(unique_drivers)\n    return X_train, y_train, driver_id, unique_drivers\n"},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"b7253237-f841-ee9a-4bd8-9950d50e8873"},"outputs":[],"source":""}],"metadata":{"_change_revision":0,"_is_fork":false,"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"codemirror_mode":{"name":"ipython","version":3},"file_extension":".py","mimetype":"text/x-python","name":"python","nbconvert_exporter":"python","pygments_lexer":"ipython3","version":"3.6.0"}},"nbformat":4,"nbformat_minor":0}