-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
dbuscombe-usgs
committed
Sep 22, 2020
1 parent
016b723
commit cc35fd2
Showing
2 changed files
with
51 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |