Git Product home page Git Product logo

yolox_deepsort_tracker's Introduction

YOLOX_deepsort_tracker


🎉 How to use

↳ Tracker example

from tracker import Tracker

tracker = Tracker()    # instantiate Tracker

cap = cv2.VideoCapture('test.mp4')  # open one video

while True:
    _, img = cap.read() # read frame from video
    if img is None:
       break
    
    img_visual, bbox = tracker.update(img)  # feed one frame and get result
    
    cv2.imshow('demo', img_visual)	# imshow
    cv2.waitKey(1)
    if cv2.getWindowProperty('demo', cv2.WND_PROP_AUTOSIZE) < 1:
        break

cap.release()
cv2.destroyAllWindows()

Tracker uses YOLOX as detector to get each target's boundingbox, and use deepsort to get every bbox's ID.

↳ Select specific category

If you just want to track only some specific categories, you can set by param filter_classes.

For example:

tracker = Tracker(filter_classes=['car','person']) 

↳ Detector example

If you don't need tracking and just want to use YOLOX for object-detection, you can use the class Detector to inference easliy .

For example:

from detector import Detector
import cv2
detector = Detector() # instantiate Detector

img = cv2.imread('YOLOX/assets/dog.jpg') 	# load image
result = detector.detect(img) 	# detect targets

img_visual = result['visual'] 	 # visualized image
cv2.imshow('detect', img_visual) # imshow
cv2.waitKey(0)

You can also get more information like raw_img/boudingbox/score/class_id from the result of detector.

🎨 Install

  1. Clone the repository recursively:

    git clone --recurse-submodules https://github.com/pmj110119/YOLOX_deepsort_tracker.git

    If you already cloned and forgot to use --recurse-submodules you can run git submodule update --init(clone最新的YOLOX仓库)

  2. Make sure that you fulfill all the requirements: Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install, run:

    pip install -r requirements.txt

⚡ Select a YOLOX family model

  1. train your own model or just download pretrained models from https://github.com/Megvii-BaseDetection/YOLOX

    Model size mAPtest
    0.5:0.95
    Speed V100
    (ms)
    Params
    (M)
    FLOPs
    (G)
    weights
    YOLOX-s 640 39.6 9.8 9.0 26.8 onedrive/github
    YOLOX-m 640 46.4 12.3 25.3 73.8 onedrive/github
    YOLOX-l 640 50.0 14.5 54.2 155.6 onedrive/github
    YOLOX-x 640 51.2 17.3 99.1 281.9 onedrive/github
    YOLOX-Darknet53 640 47.4 11.1 63.7 185.3 onedrive/github

    Download yolox_s.pth to the folder weights , which is the default model path of Tracker.

  2. You can also use other yolox models as detector,. For example:

    """
    YOLO family: yolox-s, yolox-m, yolox-l, yolox-x, yolox-tiny, yolox-nano, yolov3
    """
    # yolox-s example
    detector = Tracker(model='yolox-s', ckpt='./yolox_s.pth')
    # yolox-m example
    detector = Tracker(model='yolox-m', ckpt='./yolox_m.pth')

🌹 Run demo

python demo.py --path=test.mp4

yolox_deepsort_tracker's People

Contributors

bharath5673 avatar pmj110119 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

yolox_deepsort_tracker's Issues

Run on CPU?

When I run the demo on CPU only runs slower than using tinyYoloV4+DeepSort why is that? Is this repo configured to run optimized on GPU only?

Bounding box not align with the actual object

visualize的时候我额外输出了一些信息,但是deepsort和yolox的代码我没改,我是每秒track一次,视频fps是25,可以看
到以下连续两次track(frame475和frame500),第二次画出来的框其实是前一次那辆车所在的位置,请问为什么会这样呢?有没有什么方法可以修正?谢谢。
475
500

license

Yolox has a Apache 2.0 license. What is this ? Could it be used for commercial ?

AttributeError: 'NoneType' object has no attribute 'cpu'

