{"id":23700677,"url":"https://github.com/sidd0894/object-detector","last_synced_at":"2026-05-09T00:04:55.255Z","repository":{"id":269296126,"uuid":"906244274","full_name":"sidd0894/Object-Detector","owner":"sidd0894","description":"This project implements real-time object detection using OpenCV and the EfficientDet Lite model. The application provides an interactive display, allowing users to visualize object detection in real-time.","archived":false,"fork":false,"pushed_at":"2024-12-23T08:22:37.000Z","size":3317,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-30T09:16:55.276Z","etag":null,"topics":["computer-vision","mediapipe","mediapipe-models","object-detection","opencv","python3"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sidd0894.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2024-12-20T13:19:27.000Z","updated_at":"2024-12-23T08:47:51.000Z","dependencies_parsed_at":"2024-12-22T14:34:42.731Z","dependency_job_id":"c6225dd7-f0d7-4d6b-80e2-025bed06c05b","html_url":"https://github.com/sidd0894/Object-Detector","commit_stats":null,"previous_names":["sidd0894/object-detector"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidd0894%2FObject-Detector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidd0894%2FObject-Detector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidd0894%2FObject-Detector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sidd0894%2FObject-Detector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sidd0894","download_url":"https://codeload.github.com/sidd0894/Object-Detector/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239774333,"owners_count":19694700,"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","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":["computer-vision","mediapipe","mediapipe-models","object-detection","opencv","python3"],"created_at":"2024-12-30T09:16:57.785Z","updated_at":"2026-01-28T20:30:14.444Z","avatar_url":"https://github.com/sidd0894.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Real-Time Object Detection with EfficientDet Lite and OpenCV\n\nThis project demonstrates real-time object detection using a webcam feed, leveraging OpenCV and MediaPipe. The EfficientDet Lite0 model is used to detect objects, and bounding boxes are drawn around them, with class labels displayed on each frame.\n\n## Requirements\n\nBefore running the project, ensure that the following Python libraries are installed:\n\n- `opencv-python`: For video capture and image processing.\n- `mediapipe`: For vision tasks, including object detection.\n\nTo install the dependencies, run:\n\n```bash\npip install mediapipe opencv-python\n```\n\nAlternatively, you can install all dependencies listed in the `requirements.txt` file:\n\n```bash\npip install -r requirements.txt\n```\n\nEnsure the `efficientdet_lite0.tflite` model is placed in a `models` directory, as specified in the code, for object detection functionality.\n\n## Functions\n\n### `getObjects(frame, textColor=(0, 255, 0))`\n\nThis function processes an input frame and detects objects, drawing bounding boxes around each detected object.\n\n**Parameters:**\n- `frame` (numpy.ndarray): The image frame from the webcam feed, video, or image.\n- `textColor` (tuple, optional): The color of the text (default is green).\n\n**Returns:**\n- A frame with bounding boxes drawn around detected objects.\n\n### `main()`\n\nThis function continuously captures video from the webcam or loads an image/video file, applies object detection on each frame, and displays the result. The stream will stop when the user presses the 'q' key or reaches the end of the video.\n\n## How It Works\n\n1. **Object Detection**: The EfficientDet Lite0 model, loaded using MediaPipe's `ObjectDetector`, processes each frame to identify objects in real time.\n2. **Bounding Boxes**: For each detected object, a bounding box is drawn using OpenCV’s `cv2.rectangle()`. The object's class label is displayed near the bounding box.\n3. **Displaying Results**: The processed frame, now containing the bounding boxes and labels, is continuously displayed in a window.\n\n## Running the Program\n\nThe program accepts command-line arguments to specify the input type (image, video, or webcam), input file, and output options. Below are the details for using these arguments:\n\n### Arguments\n\n- `--input-type` / (`-t`): **Required**  \n  Specifies the type of input:\n  - `image`: Use an image file as input.\n  - `video`: Use a video file as input.\n  - `webcam`: Use a webcam for live video input.\n\n- `--index` / (`-i`):  \n  Specifies the webcam index (only for webcam input). If you have multiple webcams, you can specify which one to use (default is `0`).\n\n- `--input-file` / (`-if`):  \n  Specifies the path to the input image or video file. This is required when `input-type` is either `image` or `video`.\n\n- `--output-file` / (`-of`):  \n  Specifies the path of the output file where the result will be saved. This can be an image file (for `image` input) or a video file (for `video` or `webcam` input). If not provided, the processed frames will only be displayed.\n\n### Examples\n\n#### For Webcam Input:\n\nTo start real-time object detection using the webcam, run:\n\n```bash\npython object_detection.py --input-type webcam\n```\n\nThis will use the default webcam (`index 0`).  \n\nYou can use the `--index` / `-i` argument if you want to specify a specific webcam when the input type is set to `webcam`. For example:\n\n  ```bash\n  python object_detection.py --input-type webcam --index 1\n  ```\n\n  This will use the second webcam (if available) for object detection.  \n\n#### For Image Input:\n\nTo run object detection on an image, provide the path to the image file using the `--input-file` / `-if` argument:\n\n```bash\npython object_detection.py --input-type image --input-file path_to_image.jpg --output-file output_image.jpg\n```\n\nThis will detect objects in the specified image and save the processed image to `output_image.jpg`.\n\n#### For Video Input:\n\nTo run object detection on a video file, provide the video file path using the `--input-file` / `-if` argument:\n\n```bash\npython object_detection.py --input-type video --input-file path_to_video.mp4 --output-file output_video.mp4\n```\n\nThis will process the video and save the output with the detected objects to `output_video.mp4`.\n\n\n## Note-\n\n- If you choose to use a video or image file as input, make sure to specify the path to the input file using the `--input-file` / `-if` argument.\n\n- The output file is optional. The processed image or video or webcam feed will be displayed live unless you specify an output file to save the result using `--output-file` / `-of`.\n\n- The program uses `efficientdet_lite0.tflite`, which should be placed in a `models` directory to function correctly.\n\n- Press 'q' to exit the program.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidd0894%2Fobject-detector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsidd0894%2Fobject-detector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsidd0894%2Fobject-detector/lists"}