Spaces:
Sleeping
Sleeping
Deploy from GitHub Actions (branch: main, sha: 23b0fcdb)
Browse files- README.md +13 -0
- docs/thesis-qa.md +134 -0
README.md
CHANGED
|
@@ -37,6 +37,19 @@ A web application for detecting elephants in aerial and drone imagery using [YOL
|
|
| 37 |
- Confidence bar charts and per-detection data tables
|
| 38 |
- Automatic model download from HuggingFace Hub
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
## Model
|
| 41 |
|
| 42 |
| Property | Value |
|
|
|
|
| 37 |
- Confidence bar charts and per-detection data tables
|
| 38 |
- Automatic model download from HuggingFace Hub
|
| 39 |
|
| 40 |
+
## Quick Setup
|
| 41 |
+
|
| 42 |
+
**Requirements:** Python 3.10, Git
|
| 43 |
+
|
| 44 |
+
```bash
|
| 45 |
+
git clone https://github.com/iamhelitha/EleFind-gradio-ui.git
|
| 46 |
+
cd EleFind-gradio-ui
|
| 47 |
+
pip install -r requirements.txt
|
| 48 |
+
python app.py
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
Open [http://127.0.0.1:7860](http://127.0.0.1:7860) in your browser. The model downloads automatically on first run.
|
| 52 |
+
|
| 53 |
## Model
|
| 54 |
|
| 55 |
| Property | Value |
|
docs/thesis-qa.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EleFind Thesis Q&A (Code-Verified)
|
| 2 |
+
|
| 3 |
+
Date verified: April 20, 2026
|
| 4 |
+
Primary source: app.py (plus workflow and docs files listed below)
|
| 5 |
+
|
| 6 |
+
## SAHI configuration
|
| 7 |
+
|
| 8 |
+
### 1) What is the exact slice_height and slice_width used in the SAHI inference call? Is it 640 or 1024?
|
| 9 |
+
|
| 10 |
+
Answer:
|
| 11 |
+
- In the SAHI call, both are set to `slice_size`.
|
| 12 |
+
- The default `slice_size` in the app is `1024`, not 640.
|
| 13 |
+
- The UI slider allows changing it at runtime (range 256 to 2048), but default is 1024.
|
| 14 |
+
|
| 15 |
+
### 2) What is the exact overlap_height_ratio and overlap_width_ratio? Is it 0.20 or 0.30?
|
| 16 |
+
|
| 17 |
+
Answer:
|
| 18 |
+
- In the SAHI call, both are set to `overlap_ratio`.
|
| 19 |
+
- The default `overlap_ratio` in the app is `0.30`, not 0.20.
|
| 20 |
+
- The UI slider allows runtime change (range 0.05 to 0.50), but default is 0.30.
|
| 21 |
+
|
| 22 |
+
### 3) What is the exact confidence threshold passed to the SAHI inference?
|
| 23 |
+
|
| 24 |
+
Answer:
|
| 25 |
+
- The model confidence is set immediately before inference:
|
| 26 |
+
`detection_model.confidence_threshold = conf_threshold`
|
| 27 |
+
- The default `conf_threshold` is `0.30`.
|
| 28 |
+
- The UI slider allows runtime change (range 0.05 to 0.95), but default is 0.30.
|
| 29 |
+
|
| 30 |
+
### 4) What is the IoU threshold used for NMS post-processing?
|
| 31 |
+
|
| 32 |
+
Answer:
|
| 33 |
+
- SAHI uses `postprocess_type="NMS"`.
|
| 34 |
+
- IoU is passed as `postprocess_match_threshold=iou_threshold`.
|
| 35 |
+
- Default `iou_threshold` is `0.40`.
|
| 36 |
+
- The UI slider allows runtime change (range 0.10 to 0.80), but default is 0.40.
|
| 37 |
+
|
| 38 |
+
### 5) What is the exact model_type and model_path or Hugging Face repo ID used to load the model?
|
| 39 |
+
|
| 40 |
+
Answer:
|
| 41 |
+
- `model_type` is `"yolov8"` (comment notes SAHI uses this for YOLOv8/v11 models).
|
| 42 |
+
- `model_path` is a resolved file path from:
|
| 43 |
+
1. Hugging Face Hub download first (preferred)
|
| 44 |
+
2. Local fallback paths if download fails
|
| 45 |
+
- Hugging Face model repo ID default: `iamhelitha/EleFind-yolo11-elephant`
|
| 46 |
+
- Hugging Face model filename default: `best.pt`
|
| 47 |
+
|
| 48 |
+
## API endpoint
|
| 49 |
+
|
| 50 |
+
### 6) What is the exact api_name parameter on the Gradio detection function?
|
| 51 |
+
|
| 52 |
+
Answer:
|
| 53 |
+
- Exact value is `"detect"` in `detect_btn.click(...)`.
|
| 54 |
+
- In Gradio client usage, this endpoint is typically called as `/detect`.
|
| 55 |
+
|
| 56 |
+
### 7) What is the exact Hugging Face Space name/URL?
|
| 57 |
+
|
| 58 |
+
Answer:
|
| 59 |
+
- Space identifier: `iamhelitha/EleFind-gradio-ui`
|
| 60 |
+
- Space URL: `https://huggingface.co/spaces/iamhelitha/EleFind-gradio-ui`
|
| 61 |
+
- Public runtime URL used for API calls: `https://iamhelitha-elefind-gradio-ui.hf.space`
|
| 62 |
+
|
| 63 |
+
### 8) What is the Hugging Face Hub model repo ID where weights are loaded from?
|
| 64 |
+
|
| 65 |
+
Answer:
|
| 66 |
+
- `iamhelitha/EleFind-yolo11-elephant`
|
| 67 |
+
|
| 68 |
+
## CI/CD
|
| 69 |
+
|
| 70 |
+
### 9) Is there a GitHub Actions workflow file? What does it do on push to main?
|
| 71 |
+
|
| 72 |
+
Answer:
|
| 73 |
+
- Yes: `.github/workflows/deploy-hf.yml`
|
| 74 |
+
- Trigger is exactly:
|
| 75 |
+
- `on: push` to branch `main`
|
| 76 |
+
- Pipeline behavior:
|
| 77 |
+
1. Checks out repo
|
| 78 |
+
2. Sets up Python 3.10
|
| 79 |
+
3. Installs `huggingface-hub`
|
| 80 |
+
4. Uploads project to HF Space `iamhelitha/EleFind-gradio-ui` using `upload_folder(..., repo_type="space")`
|
| 81 |
+
5. Polls HF Space runtime status until RUNNING (or reports build/runtime error)
|
| 82 |
+
- So yes, push to main syncs/deploys to Hugging Face Spaces.
|
| 83 |
+
|
| 84 |
+
## Gradio interface
|
| 85 |
+
|
| 86 |
+
### 10) What inputs does the Gradio interface accept?
|
| 87 |
+
|
| 88 |
+
Answer:
|
| 89 |
+
- One image input component (`gr.Image`), sources: upload and clipboard.
|
| 90 |
+
- Plus 4 SAHI parameter sliders:
|
| 91 |
+
1. Confidence threshold
|
| 92 |
+
2. Slice size (px)
|
| 93 |
+
3. Tile overlap ratio
|
| 94 |
+
4. IoU threshold (NMS)
|
| 95 |
+
|
| 96 |
+
### 11) What outputs does the Gradio interface return?
|
| 97 |
+
|
| 98 |
+
Answer:
|
| 99 |
+
The detection function returns 8 outputs:
|
| 100 |
+
1. Annotated detection image
|
| 101 |
+
2. Elephant count
|
| 102 |
+
3. Average confidence
|
| 103 |
+
4. Highest confidence
|
| 104 |
+
5. Lowest confidence
|
| 105 |
+
6. Parameters summary markdown text
|
| 106 |
+
7. Confidence chart data (BarPlot data; fallback markdown if pandas unavailable)
|
| 107 |
+
8. Detection table data
|
| 108 |
+
|
| 109 |
+
### 12) Is there a requirements.txt or packages.txt, and what are key dependencies?
|
| 110 |
+
|
| 111 |
+
Answer:
|
| 112 |
+
- `requirements.txt` exists and includes:
|
| 113 |
+
- `ultralytics>=8.0.0`
|
| 114 |
+
- `sahi>=0.11.0`
|
| 115 |
+
- `opencv-python-headless>=4.5.0`
|
| 116 |
+
- `torch>=2.0.0`
|
| 117 |
+
- `torchvision>=0.15.0`
|
| 118 |
+
- `huggingface-hub>=0.20.0`
|
| 119 |
+
- `Pillow>=9.0.0`
|
| 120 |
+
- `numpy>=1.24.0`
|
| 121 |
+
- `pandas>=2.0.0`
|
| 122 |
+
- Gradio is not pinned in `requirements.txt`; Spaces uses `sdk_version: 6.8.0` from README frontmatter.
|
| 123 |
+
- `packages.txt` exists and is currently empty.
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
+
|
| 127 |
+
## Source files checked
|
| 128 |
+
|
| 129 |
+
- `app.py`
|
| 130 |
+
- `.github/workflows/deploy-hf.yml`
|
| 131 |
+
- `README.md`
|
| 132 |
+
- `requirements.txt`
|
| 133 |
+
- `packages.txt`
|
| 134 |
+
- `docs/api-usage.md`
|