Blog Posts

agriKOPA and agriPOS - Bridging Financial Gaps in Smallholder Agriculture

– By Esther Ogbole
Over the years, bridging the financial gaps in smallholder agriculture has remained challenging in developing countries of the global south. Farmers in these parts of the world are mostly resource-poor, considered ‘unbankable,’ and need access to financial services. Access to financial services eases the adoption of improved technologies and investment in production, purchasing inputs, and transportation to formal markets. As such, an overview of the agricultural value chain from accessing inputs to output markets indicates that the sustainability of food systems, particularly in the global south, depends partly on access to finance. Digital platforms such as the agriKOPA and agriPOS have been developed by agriBORA to promote the financial inclusion of smallholder farmers in Kenya.

The agriKOPA

The agriKOPA is a service that helps unbanked farmers get loans. It uses a credit scoring system to match them with lenders who provide loans through the platform. The registered farmers attached to the agriHUBs are able to carry out smooth transactions with improved access to farm inputs for sustained food production. It also enables the blockage of financial leakages that may occur with physical transactions, helps farmers maintain traceable farm records, and consequently develops a credit score that enables access to financial institutions. The credit score functionality of the agriKOPA is important as farmers are often constrained from accessing insurance, credits, and loans due to the unavailability of farm/financial records.

While it is reported that over 80% of farmers in Kenya have access to mobile financial services, less than 15% of these services are traceable to agriculture. However, research findings reveal that using financial tools in agriculture reduces farmers’ vulnerability to risks and has the potential for poverty alleviation. With this awareness, agriBORA supports smallholder farmers in Kenya in generating data through the agriKOPA, making them more visible and bankable to financial institutions. Having provided over 50,000 farmers with access to input data and available output markets through satellite imagery, the agriKOPA facilitates smooth value-chain transactions for farmers, thereby improving farm efficiency.

The agriBORA agriPOS

The agriPOS is a mobile application developed by agriBORA for Customer Relationship Management (CRM) among its agriHUB managers. The goal is to enable grassroots agro-based businesses to thrive while facilitating farmers’ access to the agri-inputs and outputs markets they offer. Unlike the conventional Point of Sales (PoS) devices, the agriPOS is linked to farmers’ funded agriKOPA through which payments can be made. The application helps agriHUB managers identify customers’ purchasing patterns through bookkeeping, thus guiding decision-making processes. In addition to data from Earth Observation (EO) and blockchain, the agriPoS, similar to the agriWallet, proves the creditworthiness of agriHUB managers and enables access to credit and loan facilities.

Conclusion

Digital financial platforms such as the agriKOPA and agriPOS are a means to an end. Both platforms reposition agricultural value-chain actors by mainly creating and storing farm data that facilitate access to opportunities that improve production and marketing efficiency. They also facilitate increased yields and increased agribusiness growth potentials. These benefits, in turn, enable actors to consistently contribute to food production, thus addressing problems relating to food and nutrition insecurity.    

Space Technologies for Socio-Economic Benefits

 – By Billy Adwar
The Kenya Space Expo Conference 2024 was a ground-breaking event that highlighted the transformative power of space technologies for socio-economic development. Startups, companies, corporations, and international organizations came together to showcase how Earth observation and space technologies are making significant impacts in our daily lives.agriBORA had the opportunity to participate as both an exhibitor and a speaker. At our booth, we demonstrated how we integrate Earth observation data into our credit recommendation service, agriKOPA. This innovative approach combines EO data with traditional data to bridge the gap of trust and risk between smallholder farmers and Financial Service Providers (FSPs) in Kenya. :seedling::bar_chart: Currently in its pilot stage, agriKOPA is addressing financial inclusion challenges faced by smallholder farmers, particularly women and young people.

Here are some key insights we gained from the conference:

1. Partnerships: Collaborations are crucial for growth in the EO field. We can achieve more by working together. :handshake:
2. Technology with Purpose: The true value of technology lies in its ability to solve real-world problems. :bulb:
3. Future of Sustainable Living: Space technology and exploration are essential for sustainable living on Earth. They provide critical information on climate change patterns, enhance communication, improve planning and resource management, aid in disaster management, and enable accurate weather forecasting. :herb::telescope:
4. Data is Digital Gold: Data drives insights, influences decisions, shapes policies, and transforms lives. :chart_with_upwards_trend::computer:agriBORA is proud to be a pioneer in using space technologies to create social and economic benefits. We are committed to leveraging these advancements to support and empower smallholder farmers in Kenya.

Crop Type Mapping for Harvest Offtakers in Kenya

In July 2023, Kenya faced a potato shortage, leaving harvest off-takers scrambling to find potato suppliers. Although the off-takers know in which parts of the country potatoes can generally be found, they still had to deal with a vast area where they needed to locate potato fields.

At agriBORA, we’ve been working closely with different off-takers and listening to their challenges. In this article, we’ll explain how we tackled these challenges with advanced crop type mapping techniques. Especially we focus on Uasin Gishu county, which is one of the main potato growing counties. The aim of our analysis is to produce a map at the field level, that indicates in which fields potatoes are grown.

Explore the data

Our approach starts with a dataset of 1250 fields in Uasin Gishu, Kenya, which includes information about the crops planted in 2023. This dataset has a major imbalance, because most fields are planted with maize, the most common crop in Uasin Gishu County.

Location of fields

We furthermore face the challenge, that the mapped crop types are not evenly distributed throughout the county. As we can see in the map, fields with potato production were mostly registered in the south, whereas there is a larger cluster of maize fields recorded in the north of the county. However we do not want the model to learn to detect whether a field is in the north or south of the county, but to differentiate potato fields from other fields. To improve the dataset’s balance and spatial diversity, we did the following:

  1. Potato Fields: We selected all 103 fields where potatoes were grown, as this is the entity we are most interested in.

  2. Maize Fields: To make the dataset fairer, we chose 52 maize fields to ensure maize was not overrepresented in the dataset. In order to account for the spatial distribution, we only selected maize fields, that were located within a short distance from potato fields.

  3. Fields with other crops: We included all 55 fields categorized as “other,” adding variety to our dataset to account for different crop types.

By doing this, we’ve created a more balanced dataset. This dataset forms the basis of our solution, helping us pinpoint potato fields more accurately and assisting offtakers in their search for reliable potato suppliers.


Original number of fields per croptype.

Number of fields per crop type in the final dataset.
Retrieve Sentinel Images

We are looking at the crops planted during the long rain season (LRS) of 2023, which ranges roughly from March to end of July. For this period we downloaded the Sentinel-2 L2A product. The processing included:

  1. cloud masking: here we are using the s2cloudless algorithm.

  2. calculating vegetation indices: – CVI: Chlorophyll vegetation index (B08∗B04)/(B03)² – PPR: Plant pigment ratio (B03-B02)/(B03+B02)

  3. resample the data to monthly resolution

Train the model

For our crop type map we use the random forest implementation of sklearn. Therefore we first needed to transform the Sentinel 2 images into a data format, that is readable by sklearn. The resulting dataframe has one column for each predictor at every timestep.

Pandas dataframe for the random forest classification

Now we can build our model. Here we opted for a simple hyperparameter tuning approach, where we looked at the parameters n_estimators and max_depth. A validation accuracy of 0.906 was achieved using n_estimators = 30 and max_depth = 20.

from sklearn.ensemble import RandomForestClassifier

n_estimators = [10, 20, 30]
max_depths = [None, 20, 30]

scores = []

for n_estimator in n_estimators:
    for max_depth in max_depths:

        model = RandomForestClassifier(n_estimators=n_estimator, 
                                       max_depth = max_depth, 
                                       random_state=42, 
                                       max_features = "sqrt", 
                                       class_weight = "balanced")
        
        model.fit(df2.loc[df2["mode"] == 0, predictors],
                df2.loc[df2["mode"] == 0, target].astype("int8"))
        
        scores.append(model.score(df2.loc[df2["mode"] == 1, predictors],
                    df2.loc[df2["mode"] == 1, target]))

combined = []

for pair in itertools.product(*[n_estimators, max_depths]):
   combined.append(pair)

print(f"best score ({np.round(np.max(scores), 3)}) was achieved with n_estimators = {combined[np.argmax(scores)][0]} and max_depth = {combined[np.argmax(scores)][1]}.")

# best score (0.906) was achieved with n_estimators = 30 and max_depth = 20.

We should note, that the accuracy score might be misleading here, since the accuracy is very sensitive to class imbalances. In the confusion matrix below, we can see, that

  1. there are a lot more 0 instances than 1 in the validation dataset. This is because we didn’t check for field sizes when splitting the dataset into train / validation / test. Apparently the non-potato fields were on average larger than the potato fields.

  2. from the 132 potato datapoints, 51 were predicted as non-potatos, which is very poor outcome. The model is quite conservative in predicting potatoes.

Confusion matrix of the validation data set

The final model achieved an accuracy of 0.668 on the test data set, which is a large drop compared to the validation score. This indicates that we overfitted our model.

Confusion matrix of the test data set

How could we improve this result?

  1. Of course more and better data is always a good idea. Especially a more diverse data set, both concerning crop types and field locations, could improve the results.

  2. Build the training data set more carefully, for example by taking into account the size of the fields.

  3. Implement a more elaborated hyper parameter tuning using cross validation and more parameters.

Predict distribution of potatoes

For now, let’s go on with our mediocre model and predict the occurance of fields planted with potatoes. We therefore selected a small area in Uasin Gishu. For the purpose of better visualization we show the 0.5 m resolution ESRI basemap image. The crop type mapping is of course done using the Sentinel-2 data.

Esri World Imagery Basemap
Create Crop Map

Since the crop type model was only trained on agricultural fields, it cannot differentiate between crop land and other landuse types. Therefore, we first define a simple cropland classifier, which is based on the range of the NDVI during the season. The intuition here is, that the amount of vegetation that is present at an agricultural field shows a higher variation during the season compared to other land use types.

# calculate NDVI
s2_data["NDVI"] = (s2_data["B08"] - s2_data["B04"]) / 
                  (s2_data["B08"] + s2_data["B04"])

# calculate NDVI range
NDVI_quantiles = s2_data["NDVI"].quantile((0.05, 0.95), "time")

ndvi_range = NDVI_quantiles.sel(quantile = 0.95) - 
              NDVI_quantiles.sel(quantile = 0.05)

# define crop mask, where values > 0.35 are crops
crop_mask = ndvi_range > 0.35
Crop mask: non-cultivated areas are marked red
Create Crop Type Map

Now we can go on and predict the distribution of potato fields in the area. The prediction is then masked with the crop mask. We can see that most of the area is planted with other crops, than potatoes (most likely maize).

Get Crop prediction at field level

To get a better impression of the agricultural landscape, we can apply our field delineation model in order to get field outlines. This model was trained using high resolution satellite imagery. If you want to know more about the field delineation algorithm please refer to the paper published by Waldner et al. (2021), the follow-up paper by Wang et al. (2022) or this medium article.

In the image above, we simply overlaid the crop type prediction with the field outlines. Now we can do a simple majority voting to assign the crop types to the fields and voilà, here is our map of potato fields for the off takers.

About agriBORA

agriBORA is a Kenyan-German agri-Fin-Tech platform that has developed a B2B2C Software as a Service solution to empower local agribusinesses with digital tools and processes that can improve farm productivity and facilitate effective trading between them and farmers. The agriBORA technology combines basic feature phone functionalities such as SMS, USSD and mobile payment solutions with advanced analytics based on Earth observation satellite data to monitor and assess crop development during the season. Visit the agriBORA website here at https://agribora.com to learn more about our work.

About the author

Lena Perzlmaier is a Data Scientist at agriBORA, specializing in Earth Observation. She analyzes remote sensing data for agricultural use cases in Eastern Africa. Her main areas of expertise are crop type mapping, field delineation and field NDVI trends analysis.