Finding pool tables in bars and hotels with YOLO image processing, built in Rust.
Automated Finder for Pocket billiards venues.
Challenges:
- Ambiguity in text
- Limited pixels on object
Finding bars, resturants, and hotels with pool tables is particuarly hard problem because these places often don't list billiards or pool tables as an amentiy on their websites. Open Street Map (OSM) does have a "sport=billiards" tag that can be added to Points of Interest, however without a OSM-enthustist pool player in the area, venues are rarely mapped.
Text: Sometimes Google reviewers will include a note in their feedback, however there is high ambiguity between "pool tables", "pool", and "table". Eg "I really enjoyed playing in the pool, and got a table right away at the resturant." Rarely will a reviewer use "billiards" for a dive bar, unless it's a pool hall or higher-scale establishment.
Images: Scanning the photos, pool tables often show as small slivers in the back of full-room shots, making identifying the billiards table difficult.
-> Text Processing: TODO
-> Image Processing: This repo approaches the problem using an image segmentation model of a pre-trained YOLOv8, fine-tuned on pool tables from OpenImages.
The developers of PocketFinder would love for users to add the pool tables found to OSM with the "sport=billiards" tag. Query through Overpass Turbo API, or phone apps.
https://www.openstreetmap.org/
https://overpass-turbo.eu/#
The YOLO model was developed, and fine-tuned using the PocketFinder repo.
- Rust (latest stable version)
- Python 3.10
- Conda or Miniconda
- Google Places API key
- Google Cloud Service Account credentials
conda create --name pool python=3.10
conda activate pool
conda install pytorch pandas
pip install -r requirements.txtCreate a .env file in the root directory with:
GOOGLE_PLACES_API_KEY=your_api_key_here
GOOGLE_PLACES_CRED_PATH=./path/to/your/service-account.json
YOLO_WEIGHTS_PATH=./yolo_weights.pt
YOLO_CONFIDENCE_THRES=0.5
OUTPUT_DIRECTORY=./google_photos- Place your YOLO model weights at
./yolo_weights.pt - Place your Google Cloud service account JSON at the path specified in
.env
Modify config.yaml to set your search parameters:
location:
latitude: your_latitude
longitude: your_longitude
radius_meters: search_radius
processing:
months_threshold: 6
reprocess_all: false
save_negative_images: false
place_types:
- bar
- hotel
- restaurantcargo run --config your_config.yamlor for web interface
cargo run -- --web The program generates two main outputs:
venues_database.json- Contains all processed venuesconfig_results_pool_tables.csv- Filtered results of venues with pool tables (>80% confidence)
src/- Rust source codePoolTableInference.py- YOLO inference scriptgoogle_photos/- Downloaded venue photos (gitignored)
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request