Skip to content

Commit

Permalink
Merge pull request #911 from mikel-brostrom/fix-appearance-based-meth…
Browse files Browse the repository at this point in the history
…ods-on-cpu

add @torch.no_grad() to all ReID related inference methods
  • Loading branch information
mikel-brostrom authored May 28, 2023
2 parents 937f9eb + 30f390a commit ed2d5ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions boxmot/botsort/bot_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from .gmc import GMC
from .basetrack import BaseTrack, TrackState
from .kalman_filter import KalmanFilter
import torch

# from fast_reid.fast_reid_interfece import FastReIDInterface

Expand Down Expand Up @@ -482,6 +483,7 @@ def _xywh_to_xyxy(self, bbox_xywh):
y2 = min(int(y + h / 2), self.height - 1)
return x1, y1, x2, y2

@torch.no_grad()
def _get_features(self, bbox_xywh, ori_img):
im_crops = []
for box in bbox_xywh:
Expand Down
3 changes: 2 additions & 1 deletion boxmot/deepocsort/ocsort.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
from __future__ import print_function


import torch
import numpy as np
from .association import *
from .cmc import CMCComputer
Expand Down Expand Up @@ -528,6 +528,7 @@ def _xywh_to_xyxy(self, bbox_xywh):
y2 = min(int(y + h / 2), self.height - 1)
return x1, y1, x2, y2

@torch.no_grad()
def _get_features(self, bbox_xyxy, ori_img):
im_crops = []
for box in bbox_xyxy:
Expand Down
1 change: 1 addition & 0 deletions boxmot/strongsort/strong_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def _xyxy_to_tlwh(self, bbox_xyxy):
h = int(y2 - y1)
return t, l, w, h

@torch.no_grad()
def _get_features(self, bbox_xywh, ori_img):
im_crops = []
for box in bbox_xywh:
Expand Down

0 comments on commit ed2d5ea

Please sign in to comment.