Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inspired from
- https://colab.research.google.com/github/corykendrick/fastai_in_colab/blob/master/Using_Google_Colab_for_Fastai.ipynb#scrollTo=8w2pvt26J6al
- !curl -s https://course.fast.ai/setup/colab | bash
- %reload_ext autoreload
- %autoreload 2
- from google.colab import drive
- drive.mount('/content/gdrive', force_remount=True)
- root_dir = "/content/gdrive/My Drive/"
- base_dir = root_dir + 'fastai-v3/'
- %matplotlib inline
- !pwd
- path = Path(base_dir + 'data/planet')
- path
- # Make sure the data is where you think it is:
- !ls '/content/gdrive/My Drive/fastai-v3/data/planet'
- #get the train tar here
- #https://forums.fast.ai/t/lesson-2-amazon-dataset-no-tar-or-zip-file/63926/4
- #get the labelling csv from kaggle
- #upload both to '/content/gdrive/My Drive/fastai-v3/data/planet'
- #intended directory structure as reference https://i.imgur.com/dfQFUsZ.png
- # In order to unzip the 7z files, need to install p7zip
- # This was helpful: http://forums.fast.ai/t/unzipping-tar-7z-files-in-google-collab-notebook/14857/4
- !apt-get install p7zip-full
- !apt install unzip
- # unzip a file named 'train_v2.csv.zip'
- # no need extension to include the .zip extension
- # -d is the name of the directory to extract to
- !unzip "/content/gdrive/My Drive/fastai-v3/data/planet/train_v2.csv" -d "/content/gdrive/My Drive/fastai-v3/data/planet"
- # Unzip the .tar files to 'somewhere'
- !tar -xvf /content/gdrive/My\ Drive/fastai-v3/data/planet/train-jpg.tar
- # Move the unzipped folders('somewhere') back into data/planet/
- #
- !mv train-jpg /content/gdrive/My\ Drive/fastai-v3/data/planet/
- #la di da
- df = pd.read_csv(path/'train_v2.csv')
- df.head()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement