Giter VIP home page Giter VIP logo

yolov8-deepsort-object-tracking's Introduction

YOLOv8 Object Detection with DeepSORT Tracking(ID + Trails)

Google Colab File Link (A Single Click Solution)

The google colab file link for yolov8 object detection and tracking is provided below, you can check the implementation in Google Colab, and its a single click implementation, you just need to select the Run Time as GPU, and click on Run All.

Google Colab File

Object Detection and Tracking (ID + Trails) using YOLOv8 on Custom Data

Google Colab File Link (A Single Click Solution)

Google Colab File

YOLOv8 Segmentation with DeepSORT Object Tracking

Github Repo Link

Steps to run Code

  • Clone the repository
git clone https://github.com/MuhammadMoinFaisal/YOLOv8-DeepSORT-Object-Tracking.git
  • Goto the cloned folder.
cd YOLOv8-DeepSORT-Object-Tracking
  • Install the dependecies
pip install -e '.[dev]'

  • Setting the Directory.
cd ultralytics/yolo/v8/detect

  • Downloading the DeepSORT Files From The Google Drive

https://drive.google.com/drive/folders/1kna8eWGrSfzaR6DtNJ8_GchGgPMv3VC8?usp=sharing
  • After downloading the DeepSORT Zip file from the drive, unzip it go into the subfolders and place the deep_sort_pytorch folder into the yolo/v8/detect folder

  • Downloading a Sample Video from the Google Drive

gdown "https://drive.google.com/uc?id=1rjBn8Fl1E_9d0EMVtL24S9aNQOJAveR5&confirm=t"
  • Run the code with mentioned command below.

  • For yolov8 object detection + Tracking

python predict.py model=yolov8l.pt source="test3.mp4" show=True
  • For yolov8 object detection + Tracking + Vehicle Counting
  • Download the updated predict.py file from the Google Drive and place it into ultralytics/yolo/v8/detect folder
  • Google Drive Link
https://drive.google.com/drive/folders/1awlzTGHBBAn_2pKCkLFADMd1EN_rJETW?usp=sharing
  • For yolov8 object detection + Tracking + Vehicle Counting
python predict.py model=yolov8l.pt source="test3.mp4" show=True

RESULTS

Vehicles Detection, Tracking and Counting

Vehicles Detection, Tracking and Counting

Watch the Complete Step by Step Explanation

Watch the Complete Tutorial for the Step by Step Explanation

yolov8-deepsort-object-tracking's People

Contributors

muhammadmoinfaisal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yolov8-deepsort-object-tracking's Issues

yolov8自己训练的模型,需要在ultralytics 8.0.3版本下训练才可以吗?

