{"id":31879416,"url":"https://github.com/jaynightmare/object-detect","last_synced_at":"2025-10-13T00:29:30.227Z","repository":{"id":305062867,"uuid":"1019542274","full_name":"JayNightmare/Object-Detect","owner":"JayNightmare","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-25T09:43:48.000Z","size":10790,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-04T04:48:01.646Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JayNightmare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-14T13:41:05.000Z","updated_at":"2025-09-25T09:43:51.000Z","dependencies_parsed_at":"2025-07-18T06:13:39.715Z","dependency_job_id":"175daefd-ae3c-4d95-b3aa-d7ad9578f0fa","html_url":"https://github.com/JayNightmare/Object-Detect","commit_stats":null,"previous_names":["jaynightmare/object-detect"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JayNightmare/Object-Detect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayNightmare%2FObject-Detect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayNightmare%2FObject-Detect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayNightmare%2FObject-Detect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayNightmare%2FObject-Detect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JayNightmare","download_url":"https://codeload.github.com/JayNightmare/Object-Detect/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JayNightmare%2FObject-Detect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013645,"owners_count":26085298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-13T00:29:25.075Z","updated_at":"2025-10-13T00:29:30.220Z","avatar_url":"https://github.com/JayNightmare.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Camera Object Detection with YOLOv11 + Object Tracking\n\nA real-time object detection application using Python, OpenCV, and YOLOv11 from Ultralytics that captures video from your computer's camera and detects objects in the live feed. Now includes intelligent object tracking that remembers important objects and their locations!\n\n![Object Detection Demo](https://img.shields.io/badge/Python-3.8%2B-blue) ![OpenCV](https://img.shields.io/badge/OpenCV-4.8%2B-green) ![YOLOv11](https://img.shields.io/badge/YOLOv11-Ultralytics-orange) ![License](https://img.shields.io/badge/License-MIT-yellow)\n\n## Features\n\n### Core Detection Features\n- **YOLOv11 Integration**: State-of-the-art object detection with Ultralytics YOLOv11\n- **Real-time Detection**: Live object detection from camera feed with high accuracy\n- **Multiple Model Sizes**: Support for YOLOv11n, YOLOv11s, YOLOv11m, YOLOv11l, YOLOv11x\n- **GPU Acceleration**: CUDA and MPS support for faster inference\n- **80+ Object Classes**: Supports full COCO dataset object classes\n- **Visual Feedback**: Bounding boxes, confidence scores, and detection counts\n- **Performance Monitoring**: FPS counter and inference time display\n- **Screenshot Capture**: Save images with detected objects\n- **Configurable Settings**: Adjustable detection thresholds and parameters\n- **Cross-platform**: Works on Windows, macOS, and Linux\n\n### 🆕 Object Tracking Features\n- **Smart Object Memory**: Remembers important objects and their last seen locations\n- **Zone-based Tracking**: Divides camera view into 9 zones (3x3 grid) for location reference\n- **Persistent Storage**: Saves tracking history between application sessions\n- **Important Objects Filter**: Focuses on user-defined important object types\n- **Real-time Tracking Info**: Shows current and recently seen objects on screen\n- **Comprehensive Statistics**: Track detection counts, memory usage, and object distribution\n- **Azure Best Practices**: Follows enterprise coding standards with proper error handling and logging\n\n## Quick Start\n\n### Prerequisites\n\n- Python 3.8 or higher\n- A working camera (built-in or USB)\n- Git (for cloning the repository)\n\n### Installation\n\n1. **Clone or download this project**\n   ```bash\n   cd \"d:\\Documents\\Object Detect\"\n   ```\n\n2. **Install dependencies**\n   ```bash\n   pip install -r requirements.txt\n   ```\n\n   The first run will download Ultralytics YOLOv11 weights automatically; if you're offline, download `yolo11n.pt` manually and point `config.YOLO_MODEL` to its path.\n\n3. **Run the application**\n   ```bash\n   python main.py\n   ```\n\n### Basic Usage\n\n1. **Start the application**: Run `python main.py`\n2. **Camera will open**: You'll see a live video feed from your camera\n3. **Objects will be detected**: Detected objects will have bounding boxes and labels\n4. **Object tracking**: Important objects will be tracked and remembered\n5. **Take screenshots**: Press `Space` to save a screenshot\n5. **Exit**: Press `Q` to quit the application\n\n## Configuration\n\nYou can customize the detection behavior by modifying `config.py`:\n\n```python\n# Detection thresholds\nCONFIDENCE_THRESHOLD = 0.5  # Minimum confidence for detections\nNMS_THRESHOLD = 0.4         # Non-maximum suppression threshold\n\n# Camera settings\nCAMERA_WIDTH = 640          # Camera resolution width\nCAMERA_HEIGHT = 480         # Camera resolution height\n\n# Display settings\nSHOW_FPS = True            # Show FPS counter\nSHOW_CONFIDENCE = True     # Show confidence scores\n```\n\n### 🆕 Object Tracking Configuration\n\nThe tracking system can be customized in `config.py`:\n\n```python\n# Object tracking settings\nTRACKING_ENABLED = True                    # Enable/disable object tracking\nIMPORTANT_OBJECTS = [                      # Objects to track and remember\n    \"person\", \"car\", \"laptop\", \"cell phone\", \"book\", \"bottle\"\n]\nTRACKING_MEMORY_DURATION = 300            # Seconds to remember objects\nTRACKING_MIN_CONFIDENCE = 0.6             # Minimum confidence to track\nTRACKING_DISTANCE_THRESHOLD = 100         # Pixel distance for object matching\nTRACKING_MAX_OBJECTS = 1000               # Maximum objects to track\nSHOW_LAST_SEEN_INFO = True                # Show tracking overlay on video\nTRACKING_HISTORY_FILE = \"object_tracking_history.json\"  # History file\n```\n\n**Key Tracking Features:**\n- **Memory System**: Objects are remembered for 5 minutes by default\n- **Zone Detection**: Screen divided into 9 zones (top-left, center, etc.)\n- **Persistent Storage**: Tracking history survives app restarts\n- **Smart Filtering**: Only tracks user-defined important objects\n- **Performance Optimized**: Follows Azure enterprise coding standards\n\n## Command Line Options\n\n```bash\npython main.py --help\n```\n\nAvailable options:\n- `--camera INDEX`: Choose camera index (default: 0)\n- `--model MODEL`: YOLOv11 model to use (default: yolo11n.pt)\n- `--confidence FLOAT`: Set confidence threshold (default: 0.5)\n- `--device DEVICE`: Device to run inference on (default: cpu)\n- `--imgsz SIZE`: Input image size (default: 640)\n- `--half`: Use half precision (FP16) for faster inference\n- `--verbose`: Show detailed model loading info\n\nExamples:\n```bash\n# Use external USB camera\npython main.py --camera 1\n\n# Use larger YOLOv11 model for better accuracy\npython main.py --model yolo11s.pt\n\n# Lower confidence threshold for more detections\npython main.py --confidence 0.3\n\n# Use GPU acceleration (if CUDA available)\npython main.py --device cuda\n\n# Combine multiple options\npython main.py --camera 1 --model yolo11m.pt --confidence 0.6 --device cuda\n```\n\n## Keyboard Controls\n\n| Key | Action |\n|-----|--------|\n| `Q` or `ESC` | Quit application |\n| `Space` | Take screenshot |\n| `R` | Reset FPS counter |\n| `T` | Show tracking information in console |\n| `S` | Save tracking history to file |\n| `I` | Show tracking statistics |\n\n### 🆕 Object Tracking Controls\n\nThe application now includes intelligent object tracking. When enabled, you'll see:\n- **Green indicators** (🟢): Objects currently visible\n- **Red indicators** (🔴): Objects that were recently seen with timestamps\n- **Zone information**: Where objects were last detected (e.g., \"center\", \"top-left\")\n\n**Example tracking display:**\n```\n🟢 person - center (now)\n🔴 laptop - bottom-left (15s ago)\n🟢 cell phone - top-right (now)\n```\n\n## Project Structure\n\n```\nObject Detect/\n├── main.py                      # Main application file with YOLOv11 detection\n├── object_tracker.py           # 🆕 Intelligent object tracking system\n├── tracking_demo.py            # 🆕 Demo script for tracking features\n├── config.py                   # Configuration settings (now with tracking config)\n├── utils.py                    # Utility functions\n├── requirements.txt            # Python dependencies\n├── README.md                   # Project documentation\n├── object_tracking_history.json # 🆕 Persistent tracking data (auto-generated)\n├── .github/\n│   └── copilot-instructions.md  # Copilot development guidelines\n├── screenshots/                # Saved screenshots (created automatically)\n├── output/                     # Output files (created automatically)\n└── models/                     # Model files (created automatically)\n```\n\n## Detected Object Classes\n\nThe application can detect 80+ object classes from the COCO dataset, including:\n\n**People \u0026 Animals**: person, cat, dog, horse, sheep, cow, elephant, bear, zebra, giraffe, bird\n\n**Vehicles**: car, motorcycle, airplane, bus, train, truck, boat, bicycle\n\n**Household Items**: chair, couch, bed, dining table, toilet, tv, laptop, mouse, remote, keyboard, cell phone\n\n**Food Items**: banana, apple, sandwich, orange, broccoli, carrot, hot dog, pizza, donut, cake\n\nAnd many more! See `main.py` for the complete list.\n\n## Troubleshooting\n\n### Camera Issues\n\n**Problem**: \"Error: Could not open camera\"\n- **Solution**: Check if your camera is being used by another application\n- **Alternative**: Try different camera index: `python main.py --camera 1`\n\n**Problem**: Poor detection performance\n- **Solution**: Ensure good lighting and try adjusting confidence threshold\n- **Example**: `python main.py --confidence 0.3`\n\n### Performance Issues\n\n**Problem**: Low FPS or laggy video\n- **Solutions**:\n  - Close other applications using the camera\n  - Lower the camera resolution in `config.py`\n  - Increase `SKIP_FRAMES` in `config.py`\n\n### Installation Issues\n\n**Problem**: \"cv2 module not found\"\n- **Solution**: Install OpenCV: `pip install opencv-python`\n\n**Problem**: \"numpy module not found\"\n- **Solution**: Install NumPy: `pip install numpy`\n\n## Advanced Features\n\n### Enhanced Object Detection\n\nFor more accurate detection, you can integrate advanced models:\n\n1. **YOLO Integration**: Download YOLO weights and config files\n2. **TensorFlow Models**: Use TensorFlow Object Detection API\n3. **Custom Models**: Train your own models for specific use cases\n\n### Recording Video\n\nModify `config.py` to enable video recording:\n\n```python\nENABLE_RECORDING = True\nOUTPUT_VIDEO_PATH = \"output/detection_output.avi\"\n```\n\n### Web Interface\n\nConsider adding a web interface using Flask or Streamlit for remote access and better user experience.\n\n## Development\n\n### Setting Up Development Environment\n\n1. **Install development dependencies**:\n   ```bash\n   pip install -r requirements.txt\n   pip install pytest black flake8  # Additional dev tools\n   ```\n\n2. **Code formatting**:\n   ```bash\n   black *.py  # Format code\n   flake8 *.py  # Check code style\n   ```\n\n### Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Test thoroughly\n5. Submit a pull request\n\n### Adding New Features\n\n- **New detection models**: Extend the `ObjectDetector` class in `main.py`\n- **UI improvements**: Modify the drawing functions in `main.py`\n- **Configuration options**: Add settings to `config.py`\n- **Utility functions**: Add helpers to `utils.py`\n\n## System Requirements\n\n### Minimum Requirements\n- **OS**: Windows 10, macOS 10.14, or Ubuntu 18.04\n- **Python**: 3.8 or higher\n- **RAM**: 4GB\n- **Camera**: Any USB or built-in camera\n\n### Recommended Requirements\n- **OS**: Latest version of Windows, macOS, or Linux\n- **Python**: 3.9 or higher\n- **RAM**: 8GB or more\n- **Camera**: HD camera (720p or higher)\n- **CPU**: Multi-core processor for better performance\n\n## FAQ\n\n**Q: Can I use an IP camera or external camera?**\nA: Yes, modify the camera initialization in `main.py` to use IP camera streams or specify different camera indices.\n\n**Q: How do I improve detection accuracy?**\nA: Use better lighting, ensure objects are clearly visible, and consider integrating more advanced models like YOLO or custom-trained models.\n\n**Q: Can I detect custom objects?**\nA: The current version uses pre-trained COCO models. For custom objects, you'll need to train your own model or use transfer learning.\n\n**Q: Does this work on Raspberry Pi?**\nA: Yes, but you may need to optimize performance settings and ensure proper camera drivers are installed.\n\n## License\n\nThis project is licensed under the MIT License - see the code comments for details.\n\n## Acknowledgments\n\n- **OpenCV Community**: For the excellent computer vision library\n- **COCO Dataset**: For providing the object class definitions\n- **Python Community**: For the robust ecosystem of libraries\n\n## Support\n\nIf you encounter issues or have questions:\n\n1. Check the troubleshooting section above\n2. Review the configuration options in `config.py`\n3. Ensure all dependencies are properly installed\n4. Test with different camera settings\n\n## Version History\n\n- **v1.0.0**: Initial release with basic object detection\n  - Real-time camera capture\n  - Basic object detection framework\n  - Screenshot functionality\n  - Configurable settings\n\n---\n\n**Note**: This is a demonstration project that provides a foundation for object detection applications. For production use, consider integrating more advanced detection models and implementing additional security and performance optimizations.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaynightmare%2Fobject-detect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaynightmare%2Fobject-detect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaynightmare%2Fobject-detect/lists"}