CoolFace
Apppublic

MLFinalProject/Final_Project_Object_Localization

sourceHugging Faceccupdated 7mo agoView on Hugging Face
0likes
README.md124 linesDownload Raw Back to root
1---2title: Final Project Object Localization3emoji: πŸ†4colorFrom: indigo5colorTo: gray6sdk: gradio7sdk_version: 5.29.08app_file: app.py9pinned: false10license: cc11---12 13Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference14 15---16 17# Object Localization β€” Bounding Box Prediction18 19**Authors:** Elizabeth Wangley and Henry Wang  20**Course:** CSCI 4750 - Machine Learning  21**Date:** May 12, 2025  22**Paper:** [Read the full paper](https://docs.google.com/document/d/1j6jLVY_zNitulqg8Gps824ZlW59BBOY2LYh2olP-B4k/edit?usp=sharing)  23**Live Demo:** [Hugging Face Spaces](https://huggingface.co/spaces/MLFinalProject/Final_Project_Object_Localization)24 25---26 27## Overview28 29A Gradio web app that predicts bounding boxes around a stop sign in images using two ML models:30 31- **Linear Regression** β€” Four separate models, one per coordinate (`x`, `y`, `width`, `height`)32- **MLP (Neural Network)** β€” Single model predicting all four coordinates simultaneously33 34Images are resized to 64Γ—64, converted to grayscale, and flattened as model input. The app displays the predicted box in **red** and the ground truth in **green** (when available).35 36---37 38## Results39 40| Metric    | Linear Regression | MLP   |41| --------- | ----------------- | ----- |42| Avg. RMSE | ~7                | ~3    |43| Mean IoU  | 0.581             | 0.778 |44 45The MLP outperformed Linear Regression and was selected for deployment.46 47---48 49## Usage50 511. Upload an image522. Select a model β€” **MLP** or **Linear Regression**533. View the predicted bounding box vs. ground truth54 55---56 57## Run Locally58 59```bash60pip install -r requirements.txt61python app.py62```63 64Open `http://127.0.0.1:7860` in your browser.65 66---67 68## Project Structure69 70```71β”œβ”€β”€ app.py72β”œβ”€β”€ image_annotation.csv73β”œβ”€β”€ mlp_bbox_model.pkl74β”œβ”€β”€ linear_model_x.pkl75β”œβ”€β”€ linear_model_y.pkl76β”œβ”€β”€ linear_model_w.pkl77β”œβ”€β”€ linear_model_h.pkl78β”œβ”€β”€ requirements.txt79└── README.md80```81 82---83 84## Installation & Running Locally85 86```bash87git clone https://github.com/your-username/Final_Project_Object_Localization.git88cd Final_Project_Object_Localization89pip install -r requirements.txt90python app.py91```92 93Then open `http://127.0.0.1:7860` in your browser.94 95---96 97## Requirements98 99- Python 3.8+100- gradio101- numpy102- pandas103- scikit-learn104- scikit-image105- matplotlib106- joblib107 108---109 110## Future Work111 112- Explore additional model architectures and do a more thorough comparison of traditional ML vs. deep learning in terms of resource cost vs. accuracy.113- Test a broader set of hyperparameters with stronger computing resources.114- Investigate alternative hyperparameter tuning strategies (e.g., random search, Bayesian optimization) for efficiency.115- Evaluate model robustness on images where the stop sign is partially visible or occluded.116 117---118 119## References120 121- GΓ©ron, AurΓ©lien. _Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow_. O'Reilly Media, 2022.122- "Hyperparameter Tuning in Linear Regression." GeeksforGeeks, July 1, 2024. https://www.geeksforgeeks.org/hyperparameter-tuning-in-linear-regression/123- Nayda, Yuriy. "Object Detection Technology: How It Works and Where It's Used." SmartTek Solutions, Jan. 11, 2023. https://smarttek.solutions/blog/object-detection-technology/124