File "predict.py", line 253, in predict
predictor()
File "/home/wr/miniconda3/envs/yolov8_py38/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/home/wr/deepsort_python/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/engine/predictor.py", line 164, in call
model = self.model if self.done_setup else self.setup(source, model)
File "/home/wr/deepsort_python/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/engine/predictor.py", line 121, in setup
model = AutoBackend(model, device=device, dnn=self.args.dnn, fp16=self.args.half)
File "/home/wr/deepsort_python/YOLOv8-DeepSORT-Object-Tracking/ultralytics/nn/autobackend.py", line 73, in init
model = attempt_load_weights(weights if isinstance(weights, list) else w,
File "/home/wr/deepsort_python/YOLOv8-DeepSORT-Object-Tracking/ultralytics/nn/tasks.py", line 303, in attempt_load_weights
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
File "/home/wr/miniconda3/envs/yolov8_py38/lib/python3.8/site-packages/torch/serialization.py", line 594, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "/home/wr/miniconda3/envs/yolov8_py38/lib/python3.8/site-packages/torch/serialization.py", line 853, in _load
result = unpickler.load()
ModuleNotFoundError: No module named 'ultralytics.nn.modules.conv'; 'ultralytics.nn.modules' is not a package

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

我更换了我自己训练的模型,在ultralytics 8.0.15环境下训练的yolov8s模型,但是替换后,报错上面

ModuleNotFoundError: No module named 'easydict'

File "D:\YOLOV8 DEEPSORT\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\deep_sort_pytorch\utils\parser.py", line 3, in
from easydict import EasyDict as edict
ModuleNotFoundError: No module named 'easydict'

How to solve this?

ModuleNotFoundError: No module named 'ultralytics.nn.modules.conv'; 'ultralytics.nn.modules' is not a package

When retrained your model yolov8l.pt with custom dataset and then used best. pt for prediction it giving following errors:
ModuleNotFoundError: No module named 'ultralytics.nn.modules.conv'; 'ultralytics.nn.modules' is not a package
!python predict.py model=yolov8l.pt source="output_video.mp4" show=True

[2024-03-18 20:54:18,878][root.tracker][INFO] - Loading weights from deep_sort_pytorch/deep_sort/deep/checkpoint/ckpt.t7... Done!
Ultralytics YOLOv8.0.3 🚀 Python-3.8.18 torch-2.2.1+cu121 CUDA:0 (NVIDIA GeForce RTX 3060, 12029MiB)
Error executing job with overrides: ['model=best.pt', 'source=output_video.mp4', 'show=True']
Traceback (most recent call last):
File "predict.py", line 326, in predict
predictor()
File "/home/tricubics/.local/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/tricubics/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/engine/predictor.py", line 164, in call
model = self.model if self.done_setup else self.setup(source, model)
File "/home/tricubics/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/engine/predictor.py", line 121, in setup
model = AutoBackend(model, device=device, dnn=self.args.dnn, fp16=self.args.half)
File "/home/tricubics/YOLOv8-DeepSORT-Object-Tracking/ultralytics/nn/autobackend.py", line 73, in init
model = attempt_load_weights(weights if isinstance(weights, list) else w,
File "/home/tricubics/YOLOv8-DeepSORT-Object-Tracking/ultralytics/nn/tasks.py", line 303, in attempt_load_weights
ckpt = torch.load(attempt_download(w), map_location='cpu') # load
File "/home/tricubics/.local/lib/python3.8/site-packages/torch/serialization.py", line 1026, in load
return _load(opened_zipfile,
File "/home/tricubics/.local/lib/python3.8/site-packages/torch/serialization.py", line 1438, in _load
result = unpickler.load()
File "/home/tricubics/.local/lib/python3.8/site-packages/torch/serialization.py", line 1431, in find_class
return super().find_class(mod_name, name)
ModuleNotFoundError: No module named 'ultralytics.nn.modules.conv'; 'ultralytics.nn.modules' is not a package

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Can't install pip install -e '.[dev]'

I've been trying for some time to fix this error but always receive this error (using python 3.10 and already updated pip)

Obtaining file:///C:/Users/Christopher%20Then/OneDrive/Documents/Ngee%20Ann%20Poly%20Year%203/Vaxtor%20Object%20Detector/TestVision2/YOLOv8-DeepSORT-Object-Tracking
Preparing metadata (setup.py) ... done
Requirement already satisfied: hydra-core>=1.2.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (1.3.2)
Requirement already satisfied: matplotlib>=3.2.2 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (3.8.4)
Requirement already satisfied: numpy>=1.18.5 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (1.26.4)
Requirement already satisfied: opencv-python>=4.1.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (4.9.0.80)
Requirement already satisfied: Pillow>=7.1.2 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (10.3.0)
Requirement already satisfied: PyYAML>=5.3.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (6.0.1)
Requirement already satisfied: requests>=2.23.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (2.31.0)
Requirement already satisfied: scipy>=1.4.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (1.13.0)
Requirement already satisfied: torch>=1.7.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (2.2.2)
Requirement already satisfied: torchvision>=0.8.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (0.17.2)
Requirement already satisfied: tqdm>=4.64.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (4.66.2)
Requirement already satisfied: tensorboard>=2.4.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (2.16.2)
Requirement already satisfied: pandas>=1.1.4 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (2.2.1)
Requirement already satisfied: seaborn>=0.11.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (0.13.2)
Requirement already satisfied: ipython in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (8.23.0)
Requirement already satisfied: psutil in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (5.9.8)
Requirement already satisfied: thop>=0.1.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (0.1.1.post2209072238)
Requirement already satisfied: GitPython>=3.1.24 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (3.1.43)
Requirement already satisfied: check-manifest in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (0.49)
Requirement already satisfied: pytest in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (8.1.1)
Requirement already satisfied: pytest-cov in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (5.0.0)
Requirement already satisfied: coverage in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (7.4.4)
Requirement already satisfied: mkdocs in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ultralytics==8.0.3) (1.5.3)
Collecting mkdocstrings[python] (from ultralytics==8.0.3)
Using cached mkdocstrings-0.24.3-py3-none-any.whl.metadata (7.6 kB)
Collecting mkdocs-material (from ultralytics==8.0.3)
Using cached mkdocs_material-9.5.17-py3-none-any.whl.metadata (17 kB)
Requirement already satisfied: gitdb<5,>=4.0.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from GitPython>=3.1.24->ultralytics==8.0.3) (4.0.11)
Requirement already satisfied: omegaconf<2.4,>=2.2 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from hydra-core>=1.2.0->ultralytics==8.0.3) (2.3.0)
Requirement already satisfied: antlr4-python3-runtime==4.9.* in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from hydra-core>=1.2.0->ultralytics==8.0.3) (4.9.3)
Requirement already satisfied: packaging in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from hydra-core>=1.2.0->ultralytics==8.0.3) (24.0)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=3.2.2->ultralytics==8.0.3) (1.2.1)
Requirement already satisfied: cycler>=0.10 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=3.2.2->ultralytics==8.0.3) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=3.2.2->ultralytics==8.0.3) (4.51.0)
Requirement already satisfied: kiwisolver>=1.3.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=3.2.2->ultralytics==8.0.3) (1.4.5)
Requirement already satisfied: pyparsing>=2.3.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=3.2.2->ultralytics==8.0.3) (3.1.2)
Requirement already satisfied: python-dateutil>=2.7 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from matplotlib>=3.2.2->ultralytics==8.0.3) (2.9.0.post0)
Requirement already satisfied: pytz>=2020.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from pandas>=1.1.4->ultralytics==8.0.3) (2024.1)
Requirement already satisfied: tzdata>=2022.7 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from pandas>=1.1.4->ultralytics==8.0.3) (2024.1)
Requirement already satisfied: charset-normalizer<4,>=2 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from requests>=2.23.0->ultralytics==8.0.3) (3.3.2)
Requirement already satisfied: idna<4,>=2.5 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from requests>=2.23.0->ultralytics==8.0.3) (3.6)
Requirement already satisfied: urllib3<3,>=1.21.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from requests>=2.23.0->ultralytics==8.0.3) (2.2.1)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from requests>=2.23.0->ultralytics==8.0.3) (2024.2.2)
Requirement already satisfied: absl-py>=0.4 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tensorboard>=2.4.1->ultralytics==8.0.3) (2.1.0)
Requirement already satisfied: grpcio>=1.48.2 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tensorboard>=2.4.1->ultralytics==8.0.3) (1.62.1)
Requirement already satisfied: markdown>=2.6.8 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tensorboard>=2.4.1->ultralytics==8.0.3) (3.6)
Requirement already satisfied: protobuf!=4.24.0,>=3.19.6 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tensorboard>=2.4.1->ultralytics==8.0.3) (5.26.1)
Requirement already satisfied: setuptools>=41.0.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tensorboard>=2.4.1->ultralytics==8.0.3) (69.2.0)
Requirement already satisfied: six>1.9 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tensorboard>=2.4.1->ultralytics==8.0.3) (1.16.0)
Requirement already satisfied: tensorboard-data-server<0.8.0,>=0.7.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tensorboard>=2.4.1->ultralytics==8.0.3) (0.7.2)
Requirement already satisfied: werkzeug>=1.0.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tensorboard>=2.4.1->ultralytics==8.0.3) (3.0.2)
Requirement already satisfied: filelock in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from torch>=1.7.0->ultralytics==8.0.3) (3.13.3)
Requirement already satisfied: typing-extensions>=4.8.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from torch>=1.7.0->ultralytics==8.0.3) (4.11.0)
Requirement already satisfied: sympy in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from torch>=1.7.0->ultralytics==8.0.3) (1.12)
Requirement already satisfied: networkx in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from torch>=1.7.0->ultralytics==8.0.3) (3.3)
Requirement already satisfied: jinja2 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from torch>=1.7.0->ultralytics==8.0.3) (3.1.3)
Requirement already satisfied: fsspec in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from torch>=1.7.0->ultralytics==8.0.3) (2024.3.1)
Requirement already satisfied: colorama in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from tqdm>=4.64.0->ultralytics==8.0.3) (0.4.6)
Requirement already satisfied: build>=0.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from check-manifest->ultralytics==8.0.3) (1.2.1)
Requirement already satisfied: tomli in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from check-manifest->ultralytics==8.0.3) (2.0.1)
Requirement already satisfied: decorator in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ipython->ultralytics==8.0.3) (5.1.1)
Requirement already satisfied: jedi>=0.16 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ipython->ultralytics==8.0.3) (0.19.1)
Requirement already satisfied: matplotlib-inline in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ipython->ultralytics==8.0.3) (0.1.6)
Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ipython->ultralytics==8.0.3) (3.0.43)
Requirement already satisfied: pygments>=2.4.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ipython->ultralytics==8.0.3) (2.17.2)
Requirement already satisfied: stack-data in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ipython->ultralytics==8.0.3) (0.6.3)
Requirement already satisfied: traitlets>=5.13.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ipython->ultralytics==8.0.3) (5.14.2)
Requirement already satisfied: exceptiongroup in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from ipython->ultralytics==8.0.3) (1.2.0)
Requirement already satisfied: click>=7.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs->ultralytics==8.0.3) (8.1.7)
Requirement already satisfied: ghp-import>=1.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs->ultralytics==8.0.3) (2.1.0)
Requirement already satisfied: markupsafe>=2.0.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs->ultralytics==8.0.3) (2.1.5)
Requirement already satisfied: mergedeep>=1.3.4 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs->ultralytics==8.0.3) (1.3.4)
Requirement already satisfied: pathspec>=0.11.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs->ultralytics==8.0.3) (0.12.1)
Requirement already satisfied: platformdirs>=2.2.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs->ultralytics==8.0.3) (4.2.0)
Requirement already satisfied: pyyaml-env-tag>=0.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs->ultralytics==8.0.3) (0.1)
Requirement already satisfied: watchdog>=2.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs->ultralytics==8.0.3) (4.0.0)
Requirement already satisfied: babel~=2.10 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs-material->ultralytics==8.0.3) (2.14.0)
Requirement already satisfied: mkdocs-material-extensions~=1.3 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs-material->ultralytics==8.0.3) (1.3.1)
Requirement already satisfied: paginate~=0.5 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs-material->ultralytics==8.0.3) (0.5.6)
Requirement already satisfied: pymdown-extensions~=10.2 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs-material->ultralytics==8.0.3) (10.7.1)
Requirement already satisfied: regex>=2022.4 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocs-material->ultralytics==8.0.3) (2023.12.25)
Collecting mkdocs-autorefs>=0.3.1 (from mkdocstrings[python]->ultralytics==8.0.3)
Using cached mkdocs_autorefs-1.0.1-py3-none-any.whl.metadata (6.9 kB)
Collecting mkdocstrings-python>=0.5.2 (from mkdocstrings[python]->ultralytics==8.0.3)
Using cached mkdocstrings_python-1.9.2-py3-none-any.whl.metadata (5.5 kB)
Requirement already satisfied: iniconfig in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from pytest->ultralytics==8.0.3) (2.0.0)
Requirement already satisfied: pluggy<2.0,>=1.4 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from pytest->ultralytics==8.0.3) (1.4.0)
Requirement already satisfied: pyproject_hooks in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from build>=0.1->check-manifest->ultralytics==8.0.3) (1.0.0)
Requirement already satisfied: importlib-metadata>=4.6 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from build>=0.1->check-manifest->ultralytics==8.0.3) (7.1.0)
Requirement already satisfied: smmap<6,>=3.0.1 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from gitdb<5,>=4.0.1->GitPython>=3.1.24->ultralytics==8.0.3) (5.0.1)
Requirement already satisfied: parso<0.9.0,>=0.8.3 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from jedi>=0.16->ipython->ultralytics==8.0.3) (0.8.4)
Requirement already satisfied: griffe>=0.37 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from mkdocstrings-python>=0.5.2->mkdocstrings[python]->ultralytics==8.0.3) (0.42.1)
Requirement already satisfied: wcwidth in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython->ultralytics==8.0.3) (0.2.13)
Requirement already satisfied: executing>=1.2.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from stack-data->ipython->ultralytics==8.0.3) (2.0.1)
Requirement already satisfied: asttokens>=2.1.0 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from stack-data->ipython->ultralytics==8.0.3) (2.4.1)
Requirement already satisfied: pure-eval in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from stack-data->ipython->ultralytics==8.0.3) (0.2.2)
Requirement already satisfied: mpmath>=0.19 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from sympy->torch>=1.7.0->ultralytics==8.0.3) (1.3.0)
Requirement already satisfied: zipp>=0.5 in c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages (from importlib-metadata>=4.6->build>=0.1->check-manifest->ultralytics==8.0.3) (3.18.1)
Using cached mkdocs_material-9.5.17-py3-none-any.whl (8.7 MB)
Using cached mkdocs_autorefs-1.0.1-py3-none-any.whl (13 kB)
Using cached mkdocstrings_python-1.9.2-py3-none-any.whl (58 kB)
Using cached mkdocstrings-0.24.3-py3-none-any.whl (28 kB)
Installing collected packages: ultralytics, mkdocs-material, mkdocs-autorefs, mkdocstrings, mkdocstrings-python
Attempting uninstall: ultralytics
Found existing installation: ultralytics 8.1.45
Uninstalling ultralytics-8.1.45:
Successfully uninstalled ultralytics-8.1.45
Running setup.py develop for ultralytics
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
    C:\Users\Christopher Then\OneDrive\Documents\Ngee Ann Poly Year 3\Vaxtor Object Detector\TestVision2\YOLOv8-DeepSORT-Object-Tracking\setup.py:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
      import pkg_resources as pkg
    running develop
    C:\Users\Christopher Then\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` and ``easy_install``.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.

            See https://github.com/pypa/setuptools/issues/917 for details.
            ********************************************************************************

    !!
      easy_install.initialize_options(self)
    C:\Users\Christopher Then\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` directly.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.

            See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
            ********************************************************************************

    !!
      self.initialize_options()
    running egg_info
    error: Cannot update time stamp of directory 'ultralytics.egg-info'
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