hi , please can you help me
I was doing every step , but i face this problem in detector.py :
YOLOX_deepsort_tracker/detector.py", line 51, in detect
outputs = postprocess(
AttributeError: 'NoneType' object has no attribute 'cpu'

the code in detecto.py is :
with torch.no_grad():
outputs = self.model(img)
outputs = postprocess(
outputs, self.exp.num_classes, self.exp.test_conf, self.exp.nmsthre # TODO:用户可更改
)[0].cpu().numpy()

load() missing 1 required positional argument: 'Loader'

Traceback (most recent call last):
File "/home/kerwin/KeTrack/demo.py", line 59, in
track_images(args.path)
File "/home/kerwin/KeTrack/demo.py", line 10, in track_images
tracker = Tracker(model='yolox-s', ckpt='weights/yolox_s.pth',filter_class=['person'])
File "/home/kerwin/KeTrack/tracker.py", line 18, in init
cfg.merge_from_file("deep_sort/configs/deep_sort.yaml")
File "/home/kerwin/KeTrack/deep_sort/utils/parser.py", line 23, in merge_from_file
self.update(yaml.load(fo.read()))
TypeError: load() missing 1 required positional argument: 'Loader'

Some error occurs while running the demo.

Traceback (most recent call last):
File "demo.py", line 52, in
track_cap(args.path)
File "demo.py", line 34, in track_cap
image,_ = tracker.update(im)
File "G:\YOLOX_deepsort_tracker-master\tracker.py", line 27, in update
info = self.detector.detect(image, visual=False)
File "G:\YOLOX_deepsort_tracker-master\detector.py", line 55, in detect
info['boxes'] = outputs[:, 0:4]/ratio
TypeError: 'NoneType' object is not subscriptable

MOT benchmark

Appreciate for your work!

did you test benchmarks(MOT15, MOT17...)

A bug

Traceback (most recent call last):
File "/home/下载/Pytorch_YOLOx_Deepsort-main/track.py", line 113, in
vdo_trk.run()
File "/home//下载/Pytorch_YOLOx_Deepsort-main/track.py", line 64, in run
info = self.detector.detect(im, visual=False)
File "/home/下载/Pytorch_YOLOx_Deepsort-main/YOLOX/detector.py", line 53, in detect
info['boxes'] = outputs[:, 0:4]/ratio
TypeError: 'NoneType' object is not subscriptable

its possible to do same for darknet yolov4x-mish,csp,swish model?

Thanks a lot for your great work, really appreciate. I'm looking for a script which supports yolov4mish,csp,swish weights, Can you please do this if it's possible for you? A not single script is available on google/GitHub for yolov4xmish+deepsort.
Thanks looking forward to your reply.

Could not install requirements

I create a new anaconda environment based on python 3.9.6.

Then I simply run pip install -r requirements.txt
I got the error message:

ERROR: Could not find a version that satisfies the requirement torchvision==0.10.0+cu111 (from versions: 0.1.6, 0.1.7, 0.1.8, 0.1.9, 0.2.0, 0.2.1, 0.2.2, 0.2.2.post2, 0.2.2.post3, 0.8.2, 0.9.0, 0.9.1, 0.10.0)
ERROR: No matching distribution found for torchvision==0.10.0+cu111

My system has the following specs:
CPU: Core I5, 11500
GPU: GTX1080
Nvidia driver version: 470.57.02,
CUDA version: 11.4

Typo in readme

img_visual, bbox = tracker.update(img) # feed one frame and get resultimg should be im

raise ImportError("{} doesn't contains class named 'Exp'".format(exp_file))

Hello, I have this error, could you please help me to find out the problem ?

File "track.py", line 33, in init
self.detector=build_detector(cfg,use_cuda=use_cuda)
File "\yolox-pytorch\detector.py", line 71, in build_detector
model= Detector(cfg.YOLOX.MODEL, cfg.YOLOX.WEIGHT)
File "\yolox-pytorch\detector.py", line 31, in init
self.exp = get_exp_by_name(model)
File "\yolox-pytorch\exp\build.py", line 36, in get_exp_by_name
return get_exp_by_file(exp_path)
File "\yolox-pytorch\exp\build.py", line 17, in get_exp_by_file
raise ImportError("{} doesn't contains class named 'Exp'".format(exp_file))
ImportError: \yolox-pytorch\exp\custom.py doesn't contains class named 'Exp

'
Thank you

While running the demo.py, the following error occurs.

(YOLOX_deepsort_tracker) sumyatnoe@MSI:/mnt/d/PycharmProjects/YOLOX_deepsort_tracker$ python demo.py --path=test.mp4
/mnt/d/PycharmProjects/YOLOX_deepsort_tracker/deep_sort/utils/parser.py:23: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please
read https://msg.pyyaml.org/load for full details.
self.update(yaml.load(fo.read()))
/home/sumyatnoe/.local/lib/python3.8/site-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Trigge
red internally at ../aten/src/ATen/native/TensorShape.cpp:2157.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]

Could we use deepsort to improve the result of detection ?

My task is use yolox to run object detect with YoloX, instead of tracking.
I trained yolox on many images with bboxes of car, then run car detection on a video.
But some of the frames are missing, may I use deepsort method to improve(postprocessing or offline or online?) the result of detection?
For example, predict the bbox when Yolox could not detect any car bbox in a frame (actually there is car)
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.