Real-time object detection and multi-object tracking using an Android CameraX client, a Python local-network backend, Ultralytics YOLO, and ByteTrack / BoT-SORT.
This project turns an Android phone into a wireless camera client for a laptop-based computer-vision system. The phone captures camera frames and sends them over a trusted local Wi-Fi network to the Python backend. The laptop performs real YOLO inference and multi-object tracking, while the browser provides the live dashboard.
The laptop GUI is the web browser. No separate desktop GUI application is required.
Android Camera APK
β
β JPEG frames: POST /frame
βΌ
Same Wi-Fi / trusted LAN
β
βΌ
Python Flask backend :5000
β
βββ Raw frame buffer ββββββββββββββββΊ Browser dashboard
β
βΌ
Ultralytics YOLO
β
βΌ
ByteTrack / BoT-SORT
β
βββ Bounding boxes
βββ Class labels
βββ Confidence scores
βββ Persistent tracking IDs
βββ Motion trails / HUD
β
βΌ
Processed frames + detection API
β
βΌ
Laptop web browser dashboard
- β Android camera client implemented
- β Python Flask backend implemented
- β Real Ultralytics YOLO inference
- β ByteTrack / BoT-SORT tracking
- β Live browser dashboard
- β
Android-compatible
/frame,/,/latest_frame, and/statusendpoints - β
LAN server binding on
0.0.0.0:5000 - β Dashboard controls, statistics, class filters and tracking visualization
- β GitHub Actions Debug APK workflow
- β JDK 17 Android build configuration
- β One-click Windows startup and shutdown scripts
- β Detailed setup and troubleshooting documentation
- β No fake detections or simulated tracking results
The project is ready for end-to-end Android + laptop LAN testing. The remaining validation that depends on physical hardware is to run the phone and laptop on the same Wi-Fi network and test the complete camera β backend β YOLO β dashboard path.
If you are using Windows, you do not need to type the Python/virtual-environment commands every time.
- Clone or update the repository once.
- Make sure Python 3.10β3.13 is installed. Python 3.12 is recommended.
- Double-click
START.batin the project folder. - The launcher creates
.venvwhen needed, installs/updates backend requirements, detects a private LAN IPv4, opens the dashboard and starts the backend. - The terminal displays the Android connection URL, for example
http://192.168.1.25:5000. - Enter that URL in the Android APK.
- Tap Test Ping, then Start Camera.
- In the browser dashboard, click Start Detection.
Keep the START.bat terminal open while using the system.
To stop the backend, double-click STOP.bat. It targets the project's backend/server.py process instead of indiscriminately terminating all Python processes.
Important:
START.batis Windows-only. Linux/macOS users should follow the manual setup below.
.
βββ START.bat
βββ STOP.bat
βββ android-app/
β βββ app-debug.apk # Preserved known-good APK
βββ app/ # Android Gradle application source
βββ backend/
β βββ server.py # Flask server + live vision pipeline
β βββ app.py # CLI/backend pipeline entry point
β βββ requirements.txt
β βββ src/
β βββ detector.py # YOLO wrapper
β βββ tracker.py # Tracker integration
βββ laptop-dashboard/
β βββ index.html
β βββ style.css
β βββ app.js
βββ screenshots/
βββ output/
βββ .github/workflows/
βββ build-apk.yml
git clone https://github.com/saba1207B/CodeAlpha_ObjectDetectionTracking.git
cd CodeAlpha_ObjectDetectionTrackingFor an existing checkout:
git pull origin mainPython 3.10β3.13 is recommended; Python 3.12 is recommended for a consistent Windows setup.
Windows:
py -3.12 -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pipIf PowerShell activation is restricted:
.venv\Scripts\activate.batLinux/macOS:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pippython -m pip install -r backend/requirements.txtThe backend uses Flask, OpenCV, NumPy, Ultralytics and related computer-vision dependencies. On first YOLO startup, Ultralytics may download yolo11n.pt; therefore first-time detection normally needs Internet access unless the model is already cached locally.
From the repository root:
python backend/server.pyThe server listens on:
0.0.0.0:5000
Open the dashboard on the laptop:
http://localhost:5000/
or, from another device on the same LAN:
http://LAPTOP_IPV4:5000/
The backend is the processing engine; the browser is the user interface.
Windows:
ipconfigUse the Wi-Fi adapter's IPv4 address, such as 192.168.1.25.
Linux:
ip -4 addr
# or
hostname -ImacOS:
ipconfig getifaddr en0Use the correct active Wi-Fi interface if en0 is not applicable.
The phone and laptop must be on the same Wi-Fi network.
In the Android app, enter:
http://LAPTOP_IPV4:5000
Example:
http://192.168.1.25:5000
Never enter localhost or 127.0.0.1 in the Android app for the laptop server. Those addresses point back to the phone itself.
Use the laptop's actual LAN IPv4 address.
- Start the Python backend.
- Confirm the laptop dashboard opens.
- Enter the laptop LAN URL in the Android app.
- Tap Test Ping.
- If ping succeeds, tap Start Camera.
- Return to the laptop dashboard.
- Confirm frames and phone/stream status are updating.
- Click Start Detection.
- Confirm YOLO boxes, labels, confidence values and tracking IDs appear.
The application uses real incoming phone frames. When detection is started:
- The backend receives JPEG frames from Android.
- Frames are stored in the live frame buffer.
- Ultralytics YOLO performs object detection.
- The selected tracker associates detections between frames.
- Bounding boxes, class labels, confidence values and tracking IDs are generated.
- Optional trails/HUD information is rendered.
- The annotated frame is exposed to the dashboard.
- The dashboard reads current detection/tracking data through the API.
There are no fake boxes, mock detections, simulated tracking IDs or fabricated performance metrics.
- Model:
yolo11n.pt/ YOLOv11 Nano - Tracker: ByteTrack
- Confidence: use the dashboard default initially
- IoU: use the dashboard default initially
- Class filters: all classes initially
- Trails: optional
- HUD: optional
yolo11n.pt is recommended for CPU-friendly laptop testing. Larger models may improve detection quality but can reduce FPS and increase resource usage.
The browser dashboard provides:
- Backend health status
- Android/stream status
- Laptop IPv4
- Complete Android connection URL
- Copy URL control
- Received frame count
- Stream FPS
- API round-trip latency
- Frame resolution
- Last-frame age
- Raw camera frame
- Processed YOLO frame
- Raw/processed split view
- Bounding boxes
- Class labels
- Confidence scores
- Persistent tracking IDs
- Current tracked-object table
- Motion trails
- HUD/statistics overlay
- Start Detection
- Stop Detection
- Reset/Clear Results
- YOLO model selection
- Confidence threshold
- IoU threshold
- ByteTrack / BoT-SORT selection
- COCO class filtering
- Screenshot capture
- Optional annotated video recording
- Visible server, Wi-Fi, frame, package and YOLO errors
| Method | Endpoint | Purpose |
|---|---|---|
| GET | / |
Health check and dashboard |
| POST | /frame |
Receive Android JPEG frame |
| GET | /latest_frame |
Return latest raw frame |
| GET | /status |
Return server/stream metrics |
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /processed_frame |
Latest annotated YOLO frame |
| GET | /detections |
Current tracked objects |
| POST | /start-detection |
Start real detection/tracking |
| POST | /stop-detection |
Stop detection/tracking |
| GET | /settings |
Read current settings |
| POST | /settings |
Update model/tracker/threshold/filter settings |
| POST | /clear-results |
Reset tracking/results state |
| POST | /screenshot |
Capture a frame |
| POST | /recording/start |
Start annotated recording |
| POST | /recording/stop |
Stop annotated recording |
If the dashboard works on the laptop but the Android Test Ping fails, the firewall is a likely cause.
Run PowerShell as Administrator:
New-NetFirewallRule -DisplayName "CodeAlpha Object Detection 5000" -Direction Inbound -Protocol TCP -LocalPort 5000 -Action Allow -Profile PrivateOnly use this for a trusted/private network profile.
sudo ufw allow 5000/tcp
sudo ufw statusSome guest, campus, office and public Wi-Fi networks prevent devices from communicating with one another. If both devices are connected but the phone cannot reach the laptop, test using a trusted network that permits device-to-device traffic.
Security: this is a local development server. Do not port-forward or expose TCP port 5000 directly to the public Internet.
Use this checklist after cloning/updating the repository.
- Python installed
- Virtual environment created
- Requirements installed
- Backend starts without a fatal error
- Server reports/listens on port 5000
- Dashboard opens at
http://localhost:5000/ - Laptop Wi-Fi IPv4 identified
- APK installed
- Phone and laptop are on the same Wi-Fi
- Android connection URL uses laptop IPv4
- No
localhost/127.0.0.1used - Test Ping succeeds
- Camera starts
- Frames are transmitted
- Android/stream status becomes active
- Frame count increases
- Resolution is reported
- Stream FPS updates
- Raw frame appears
- Start Detection succeeds
- Processed frame appears
- Real YOLO detections appear when objects are visible
- Tracking IDs persist across suitable frames
- Tracker/class/filter controls respond
- Screenshot works
- Recording works if enabled
Check, in order:
- Backend is running.
- Backend is bound to
0.0.0.0:5000. - Phone and laptop are on the same Wi-Fi.
- Android uses the laptop's Wi-Fi IPv4.
- Port 5000 is allowed through the private-network firewall.
- The Wi-Fi network is not using client isolation.
Test Ping only checks phone-to-backend connectivity. YOLO does not need to be running for this test. Fix IP, Wi-Fi and firewall problems before troubleshooting detection.
- Start the Android camera.
- Confirm the connection URL is correct.
- Check the laptop IP again if Wi-Fi was disconnected/reconnected.
- Confirm the dashboard is reachable from the phone's network.
- Check the backend terminal for incoming requests/errors.
Keep yolo11n.pt selected for the initial test and allow Ultralytics to download the model if it is not cached. If the laptop is offline, a locally available compatible weight file is required.
The application surfaces the actual engine error instead of pretending that inference succeeded.
The processed endpoint does not silently substitute the raw frame. Confirm:
- Phone camera is streaming.
- Frames are increasing.
- Start Detection has been clicked.
- YOLO initialized successfully.
- The backend terminal contains no inference error.
- Start with
yolo11n.pt. - Prefer ByteTrack for lighter tracking.
- Reduce camera resolution if necessary.
- Reduce transmission rate if Wi-Fi is congested.
- Close other CPU/GPU-heavy applications.
- Use a stable Wi-Fi connection.
- A wired laptop connection can reduce LAN variability.
The repository contains a Build Android APK workflow.
The workflow is configured to:
- use JDK 17;
- make
gradlewexecutable; - run
./gradlew assembleDebug; - verify the generated Debug APK exists and is non-empty;
- upload the APK as
CodeAlpha_ObjectDetectionTracking-debug-apk.
The latest verified GitHub Actions build completed successfully as Build Android APK run #22.
Successful run:
https://github.com/saba1207B/CodeAlpha_ObjectDetectionTracking/actions/runs/33707787292
Build commit:
11ba43102bb0f51c1fe3620ebf73904f9767823d
Artifact:
CodeAlpha_ObjectDetectionTracking-debug-apk
The APK generated by that successful build is suitable for the current Android source. Laptop-only changes such as START.bat, STOP.bat and README documentation do not require rebuilding the APK.
- Open the repository's Actions page.
- Select Build Android APK.
- Open a successful build run.
- Scroll to Artifacts.
- Select
CodeAlpha_ObjectDetectionTracking-debug-apk. - Extract
app-debug.apkfrom the downloaded ZIP.
A known-good APK is also preserved at:
android-app/app-debug.apk
It should not be replaced by a failed CI output.
The Android Gradle configuration uses Java 17 through compileOptions.
The obsolete Kotlin kotlinOptions { jvmTarget = "17" } configuration that caused the earlier CI failure was removed. The current build workflow uses JDK 17 and the Gradle wrapper.
Local build commands:
Linux/macOS:
./gradlew assembleDebugWindows:
gradlew.bat assembleDebugGenerated APK:
app/build/outputs/apk/debug/app-debug.apk
Double-click START.bat
β
Virtual environment + dependencies
β
LAN IPv4 detected
β
Browser dashboard opens
β
Backend starts on port 5000
β
Enter displayed URL in Android APK
β
Test Ping
β
Start Camera
β
Start Detection in browser
β
YOLO + tracking + live dashboard
Double-click STOP.bat
β
backend/server.py process stops
β
Close browser tab normally
This repository is also intended to be independently reviewed after implementation changes. A reviewer should inspect the actual source rather than relying only on this README, with particular attention to:
- Android-to-laptop IP handling
/framecompatibility- Flask binding and LAN accessibility
- YOLO initialization and real inference
- ByteTrack / BoT-SORT integration
- frame buffering and concurrency
- dashboard API compatibility
- error handling and non-fake status reporting
- Gradle/JDK compatibility
- GitHub Actions APK artifact generation
- Windows launcher behavior
- firewall and trusted-LAN assumptions
The goal is to keep the implementation simple, reproducible and testable while avoiding unnecessary changes that do not address a real issue.
This is a CodeAlpha project implementation for learning and demonstration of real-time computer vision, Android networking, object detection and multi-object tracking.