yolov8—tracking

yolov8—tracking

仓库地址
下载的时候要用git clone 下载所有子文件 详见这篇文章.

我的运行过程

conda create -n tracking python=3.9
 conda activate tracking
 # 进入文件夹
 pip install -r requirements.txt 

1. 遇到bug

Building wheels for collected packages: lap
  Building wheel for lap (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Partial import of lap during the build process.
      Traceback (most recent call last):
        File "/tmp/pip-install-r2stxxq9/lap_740a823bdcb7492aadaff87c0f2d1f0c/setup.py", line 127, in get_numpy_status
          import numpy
      ModuleNotFoundError: No module named 'numpy'
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-r2stxxq9/lap_740a823bdcb7492aadaff87c0f2d1f0c/setup.py", line 236, in <module>
          setup_package()
        File "/tmp/pip-install-r2stxxq9/lap_740a823bdcb7492aadaff87c0f2d1f0c/setup.py", line 220, in setup_package
          raise ImportError('lap requires numpy, '
      ImportError: lap requires numpy, please "pip install numpy".
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for lap
  Running setup.py clean for lap
Failed to build lap
Installing collected packages: lap, executing, easydict, cmake, backcall, zipp, urllib3, tzdata, typing-extensions, traitlets, tqdmy, soupsieve, smmap, six, PyYAML, PySocks, pyparsing, pygments, pyasn1, psutil, protobuf, prompt-toolkit, Pillow, pexpect, parso, p-cu11, nvidia-nccl-cu11, nvidia-cusparse-cu11, nvidia-curand-cu11, nvidia-cufft-cu11, nvidia-cuda-runtime-cu11, nvidia-cuda-nvrtc-cidia-cublas-cu11, numpy, networkx, MarkupSafe, kiwisolver, idna, grpcio, fonttools, filelock, decorator, cycler, charset-normalizer werkzeug, sentry-sdk, scipy, rsa, requests, python-dateutil, pyasn1-modules, opencv-python, nvidia-cusolver-cu11, nvidia-cudnn-cu1edi, importlib-resources, importlib-metadata, gitdb, contourpy, beautifulsoup4, asttokens, stack-data, requests-oauthlib, pandas, mh, gitpython, seaborn, ipython, google-auth-oauthlib, gdown, filterpy, tensorboard, triton, torch, torchvision, thop, ultralytics
  Running setup.py install for lap ... error
  error: subprocess-exited-with-error
  
  × Running setup.py install for lap did not run successfully.
  │ exit code: 1
  ╰─> [13 lines of output]
      Partial import of lap during the build process.
      Traceback (most recent call last):
        File "/tmp/pip-install-r2stxxq9/lap_740a823bdcb7492aadaff87c0f2d1f0c/setup.py", line 127, in get_numpy_status
          import numpy
      ModuleNotFoundError: No module named 'numpy'
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-r2stxxq9/lap_740a823bdcb7492aadaff87c0f2d1f0c/setup.py", line 236, in <module>
          setup_package()
        File "/tmp/pip-install-r2stxxq9/lap_740a823bdcb7492aadaff87c0f2d1f0c/setup.py", line 220, in setup_package
          raise ImportError('lap requires numpy, '
      ImportError: lap requires numpy, please "pip install numpy".
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> lap

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

bug:
subprocess-exited-with-error
Failed building wheel for lap
subprocess-exited-with-error
legacy-install-failure

解决:

conda install -c conda-forge lap
继续:
pip install --upgrade  ultralytics
python track.py --source Traffic.mp4 

2. 遇到新bug

Traceback (most recent call last):
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 365, in <module>
    main(opt)
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 360, in main
    run(**vars(opt))
  File "/home/hyzhang/anaconda3/envs/tracking/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_contex
    return func(*args, **kwargs)
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 122, in run
    dataset = LoadImages(
TypeError: __init__() got an unexpected keyword argument 'stride'

两个bug都和loadimage这个函数有关
** The following layers are discarded due to unmatched keys or layer size: ['classifier.1.weight', 'classifier.1.bias']
不知道为什么这个模型参数不匹配,一直没解决
Traceback (most recent call last):
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 362, in <module>
    main(opt)
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 357, in main
    run(**vars(opt))
  File "/home/hyzhang/anaconda3/envs/tracking/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_contex
    return func(*args, **kwargs)
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 145, in run
    path, im, im0s, vid_cap, s = batch
ValueError: not enough values to unpack (expected 5, got 4)

解决:
用yolov5中的loadimage函数替换了yolov8的

3. 新的bug:

    assert s in suffix, f"{msg}{f} acceptable suffix is {suffix}"
AssertionError: /home/hyzhang/yolov8_tracking-master/weights/mobilenetv2_1.0-0f96a698.pth acceptable suffix is ['.pt', '.torchscrip '.engine', '.tflite']

解决:
将官网的.pth重命名为.pt

4. bug again

Traceback (most recent call last):
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 365, in <module>
    main(opt)
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 360, in main
    run(**vars(opt))
  File "/home/hyzhang/anaconda3/envs/tracking/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
    return func(*args, **kwargs)
  File "/home/hyzhang/yolov8_tracking-master/track.py", line 147, in run
    for frame_idx, batch in enumerate(dataset):
  File "/home/hyzhang/yolov8_tracking-master/yolov8/ultralytics/yolo/data/dataloaders/stream_loaders.py", line 225, in __next__
    im = letterbox(im0, self.img_size, stride=self.stride, auto=self.auto)[0]  # padded resize
NameError: name 'letterbox' is not defined

因为改了loadimage的函数,yolov5中这个函数引用了augments脚本里面的letterbox函数
于是我把那个函数也一起复制过来了

python track.py --source Traffic.mp4  --save-txt --save-trajectories --save-vid

终于运行成功了!别人是怎么直接成功的呀,可能是因为我是手动下载的仓库,有些问题

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值