A service to detect if a given image of palm is ripe or not. A R&D initiated for Swopt
|
|
vor 3 Tagen | |
|---|---|---|
| src | vor 3 Tagen | |
| .env | vor 3 Tagen | |
| .gitignore | vor 4 Tagen | |
| LICENSE | vor 3 Tagen | |
| README.md | vor 3 Tagen | |
| Streamlit.md | vor 4 Tagen | |
| best.pt | vor 4 Tagen | |
| demo_app.py | vor 4 Tagen | |
| main.py | vor 3 Tagen | |
| requirements.txt | vor 3 Tagen | |
| test_model.py | vor 4 Tagen | |
| train_script.py | vor 4 Tagen | |
| yolov8n.pt | vor 4 Tagen |
This project uses a custom-trained YOLOv8 model to detect the ripeness of Palm Oil Fresh Fruit Bunches (FFB). It features a local Python FastAPI server and a Streamlit Dashboard, both integrated into an agentic n8n workflow.
git clone <your-repo-url>
cd palm-oil-ai
python -m venv venv
# Windows: venv\Scripts\activate | Mac: source venv/bin/activate
pip install ultralytics fastapi uvicorn streamlit python-multipart pillow
/datasets.Train the model:
python train_script.py
best.pt from runs/detect/train/weights/ to the project root.The new architecture decouples the vision logic from the API entry point. You can run it either via the root wrapper or directly as a module:
# Option 1: Using the root wrapper
python main.py
# Option 2: Running as a module
python -m src.api.main
By default, the server runs on http://localhost:8000.
| Endpoint | Method | Description |
|---|---|---|
/detect |
POST |
Simple YOLO detection (Returns JSON) |
/analyze |
POST |
Detection + Vertex Vectorization + MongoDB Archival |
/get_confidence |
GET |
Returns the current model confidence setting |
/set_confidence |
POST |
Updates the global model confidence setting |
The Streamlit app still provides the user interface for manual testing.
# Run the Streamlit app
streamlit run demo_app.py
---
## 📂 Repository Structure
```text
├── datasets/ # Labeled images (Train/Valid/Test)
├── runs/ # YOLO training logs and output weight├── src
│ ├── api # FastAPI entry points
│ ├── application # Use Cases (Orchestration)
│ ├── domain # Business Logic & Entities
│ └── infrastructure # External Services (MongoDB, VertexAI)
├── best.pt # YOLOv8 Trained weights
├── requirements.txt # Python dependencies
├── .env # Configuration (Mongo, Vertex)
├── LICENSE # MIT License
└── README.md