Skip to content
Most Fun Hack

Beacon

Lost something on campus? Beacon uses OpenAI CLIP + GPS to match photos of lost items visually and by location. No perfect descriptions needed - just snap and search.

Core trick

Embeds photos with OpenAI CLIP and ranks matches by similarity, boosted by EXIF GPS distance from the loss location.

Tags

Built with

clipcore-locationflasknumpyopenaipillowpythonpytorchswiftswiftui

Description

Inspiration Beacon - AI-Powered Campus Lost & Found 🔍 Inspiration 💡 We've all been there—losing your keys, wallet, or AirPods somewhere on campus and hoping someone turned it in. But traditional lost-and-found systems have a fatal flaw: they rely on perfect descriptions. Your "navy blue backpack" might be someone else's "dark blue bag" or "black backpack." We realized that showing is better than telling , and with modern AI vision models, we could match items visually instead of relying on subjective descriptions. What It Does ⚡ Beacon is a native iOS app that revolutionizes how students find lost items on campus: Visual AI Search : Upload a photo of what you lost, and OpenAI's CLIP model finds visually similar items—no perfect description needed Smart Location Matching : Uses GPS coordinates and EXIF metadata to prioritize matches near where you lost your item Intelligent Ranking Algorithm : Combines visual similarity with location proximity for accurate results Dual-Mode System : Finder Mode : Report found items with photos and location Searcher Mode : Search for lost items using natural language or quick filters How We Built It 🛠️ Frontend (iOS): Swift/SwiftUI for a native, fluid user experience CoreLocation for GPS tracking and location services ImageIO for extracting EXIF metadata from photos Custom glassmorphism UI with gradient animations Backend (Flask/Python): OpenAI CLIP (ViT-B/32) for generating image embeddings and text-to-image matching Haversine Formula for calculating distances between GPS coordinates: $$d = 2R \arcsin\left(\sqrt{\sin^2\left(\frac{\Delta\phi}{2}\right) + \cos(\phi_1)\cos(\phi_2)\sin^2\left(\frac{\Delta\lambda}{2}\right)}\right)$$ where $R$ is Earth's radius, $\phi$ is latitude, and $\lambda$ is longitude Custom Matching Algorithm : Generate CLIP embeddings for all stored images Compute similarity scores using cosine similarity If multiple candidates score within 10% of the best match, use location distance as tiebreaker Return best match with confidence score Infrastructure: Flask REST API with CORS support Multipart form-data for image uploads Metadata embedded in filenames: originalname__lat_lon__pickupLocation.ext ngrok for secure tunneling during development Challenges We Faced 😤 EXIF Metadata Extraction : Camera photos don't automatically include GPS data like photos from the library. We had to implement dual fallback: try EXIF first, then use live GPS. Platform Migration : Midway through, we migrated from React Native to native Swift for better performance and iOS integration. This required rewriting the entire frontend while maintaining API compatibility. Location-Based Tiebreaking : Initially, we only used CLIP confidence scores, but this led to ambiguity when multiple similar items existed. We developed a sophisticated tiebreaker algorithm that uses GPS distance when confidence scores are close. Cross-Platform Path Handling : Hardcoded Windows paths broke on macOS. We solved this with dynamic path resolution using os.path.dirname(os.path.abspath(__file__)) . Image Format Inconsistency : The backend originally only searched .jpg files but accepted all formats. We expanded to .jpg , .jpeg , and .png to ensure all uploads are searchable. Accomplishments We're Proud Of 🏆 ✅ Successfully integrated OpenAI CLIP for semantic visual search ✅ Built a beautiful, native iOS app with smooth animations and intuitive UX ✅ Implemented intelligent location-aware matching that combines AI with geography ✅ Created a robust filename-based metadata system that survives database-free deployments ✅ Achieved <2 second search times even with hundreds of images ✅ Extracted EXIF GPS data from photos for automatic location tagging What We Learned 📚 Technical Skills: How transformer-based vision models like CLIP work and how to optimize them for real-time use SwiftUI's declarative paradigm and state management patterns CoreLocation API and handling iOS permission workflows Image metadata standards (EXIF, IPTC) and extraction techniques Implementing distance calculations with the Haversine formula Design Insights: The importance of fallback mechanisms (EXIF → GPS → manual entry) How confidence thresholds affect user trust in AI systems The value of visual feedback during async operations (uploading, searching) Product Development: When to use AI vs. traditional algorithms (AI for matching, math for distance) The critical importance of location context in physical-world applications Native vs. cross-platform trade-offs in mobile development What's Next for Beacon 🚀 Real-Time Notifications : Push alerts when a potential match is found Interactive Campus Map : Visual display of where items were found User Authentication : Account system for tracking your reports OCR for ID Cards : Automatically extract names from student IDs Machine Learning Pipeline : Retrain CLIP on campus-specific items for better accuracy Multi-Campus Support : Scale to universities nationwide Blockchain Integration : Immutable proof-of-finding for high-value items Social Features : Thank and rate finders, build reputation scores
purabshah12/beacon★ 00 forksSwiftCreated Nov 7, 2025 · last push Nov 8, 2025

README excerpt

# Beacon - UMD Lost and Found App

A lost and found application for UMD students with a Flask backend and SwiftUI frontend.

## Backend (Python/Flask)

### Setup
```bash
cd backend
pip install -r requirements.txt
```

### Run
```bash
python main.py
```

Server runs on `http://localhost:8000`

Data is stored locally in `items.json` in the backend directory.
Uploaded images are stored in the `uploads/` folder.

## Frontend (Swift/iOS)

### Requirements
- Xcode 15+
- iOS 17+

### Setup
1. Open Xcode
2. Create a new iOS App project
3. Copy all `.swift` files from the `frontend` folder into your Xcode project
4. Ensure the backend server is running on `http://localhost:8000`

### Run
Build and run the app in Xcode simulator or on a device.

## Features

- **Post Lost Items**: Report items you've lost with optional photo
- **Post Found Items**: Report items you've found with optional photo
- **Upload Photos**: Attach photos to items when posting
- **Browse Items**: View all lost and found items
- **Filter**: Filter by lost or found status
- **Contact**: Access contact information to coordinate returns
- **Delete**: Remove items once they're resolved

## API Endpoints

- `GET /` - Health check
- `POST /upload` - Upload image file (returns filename)
- `POST /items` - Create new item (with optional image_filename)
- `GET /items` - Get all items (optional `?status=lost` or `?status=found`)
- `GET /items/{id}` - Get specific item
- `PUT /items/{id}` - Update item
- `DELETE /items/{id}` 

Team