OceanSight is an AI-assisted platform for real-time underwater image enhancement and threat detection. It couples a TensorFlow-based enhancement model with a YOLOv8 detector, then exposes the pipeline through a FastAPI backend and a React/Vite frontend secured with Firebase Authentication and Realtime Database logging.
Live Demo : Oceansight
- Hybrid AI pipeline: TensorFlow autoencoder-style enhancer followed by Ultralytics YOLOv8 object detection.
- FastAPI service: Single
/predictendpoint that accepts underwater imagery, persists artifacts, and returns the annotated detection output. - React dashboard: Authenticated upload workflow, live processing feedback, result previews, and a per-user history view backed by Firebase Realtime Database.
- Audit trail: Upload/enhance/prediction metadata persisted per user for traceability.
- Frontend (Vite + React 18) renders the dashboard, handles authentication, and calls the backend.
- Firebase services manage auth state (
getAuth) and store prediction history (Realtime Database). - ML Backend (FastAPI) enhances and detects objects, saving outputs to local folders and responding with the annotated image.
- Model artifacts (
model2.h5,best.pt) are loaded at startup; directoriesuploads/,enhanced/, andresults/hold intermediate files.
OceanSight/
├── Frontend/ # Vite + React client (authentication, upload UI, history)
├── MLbackend/ # FastAPI service loading TensorFlow enhancer + YOLO detector
├── uploads/ # Created at runtime for raw uploads
├── enhanced/ # Created at runtime for enhanced images
├── results/ # Created at runtime for annotated outputs
├── README.md # Project overview (this file)
├── readme # Legacy setup snippet (kept for reference)
└── ...
- Python: 3.10.x recommended (TensorFlow compatibility).
- Node.js: 18.x or newer (Vite requirement).
- npm: 9.x or newer.
- CUDA/cuDNN (optional): Required only if running GPU-accelerated inference.
cd MLbackendpython -m venv .venv.venv\Scripts\activate(Windows) orsource .venv/bin/activate(macOS/Linux)
pip install --upgrade pippip install -r requirements.txt
- model2.h5: TensorFlow enhancement model.
- best.pt: Ultralytics YOLOv8 checkpoint.
- Place both in
MLbackend/(same directory asmain.py).
uvicorn main:app --reload- The service listens on
http://127.0.0.1:8000by default.
- GET
/→{ "message": "API is running! Upload an image to /predict" } - POST
/predict- Request:
multipart/form-datawith fieldfile(image bytes). - Processing:
- Saves the original file in
uploads/. - Enhances the image via TensorFlow model and writes to
enhanced/. - Runs YOLO detection, draws bounding boxes, and writes to
results/.
- Saves the original file in
- Response: Annotated image returned as a binary file (
FileResponse).
- Request:
curl -X POST \
-F "file=@sample.jpg" \
http://127.0.0.1:8000/predict \
--output result.jpg- uploads/: raw user input.
- enhanced/: enhanced output from TensorFlow model.
- results/: annotated detection results returned to clients.
- All folders are auto-created via
os.makedirs(..., exist_ok=True)on service start.
cd Frontendnpm install
VITE_URL=http://127.0.0.1:8000 # FastAPI base URL (no trailing slash)
VITE_FIREBASE_API_KEY=...
VITE_FIREBASE_AUTH_DOMAIN=...
VITE_FIREBASE_PROJECT_ID=...
VITE_FIREBASE_STORAGE_BUCKET=...
VITE_FIREBASE_MESSAGING_SENDER_ID=...
VITE_FIREBASE_APP_ID=...
VITE_FIREBASE_MEASUREMENT_ID=...
npm run dev- Access the UI at the Vite dev URL (typically
http://127.0.0.1:5173).
npm run build- Preview locally with
npm run preview.
- Users are stored at
users/{uid}with metadata (email,displayName, timestamps). - Predictions append under
users/{uid}/predictions/{pushId}with URLs and timestamps.
- User authenticates via Firebase (email/password or Google OAuth).
- Dashboard issues POST
/predictwith an image and Firebase ID token (token currently unused by backend). - Backend enhances, detects, persists intermediate files, and returns the annotated image.
- Frontend expects JSON containing
original_url,enhanced_url,result_urland records the response URLs in Firebase history. - History view retrieves the prediction list from Firebase and renders cards with copyable links.
- Frontend:
npm run lint - Backend: No automated test suite yet; manual verification via cURL or API client.
- Align backend response schema with frontend expectations (JSON URLs).
- Persist enhanced/detected images to object storage (Firebase Storage/S3) and store signed URLs in Firebase.
- Add automated tests (unit + integration) for both backend and frontend.
- Containerize services for simplified deployment.
