Skip to content

CropTypes: Training and test data for your own model, save time and compare your model performance

Notifications You must be signed in to change notification settings

michl-in-pan/CropTypes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Alt text

Environment setup for Python3

Create a new virtual environment with

python3 -m venv env

activate it

source env/bin/activate

install requirements

pip3 install -r requirements.txt 

and enjoy

jupyter lab notebook/CropType.ipynb

Introduction

The following code snippets show examples of how a classification can be carried out with the sources and what data is required for this. We would be pleased if you test and compare your methods with the same data.

Crop Data

The data is loaded as follows:

fp = "../data/cropdata/Test_area.shp"
gpd_frame = gpd.read_file(fp)
gpd_frame.plot()

The codes in column "NC_ant" stand for:
Potato: 600
Winter barley: 131
Corn: 400
Winter rapeseed: 311
Winter wheat: 115
Sugar beet: 603
Other: 1

Satellite Data

The satellite data have a temporary resolution of 2 weeks and include the average values for raw bands (B1-B12), NDVI, NDWI, REIP and NDWI. A total of 2099 fields were randomly selected in Upper Bavaria and corresponding Sentinel-2 data from February to August were added. The data is already preprocessed and downloaded form Google Earth Engine. (interpolation: 2 weeks, Scene meta cloud filter: 20%)

We provide two data sets (data2016-2018.xlsx and testdata.xlsx). The test data set is an independent data set with fields near Dürnast, Freising in 2018 with additional 301 crop records.

First-Layer Attention Heads

Classification

The CropType notebook describes the classification based on a trained model. The record contains various satellite data if you want to train your own model.

# load the model 2016-2018
filename='../model/model_RF_bands_161718_withoutother.sav'
loaded_model = pickle.load(open(filename, 'rb'))

#predict label
y_pred = loaded_model.predict(X=X)

Alt text

Acknowledgment

StMELF, the Bavarian State Ministry of Agriculture and Forestry supported this research with its crop type data set. Many thanks for permission to publish the data for research purposes. License: CC BY-NC 4.0

About

CropTypes: Training and test data for your own model, save time and compare your model performance

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Jupyter Notebook 100.0%