Can I get CSV files of both training and test sets. Having an issue installing a few libraries
If you are using colab, you have to use python 3.9. Here are the details.
--------------------------------------------------
1. Install python 3.9
from IPython.display import clear_output
!python --version
!wget -O mini.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
!chmod +x mini.sh
!bash ./mini.sh -b -f -p /usr/local
!conda install -q -y jupyter
!conda install -q -y google-colab -c conda-forge
!python -m ipykernel install --name "py39" --user
clear_output()
2. Install libs
!pip install rasterio==1.3.0
!pip install radiant_mlhub==0.5.2
Note that these libs. are only available in the shell command
3. Write a script with your own api key
%%writefile my_downloader.sh
import rasterio
from radiant_mlhub import Dataset
import radiant_mlhub
print(rasterio.__version__, radiant_mlhub.__version__)
import os
import glob
Full_bands = ['B01', 'B02', 'B03', 'B04','B05', 'B06', 'B07', 'B08','B8A', 'B09', 'B11', 'B12']
selected_bands = Full_bands # Full_bands[1:4] + [Full_bands[-5]] #'B02', 'B03', 'B04', 'B08'
#define dataset collection_id , assets and necessary paths to collections
main = 'ref_agrifieldnet_competition_v1'
assets = ['field_ids','raster_labels']
source_collection = f'{main}_source'
train_label_collection = f'{main}_labels_train'
test_label_collection = f'{main}_labels_test'
api_key = "YOUR API KEY"
os.environ['MLHUB_API_KEY'] = api_key # getpass.getpass(prompt="MLHub API Key: ")
dataset = Dataset.fetch(main)
my_filter = dict(
ref_agrifieldnet_competition_v1_labels_train=assets,
ref_agrifieldnet_competition_v1_labels_test=[assets[0]],
ref_agrifieldnet_competition_v1_source=selected_bands
)
dataset.download(collection_filter=my_filter)
4. Download data
!python my_downloader.sh
5. Zip and download the file
Good luck,
M
Thank you very much. I appreciate
Thanks. Have question. I've install rasterio and radiant_mlhub, but when I try to import them - got message ModuleNotFoundError: No module named 'radiant_mlhub'. The same for rasterio. What did I do wrong?
"Note that these libs. are only available in the shell command"
You need to create the proposed "3. Write a script with your own api key" with "%%writefile my_downloader.sh"
If you are using colab, you have to use python 3.9. Here are the details.
--------------------------------------------------
1. Install python 3.9
--------------------------------------------------
from IPython.display import clear_output
!python --version
!wget -O mini.sh https://repo.anaconda.com/miniconda/Miniconda3-py39_4.9.2-Linux-x86_64.sh
!chmod +x mini.sh
!bash ./mini.sh -b -f -p /usr/local
!conda install -q -y jupyter
!conda install -q -y google-colab -c conda-forge
!python -m ipykernel install --name "py39" --user
clear_output()
!python --version
--------------------------------------------------
2. Install libs
--------------------------------------------------
!pip install rasterio==1.3.0
!pip install radiant_mlhub==0.5.2
Note that these libs. are only available in the shell command
--------------------------------------------------
3. Write a script with your own api key
--------------------------------------------------
%%writefile my_downloader.sh
import rasterio
from radiant_mlhub import Dataset
import radiant_mlhub
print(rasterio.__version__, radiant_mlhub.__version__)
import os
import glob
Full_bands = ['B01', 'B02', 'B03', 'B04','B05', 'B06', 'B07', 'B08','B8A', 'B09', 'B11', 'B12']
selected_bands = Full_bands # Full_bands[1:4] + [Full_bands[-5]] #'B02', 'B03', 'B04', 'B08'
#define dataset collection_id , assets and necessary paths to collections
main = 'ref_agrifieldnet_competition_v1'
assets = ['field_ids','raster_labels']
source_collection = f'{main}_source'
train_label_collection = f'{main}_labels_train'
test_label_collection = f'{main}_labels_test'
api_key = "YOUR API KEY"
os.environ['MLHUB_API_KEY'] = api_key # getpass.getpass(prompt="MLHub API Key: ")
dataset = Dataset.fetch(main)
my_filter = dict(
ref_agrifieldnet_competition_v1_labels_train=assets,
ref_agrifieldnet_competition_v1_labels_test=[assets[0]],
ref_agrifieldnet_competition_v1_source=selected_bands
)
dataset.download(collection_filter=my_filter)
--------------------------------------------------
4. Download data
--------------------------------------------------
!python my_downloader.sh
--------------------------------------------------
5. Zip and download the file
--------------------------------------------------
Good luck,
M
Thank you very much. I appreciate
Thanks. Have question. I've install rasterio and radiant_mlhub, but when I try to import them - got message ModuleNotFoundError: No module named 'radiant_mlhub'. The same for rasterio. What did I do wrong?
"Note that these libs. are only available in the shell command"
You need to create the proposed "3. Write a script with your own api key" with "%%writefile my_downloader.sh"