-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Classified image #3
Comments
Which imagery did you use, RGB or MS? In case of Level 1C MS data you must guarantee the same band order as in the Eurosat dataset, if you use it for training. This order is (image band - Sentinel band): All bands have 10 m resolution. You can easily merge the the individual bands using gdal tools: # define your tile
tile_id=T32UMV_20190704T103029
# delete result image if already exists, as gdal_merge does not have an overwrite option
if test -f ${tile_id}.tif; then
rm ${tile_id}.tif
fi
# gdal_merge only supports nearest neighbor resampling
gdal_merge.py -separate -of GTiff -ps 10 10 -o ${tile_id}.tif ${tile_id}_B01.jp2 ${tile_id}_B02.jp2 ${tile_id}_B03.jp2 ${tile_id}_B04.jp2 ${tile_id}_B05.jp2 ${tile_id}_B06.jp2 ${tile_id}_B07.jp2 ${tile_id}_B08.jp2 ${tile_id}_B09.jp2 ${tile_id}_B10.jp2 ${tile_id}_B11.jp2 ${tile_id}_B12.jp2 ${tile_id}_B8A.jp2 If you don't want to use nearest neighbour interpolation, you can use gdalbuildvrt with this script: # define your tile
tile_id=T32UMV_20190704T103029
# define interpolation (nearest (default),bilinear,cubic,cubicspline,lanczos,average,mode)
interp=bilinear
# band order of EuroSAT
bands="B01 B02 B03 B04 B05 B06 B07 B08 B09 B10 B11 B12 B8A"
# delete result image if already exists, as gdal_merge does not have an overwrite option
if test -f ${tile_id}.tif; then
rm ${tile_id}.tif
fi
# (virtually) resample downloaded bands to 10 m
for band in $bands; do
gdalbuildvrt -tr 10 10 -r $interp ${tile_id}_${band}.vrt ${tile_id}_${band}.jp2
done
# merge
gdal_merge.py -separate -of GTiff -o ${tile_id}.tif ${tile_id}_B01.vrt ${tile_id}_B02.vrt ${tile_id}_B03.vrt ${tile_id}_B04.vrt ${tile_id}_B05.vrt ${tile_id}_B06.vrt ${tile_id}_B07.vrt ${tile_id}_B08.vrt ${tile_id}_B09.vrt ${tile_id}_B10.vrt ${tile_id}_B11.vrt ${tile_id}_B12.vrt ${tile_id}_B8A.vrt
# delete vrts
rm ${tile_id}_*.vrt Hope this helps. |
Thanks a lot. |
Whether to train this model, sentinel 2 L1C should we use? Whether sentinel 2A with cloud masking will give better result? |
EuroSAT dataset uses L1C. If you intend to build your own dataset L2A would be better. |
ok thanks |
Hi, Thanks a lot for the code. I trained my model and tried to classify the sentinel image with that. But all I could get is some small patches. Is there any restriction on the size of the test image? I used the same area in Germany as specified in the slide. It would be helpful if you could clarify this.

The text was updated successfully, but these errors were encountered: