Skip to content

ljiro/SoilScan

Repository files navigation

SoilScan

SoilScan is a research project building an end-to-end pipeline for non-destructive soil nutrient analysis using field photography and deep learning. It targets smallholder farms in the Cordillera Administrative Region of the Philippines (Atok, La Trinidad, Benguet), where lab soil testing is inaccessible or cost-prohibitive.

The repository is split into focused branches. This page is your map.


How the System Fits Together

Field researcher
      |
      v
[ AgriCapture app ]  ──── captures geotagged photos + metadata ────>  CSV + images
      |                                                                      |
      |                                                                      v
      |                                                        [ Soil BG Remover tool ]
      |                                                         (optional preprocessing)
      |                                                                      |
      v                                                                      v
[ SoilScan app ]  <──── on-device inference ────  [ ML Training Pipeline ]
  (end-user)                                        model/classification-models
  • AgriCapture collects the raw data (photos + GPS + weather + labels) in the field.
  • The ML pipeline trains deep learning models on that data to predict N, P, K levels.
  • The SoilScan app delivers predictions to end-users via an on-device or API-backed interface.
  • The Soil BG Remover is a preprocessing tool for cleaning controlled-environment images before training.

Branch Guide

Active Development

Branch What it is Stack README
model/classification-models Deep learning training pipeline. Predicts N, P, K (Low/Medium/High) from field photos. Supports ResNet-50, EfficientNet-B4, ConvNeXt-Tiny, ViT-B/16. Full TensorBoard, AMP, early stopping. Python · PyTorch · timm README
tool/agricapture-camera-directory Android field data collection app. Camera + GPS + compass + weather per capture. Exports ZIP archives (CSV + images) for handoff to the ML pipeline. React Native · Expo · Android README
feature/soil-bg-remover Desktop GUI for removing backgrounds from soil sample photos. Supports AI full removal, AI + lasso, zoom edit, and field mode for outdoor images. Python · Tkinter README

App Versions

Branch What it is Stack
main (this page) Original SoilScan app. Soil texture classification (ResNet-50) + fertilizer recommendation (ExtraTreeClassifier). Hugging Face Spaces backend. React Native · Expo · Hugging Face
version/soilcan-texture-build Soil texture + crop recommendation variant (ResNet-50 + XGBoost). React Native · Expo
version/SoilScan-GIS-Web Web-based GIS version of the SoilScan interface. Web

Other Branches

Branch What it is
tool/agricapture-camera Earlier single-camera variant of AgriCapture.
feature/lens-cap-camera Experimental lens-cap detection feature.
prototype/soilscan-GIS Early GIS integration prototype.

Where to Start

I want to collect soil field data → tool/agricapture-camera-directory

I want to train or evaluate an NPK prediction model → model/classification-models

I want to preprocess controlled-environment images → feature/soil-bg-remover

I want to run the end-user soil scanner app → you are on the right branch — see How to Run below.


SoilScan App (this branch)

The original SoilScan mobile app. A user points their phone camera at soil, and the app returns the soil texture classification and fertilizer recommendations.

Stack

Layer Technology
Mobile app React Native (Expo)
Soil classification ResNet-50 CNN
Fertilizer recommendation ExtraTreeClassifier
Backend / inference Python on Hugging Face Spaces

Screenshots

Soil Image Classification — upload or capture a photo to get soil texture, description, and properties.

Fertilizer Recommendation — input NPK values, temperature, moisture, and crop type to get a fertilizer recommendation and description.

How to Run

Prerequisites: Node.js, npm 10.9+, Expo Go on your device.

# 1. Clone and install
git clone https://github.com/ljiro/SoilScan.git
cd SoilScan
npm install

# 2. Start (local network)
npx expo start

# 3. Start (over the internet / tunnel)
npx expo start --tunnel

Scan the QR code with Expo Go on your Android or iOS device.


Research Context

This project supports agricultural research in the Cordillera Administrative Region, Philippines. The primary study areas are Atok and La Trinidad, Benguet — highland vegetable-farming communities where soil health directly determines crop yields and food security.

The goal is to replace or supplement expensive laboratory soil testing with a phone camera, making nutrient-level assessment accessible to individual farmers in the field.

About

🌱 A React Native app that classifies soil using ResNet50 and recommends Fertilizers via ExtraTreeClassifier. Backend hosted on Hugging Face.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors