Skip to content
This repository has been archived by the owner on Oct 30, 2022. It is now read-only.
/ box_of_crayons Public archive

Taking food security, sustainable agriculture and "plant pathology" beyond the moon. πŸš€πŸš€πŸš€πŸš€( "぀γ₯く!!" )

Notifications You must be signed in to change notification settings

mrdvince/box_of_crayons

Repository files navigation

⚠️⚠️⚠️ Notice ⚠️⚠️⚠️⚠️

Taking an "untill further notice" on this. Probably going to play with other shiny toys.

Nebo

Nebo is a noun meaning the Babylonian god of wisdom and agriculture and patron of scribes and schools

Introduction

This project aims to combine computer vision and natural language processing to build a tool that can be used by anyone (from agricultural researchers, farmers, and hobbyists).

Using object detection, the prediction and localization of plant disease can be easily detected, and further combining this with question answering model feeding questions about the pathogen, the user gets to learn about what's ailing the crops, how to treat them, and a whole range of other agricultural-related questions.

Training

The dataset currently used to train the model is custom-built (a small sample, I couldn't find publicly available annotated datasets for this particular use case).

Some metrics (visualized with W&B):

Getting started

Docker

To set up the environment to run the code in this repository, follow the instructions below.

  1. Install docker (avoid the "it works on my machine πŸ˜…")
# Download Docker
curl -fsSL get.docker.com -o get-docker.sh
# Install Docker using the stable channel (instead of the default "edge")
CHANNEL=stable sh get-docker.sh
# Remove Docker install script
rm get-docker.sh
  1. Install docker compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  1. Clone the repository (if you haven't already!), and navigate to the box_of_crayons folder, then use docker-compose to start the application.

Using recursive so as to pull in other dependent repos. (Can be ommitted if the interest is only this repo).

git clone --recursive https://github.com/mrdvince/box_of_crayons.git

cd box_of_crayons

NB: You might have to set a couple of env variables

  1. Start the application.
docker-compose up -d

this will pull and build all the images required to run the containers and finally start it.

Kubernetes

Setting this up on a single node but can be easily scaled to as much nodes as you want/can afford to pay for.

I don't have much experience with kubernetes but here's a small guide to setup a minimal CI/CD pipeline for the project using k3s, argocd and Github Actions.

Skipping setting up wildcard certs, rancher, secrets and config maps

  1. Start by setting up k3s (k3s is a rancher's lightweight kubernetes distribution, and yes it's completely production ready)
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--node-ip=<internal ip> --flannel-iface=eth0 --write-kubeconfig-mode=644 --node-external-ip=<public ip>" sh -
# This will pull k3s, install and set it up to autostart on system startup (pretty darn cool).
# Run to see your node/nodes
kubectl get nodes -o wide
  1. Install argocd
# Create argocd namespace
kubectl create namespace argocd
# This should apply the argocd manifest to your cluster
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/v2.1.7/manifests/install.yaml

k3s comes with traefik as the ingress controller, to be able to access the argocd gui on a your custom domain of choice follow this guide to set up an ingress route for the argocd server.

  1. Use github actions to build your container image.

In the github workflows folder uncomment and edit the file to your needs, setup secrets for the repo in the repo settings folder.

On pull request this will build the container image and push to the registry of choice. It doesn't have to be on PR, feel free to use any event that you like.

  1. Edit the deploy yaml files. This uses kustomize to deploy either in dev or in production. - Update the dployment file image.

    ```bash
        optional: false
        image: <registry>/<container image> # change this to the container image built
        imagePullPolicy: Always
    ```
    - Update ingress
    
    ```bash
        spec:
            rules:
            - host: prod.api.<domain name> # your domain name
                http:
                paths:
                - backend:
    ```
    
  2. Build container image with Github Actions Commit and push the repo to your repo on Github

Open a PR on github and Github Actions should build and push the container image to your registry

  1. Deploy with argocd. Follow this guide on how to use kustomize and argocd to deploy the app.

Argocd from now on will be taking care of all your deployments.

When finished you should have something that looks like the image below.

More screenshots

Who doesn't love more screenshots πŸ˜‚πŸ˜‚ (they do make a README look pretty sleek if you ask me.)

W&B evaluation summary table, showing the ground truth, prediction and avg confidence

Sample image showing a single disease classification

Random image evalution screenshots.

About

Taking food security, sustainable agriculture and "plant pathology" beyond the moon. πŸš€πŸš€πŸš€πŸš€( "぀γ₯く!!" )

Topics

Resources

Stars

Watchers

Forks