Spaces:
Configuration error
Configuration error
Update README.md
Browse files
README.md
CHANGED
@@ -1,118 +0,0 @@
|
|
1 |
-
# Real-time Object Detection and Tracking with YOLOv8 and Streamlit
|
2 |
-
|
3 |
-
This repository is a comprehensive open-source project that demonstrates the integration of object detection and tracking using the YOLOv8 object detection algorithm and Streamlit, a popular Python web application framework for building interactive web applications. This project provides a user-friendly and customizable interface that can detect and track objects in real-time video streams.
|
4 |
-
|
5 |
-
## Demo WebApp
|
6 |
-
|
7 |
-
This app is up and running on Streamlit cloud server!!! Thanks 'Streamlit' for the community support for the cloud upload. You can check the demo of this web application on the link below.
|
8 |
-
|
9 |
-
[yolov8-streamlit-detection-tracking-webapp](https://codingmantras-yolov8-streamlit-detection-tracking-app-njcqjg.streamlit.app/)
|
10 |
-
|
11 |
-
## Tracking With Object Detection Demo
|
12 |
-
|
13 |
-
<https://user-images.githubusercontent.com/104087274/234874398-75248e8c-6965-4c91-9176-622509f0ad86.mov>
|
14 |
-
|
15 |
-
## Demo Pics
|
16 |
-
|
17 |
-
### Home page
|
18 |
-
|
19 |
-
<img src="https://github.com/CodingMantras/yolov8-streamlit-detection-tracking/blob/master/assets/pic1.png" >
|
20 |
-
|
21 |
-
### Page after uploading an image and object detection
|
22 |
-
|
23 |
-
<img src="https://github.com/CodingMantras/yolov8-streamlit-detection-tracking/blob/master/assets/pic3.png" >
|
24 |
-
|
25 |
-
### Segmentation task on image
|
26 |
-
|
27 |
-
<img src="https://github.com/CodingMantras/yolov8-streamlit-detection-tracking/blob/master/assets/segmentation.png" >
|
28 |
-
|
29 |
-
## Requirements
|
30 |
-
|
31 |
-
Python 3.6+
|
32 |
-
YOLOv8
|
33 |
-
Streamlit
|
34 |
-
|
35 |
-
```bash
|
36 |
-
pip install ultralytics streamlit pytube
|
37 |
-
```
|
38 |
-
|
39 |
-
## Installation
|
40 |
-
|
41 |
-
- Clone the repository: git clone <https://github.com/CodingMantras/yolov8-streamlit-detection-tracking.git>
|
42 |
-
- Change to the repository directory: `cd yolov8-streamlit-detection-tracking`
|
43 |
-
- Create `weights`, `videos`, and `images` directories inside the project.
|
44 |
-
- Download the pre-trained YOLOv8 weights from (<https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt>) and save them to the `weights` directory in the same project.
|
45 |
-
|
46 |
-
## Usage
|
47 |
-
|
48 |
-
- Run the app with the following command: `streamlit run app.py`
|
49 |
-
- The app should open in a new browser window.
|
50 |
-
|
51 |
-
### ML Model Config
|
52 |
-
|
53 |
-
- Select task (Detection, Segmentation)
|
54 |
-
- Select model confidence
|
55 |
-
- Use the slider to adjust the confidence threshold (25-100) for the model.
|
56 |
-
|
57 |
-
One the model config is done, select a source.
|
58 |
-
|
59 |
-
### Detection on images
|
60 |
-
|
61 |
-
- The default image with its objects-detected image is displayed on the main page.
|
62 |
-
- Select a source. (radio button selection `Image`).
|
63 |
-
- Upload an image by clicking on the "Browse files" button.
|
64 |
-
- Click the "Detect Objects" button to run the object detection algorithm on the uploaded image with the selected confidence threshold.
|
65 |
-
- The resulting image with objects detected will be displayed on the page. Click the "Download Image" button to download the image.("If save image to download" is selected)
|
66 |
-
|
67 |
-
## Detection in Videos
|
68 |
-
|
69 |
-
- Create a folder with name `videos` in the same directory
|
70 |
-
- Dump your videos in this folder
|
71 |
-
- In `settings.py` edit the following lines.
|
72 |
-
|
73 |
-
```python
|
74 |
-
# video
|
75 |
-
VIDEO_DIR = ROOT / 'videos' # After creating the videos folder
|
76 |
-
|
77 |
-
# Suppose you have four videos inside videos folder
|
78 |
-
# Edit the name of video_1, 2, 3, 4 (with the names of your video files)
|
79 |
-
VIDEO_1_PATH = VIDEO_DIR / 'video_1.mp4'
|
80 |
-
VIDEO_2_PATH = VIDEO_DIR / 'video_2.mp4'
|
81 |
-
VIDEO_3_PATH = VIDEO_DIR / 'video_3.mp4'
|
82 |
-
VIDEO_4_PATH = VIDEO_DIR / 'video_4.mp4'
|
83 |
-
|
84 |
-
# Edit the same names here also.
|
85 |
-
VIDEOS_DICT = {
|
86 |
-
'video_1': VIDEO_1_PATH,
|
87 |
-
'video_2': VIDEO_2_PATH,
|
88 |
-
'video_3': VIDEO_3_PATH,
|
89 |
-
'video_4': VIDEO_4_PATH,
|
90 |
-
}
|
91 |
-
|
92 |
-
# Your videos will start appearing inside streamlit webapp 'Choose a video'.
|
93 |
-
```
|
94 |
-
|
95 |
-
- Click on `Detect Video Objects` button and the selected task (detection/segmentation) will start on the selected video.
|
96 |
-
|
97 |
-
### Detection on RTSP
|
98 |
-
|
99 |
-
- Select the RTSP stream button
|
100 |
-
- Enter the rtsp url inside the textbox and hit `Detect Objects` button
|
101 |
-
|
102 |
-
### Detection on YouTube Video URL
|
103 |
-
|
104 |
-
- Select the source as YouTube
|
105 |
-
- Copy paste the url inside the text box.
|
106 |
-
- The detection/segmentation task will start on the YouTube video url
|
107 |
-
|
108 |
-
<https://user-images.githubusercontent.com/104087274/226178296-684ad72a-fe5f-4589-b668-95c835cd8d8a.mov>
|
109 |
-
|
110 |
-
## Acknowledgements
|
111 |
-
|
112 |
-
This app is based on the YOLOv8(<https://github.com/ultralytics/ultralytics>) object detection algorithm. The app uses the Streamlit(<https://github.com/streamlit/streamlit>) library for the user interface.
|
113 |
-
|
114 |
-
### Disclaimer
|
115 |
-
|
116 |
-
Please note that this project is intended for educational purposes only and should not be used in production environments.
|
117 |
-
|
118 |
-
**Hit star ⭐ if you like this repo!!!**
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|