Rolling back uninstall of ultralytics
Moving to c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages\ultralytics-8.1.45.dist-info
from C:\Users\Christopher Then\AppData\Local\Programs\Python\Python310\Lib\site-packages~ltralytics-8.1.45.dist-info
Moving to c:\users\christopher then\appdata\local\programs\python\python310\lib\site-packages\ultralytics
from C:\Users\Christopher Then\AppData\Local\Programs\Python\Python310\Lib\site-packages~ltralytics
Moving to c:\users\christopher then\appdata\local\programs\python\python310\scripts\ultralytics.exe
from C:\Users\Christopher Then\AppData\Local\Temp\pip-uninstall-h56rigrd\ultralytics.exe
Moving to c:\users\christopher then\appdata\local\programs\python\python310\scripts\yolo.exe
from C:\Users\Christopher Then\AppData\Local\Temp\pip-uninstall-h56rigrd\yolo.exe
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
C:\Users\Christopher Then\OneDrive\Documents\Ngee Ann Poly Year 3\Vaxtor Object Detector\TestVision2\YOLOv8-DeepSORT-Object-Tracking\setup.py:6: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
import pkg_resources as pkg
running develop
C:\Users\Christopher Then\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` and ``easy_install``.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://github.com/pypa/setuptools/issues/917 for details.
        ********************************************************************************

!!
  easy_install.initialize_options(self)
C:\Users\Christopher Then\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!

        ********************************************************************************
        Please avoid running ``setup.py`` directly.
        Instead, use pypa/build, pypa/installer or other
        standards-based tools.

        See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
        ********************************************************************************

!!
  self.initialize_options()
running egg_info
error: Cannot update time stamp of directory 'ultralytics.egg-info'
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

AttributeError: 'DetectionPredictor' object has no attribute 'all_outputs'

[2023-01-19 11:46:32,799][root.tracker][INFO] - Loading weights from deep_sort_pytorch/deep_sort/deep/checkpoint/ckpt.t7... Done!
Ultralytics YOLOv8.0.7 Python-3.10.9 torch-1.13.1+cpu CPU
Fusing layers...
YOLOv8l summary: 268 layers, 43668288 parameters, 0 gradients, 165.2 GFLOPs
Error executing job with overrides: ['model=yolov8l.pt', 'source=test3.mp4', 'show=True']
Traceback (most recent call last):
File "C:\Users\messam\Desktop\Project\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\predict.py", line 252, in predict
predictor()
File "C:\Users\messam\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\autograd\grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "C:\Users\messam\AppData\Local\Programs\Python\Python310\lib\site-packages\ultralytics\yolo\engine\predictor.py", line 160, in call
return list(chain(*list(self.stream_inference(source, model, verbose)))) # merge list of Result into one
File "C:\Users\messam\AppData\Local\Programs\Python\Python310\lib\site-packages\ultralytics\yolo\engine\predictor.py", line 194, in stream_inference
s += self.write_results(i, results, (p, im, im0))
File "C:\Users\messam\Desktop\Project\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\predict.py", line 213, in write_results
self.all_outputs.append(det)
AttributeError: 'DetectionPredictor' object has no attribute 'all_outputs'

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Output formatting

A request @MuhammadMoinFaisal

When I am trying to run the model by passing the image, I do get a response regarding no.of objects detected in the image

The output looks like this
python predict.py model=yolov8l.pt source="/Users/Desktop/t_s.jpeg" show=True

Loading weights from deep_sort_pytorch/deep_sort/deep/checkpoint/ckpt.t7... Done! Ultralytics YOLOv8.0.3 🚀 Python-3.8.16 torch-1.13.1 CPU Fusing layers... YOLOv8l summary: 268 layers, 43668288 parameters, 0 gradients, 165.2 GFLOPs image 1/1 /Users/Desktop/t_s.jpeg: 384x640 8 persons, 15 cars, 6 motorcycles, 1 traffic light, 1514.5ms Speed: 1.2ms pre-process, 1514.5ms inference, 3.5ms postprocess per image at shape (1, 3, 640, 640) Results saved to /Users/Desktop/pythonProject/YOLOv8-DeepSORT-Object-Tracking/runs/detect/train13

Can you please tell me where to make changes to return the object detected in key-value pairs so that I can pass on the results to other processes

as there is no #12 debug mode, I was not able to find the function from which the results are being returned, so I am trying to make a dictionary of objects found in the image uploaded so the results can be stored in a format of key-value pair where the key is the object identified and the value is the count of such objects in the image uploaded
{'persons' : 8, 'cars' : 15, 'motorcycles' : 6, 'traffic light' : 1}

Minor

I don't think thedraw_boxes function is getting called cause the image result stored in the run folder doesn't have the boxes around the identified objects.

Ps Thank you for your quick and active response here

The embedding model for feature extraction

Fantastic, I have a question, in the DeepSort method, we should extract the embedding vector of the objects (Re-ID network) for the appearance feature and use it with the motional feature (Kalman filter), how do you do this for the vehicles? Did you train a network?
Can the model extract features for any object? or it just can be used for vehicles and pedestrians?

Live stream URL?

Is it possible to count the traffic from live stream url? and not just using output .mp4 video?

HYDRA_FULL_ERROR=1 for a complete stack trace Error Occur.

raise AttributeError(former_attrs[attr])
AttributeError: module 'numpy' has no attribute 'float'.
np.float was a deprecated alias for the builtin float. To avoid this error in existing code, use float by itself. Doing this will not modify any behavior and is safe. If you specifi
cally wanted the numpy scalar type, use np.float64 here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Although I have used your updated "predict.py" code, but the same error occur. I have tested both on my desktop PC and Laptop? Do u have any idea how to solve this?

RuntimeError: Couldn't load custom C++ ops.

I get the following error when running on Jetson Orin Nano development kit:

user@user-orin:~/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect$ python predict.py model=yolov8l.pt source="test3.mp4" show=True
/usr/local/lib/python3.8/dist-packages/torchvision-0.15.1a0+42759b1-py3.8-linux-aarch64.egg/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: '/usr/local/lib/python3.8/dist-packages/torchvision-0.15.1a0+42759b1-py3.8-linux-aarch64.egg/torchvision/image.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'If you don't plan on using image functionality from torchvision.io, you can ignore this warning. Otherwise, there might be something wrong with your environment. Did you have libjpeg or libpng installed before building torchvision from source?
warn(
[2023-07-22 14:57:40,246][root.tracker][INFO] - Loading weights from deep_sort_pytorch/deep_sort/deep/checkpoint/ckpt.t7... Done!
Ultralytics YOLOv8.0.3 🚀 Python-3.8.10 torch-2.0.1 CPU
Fusing layers...
YOLOv8l summary: 268 layers, 43668288 parameters, 0 gradients, 165.2 GFLOPs
Error executing job with overrides: ['model=yolov8l.pt', 'source=test3.mp4', 'show=True']
Traceback (most recent call last):
File "predict.py", line 253, in predict
predictor()
File "/home/user/.local/lib/python3.8/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/engine/predictor.py", line 183, in call
preds = self.postprocess(preds, im, im0s)
File "predict.py", line 181, in postprocess
preds = ops.non_max_suppression(preds,
File "/home/user/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/utils/ops.py", line 212, in non_max_suppression
i = torchvision.ops.nms(boxes, scores, iou_thres) # NMS
File "/usr/local/lib/python3.8/dist-packages/torchvision-0.15.1a0+42759b1-py3.8-linux-aarch64.egg/torchvision/ops/boxes.py", line 40, in nms
_assert_has_ops()
File "/usr/local/lib/python3.8/dist-packages/torchvision-0.15.1a0+42759b1-py3.8-linux-aarch64.egg/torchvision/extension.py", line 48, in _assert_has_ops
raise RuntimeError(
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.

I have checked the Runtime error suggetion following the link https://github.com/pytorch/vision#installation and the following versions should be compatible:

  • Python 3.8.10
  • pytorch 2.0.1
  • torchvision 0.15.1a0+42759b1

pip install -e '.[dev]' ERROR

pip install -e '.[dev]'
得到了这个结果
ERROR: '.[dev]' is not a valid editable requirement. It should either be a path to a local project or a VCS URL (beginning with bzr+http, bzr+https, bzr+ssh, bzr+sftp, bzr+ftp, bzr+l
p, bzr+file, git+http, git+https, git+ssh, git+git, git+file, hg+file, hg+http, hg+https, hg+ssh, hg+static-http, svn+ssh, svn+http, svn+https, svn+svn, svn+file).
这是怎么回事?

Custom Model from Different version of Ultralytics Not Working

Hello,

I am trying to run my custom model in this tracking code. It seems like this code works with ultralytics<=8.0.10. When I use my custom model trained with latest ultralytics, it doesn't work with the lower version of ultralytics (detection and tracking don't work). When I try to train model with lower version of ultralytics (which actually works with this tracking code), the training shows 'nan' loss (picture below). Can anyone please help?
Thanks!

image

how to run it in IDE without using terminal?

Hi Moin, currently, we are running the predict .py from the terminal using
python predict.py model=yolov8l.pt source="test3.mp4" show=True
can you tell me how to run it from the IDE in the main method of predict.py

if __name__ == "__main__":
    predict()

So that I can debug the code in pyCharm to better understand the flow!
How do I pass the model and source in

if __name__ == "__main__":
    predict()

ImportError: cannot import name 'DEFAULT_CONFIG' from 'ultralytics.yolo.utils'

hello all
do you all guys also have this issue, just like below description

    Traceback (most recent call last):

File "predict.py", line 14, in
from ultralytics.yolo.utils import DEFAULT_CONFIG, ROOT, ops
ImportError: cannot import name 'DEFAULT_CONFIG' from 'ultralytics.yolo.utils' (C:\Users\whs6szh.conda\envs\py38\lib\site-packages\ultralytics\yolo\utils_init_.py)

seeking code for the line for counting,

Sorry sir, please on your video at the end you do explain about the line, and it was in tracking_vehicle_counting.py but here in the source code, I can not seem to find that file or those code.

Same happened with tracking.py which here is predict.py.

please help me understand, thank you in advance.

i resolved this by following last step on the documentation

tracking two video

Hi, I want to do speed estimate and object tracking for two video and when I do that with thread it goes until the second thread stop with this error :
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "G:\Programming\Python Project\Speed Detection\myVenv\lib\site-packages\torch\utils_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "G:\Programming\Python Project\Speed Detection\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\engine\predictor.py", line 189, in call
s += self.write_results(i, preds, (p, im, im0s))
File "G:\Programming\Python Project\Speed Detection\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\predict.py", line 326, in write_results
outputs = deepsort.update(xywhs, confss, oids, im0)
File "G:\Programming\Python Project\Speed Detection\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\deep_sort_pytorch\deep_sort\deep_sort.py", line 39, in update
self.tracker.update(detections)
File "G:\Programming\Python Project\Speed Detection\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\deep_sort_pytorch\deep_sort\sort\tracker.py", line 74, in update
self._match(detections)
File "G:\Programming\Python Project\Speed Detection\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\deep_sort_pytorch\deep_sort\sort\tracker.py", line 130, in _match
linear_assignment.min_cost_matching(
File "G:\Programming\Python Project\Speed Detection\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\deep_sort_pytorch\deep_sort\sort\linear_assignment.py", line 56, in min_cost_matching
cost_matrix = distance_metric(
File "G:\Programming\Python Project\Speed Detection\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\deep_sort_pytorch\deep_sort\sort\iou_matching.py", line 74, in iou_cost
if tracks[track_idx].time_since_update > 1:
IndexError: list index out of range
what do you suggest me to do?
and is there another way to do that without a thread?
I want to do that with an id for every video to save its detections with its video id
please help me with this error
thanks for your Time...

something wrong! help

(deepsort) D:\download1\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\detect>python predict.py model=yolov8l.pt source="test3.mp4" show=True
Traceback (most recent call last):
File "predict.py", line 13, in
from ultralytics.yolo.engine.predictor import BasePredictor
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics_init_.py", line 5, in
from ultralytics.hub import checks
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub_init_.py", line 10, in
from ultralytics.hub.auth import Auth
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub\auth.py", line 5, in
from ultralytics.hub.utils import HUB_API_ROOT, request_with_credentials
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub\utils.py", line 10, in
from ultralytics.yolo.utils import DEFAULT_CONFIG_DICT, LOGGER, RANK, SETTINGS, TryExcept, colorstr, emojis
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 400, in
SETTINGS = get_settings()
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 363, in get_settings
root = get_git_root_dir() or Path('') # not is_pip_package()
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 189, in get_git_root_dir
output = subprocess.run(["git", "rev-parse", "--git-dir"], capture_output=True, check=True)
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

(deepsort) D:\download1\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\detect>python predict.py model=yolov8l.pt source="test3.mp4" show=True
Traceback (most recent call last):
File "predict.py", line 13, in
from ultralytics.yolo.engine.predictor import BasePredictor
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics_init_.py", line 5, in
from ultralytics.hub import checks
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub_init_.py", line 10, in
from ultralytics.hub.auth import Auth
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub\auth.py", line 5, in
from ultralytics.hub.utils import HUB_API_ROOT, request_with_credentials
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub\utils.py", line 10, in
from ultralytics.yolo.utils import DEFAULT_CONFIG_DICT, LOGGER, RANK, SETTINGS, TryExcept, colorstr, emojis
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 400, in
SETTINGS = get_settings()
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 363, in get_settings
root = get_git_root_dir() or Path('') # not is_pip_package()
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 189, in get_git_root_dir
output = subprocess.run(["git", "rev-parse", "--git-dir"], capture_output=True, check=True)
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,None, None,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

(deepsort) D:\download1\YOLOv8-DeepSORT-Object-Tracking-main\ultralytics\yolo\v8\detect>python predict.py model=yolov8l.pt source="test3.mp4" show=True
Traceback (most recent call last):
File "predict.py", line 13, in
from ultralytics.yolo.engine.predictor import BasePredictor
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics_init_.py", line 5, in
from ultralytics.hub import checks
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub_init_.py", line 10, in
from ultralytics.hub.auth import Auth
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub\auth.py", line 5, in
from ultralytics.hub.utils import HUB_API_ROOT, request_with_credentials
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\hub\utils.py", line 10, in
from ultralytics.yolo.utils import DEFAULT_CONFIG_DICT, LOGGER, RANK, SETTINGS, TryExcept, colorstr, emojis
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 400, in
SETTINGS = get_settings()
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 363, in get_settings
root = get_git_root_dir() or Path('') # not is_pip_package()
File "d:\download1\yolov8-deepsort-object-tracking-main\ultralytics\yolo\utils_init_.py", line 189, in get_git_root_dir
output = subprocess.run(["git", "rev-parse", "--git-dir"], capture_output=True, check=True)
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 493, in run
with Popen(*popenargs, **kwargs) as process:
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 858, in init
self._execute_child(args, executable, preexec_fn, close_fds,
File "D:\ProgramData\Anaconda3\envs\deepsort\lib\subprocess.py", line 1311, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,None, None,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

custom_model

ModuleNotFoundError: No module named 'ultralytics.nn.modules.conv'; 'ultralytics.nn.modules' is not a package

How to develop this code?

Hi,

What should I change in the code to be able to use the webcam or camera online?
What should I change in the code so that I can measure the distance to obstacles with a camera?

Please help me.
Thanks.

Training works great, but it doesn't computes correctly losses in validation data

I trained a Yolov8 model for object detection with my custom dataset, made by videos. Observing at the results the network gave me (both the results.png and the results.csv), I noticed that the train losses are correct: they decrease with the training process, but the validation losses remain constant to zero from the beginning both for the val/box_loss and the val/dfl_loss, while the val/cls_loss is always infinite (it says “inf” in the results.csv).
results

Screenshot

Just a few epochs, to show the issue about val/box_loss, val/dfl_loss, val/cls_loss.

This is the command line I used to train:
!python train.py model=yolov8n.yaml data='My_Path/data/data.yaml' epochs=50 imgsz=800 project='My_Path/Yolov8_models/Yolov8n'
I also did some attempts like interchanging the train and validation datasets or using the train dataset both for training and for validation, but the error still persists, so I guess the problem it’s not on how I defined the validation dataset. Furthermore, I tried to use the trained network on an unseen video and it works just fine, so I think the problem is how it calculates the validation losses specifically (since the train losses are normally calculated), but I can’t find the error.

My suspect is that it computes the losses between ground truth and ground truth, so the loss is exactly zero.

Thank you in advance for your attention to my question, hope you will help me with my issue.

AttributeError: 'IterableSimpleNamespace' object has no attribute 'parent'. This may be caused by a modified or out of date ultralytics

Hello, I encountered this problem when running;

(yolov8) F:\ultralytics>python .\ultralytics\yolo\v8\detect\predict_deepsort.py model=yolov8l.pt source="test3.mp4" show=True
Traceback (most recent call last):
File "F:\ultralytics\ultralytics\yolo\v8\detect\predict_deepsort.py", line 308, in
@hydra.main(version_base=None, config_path=str(DEFAULT_CFG.parent), config_name=DEFAULT_CFG.name)
File "D:\Users\liush\Anaconda3\envs\yolov8\lib\site-packages\ultralytics\yolo\utils_init_.py", line 118, in getattr
raise AttributeError(f"""
AttributeError:
'IterableSimpleNamespace' object has no attribute 'parent'. This may be caused by a modified or out of date ultralytics
'default.yaml' file.
Please update your code with 'pip install -U ultralytics' and if necessary replace
D:\Users\liush\Anaconda3\envs\yolov8\Lib\site-packages\ultralytics\yolo\cfg\default.yaml with the latest version from
https://github.com/ultralytics/ultralytics/blob/main/ultralytics/yolo/cfg/default.yaml

Select a class

Hi. Thanks for your code.
Do you know how to set the desired class? I mean , in which file we can set a class label/number to show in the output.
Actually, I'd like to only show "person"s in the output, not all the COCO labels.
Thanks

error executing job with overrides

when I do predict, i get below error. Could you advise what I should do ?

!python predict_yolov8.0.0_track_count.py source="P35_IMG_1173_0.1.mp4" model=best_yolov8x_v8.0.0_11April2023.pt conf=0.01


[2023-04-28 15:24:31,434][root.tracker][INFO] - Loading weights from deep_sort_pytorch/deep_sort/deep/checkpoint/ckpt.t7... Done!
2023-04-28 15:24:31.897684: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-04-28 15:24:33.672485: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
Ultralytics YOLOv8.0.3 🚀 Python-3.10.11 torch-2.0.0+cu118 CPU
Fusing layers... 
Model summary: 268 layers, 68124531 parameters, 0 gradients, 257.4 GFLOPs
Error executing job with overrides: ['source=P35_IMG_1173_0.1.mp4', 'model=best_yolov8x_v8.0.0_11April2023.pt', 'conf=0.01']
Traceback (most recent call last):
  File "/content/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect/predict_yolov8.0.0_track_count.py", line 324, in <module>
    predict()
  File "/usr/local/lib/python3.10/dist-packages/hydra/main.py", line 94, in decorated_main
    _run_hydra(
  File "/usr/local/lib/python3.10/dist-packages/hydra/_internal/utils.py", line 394, in _run_hydra
    _run_app(
  File "/usr/local/lib/python3.10/dist-packages/hydra/_internal/utils.py", line 457, in _run_app
    run_and_report(
  File "/usr/local/lib/python3.10/dist-packages/hydra/_internal/utils.py", line 223, in run_and_report
    raise ex
  File "/usr/local/lib/python3.10/dist-packages/hydra/_internal/utils.py", line 220, in run_and_report
    return func()
  File "/usr/local/lib/python3.10/dist-packages/hydra/_internal/utils.py", line 458, in <lambda>
    lambda: hydra.run(
  File "/usr/local/lib/python3.10/dist-packages/hydra/_internal/hydra.py", line 132, in run
    _ = ret.return_value
  File "/usr/local/lib/python3.10/dist-packages/hydra/core/utils.py", line 260, in return_value
    raise self._return_value
  File "/usr/local/lib/python3.10/dist-packages/hydra/core/utils.py", line 186, in run_job
    ret.return_value = task_function(task_cfg)
  File "/content/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect/predict_yolov8.0.0_track_count.py", line 320, in predict
    predictor()
  File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/content/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/engine/predictor.py", line 189, in __call__
    s += self.write_results(i, preds, (p, im, im0s))
  File "/content/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect/predict_yolov8.0.0_track_count.py", line 302, in write_results
    outputs = deepsort.update(xywhs, confss, oids, im0)
  File "/content/YOLOv8-DeepSORT-Object-Tracking/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 "/content/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep_sort.py", line 110, in _get_features
    features = self.extractor(im_crops)
  File "/content/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep/feature_extractor.py", line 43, in __call__
    im_batch = self._preprocess(im_crops)
  File "/content/YOLOv8-DeepSORT-Object-Tracking/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 "/content/YOLOv8-DeepSORT-Object-Tracking/ultralytics/yolo/v8/detect/deep_sort_pytorch/deep_sort/deep/feature_extractor.py", line 38, in <listcomp>
    im_batch = torch.cat([self.norm(_resize(im, self.size)).unsqueeze(
  File "/content/YOLOv8-DeepSORT-Object-Tracking/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'

DEFAULT_CONFIG issue

When I run predictions, I keep getting this DEFAULT_CONFIG error which I never had before.
Could you assist ?

WARNING ⚠️ Ultralytics settings reset to defaults. This is normal and may be due to a recent ultralytics package update, but may have overwritten previous settings.
View and update settings with 'yolo settings' or at '/root/.config/Ultralytics/settings.yaml'
Traceback (most recent call last):
File "/root/ultralytics-main/ultralytics/yolo/v8/detect/tracking_fish_counting.py", line 21, in
from ultralytics.yolo.utils import DEFAULT_CONFIG
ImportError: cannot import name 'DEFAULT_CONFIG' from 'ultralytics.yolo.utils' (/opt/conda/lib/python3.9/site-packages/ultralytics/yolo/utils/init.py)

FileNotFoundError, I'm new

Where should the yolov8n.pt and the test video be put? It said FileNotFoundError, and can't realize tracking. Thanks for help.

saving tracking result as text file

Hi Muhammad
Is there any way to save tracking results as a text file in a format like this:
Frame_id, object_id, class, x_center, y_center, width, height

ImportError: cannot import name 'DeepSort' from 'deep_sort_pytorch.deep_sort' (unknown location)

After I unzip the deep_sort_pytorch zip file, and i run the code like: !python predict.py source="test1.mp4"
The model have the problem below, i reall appreciate if you help me to sovle it, thank you in advance
Traceback (most recent call last):
File "d:\OneDrive - Sejong University\NgheNhan_Master\Course Work\First Semester\Advanced in Machine Vision\Projects\Abnormal Behavior\Code\Object_detection_and Tracking\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\predict.py", line 14, in
from ultralytics.yolo.engine.predictor import BasePredictor
File "d:\onedrive - sejong university\nghenhan_master\course work\first semester\advanced in machine vision\projects\abnormal behavior\code\object_detection_and tracking\yolov8-deepsort-object-tracking\ultralytics_init_.py", line 5, in
from ultralytics.hub import checks
File "d:\onedrive - sejong university\nghenhan_master\course work\first semester\advanced in machine vision\projects\abnormal behavior\code\object_detection_and tracking\yolov8-deepsort-object-tracking\ultralytics\hub_init_.py", line 15, in
from ultralytics.yolo.v8.detect import DetectionTrainer
File "d:\onedrive - sejong university\nghenhan_master\course work\first semester\advanced in machine vision\projects\abnormal behavior\code\object_detection_and tracking\yolov8-deepsort-object-tracking\ultralytics\yolo\v8\detect_init_.py", line 3, in
from .predict import DetectionPredictor, predict
File "d:\onedrive - sejong university\nghenhan_master\course work\first semester\advanced in machine vision\projects\abnormal behavior\code\object_detection_and tracking\yolov8-deepsort-object-tracking\ultralytics\yolo\v8\detect\predict.py", line 23, in
from deep_sort_pytorch.deep_sort import DeepSort
ImportError: cannot import name 'DeepSort' from 'deep_sort_pytorch.deep_sort' (unknown location)

Bug in the training code that causes validation losses to be stuck to 0 and infinite

I trained a yolov8 model for object detection, but when looking at the results, I saw that the training losses are correct (they decrease with the training process), but the validation losses are not computed properly: val/box_losses and val/dfl_loss are always equal to zero (from the beginning to the end), while val/cls_loss is always "inf".

results

I also trained my model with the official github and I don't get this error, so I think there is a bug in the code that trains the network.

Thank you in advance for your attention, I hope this error will be fixed soon.

Integrate pose estimation

Hi
I want to estimate pose and track instead of just detecting pose and tracking. When i'm passing the model as yolov8n-pose.pt in predict.py inplace of yolov8n.pt, it's giving me an error. please help me out.

predict.py on custom weights

I have trained a yolov8 model which has two labels. How can I pass the labels to predict.py file for the model to output classes for the custom weights. I have already tried changing the coco.yaml and coco128.yaml files but didn't work

how to train my own dataset

hello, the pretrained model(yolov8l.pt) didn't fit my dataset, so I want to train on my own dataset. But I don't know how to train it, could you give me some advice? Thanks.

No ultralytics.yolo module

Traceback of the error:
C:\Users\Ivana\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect>python predict.py model=yolov8l.pt source="test3.mp4" show=True
Traceback (most recent call last):
File "C:\Users\Ivana\YOLOv8-DeepSORT-Object-Tracking\ultralytics\yolo\v8\detect\predict.py", line 13, in
from ultralytics.yolo.engine.predictor import BasePredictor
ModuleNotFoundError: No module named 'ultralytics.yolo'

I already installed ultralytics previously (pip show ultralytics shows ultralytics information) and I followed instructions step by step for setting up. I am trying to run this in Anaconda Prompt on Windows 10.

Add distance of vehicles from us in the bounding boxes

Hi, I am trying to display the measured distance in the bounding boxes. Can someone help? We already have the 'd_meters', can it be used to display on the bounding boxes? if can, I'm not sure how and where do I have to modify it. I also tried the Ultralytics 'measuring distance' but a lot of directories needed to be adjusted. So, I am wondering if there is a better/simpler option. Thanks in advance.

'str' object has no attribute 'parent'

When I ran the predict.py, this problem occurred. I went to investigate and found it that DEFAULT_CONFIG really doesn't have attribute‘parent’.May I ask how to solve this problem?Thanks very much.
Uploading 1.png…

Change name of labels

Do you know how to change the name of labels?
I want to display the names of the labels in different languages. How can I do that?
I appreciate your answer!

Tracking path

Hi,
I'd like to have the tracking path for each object. is there any way to extract the path information frame by frame? I mean i need to have the location of each object in each frame
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.