rizwanmunawar / yolov8-object-tracking Goto Github PK
View Code? Open in Web Editor NEWYOLOv8 Object Tracking Using PyTorch, OpenCV and Ultralytics
License: GNU Affero General Public License v3.0
YOLOv8 Object Tracking Using PyTorch, OpenCV and Ultralytics
License: GNU Affero General Public License v3.0
While running the following command:
python yolo/v8/detect/detect_and_trk.py model=yolov8m.pt source="/home/Desktop/YOLOV8/yolotracking/yolov8-object-tracking/1.JPG"
No image is being saved with any sort of putput. The code is not crashing also.
Do let me know.
How to detect only persons?
Hi,
Thanks for the great work. I was playing with your code and I was using a yolov8 segmentation model trained on a custom dataset. I get the following error:
YOLOv8x-seg summary: 295 layers, 71729323 parameters, 0 gradients, 343.7 GFLOPs
1/1: 0... Success (inf frames 640x480 at 30.00 FPS)
Traceback (most recent call last):
File "track.py", line 367, in
main(opt)
File "track.py", line 362, in main
run(**vars(opt))
File "/home/azunino/anaconda3/envs/tracking/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "track.py", line 220, in run
s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string
KeyError: 12
Aborted (core dumped)
Can you help me here? That error comes only when I use a model pretrained on custom data.
Thanks
Andrea
I keep getting this error when I run track.py. I have checked the init.py under yolo/utilities and can find the DEFAULT_CONFIG.
Traceback (most recent call last):
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/tracking_fish_counting.py", line 19, in
from yolo.utils import DEFAULT_CONFIG
ImportError: cannot import name 'DEFAULT_CONFIG' from 'yolo.utils' (/opt/conda/lib/python3.9/site-packages/ultralytics/yolo/utils/init.py)
Sentry is attempting to send 2 pending error messages
Waiting up to 2 seconds
Press Ctrl-C to quit
Can we train custom models on this
hi i use CoLab, after doing installation instructions, when i reached this line
!python /content/yolov8-object-tracking/yolo/v8/detect/detect_and_trk.py model=yolov8s.pt source="test.mp4" show=True
this error appear
Traceback (most recent call last):
File "/content/yolov8-object-tracking/yolo/v8/detect/detect_and_trk.py", line 1, in
import hydra
ModuleNotFoundError: No module named 'hydra' so i pip installed it , but then Traceback (most recent call last):
File "/content/yolov8-object-tracking/yolo/v8/detect/detect_and_trk.py", line 7, in
from ultralytics.yolo.utils import DEFAULT_CONFIG, ROOT, ops
ImportError: cannot import name 'DEFAULT_CONFIG' from 'ultralytics.yolo.utils' (/usr/local/lib/python3.10/dist-packages/ultralytics/yolo/utils/init.py) appeared
Traceback (most recent call last):
File "yolo\v8\detect\detect_and_trk.py", line 5, in
from sort import *
File "E:\yolov8\gitobject\yolov8-object-tracking\yolo\v8\detect\sort.py", line 14, in
from filterpy.kalman import KalmanFilter
ModuleNotFoundError: No module named 'filterpy'
Hi,
I am running python yolo\v8\detect\detect_and_trk.py model=yolov8m.pt source=0 show=True but I get the following error:
File "yolo/v8/detect/detect_and_trk.py", line 115, in write_results
draw_boxes(im0, bbox_xyxy, identities, categories, self.model.names)
NameError: name 'draw_boxes' is not defined
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
terminate called without an active exception
Can you help me?
Thanks
Andrea
Previously, I had no issue doing inferences on mp4 file. But somehow, when I tried to do inference now on my mp4 file, the programme gives me this error. It works if I used some of my older mp4 files.
[2023-04-20 14:23:57,021][root.tracker][INFO] - Loading weights from deep_sort_pytorch/deep_sort/deep/checkpoint/ckpt.t7... Done!
Ultralytics YOLOv8.0.3 🚀 Python-3.9.16 torch-1.13.1+cu117 CUDA:0 (Tesla T4, 15110MiB)
Fusing layers...
Model summary: 268 layers, 68124531 parameters, 0 gradients, 257.4 GFLOPs
Error executing job with overrides: ['model=best_yolov8x_v8.0.0_11April2023.pt', 'conf=0.01', 'source=/root/Yolov5_DeepSort_Pytorch/VideosForTracking/P69_IMG_1095_0.1_Part1.mp4']
Traceback (most recent call last):
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/tracking_fish_counting.py", line 321, in predict
predictor()
File "/opt/conda/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/root/ultralytics-main/ultralytics/yolo/engine/predictor.py", line 189, in call
s += self.write_results(i, preds, (p, im, im0s))
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/tracking_fish_counting.py", line 303, in write_results
outputs = deepsort.update(xywhs, confss, oids, im0)
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep_sort.py", line 29, in update
features = self._get_features(bbox_xywh, ori_img)
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep_sort.py", line 110, in _get_features
features = self.extractor(im_crops)
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep/feature_extractor.py", line 43, in call
im_batch = self._preprocess(im_crops)
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep/feature_extractor.py", line 38, in _preprocess
im_batch = torch.cat([self.norm(_resize(im, self.size)).unsqueeze(
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep/feature_extractor.py", line 38, in
im_batch = torch.cat([self.norm(_resize(im, self.size)).unsqueeze(
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep/feature_extractor.py", line 36, in _resize
return cv2.resize(im.astype(np.float32)/255., size)
cv2.error: OpenCV(4.7.0) /io/opencv/modules/imgproc/src/resize.cpp:4062: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
everything working...great work.thanks
I couldn't solve thin problem.
I type pip install --upgrade attr
but has been error.
Thinking about using rtmp push
RuntimeError: Couldn't load custom C++ ops. This can happen if your PyTorch and torchvision versions are incompatible, or if you had errors while compiling torchvision from source. For further information on the compatible versions, check https://github.com/pytorch/vision#installation for
the compatibility matrix. Please check your PyTorch version with torch.version and your torchvision version with torchvision.version and
verify if they are compatible, and if not please reinstall torchvision so that it matches your PyTorch install.
Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.