A service to detect if a given image of palm is ripe or not. A R&D initiated for Swopt

Dr-Swopt 8427bd4633 updated readme преди 7 часа
palm_oil_mobile 0f77fae817 feat: Implement interactive Plotly visualizations, PDF batch report generation, and a 'History Vault' tab, alongside a new API endpoint. преди 4 дни
src 5096aab978 feat: implement FastAPI service with multi-engine inference and local SQLite history tracking преди 8 часа
.env 491c6c4829 services преди 3 седмици
.gitignore 0e965994ee update преди 3 дни
LICENSE 328e3e8b22 Initialize: Add requirements.txt and MIT LICENSE преди 3 седмици
README.md 8427bd4633 updated readme преди 7 часа
Streamlit.md ebcabef0d7 basic setup and trained data преди 3 седмици
best.onnx 9caef843c9 working ver преди 1 седмица
best.pt f486848971 enhancements for different grades преди 2 седмици
demo_app.py 5096aab978 feat: implement FastAPI service with multi-engine inference and local SQLite history tracking преди 8 часа
export_mobile.py 68dd501a74 Further streamlit UI enchancements преди 2 седмици
export_raw_tflite.py 9caef843c9 working ver преди 1 седмица
gemini-embedding-service-key.json 491c6c4829 services преди 3 седмици
last.pt f486848971 enhancements for different grades преди 2 седмици
main.py 6702db105a update to include mutliple endpoints преди 3 седмици
manual_convert_tflite.py 0089edcf9b adidtional set up for tfllite conversion from best.pt преди 2 седмици
requirements.txt ae6d70a7ba updated преди 4 дни
sawit_tbs.pt 4bc1b9ab71 include 3rd party model преди 3 дни
test_benchmark.py 793eb2495e feat: Add a FastAPI backend for model inference and management, update the demo app to use a YOLOv8-Sawit benchmark model and display its capabilities via the new API. преди 3 дни
test_model.py f486848971 enhancements for different grades преди 2 седмици
train_palm.py 91b2d69f4f update преди 2 седмици
unify.py 91b2d69f4f update преди 2 седмици
yolo26n.pt 91b2d69f4f update преди 2 седмици
yolov8n.pt 6dc23e13aa simple setup преди 3 седмици

README.md

🌴 Palm Oil FFB Management System (YOLO26)

⚠️ PROTOTYPE / PROOF OF CONCEPT (PoC) > This system is developed strictly for demonstration purposes to potential clients and is not intended for production use in its current state.

A high-fidelity AI prototype for detecting the ripeness of Palm Oil Fresh Fruit Bunches (FFB) according to MPOB standards. Built on a custom-trained YOLO26 model (utilizing the latest high-performance architecture via ultralytics) with a triple-engine inference backend and a specialized 5-tab operations dashboard.

LINK for GOOGLE DOC: https://docs.google.com/document/d/1bbdGuLCGHdnHj_iCQIreh9DlYwu12PDUEPpA2eCsR-M/edit?usp=sharing

🚀 Project Overview

Component Technology Purpose
Primary Engine YOLO26 (Latest SOTA Backbone) High-accuracy FFB Ripeness Detection.
ONNX Runtime onnxruntime + best.onnx Ultra-fast edge inference simulation (~39ms).
PyTorch Runtime ultralytics + best.pt High-resolution auditing and verification.
Benchmark Engine YOLOv8-Sawit (sawit_tbs.pt) Competitive baseline comparison.
Inference Server FastAPI (Python) REST API for multi-client orchestration.
Local Audit Log SQLite (palm_history.db) Primary offline-first data persistence.
Operations UI Streamlit (demo_app.py) 5-tab industrial management dashboard.

🛠️ Triple-Engine Inference Logic

The system demonstrates three distinct AI pathways to showcase deployment flexibility:

  1. YOLO26 (ONNX): Optimized for zero-latency scenarios. It utilizes normalized coordinates ($0.0$ to $1.0$) mapped back to original resolution via a custom scaling handler.
  2. YOLO26 (PyTorch): The native "Ground Truth" engine. It provides absolute pixel coordinates and serves as the benchmark for high-resolution audits.
  3. YOLOv8-Sawit (Benchmark): A third-party model implementation. It allows clients to see how the custom YOLO26 architecture performs against standard industry baselines.

🖥️ Demonstration Features (Streamlit)

  • Tab 1: Single Analysis: Drag-and-drop detection with interactive Plotly overlays and a "Manager's Dashboard" for OER (Oil Extraction Rate) yield-loss insights.
  • Tab 2: Batch Processing: Simulates a full harvest day by processing multiple images under a specific metadata context (Estate, Block, Harvester) and generating an Executive PDF Report.
  • Tab 3: Similarity Search (KIV): Keep In View. Currently staged for future integration. Designed for visual and natural language search via Vertex AI.
  • Tab 4: History Vault: A local audit log showing every analysis performed. It displays archived images alongside their raw mathematical tensors.
  • Tab 5: Batch Reviewer: An auditor's tool to browse manifest.json data contracts and verify resolution-agnostic norm_box coordinates.

🚧 Status & Future Roadmap (KIV)

The following features are currently KIV (Keep In View) and are disabled in the current prototype due to cloud service constraints:

  • Cloud Archival: Automatic vectorization of detections to MongoDB Atlas.
  • Semantic Search: Visual similarity and Natural Language search via Vertex AI Multi-modal embeddings.
  • Vertex AI Integration: Currently experiencing issues; the system gracefully degrades to Local-Only Mode for stable demonstrations.

🔌 Running the Demonstration

1. Start the FastAPI Backend

The API server must be running to provide the NMS-Free inference logic.

python main.py

2. Launch the Operations Dashboard

In a separate terminal, run the Streamlit UI:

streamlit run demo_app.py

3. Local Data Contract

Every batch job generates a manifest.json in batch_outputs/. This file demonstrates the "Subscriber Payload"—a clean JSON structure ready for hand-off to corporate ERP systems or future vector databases.


🏗️ Architecture (DDD)

The prototype follows Domain-Driven Design to ensure that while this is a PoC, the underlying logic is built on a scalable enterprise foundation:

  • src/api/: Model orchestration and API endpoints.
  • src/application/: Industrial use cases (Batch, Analysis).
  • src/domain/: Core PalmOilBunch business entities.
  • src/infrastructure/: Repository logic and AI Service wrappers.