{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "accelerator": "GPU", "colab": { "name": "NVIDIA_Model.ipynb", "provenance": [] }, "kernelspec": { "display_name": "Python 3", "name": "python3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "BKnMAKV2juCn", "outputId": "6e405f7b-56c2-45d9-bbe3-257c81f6d892" }, "source": [ "#!git clone https://github.com/tbchhetri/DrivingData #use ! to invoke bash commands to use commands like ls cd git clone, these can just be used as a command line" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "fatal: destination path 'DrivingData' already exists and is not an empty directory.\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "LfxvLfwutcaw", "outputId": "26bc021f-c1e8-43f0-acea-b51b4537d9c8" }, "source": [ "from google.colab import drive #details: https://youtu.be/InZ16tcM9Pc, https://youtu.be/58t0PFIWR9Y\n", "drive.mount('/content/drive')" ], "execution_count": null, "outputs": [ { "output_type": "stream", "text": [ "Mounted at /content/drive\n" ], "name": "stdout" } ] }, { "cell_type": "code", "metadata": { "id": "tgWQ03ADJdGV" }, "source": [ "import os\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import matplotlib.image as mpimg\n", "import keras\n", "from keras.models import Sequential\n", "from keras.optimizers import Adam\n", "from keras.layers import Convolution2D, MaxPooling2D, Dropout, Flatten, Dense\n", "from sklearn.utils import shuffle\n", "from sklearn.model_selection import train_test_split\n", "from imgaug import augmenters as iaa #https://imgaug.readthedocs.io/en/latest/\n", "import cv2\n", "import pandas as pd\n", "import ntpath #to cut the path \n", "import random" ], "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 204 }, "id": "d1ZONeyBKPPK", "outputId": "8f4a94cd-205a-44e8-89a5-e394456714c6" }, "source": [ "#getting the data from the git and save it in a var\n", "#gitData = \"DrivingData\"\n", "gitData = r'/content/drive/MyDrive/DrivingData'\n", "columns = ['center','steering', 'speed'] #inref to the csv file\n", "drivingData = pd.read_csv(os.path.join(gitData, 'driving_log.csv'), names = columns)\n", "drivingData.head()" ], "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "
\n", " | center | \n", "steering | \n", "speed | \n", "
---|---|---|---|
0 | \n", "/Volumes/MyData/Data/College/Winter20/training... | \n", "0.0 | \n", "0.000077 | \n", "
1 | \n", "/Volumes/MyData/Data/College/Winter20/training... | \n", "0.0 | \n", "0.000079 | \n", "
2 | \n", "/Volumes/MyData/Data/College/Winter20/training... | \n", "0.0 | \n", "0.000079 | \n", "
3 | \n", "/Volumes/MyData/Data/College/Winter20/training... | \n", "0.0 | \n", "0.000079 | \n", "
4 | \n", "/Volumes/MyData/Data/College/Winter20/training... | \n", "0.0 | \n", "0.000080 | \n", "