Merge pull request #660 from roboflow/example-fixes

fix(examples): 🐞 tracking LabelAnnotator and traffic_analysis deps fixed
This commit is contained in:
Piotr Skalski 2023-12-08 15:03:07 +01:00 committed by GitHub
commit a53e39d097
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 7 deletions

19
demo.ipynb vendored
View File

@ -226,7 +226,7 @@
"output_type": "stream",
"text": [
"\u001b[?25l \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m0.0/45.4 kB\u001b[0m \u001b[31m?\u001b[0m eta \u001b[36m-:--:--\u001b[0m\r\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.4/45.4 kB\u001b[0m \u001b[31m3.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25h0.16.0\n"
"\u001b[?25h0.17.0\n"
]
}
],
@ -803,6 +803,15 @@
"**NOTE:** During our demo, we will need some example videos."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"!pip install -q supervision[assets]"
]
},
{
"cell_type": "code",
"execution_count": 63,
@ -831,9 +840,7 @@
},
"outputs": [],
"source": [
"%cd {HOME}/videos\n",
"\n",
"!wget --load-cookies /tmp/cookies.txt \"https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1pz68D1Gsx80MoPg-_q-IbEdESEmyVLm-' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\\1\\n/p')&id=1pz68D1Gsx80MoPg-_q-IbEdESEmyVLm-\" -O vehicle-counting.mp4 && rm -rf /tmp/cookies.txt"
"%cd {HOME}/videos"
]
},
{
@ -844,7 +851,9 @@
},
"outputs": [],
"source": [
"VIDEO_PATH = f\"{HOME}/videos/vehicle-counting.mp4\""
"from supervision.assets import download_assets, VideoAssets\n",
"download_assets(VideoAssets.VEHICLES)\n",
"VIDEO_PATH = f\"{HOME}/videos/vehicle.mp4\""
]
},
{

View File

@ -9,6 +9,16 @@ detection and Supervision for tracking and annotation.
pip install -r requirements.txt
```
## ⚙️ run
```bash
python script.py \
--source_weights_path yolov8s.pt \
--source_video_path input.mp4 \
--target_video_path tracking_result.mp4
```
## ⚙️ parameters
| parameter | required | description |

View File

@ -17,7 +17,7 @@ def process_video(
tracker = sv.ByteTrack()
box_annotator = sv.BoundingBoxAnnotator()
label_annotator = sv.LabelAnnotator(classes=model.names)
label_annotator = sv.LabelAnnotator()
frame_generator = sv.get_video_frames_generator(source_path=source_video_path)
video_info = sv.VideoInfo.from_video_path(video_path=source_video_path)

View File

@ -1,4 +1,4 @@
supervision>=0.15.0rc1
supervision
tqdm
ultralytics
gdown