CropWise: Optimizing Food Production for a Sustainable Future 🌾TEAM - manJS

🌱 Inspiration

Food is one of the basic needs for survival. A famine is defined as an event of food scarcity, often resulting in mass amounts of death. In such emergencies, we need to get the most food, with the right nutrients, out of the limited land we have. Considering that not all crops are created equal, whereby some crops thrive in hot, tropical climates but others dread these conditions, different crops may need to be planted for optimal outcomes at different areas. Hence, we aim to answer the question: "What crop is the most efficient and nutrient rich to grow, right here, right now?"

🚀 What it does

CropWise is a web app that helps optimize food production by giving users crop suggestions that produce the highest nutrient yield given their farmland's weather conditions. Users can select their farmland based on a real life location, and a 3D rendered grid of their farmland will be created, complete with:

  • Weather animations that reflect current conditions
  • Detailed environmental data analysis
  • Dynamically rendered heatmap based on location's latest weather data
  • Custom-made regression machine learning model for crop yield prediction

Upon interacting with our 3D scene, users can select a nutrient focus of their choice (Calories, Carbohydrates, EFA, Oil, or Protein), and the plane will dynamically optimise its crop suggestions (Barley, Corn, Potato, Rice, Soybean, Sugarcane, Sunflower, or Wheat) for this nutrient.

🛠️ How we built it

The frontend was developed using Three.js for 3D rendering and styled with CSS for a clean, responsive interface. After logging in—integrated seamlessly with Firebase—users are prompted to select a plot of farmland from a 2D map of the Earth. This selection is powered by Mapbox, allowing users to define a rectangular region using four coordinates. Once selected, a 3D subdivided plane representing the chosen location is generated and displayed, complete with coordinate references.

Weather data is retrieved from the Open-Meteo API and used to enrich the visualization with real-time animations and contextual information. Our key output, the optimal yield and its most suitable crop, is visualized as a heatmap overlay on the 3D plane through a color mesh algorithm, sorting green areas as best yield and red areas as worst yield.

Weather Condition Animation Trigger Visual Effect
Precipitation Top 5% of rainfall values Falling rain particles
Cloud Cover Top 5% of cloud density Animated cloud formations
Wind Top 5% of wind speed Directional particle flow

The dataset for crop yields according to humidity, temperature, and crop type was obtained via Kaggle and split into a training and testing dataset by a 80:20 ratio. Using Python, an XGBoost regression machine learning model for crop yield production was trained and tested, with the Mean Squared Error and R-Squared values noted down. A RESTful API was then created using Flask. When the user selects a nutrient (calories by default), the web app will call the RESTful API and get predicted yields generated by the machine learning model.

🧩 Challenges we ran into

One of the challenges we faced was finding a reliable dataset to train and test our machine learning model on. Research was conducted on multiple websites to find a dataset that had the attributes we needed and that had a wide enough range of plants.

The main challenge from our frontend team was creating a divided plane for our crop yield heat map, we wanted users to interact with our visualization to increase engagement and provide visualization. It was also difficult to overlap both 2D and 3D UI since our 3D has animation.

One challenge our backend team ran into was optimizing our API since it had to make close to 512 calls, each with multiple parameters.

🏆 Accomplishments that we're proud of

  • Learning on the fly, we were able to create 3D renders that reflect the area of farmland
  • Implemented animations that reflect the ==current weather situation== in that area
  • Built a heatmap system to help farmers optimize their crop placements
  • Constructed a machine learning model that predicts crop yield with a decently high average R-squared value of 0.90
  • Completed a Minimum Viable Product within just over 2 days that visualizes agricultural and weather data in a meaningful way

📚 What we learned

Through this project, we learned how to:

  1. Integrate multiple APIs
  2. Extract real-time data
  3. Call machine learning models in a seamless workflow
  4. Understand what an XGBoost model is and how it works
  5. Create 3D models that interact with different lighting to form shadows

🔮 What's next for CropWise

  • Expand crop selection to include more varieties suited to local weather patterns
  • Add more nutrient categories like Vitamins and Minerals for a more balanced diet
  • Introduce more dynamic 3D rendering for irregular plots and topographic variations
  • Extend the machine learning pipeline to generate crop rotation schedules
  • Account for growth time of crops in recommendations

🌐 References/Sources

🎮 Test it out!

Email: test@test.com | Password: test123


"CropWise represents our vision for a world where technology enables smarter, more sustainable farming practices that can help prevent food shortages and maximize nutrition when it matters most." - Team manJS

Share this project:

Updates