timmeinhardt / trackformer

Implementation of "TrackFormer: Multi-Object Tracking with Transformers”. [Conference on Computer Vision and Pattern Recognition (CVPR), 2022]
https://arxiv.org/abs/2101.02702
Apache License 2.0
487 stars 113 forks source link

Multi-Class MOT #10

Open edmuthiah opened 3 years ago

edmuthiah commented 3 years ago

Hello,

Does TrackFormer support multi-class multi-object tracking? If so how do I go about training this?

Thanks :)

timmeinhardt commented 3 years ago

The MOT and CrowdHuman dataset only support a single class. But the extension to multiple classes should be very straight forward and require little implementation effort.

JackWoo0831 commented 2 years ago

Hello, Now I want to try multi-class MOT, but I met the assert error: in util/box_ops.py: assert (boxes1[:, 2:] >= boxes1[:, :2]).all()

When I trained the single class, it happened once only because a large learning rate. but now the learning rate is proper and it doesn't work when I decrease the lr.

Have you met this issue?

Thanks.

timmeinhardt commented 2 years ago

I never tried to convert the repo to multiple classes. This is definitely possible and should be straightforward. But you need to change the code accordingly.

JackWoo0831 commented 2 years ago

Hello, Now I solved this issue. To train in multi-class, you only need to modify a few codes.

  1. change the 'num_classes' in models/init.py. e.g., I want to track objects of 4 classes in VisDrone dataset:
    elif args. dataset==' VisDrone':# Edited
    # num_classes=1
    num_classes=4

    then the classification head will change the dimension in FC layer accordingly. 2.Most importantly, when generate COCO format annotations, the category id must start with 1 and increase by one, e.g.:

    annotations['categories']=[{"supercategory":"vehicle","name":"car","id":1},
    {"supercategory":"vehicle","name":"van","id":2},
    {"supercategory":"vehicle","name":"truck","id":3},
    {"supercategory":"vehicle","name":"bus","id":4}]
timmeinhardt commented 2 years ago

Great! Is it working now?

JackWoo0831 commented 2 years ago

I'm still training, and it seems good. Thank u very much for your excellent work. After some epochs I plan to add some code of showing the class name in visdom, hahaha.

timmeinhardt commented 2 years ago

Class name in visdom sounds good. :)

bilalorhanlr commented 1 year ago

Merhaba, Şimdi bu sorunu çözdüm. Çoklu sınıfta eğitim almak için sadece birkaç kodu değiştirmeniz yeterlidir.

  1. Modeller/init.py içindeki 'num_classes' değerini değiştirin. örneğin, VisDrone veri kümesindeki 4 sınıfın nesnelerini izlemek istiyorum:
elif args. dataset==' VisDrone':# Edited
    # num_classes=1
    num_classes=4

daha sonra sınıflandırma kafası buna göre FC katmanındaki boyutu değiştirecektir. 2.En önemlisi, COCO biçimi ek açıklamaları oluştururken, kategori kimliği 1 ile başlamalı ve birer birer artmalıdır, örneğin:

annotations['categories']=[{"supercategory":"vehicle","name":"car","id":1},
{"supercategory":"vehicle","name":"van","id":2},
{"supercategory":"vehicle","name":"truck","id":3},
{"supercategory":"vehicle","name":"bus","id":4}]

Hello there, is it work ?