{"cells":[{"metadata":{},"cell_type":"markdown","source":"# A Simple EDA"},{"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)\nimport cv2\nimport matplotlib.pyplot as plt\nfrom mpl_toolkits.mplot3d import Axes3D\nimport os\nimport json\nfrom sklearn import preprocessing\n# Input data files are available in the \"../input/\" directory.","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Set the paths for various files"},{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"# This is not an optimal way to do it.\ndataset_path = '/kaggle/input/pku-autonomous-driving/'\nsample_submission_path = dataset_path + 'sample_submission.csv'\ntest_images_path = dataset_path + 'test_images/'\ntest_masks_path = dataset_path + 'test_masks/'\ntrain_images_path = dataset_path + 'train_images/'\ntrain_masks_path = dataset_path + 'train_masks/'\ntrain_path = dataset_path + 'train.csv'\ncar_models_path = dataset_path + 'car_models/'\ncar_models_json_path = dataset_path + 'car_models_json/'","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Print 5 rows of data from sample_submission.csv and also the shape"},{"metadata":{"trusted":true},"cell_type":"code","source":"ss_df = pd.read_csv(sample_submission_path)\nprint(ss_df.head(n=5))\nprint(ss_df.shape)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Print 5 rows of data from train.csv and also the shape"},{"metadata":{"trusted":true},"cell_type":"code","source":"train_df = pd.read_csv(train_path)\nprint(train_df.head(n=5))\nprint(train_df.shape)","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Display few images from training set and test set"},{"metadata":{"trusted":true},"cell_type":"code","source":"# print train images in row 1\nf, axarr = plt.subplots(2,3, figsize = (15,5))\nfor i in range(3):\n    image_name = str(train_df['ImageId'].iloc[i])+'.jpg'\n    im_read = cv2.imread(train_images_path + image_name,1)\n    im = cv2.cvtColor(im_read, cv2.COLOR_BGR2RGB)\n    axarr[0][i].imshow(im)\n    axarr[0][i].set_title(image_name)\n    axarr[0][i].axis('off')\n    \n# print test images in row 2    \ntest_image_names = os.listdir(test_images_path)\nfor i in range(3):\n    im_read = cv2.imread(test_images_path + test_image_names[i],1)\n    im = cv2.cvtColor(im_read, cv2.COLOR_BGR2RGB)\n    axarr[1][i].imshow(im)\n    axarr[1][i].set_title(image_name)\n    axarr[1][i].axis('off')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{},"cell_type":"markdown","source":"# Display the 3D model of a car"},{"metadata":{"trusted":true},"cell_type":"code","source":"car_models_json_names = os.listdir(car_models_json_path)\nwith open(car_models_json_path + car_model_json_names[1]) as json_file:\n    jsonData = json.load(json_file)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"vertices = np.asarray(jsonData['vertices'])\nfaces = np.array(jsonData['faces']) - 1\nplt.figure()\nax = plt.axes(projection='3d')\nax.set_title(jsonData['car_type'])\nax.plot_trisurf(vertices[:,0], vertices[:,2], faces, -vertices[:,1])\nax.axis('off')\nplt.show()","execution_count":null,"outputs":[]}],"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":1}