try: import torch import torchvision except ImportError: import subprocess print("Attempting to install missing packages...") subprocess.check_call(["pip", "install", "torch", "torchvision"]) import torch import torchvision import gradio as gr import os import numpy as np import torch import torch.nn as nn from torchvision import transforms import requests import os from PIL import Image from collections import OrderedDict from torchvision import models import torch.nn.functional as F import matplotlib.pyplot as plt import cv2 import io # Import CSS and URL File css_file_path = os.path.join(os.path.dirname(__file__), "ui.css") with open(css_file_path,"r") as f: custom_css = f.read() # HTML Design html_welcome_page = """
Project Aim: This system is designed to optimize rice planting schedules with broad-leaved weed detection using machine learning.
Designed by: Whitney Lim Wan Yee (TP068221)
This system is designed to help farmers detect broad-leaved weeds in rice fields using machine learning techniques. The aim is to optimize rice planting schedules and improve crop yield.
Resource: Statista (2024) - Agricultural consumption of herbicides worldwide from 1990 to 2022 (in 1,000 metric tons)
Statista (2024) revealed that global herbicide consumption has reached 1.94 million metric tons. To control dock weed in farming fields, the application of herbicides can cause delays in rice planting schedules ranging from 7 to 30 days.
RemoveWeed is a system designed to detect broad-leaved dock weed in paddy fields. It uses object detection like Single Shot Detection (SSD) model, along with instance segmentation models like U-Net and Fully Convolutional Neural Network (FCNN, to predict the presence of dock weed.
Broad-leaved Dock Weed in Paddy Field