--- title: Final Project Object Localization emoji: πŸ† colorFrom: indigo colorTo: gray sdk: gradio sdk_version: 5.29.0 app_file: app.py pinned: false license: cc --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference --- # Object Localization β€” Bounding Box Prediction **Authors:** Elizabeth Wangley and Henry Wang **Course:** CSCI 4750 - Machine Learning **Date:** May 12, 2025 **Paper:** [Read the full paper](https://docs.google.com/document/d/1j6jLVY_zNitulqg8Gps824ZlW59BBOY2LYh2olP-B4k/edit?usp=sharing) **Live Demo:** [Hugging Face Spaces](https://huggingface.co/spaces/MLFinalProject/Final_Project_Object_Localization) --- ## Overview A Gradio web app that predicts bounding boxes around a stop sign in images using two ML models: - **Linear Regression** β€” Four separate models, one per coordinate (`x`, `y`, `width`, `height`) - **MLP (Neural Network)** β€” Single model predicting all four coordinates simultaneously Images 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). --- ## Results | Metric | Linear Regression | MLP | | --------- | ----------------- | ----- | | Avg. RMSE | ~7 | ~3 | | Mean IoU | 0.581 | 0.778 | The MLP outperformed Linear Regression and was selected for deployment. --- ## Usage 1. Upload an image 2. Select a model β€” **MLP** or **Linear Regression** 3. View the predicted bounding box vs. ground truth --- ## Run Locally ```bash pip install -r requirements.txt python app.py ``` Open `http://127.0.0.1:7860` in your browser. --- ## Project Structure ``` β”œβ”€β”€ app.py β”œβ”€β”€ image_annotation.csv β”œβ”€β”€ mlp_bbox_model.pkl β”œβ”€β”€ linear_model_x.pkl β”œβ”€β”€ linear_model_y.pkl β”œβ”€β”€ linear_model_w.pkl β”œβ”€β”€ linear_model_h.pkl β”œβ”€β”€ requirements.txt └── README.md ``` --- ## Installation & Running Locally ```bash git clone https://github.com/your-username/Final_Project_Object_Localization.git cd Final_Project_Object_Localization pip install -r requirements.txt python app.py ``` Then open `http://127.0.0.1:7860` in your browser. --- ## Requirements - Python 3.8+ - gradio - numpy - pandas - scikit-learn - scikit-image - matplotlib - joblib --- ## Future Work - Explore additional model architectures and do a more thorough comparison of traditional ML vs. deep learning in terms of resource cost vs. accuracy. - Test a broader set of hyperparameters with stronger computing resources. - Investigate alternative hyperparameter tuning strategies (e.g., random search, Bayesian optimization) for efficiency. - Evaluate model robustness on images where the stop sign is partially visible or occluded. --- ## References - GΓ©ron, AurΓ©lien. _Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow_. O'Reilly Media, 2022. - "Hyperparameter Tuning in Linear Regression." GeeksforGeeks, July 1, 2024. https://www.geeksforgeeks.org/hyperparameter-tuning-in-linear-regression/ - 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/