title: How do I train the DeepSORT tracker for custom class?
body: <p>I want to detect and count the number of vines in a vineyard using Deep Learning and Computer Vision techniques. I am using the YOLOv4 object detector and training on the <a href="https://www.github.com/AlexeyAB/darknet" rel="nofollow noreferrer">darknet</a> framework. I have been able to integrate the SORT tracker into my application and it works well, but I still have the following issues:</p>
  <ul>
  <li>The tracker sometimes reassigns a new ID to the object</li>
  <li>The detector sometimes misidentifies the object <em>(which lead to incorrect tracking)</em></li>
  <li>The tracker sometimes does not track a detected object.</li>
  </ul>
  <p>You can see an example of the reassignment issue in the following <a href="https://i.stack.imgur.com/efjae.jpg" rel="nofollow noreferrer">image</a>. As you can see, in frame 40 the id 9 was a metal post, and frame 42 onwards it is being assigned to a tree</p>
  <p>In searching for the cause of these problems, I have learnt that <a href="https://www.github.com/nwojke/deep_sort" rel="nofollow noreferrer">DeepSORT</a> is an improved version of the SORT, which aims to handle this problem by using a Neural Network for associating tracks to detections.</p>
  <h3>Problem:</h3>
  <p>The problem I am facing is with the training of this particular model for Deepsort. I have seen that the authors have used <a href="https://www.github.com/nwojke/cosine_metric_learning" rel="nofollow noreferrer">cosine metric learning</a> to train their model, but I am not being able to customize the learning for my custom classes. The questions I have are as follows:</p>
  <ol>
  <li><p>I have a dataset of annotated <em>(YOLO TXT format)</em> images which I have used to train the YOLOv4 model. Can I reuse the same dataset for the Deepsort tracker? If so, then how?</p>
  </li>
  <li><p>If I cannot reuse the dataset, then how do I create my own dataset for training the model?</p>
  </li>
  </ol>
  <p>Thanks in advance for the help!</p>