--- title: ObjectDetection emoji: 🚗 colorFrom: red colorTo: red sdk: streamlit app_file: src/streamlit_app.py pinned: false short_description: Detect and count cars/trucks in images (cvlib + OpenCV). license: mit --- # 🚗 Vehicle Counter – Object Detection App This project uses computer vision to detect and count vehicles in an image. A pre-trained object detection model from **cvlib** (YOLO) is used to identify cars and trucks. The results are saved as: - an output image with bounding boxes (`detected.jpg`) - a JSON file with the object counts (`results.json`) --- ## 🔍 Features - Upload an image (JPG / PNG / WEBP) - Detect vehicles using cvlib and OpenCV - Count cars and trucks automatically - Save results as JSON - Display detected image in a Streamlit app --- ## 🧠 How it works 1. The user uploads an image 2. Objects are detected using `cvlib.detect_common_objects` 3. Bounding boxes are drawn on the image 4. The number of cars and trucks is counted 5. Results are saved to `src/results.json` and `src/detected.jpg` --- ## ▶️ Run locally ```bash pip install -r requirements.txt streamlit run app.py 📁 Project Structure . ├── app.py ├── requirements.txt ├── README.md └── src/ ├── results.json └── detected.jpg 📌 Output Example { "cars": 11, "trucks": 3 } Author Enes Yamac