Skip to content

Commit

Permalink
9/22/20
Browse files Browse the repository at this point in the history
  • Loading branch information
dbuscombe-usgs committed Sep 22, 2020
1 parent 016b723 commit cc35fd2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,15 @@
# mlmondays_data_imrecog
Datasets for the 'image recognition' ML-Mondays lessons
Datasets for the 'image recognition' ML-Mondays lessons


Activate the `mlmondays` conda environment

`conda activate mlmondays`

Run the providing script:

`python download_data.py`

Deactivate the `mlmondays` conda environment

`conda deactivate mlmondays`
37 changes: 37 additions & 0 deletions download_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

import os, zipfile
import tensorflow as tf

os.mkdir('data')
os.mkdir('data/tamucc')


folders_to_extract_to = [
'./data',
'./data/tamucc',
'./data/tamucc',
'./data/tamucc',
'./data/tamucc',
'./data/tamucc',
]

files_to_download = [
'nwpu.zip',
'tamucc_full_2class.zip',
'tamucc_full_4class.zip',
'tamucc_subset_2class.zip',
'tamucc_subset_3class.zip',
'tamucc_subset_4class.zip',
]


for k in range(len(files_to_download)):
file = files_to_download[k]
folder = folders_to_extract_to[k]
url = "https://github.com/dbuscombe-usgs/mlmondays_data_imrecog/releases/download/0.1.0/"+file
filename = os.path.join(os.getcwd(), file)
print("Downloading %s ... " % (filename))
tf.keras.utils.get_file(filename, url)
print("Unzipping to %s ... " % (folder))
with zipfile.ZipFile(file, "r") as z_fp:
z_fp.extractall("./"+folder)

0 comments on commit cc35fd2

Please sign in to comment.