This video demonstrates a complete workflow for predicting wheat yield using satellite data and deep learning: (1) Collect multi-source satellite data including NDVI from Sentinel-2 and Landsat 8, precipitation, temperature, and soil moisture using Google Earth Engine; (2) Export training samples as CSV files containing feature values and ground-truth yield data; (3) Preprocess data by normalizing features with StandardScaler and splitting into 80% training and 20% testing sets; (4) Build a transformer-based regression model using PyTorch with Adam optimizer; (5) Train the model for 100 epochs and evaluate using RMSE and R² scores; (6) Apply the trained model to full imagery to generate yield prediction maps in GeoTIFF format for visualization and analysis.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Satellite-Based Wheat Yield Forecasting using GEE & Transformer Neural Network
Added:Hello everyone, welcome to the study hacks institute of GIS and remote sensing. Hope you are well. Today I discuss a very important topic mainly how we can easily use the transformer based with yield prediction model using pytors. So I will try to explain all of details step by step. I will try to explain then I hope you can easily get the idea and further you can easily work with that. So in this case we are just use different types of uh parameter as a features. So in this case I try to use for NDVI mainly for signal 2 landset 8 and modice. So then also use the charts mainly precipitation data. Then we also use for the temperature data and also use the soil moisture data. Okay. And then we also have this type of eel data.
EL data basically this type of yield. So now I have this type of data. So this data we need to also create it. Okay. So how I can create it? So uh for this we can easily use this type of training sample if you check. So we just use the Google Earth engine. So basically in this time it's one kind of prop prediction. But in this case we are just use the machine learning. But if you want you can also get the more advanced result when you are using at the deep learning. So this type of same data you also use in here. So this is my study area. So for this study area I have this type of training point. Basically this type of point I have the uh eel data.
Okay this type of place. So now I want to use this type of yield data and then I just create the transformer based with yield prediction model using pytors mainly deep learning which I apply in here. So this type of point I already have and I already have this type of value for yield value. Okay. So now for this point I just need to extract this type of information. So I need to extract the information for NDVI value then charts mainly precipitation value then temperature value and also soil moisture value. So for that we are just use the Google Earth engine. So in the Google Earth engine we try to combine all of those NDVI from Sinel to satellite imagery NDVI from Lancet NDVI mod then precipitation then temperature and soil moisture. Then we download the data as a CSV file format. Okay, this data is simply downloaded as a CSV file format. Okay, so then we are just use this CSV file in here. So this is my CSV file. This CSV file I simply import in the Google Collab and then I find out this type of result. So in this time we find out this type of value for each crop yield point. We find out this type of result and before that I also imported some necessary library such as pandas then pros then this type of scalan model. So all of necessary libraries simply imported and this is my uh sample okay sample data for the crop yield. So for this training sample I already struck this type of information land set NDVI modus NDVI precipitation then NDVI from sentinel 2 then soil moisture and I have also ground truth data for probe eel data okay we find out so this is my data set so then we try to apply the drop geometry column if exist so then we try to simply ignore and then feature so in this time this type this column I just make a list of features and this is my target. Okay. So we are simply create the two list. One is for features. In the feature we try to add all of um features. So if you want you can also add the more features to get the more better result. And then our target value basically yield because we want to predict for yield. Then remove all of null values. So just simply tf and then simply just uh take the float 32 and reshape it one array. So then normalize the feature just we use the standard scaler and normalize and fit with the transform using the scalar value and reshape for the transform sample we try to reshape it and then spill the data uh x train x test and y train and y test just simply split and we are just using the 80% data for train our model and 20% data just check for our accuracy then convert to tr tensor so for that just simply call this pro I already imported this library and then use the tensor function. Then X train, X test, Y train and Y test just we simply convert to cross tensors and then we create the transformerbased regression model. So this is the model for the transformerbased regression model. So in this model we just created and then this model is simply connect with our training data set 80% training data set and in this case we create the model and use the Adam optimizer okay and also called the pro or Adam optimizer we try to apply in here and then we are just create the uh loop for 100 time we create this type of uh epoch we create 10 20 30 40 50 60 80 90 and 100 we create and also estimate the loss okay and then evaluate this model. Okay. So then we try to check the root mean square error and also create the R squar score. We find out from here and finally we create the plot for that actual yield value and predicted it value. So we find out this type of valency this is the actual yield value it's collecting from our um ground data and predicted value.
So it's come from the prediction result.
Okay. And we find out this type of graph or line we find out in here. So this is the transformer weight ill prediction graph we also find out. So now we try to visualize our imagery. Okay. So for that we need to import the rastero then pro then cross skit learn and m plot li this type of necessary library simply imported or install it then imported this type of library and now we load the uh imagery. Basically it's a combined imagery. Okay this combined imagery basically it's come from our Google Earth engine. So this combined imagery uh we you can see this is the combined so it including all of those all of uh imagery such as NDVI mod NDVI senel to NDVI precipitation temperature so merure so this combined imagery we simply export as a geotip file format and then import it in the Google collab okay then we simply reshape it and also transpose basically a height width and band and replace the field values with infill with non non values and F and drop about the reshape it. Okay. And finally standard using the scalar as a training.
So just simply scalar standard scaler and reshape for the transformer. Just use the code for reshape for transformer. And finally we import the tr for the e transformer model we created. And this model is save. Okay.
And I put the name. This is the this model is simply save using this name.
And further we simply define the model architecture exactly the same as before.
So just we simply put here the five because in this case I just use the five features. So that's why I simply put here the five and then we find out this type of model and then this model we just use the u best size put in define the 100. Okay. So sometime if it the crashing then we try to increasing or decreasing this value otherwise it also okay there is no problem and further we just evaluate the show the uh reconstruct the full imagery for our output imagery. So we put this type of output about the imagery. And finally we download this imagery. If you want download the geot file format as well as if you want you can also display this type of map using the rasterio package.
So we find out this type of map. So this is the crop yield prediction map we find out in here. So turns per hectare unit.
So we can easily identify you can also use the different types of color or if you want you can also download is a geot file format and for that you can also use it in dark map or QS software for making the map. So this is the way for the u transformer based weight yield prediction we can easily use. If you want you can also add here the more further u features then it will look more better. Okay. So if you have any question or any doubt you can simply contact I also give the answer about that. So today is no more. Thank you for watching that. Stay happy stay safe.
Related Videos

