@@ -20,7 +20,7 @@ First, download the model checkpoint to the `RSLP_PREFIX` directory.
20
20
21
21
cd rslearn_projects
22
22
mkdir -p project_data/projects/sentinel2_vessels/data_20240927_satlaspretrain_patch512_00/checkpoints/
23
- wget https://storage.googleapis.com/ai2-rslearn-projects-data/sentinel2_vessels/best.ckpt -O project_data/projects/sentinel2_vessels/data_20240927_satlaspretrain_patch512_00 /checkpoints/best.ckpt
23
+ wget https://storage.googleapis.com/ai2-rslearn-projects-data/projects/ sentinel2_vessels/data_20240213_01_add_freezing_and_fix_fpn_restore/checkpoints/ best.ckpt -O project_data/projects/sentinel2_vessels/data_20240213_01_add_freezing_and_fix_fpn_restore /checkpoints/best.ckpt
24
24
25
25
The easiest way to apply the model is using the prediction pipeline in
26
26
` rslp/sentinel2_vessels/predict_pipeline.py ` . It accepts a Sentinel-2 scene ID and
@@ -65,3 +65,82 @@ To visualize outputs on the validation set:
65
65
66
66
mkdir vis
67
67
python -m rslp.rslearn_main model test --config data/sentinel2_vessels/config.yaml --data.init_args.path project_data/datasets/sentinel2_vessels/ --model.init_args.visualize_dir vis/ --load_best true
68
+
69
+
70
+ Model Version History
71
+ ---------------------
72
+
73
+ The version names correspond to the ` rslp_experiment ` field in the model configuration
74
+ file (` data/sentinel2_vessels/config.yaml ` ).
75
+
76
+ - ` data_20240213_01_add_freezing_and_fix_fpn_restore ` : Freeze the pre-trained model for
77
+ the first few epochs before unfreezing.
78
+ - ` data_20240213_00 ` : Some of the windows contained blank images. I re-ingested the
79
+ dataset and the issue seems to be fixed. The model is re-trained.
80
+ - ` data_20240927_satlaspretrain_patch512_00 ` : initial model.
81
+
82
+
83
+ Model Performance
84
+ -----------------
85
+
86
+ ### data_20240213_01_add_freezing_and_fix_fpn_restore
87
+
88
+ - Selected threshold: 0.8
89
+ - Results on validation set (split1, split7, sargassum_val)
90
+ - Precision: 78.0%
91
+ - Recall: 77.6%
92
+ - Note it should be 20250213 but there is typo.
93
+
94
+ Docker Container with FastAPI
95
+ -----------------------------
96
+
97
+ We also have a Docker container that exposes a FastAPI interface to apply vessel
98
+ detection on Sentinel-2 scenes. This section explains how to setup the API.
99
+
100
+ ### Run the Docker container
101
+
102
+ The Docker container does not contain the model weights. Instead, it expects the model
103
+ weights to be present in a directory based on the ` RSLP_PREFIX ` environment variable.
104
+ So download the model checkpoint:
105
+
106
+ mkdir -p project_data/projects/sentinel2_vessels/data_20240213_01_add_freezing_and_fix_fpn_restore/checkpoints/
107
+ wget https://storage.googleapis.com/ai2-rslearn-projects-data/projects/sentinel2_vessels/data_20240213_01_add_freezing_and_fix_fpn_restore/checkpoints/best.ckpt -O project_data/projects/sentinel2_vessels/data_20240213_01_add_freezing_and_fix_fpn_restore/checkpoints/best.ckpt
108
+
109
+ Run the container:
110
+
111
+ ``` bash
112
+ export SENTINEL2_PORT=5555
113
+ docker run \
114
+ --rm -p $SENTINEL2_PORT :$SENTINEL2_PORT \
115
+ -e RSLP_PREFIX=/project_data \
116
+ -e SENTINEL2_PORT=$SENTINEL2_PORT \
117
+ -v $PWD /project_data/:/project_data/ \
118
+ --shm-size=15g \
119
+ --gpus all \
120
+ ghcr.io/allenai/sentinel2-vessel-detection:sentinel2_vessels_v0.0.1
121
+ ```
122
+
123
+ ### Auto Documentation
124
+
125
+ This API has enabled Swagger UI (` http://<your_address>:<port_number>/docs ` ) and ReDoc (` http://<your_address>:<port_number>/redoc ` ).
126
+
127
+ ### Making Requests
128
+
129
+ Process a scene by its Sentinel-2 scene ID. Note that the crop path is optional.
130
+
131
+ ``` bash
132
+ curl -X POST http://localhost:${SENTINEL2_PORT} /detections -H " Content-Type: application/json" -d ' {"scene_id": "S2A_MSIL1C_20180904T110621_N0206_R137_T30UYD_20180904T133425", "crop_path": "crops/"}'
133
+ ```
134
+
135
+ The API will respond with the vessel detection results in JSON format.
136
+
137
+ Alternatively, process the scene by providing the paths to the image assets. The paths
138
+ can be URIs but must be accessible from the Docker container.
139
+
140
+ ``` bash
141
+ curl -X POST http://localhost:${SENTINEL2_PORT} /detections -H " Content-Type: application/json" -d ' {"image_files": [{"bands": ["R", "G", "B"], "fname": "gs://gcp-public-data-sentinel-2/tiles/30/U/YD/S2A_MSIL1C_20180904T110621_N0206_R137_T30UYD_20180904T133425.SAFE/GRANULE/L1C_T30UYD_A016722_20180904T110820/IMG_DATA/T30UYD_20180904T110621_TCI.jp2"}, {"bands": ["B08"], "fname": "gs://gcp-public-data-sentinel-2/tiles/30/U/YD/S2A_MSIL1C_20180904T110621_N0206_R137_T30UYD_20180904T133425.SAFE/GRANULE/L1C_T30UYD_A016722_20180904T110820/IMG_DATA/T30UYD_20180904T110621_B08.jp2"}]}'
142
+ ```
143
+
144
+ ### Docker Container Version History
145
+
146
+ - v0.0.1: initial version. It uses model ` data_20240213_01_add_freezing_and_fix_fpn_restore ` .
0 commit comments