This is the starting kit for the competition: AI on the edge: "the OPS-SAT case" - Starter kit.
Directory content
The competition_toolkit includes:
efficientnet_lite.py, this is a slightly edited version of the Keras-based implementation of the EfficientNet-lite-0 deep neural network included in efficientnet-lite-keras. This is the Deep Neural Network model that shall be used for the competition. Submissions exploiting different architecture will be discarded.
starter_kit_notebook.ipynb: this notebook shows how to load the competition dataset, instatiate and train an EfficientNet-lite-0 model, included in efficientnet_lite.py and evaluate it by using the metrics described in here.
serverside_evaluation.ipynb: this script shows the pipeline used to evaluate a submission. Such a pipeline includes, HDF5 weights loading and model checking, conversion from TF (Keras) model to tflite by using float16 quantization format (please, refer to post-training float16 - quantization) and score calculation by using the metrics described here.
pytorch_to_tf_conversion.ipynb: this notebook provides a utility to converts EfficientNet-lite-0 models trained in PyTorch by using the efficientnet-lite-pytorch and efficientnet_lite0_pytorch_model python packages to the TF (Keras) model included in efficientnet_lite.py.
model_pytorch_baseline.pth: This is an example of a valid PyTorch model (same as the competition baseline) which is used to showcase its translation to a valid submission file.
Getting started
Clone this repository:
git clone https://gitlab.com/EuropeanSpaceAgency/the_opssat_case_starter_kit.git
cd the_opssat_case_starter_kit
In our servers, where the submissions are evaluated, the following version of core packages are running:
python3.9
tensorflow2.7.0
numpy1.21.1
sciki_learn1.0.2
cudatoolkit11.2
cudnn8.1.0
To create a similar environment on your machine, assuming you are in an updated conda base environment, you can run:
If you have GPUs (not strictly needed fot he notebooks, but highly useful for the competition) you will also need to install the correct versions of cudatoolkit and cudnn before the tensorflow installation.
Note that we pinned the tensorflow version and python version: the notebooks in this starter kit may break if different versions are used, since the tensorflow/keras API is not stable.
Eventually, to test the correct installation of tensorflow, you can run:
python
import tensorflow
If you get a PROTOBUF error, you can fix it by running:
conda install protobuf=3.20.1
If you want to use the pytorch_to_tf_conversion.ipynb notebook to convert a model trained on Pytorch and based on efficientnet-lite-pytorch and efficientnet_lite0_pytorch_model, you need to run the following commands to install efficientnet_lite0_pytorch_model and efficientnet_lite0_pytorch_model:
The competition dataset can be downloaded from the following Zenodolink. Consecutively to the download, proceed as follows:
Create a directory ops_sat_competiton_official.
Unzip ops_sat_competiton_official.zip in the ops_sat_competiton_official.
Once unzipped, the ops_sat_competiton_official will contain:
a subdirectory for each of the 8 competition class: Agricultural, Cloud, Mountain, Natural,River, Sea_ice, Snow, and Water. Each of this subdirectory includes 10 200x200x3-patches of that class (labeled traing data).
a subdirectory images containing 26 2048x1944x3 or 2048x1942x3 raw OPS-SAT satellite images. The competitors can dispose of these images to implement a training strategy to improve their models.
*N.B.**: imagesDOES NOT contain data of one of the competition class. Therefore, to run the notebooks correctly, the directory imagesshall be removed from the ops_sat_competiton_official directory to run the previous notebooks correctly.
关于
ESA 官方 GitLab 组织入口,集中托管 ESA 官方开源项目(OPS-SAT 竞赛套件等),是获取 ESA 官方航天开源软件的主要入口。来源 https://gitlab.com/EuropeanSpaceAgency,License 见文末许可证核查表
AI on the edge: “the OPS-SAT case” - Starter kit
Scripts to clean and prepare the OPSSAT competition dataset.
Table of Contents
About The Project
This is the starting kit for the competition:
AI on the edge: "the OPS-SAT case" - Starter kit.Directory content
The
competition_toolkitincludes:efficientnet_lite.py, this is a slightly edited version of the Keras-based implementation of theEfficientNet-lite-0deep neural network included in efficientnet-lite-keras. This is the Deep Neural Network model that shall be used for the competition. Submissions exploiting different architecture will be discarded.starter_kit_notebook.ipynb: this notebook shows how to load the competition dataset, instatiate and train anEfficientNet-lite-0model, included inefficientnet_lite.pyand evaluate it by using the metrics described in here.serverside_evaluation.ipynb: this script shows the pipeline used to evaluate a submission. Such a pipeline includes,HDF5weights loading and model checking, conversion fromTF (Keras)model totfliteby usingfloat16quantization format (please, refer to post-training float16 - quantization) and score calculation by using the metrics described here.pytorch_to_tf_conversion.ipynb: this notebook provides a utility to convertsEfficientNet-lite-0models trained in PyTorch by using the efficientnet-lite-pytorch and efficientnet_lite0_pytorch_model python packages to theTF (Keras)model included inefficientnet_lite.py.model_pytorch_baseline.pth: This is an example of a valid PyTorch model (same as the competition baseline) which is used to showcase its translation to a valid submission file.Getting started
Clone this repository:
In our servers, where the submissions are evaluated, the following version of core packages are running:
python3.9tensorflow2.7.0numpy1.21.1sciki_learn1.0.2cudatoolkit11.2cudnn8.1.0To create a similar environment on your machine, assuming you are in an updated conda base environment, you can run:
If you have GPUs (not strictly needed fot he notebooks, but highly useful for the competition) you will also need to install the correct versions of
cudatoolkitandcudnnbefore the tensorflow installation.Note that we pinned the tensorflow version and python version: the notebooks in this starter kit may break if different versions are used, since the tensorflow/keras API is not stable.
Eventually, to test the correct installation of
tensorflow, you can run:If you get a
PROTOBUFerror, you can fix it by running:If you want to use the
pytorch_to_tf_conversion.ipynbnotebook to convert a model trained onPytorchand based on efficientnet-lite-pytorch and efficientnet_lite0_pytorch_model, you need to run the following commands to installefficientnet_lite0_pytorch_modelandefficientnet_lite0_pytorch_model:Competition data
The competition dataset can be downloaded from the following
Zenodolink. Consecutively to the download, proceed as follows:ops_sat_competiton_official.ops_sat_competiton_official.zipin theops_sat_competiton_official.Once unzipped, the
ops_sat_competiton_officialwill contain:a subdirectory for each of the 8 competition class:
Agricultural,Cloud,Mountain,Natural,River,Sea_ice,Snow, andWater. Each of this subdirectory includes 10 200x200x3-patches of that class (labeled traing data).a subdirectory
imagescontaining 26 2048x1944x3 or 2048x1942x3 raw OPS-SAT satellite images. The competitors can dispose of these images to implement a training strategy to improve their models.*N.B.**:
imagesDOES NOT contain data of one of the competition class. Therefore, to run the notebooks correctly, the directoryimagesshall be removed from theops_sat_competiton_officialdirectory to run the previous notebooks correctly.