Expanding Stikbot thumbnails
leopoldshorts
2K views•2023-09-24

Digital Discrimination: Cognitive Bias in Machine Learning
redmonktechevents2974
4K views•2019-12-18

Evolutionary Approach to Clustering by Ujjwal Maulik
ICTStalks
279 views•2019-06-26

Rose Yu "Learning from Large-Scale Spatiotemporal Data"
networkscienceinstitute
2K views•2019-03-04

Stanford Seminar - Generalization through Task Representations with Foundation Models
stanfordonline
4K views•2025-07-14

Paradigm Shifts in Data Processing for the Generative AI Era: Robert Nishihara of Anyscale & Ray.io
GradientFlow
2K views•2025-01-02

How to Build Your Own GenAI-Based Knowledge Management System
2150GmbH
360 views•2025-06-03

Time Crystals on Money?! Future of Cryptography is Here!
FromFirstPrinciplesPod
573 views•2025-09-25
Trending

Lupita Nyong'o Goes Viral For Her Horrible Take On The Odyssey
TheAmalaEkpunobi
62K views•2026-07-06

What Went Wrong With Alpha? | Spoiler Talk & Discussion
TriedRefusedProductions
76K views•2026-07-06

Ford Rehires Engineers They Had Replaced With AI
stevelehto
39K views•2026-07-06

CHINA BANS GOLD TRADING
lenapetrova
69K views•2026-07-06