|
1 | | -## Edge Vision Mathifyer |
2 | | -## Edge Vision + Math Engine (Quickstart Bundle) |
| 1 | +# Edge Vision + Math Engine |
3 | 2 |
|
4 | | -This bundle contains two self-contained projects: |
| 3 | +[](https://github.com/smakde/Edge-Vision-Mathifyer/actions/workflows/ci.yml) |
| 4 | +[](https://www.python.org/downloads/) |
| 5 | +[](LICENSE) |
5 | 6 |
|
6 | | -1. **edge-vision/** — Real-time, privacy-preserving computer vision demo on local hardware with OpenCV. |
7 | | - - Streamlit UI that plays a sample video, measures FPS, and (optionally) uses a TFLite model if you add one. |
8 | | -2. **math-engine/** — SymPy + NumPy solver for calculus/combinatorics/probability, with a Streamlit UI and Monte Carlo verification. |
| 7 | +Two self-contained projects in one repo: |
9 | 8 |
|
10 | | -> Tip: Use two terminals (or tabs) to run both UIs. |
| 9 | +- **Math Engine** — symbolic solver with step-by-step explanations and Monte Carlo verification (SymPy + NumPy + SciPy) |
| 10 | +- **Edge Vision** — multi-algorithm computer vision demo running 4 CV pipelines side-by-side on local video (OpenCV) |
11 | 11 |
|
12 | 12 | --- |
13 | 13 |
|
14 | | -## 0) Create Python env (recommended) |
| 14 | +## Math Engine |
15 | 15 |
|
| 16 | +Symbolic solver supporting integrals, derivatives, limits, combinatorics, and probability — with LaTeX output and Monte Carlo cross-checks. |
| 17 | + |
| 18 | +### Quickstart |
16 | 19 | ```bash |
17 | | -python3 -m venv .venv && source .venv/bin/activate |
18 | | -# Windows: .venv\Scripts\activate |
| 20 | +cd math-engine |
| 21 | +pip install -r requirements.txt |
| 22 | +streamlit run streamlit_app.py |
19 | 23 | ``` |
20 | 24 |
|
| 25 | +### Supported expressions |
| 26 | + |
| 27 | +| Type | Example | |
| 28 | +|------|---------| |
| 29 | +| Indefinite integral | `integral(sin(x)^2, x)` | |
| 30 | +| Definite integral | `integral(x^2, x, 0, 1)` | |
| 31 | +| Derivative | `diff(exp(x)*log(x), x)` | |
| 32 | +| nth-order derivative | `diff(x^5, x, 3)` | |
| 33 | +| Limit | `limit(sin(x)/x, x, 0)` | |
| 34 | +| Limit at infinity | `limit((1 + 1/x)**x, x, oo)` | |
| 35 | +| Combinations | `C(52, 5)` | |
| 36 | +| Permutations | `P(5, 2)` | |
| 37 | +| Factorial | `factorial(10)` | |
| 38 | +| Dice probability | `P(sum_{i=1..3} die() >= 10)` | |
| 39 | +| Binomial CDF | `P(binomial(10, 0.3) >= 4)` | |
| 40 | +| Normal tail | `P(normal(0, 1) > 1.96)` | |
| 41 | + |
| 42 | +All probability results include exact + Monte Carlo verification with 95% CI. |
| 43 | + |
21 | 44 | --- |
22 | 45 |
|
23 | | -## 1) Edge Vision — Run |
| 46 | +## Edge Vision |
| 47 | + |
| 48 | +Runs 4 CV algorithms simultaneously on a local video, with per-algorithm controls and processing metrics. |
24 | 49 |
|
| 50 | +### Algorithms |
| 51 | +- **Canny edges** — tunable low/high thresholds, edge density metric |
| 52 | +- **Sobel gradient** — magnitude map, mean gradient metric |
| 53 | +- **Contour detection** — Otsu threshold + contour filtering by area |
| 54 | +- **CLAHE equalisation** — adaptive histogram equalisation, contrast before/after |
| 55 | + |
| 56 | +### Quickstart |
25 | 57 | ```bash |
26 | 58 | cd edge-vision |
27 | 59 | pip install -r requirements.txt |
28 | | -# Run Streamlit dashboard (plays sample video and shows FPS) |
29 | 60 | streamlit run apps/streamlit_app.py |
30 | 61 | ``` |
31 | | -- Add your model at `edge-vision/models/model.tflite` (optional). If present, the app will try to run TFLite inference. |
32 | | -- Otherwise, it will fall back to a simple OpenCV edge detector as a placeholder. |
33 | 62 |
|
34 | | -CLI benchmark (optional): |
35 | | -```bash |
36 | | -python tools/benchmark.py --video data/sample.mp4 |
37 | | -``` |
| 63 | +Add your own video at `edge-vision/data/sample.mp4` or use the included sample. |
38 | 64 |
|
39 | 65 | --- |
40 | 66 |
|
41 | | -## 2) Math Engine — Run |
| 67 | +## Tests |
42 | 68 |
|
43 | 69 | ```bash |
44 | | -cd math-engine |
45 | | -pip install -r requirements.txt |
46 | | -streamlit run streamlit_app.py |
| 70 | +pip install pytest pytest-cov scipy opencv-python-headless sympy numpy |
| 71 | +PYTHONPATH=math-engine:edge-vision pytest math-engine/tests/ edge-vision/tests/ -v |
47 | 72 | ``` |
48 | 73 |
|
49 | | -Examples in the UI: |
50 | | -- Calculus: `integral(sin(x)^2, x)` |
51 | | -- Probability: `P(sum_{i=1..3} die() >= 10)` |
52 | | -- Combinatorics: `C(10,3)` |
53 | | - |
54 | | ---- |
55 | | - |
56 | | -## Notes |
57 | | - |
58 | | -- `tflite-runtime` is platform-specific; we do **not** auto-install it. If you need it, install for your device (Raspberry Pi/ARM, etc.). |
59 | | -- Everything runs locally and offline. Replace `data/sample.mp4` with your own footage for edge-vision. |
| 74 | +38 tests — 21 engine (integrals, derivatives, limits, combinatorics, probability) + 17 CV pipeline (shape, dtype, edge cases). |
0 commit comments