diff --git a/src/demo.py b/src/demo.py index beed55e8..1d1f7457 100644 --- a/src/demo.py +++ b/src/demo.py @@ -2,17 +2,15 @@ from __future__ import division from __future__ import print_function -import _init_paths - import logging import os import os.path as osp -from opts import opts -from tracking_utils.utils import mkdir_if_missing -from tracking_utils.log import logger + import datasets.dataset.jde as datasets +from opts import opts from track import eval_seq - +from tracking_utils.log import logger +from tracking_utils.utils import mkdir_if_missing logger.setLevel(logging.INFO) diff --git a/src/gen_data_path.py b/src/gen_data_path.py index 19aaf196..6a6c3bac 100644 --- a/src/gen_data_path.py +++ b/src/gen_data_path.py @@ -1,6 +1,5 @@ -import os import glob -import _init_paths +import os def gen_caltech_path(root_path): @@ -19,4 +18,4 @@ def gen_caltech_path(root_path): if __name__ == '__main__': root = '/data/yfzhang/MOT/JDE' - gen_caltech_path(root) \ No newline at end of file + gen_caltech_path(root) diff --git a/src/lib/datasets/dataset/jde.py b/src/lib/datasets/dataset/jde.py index a6501751..302dafd1 100644 --- a/src/lib/datasets/dataset/jde.py +++ b/src/lib/datasets/dataset/jde.py @@ -7,16 +7,10 @@ from collections import OrderedDict import cv2 -import json import numpy as np import torch - -from torch.utils.data import Dataset -from torchvision.transforms import transforms as T -from cython_bbox import bbox_overlaps as bbox_ious -from opts import opts from utils.image import gaussian_radius, draw_umich_gaussian, draw_msra_gaussian -from utils.utils import xyxy2xywh, generate_anchors, xywh2xyxy, encode_delta +from utils.utils import xyxy2xywh class LoadImages: # for inference @@ -535,5 +529,3 @@ def __getitem__(self, files_index): labels[i, 1] += self.tid_start_index[ds] return imgs, labels0, img_path, (h, w) - - diff --git a/src/lib/models/networks/DCNv2/setup.py b/src/lib/models/networks/DCNv2/setup.py index 571b5365..695818f3 100644 --- a/src/lib/models/networks/DCNv2/setup.py +++ b/src/lib/models/networks/DCNv2/setup.py @@ -2,7 +2,6 @@ import os import glob - import torch from torch.utils.cpp_extension import CUDA_HOME @@ -14,6 +13,7 @@ requirements = ["torch", "torchvision"] + def get_extensions(): this_dir = os.path.dirname(os.path.abspath(__file__)) extensions_dir = os.path.join(this_dir, "src") @@ -53,6 +53,7 @@ def get_extensions(): ] return ext_modules + setup( name="DCNv2", version="0.1", diff --git a/src/test_det.py b/src/test_det.py index 4172a691..362e9f30 100644 --- a/src/test_det.py +++ b/src/test_det.py @@ -2,24 +2,19 @@ from __future__ import division from __future__ import print_function -import _init_paths -import argparse -import torch import json -import time import os -import cv2 +import time -from sklearn import metrics -from scipy import interpolate import numpy as np -from torchvision.transforms import transforms as T -from models.model import create_model, load_model +import torch from datasets.dataset.jde import DetDataset, collate_fn -from utils.utils import xywh2xyxy, ap_per_class, bbox_iou -from opts import opts from models.decode import mot_decode +from models.model import create_model, load_model +from opts import opts +from torchvision.transforms import transforms as T from utils.post_process import ctdet_post_process +from utils.utils import xywh2xyxy, ap_per_class, bbox_iou def post_process(opt, dets, meta): @@ -208,6 +203,7 @@ def test_det( # Return mAP return mean_mAP, mean_R, mean_P + if __name__ == '__main__': os.environ['CUDA_VISIBLE_DEVICES'] = '1' opt = opts().init() diff --git a/src/test_emb.py b/src/test_emb.py index 0fb55a30..552bc7af 100644 --- a/src/test_emb.py +++ b/src/test_emb.py @@ -2,27 +2,21 @@ from __future__ import division from __future__ import print_function -import _init_paths -import argparse -import torch import json -import time -import os -import cv2 import math +import os +import time -from sklearn import metrics -from scipy import interpolate import numpy as np -from torchvision.transforms import transforms as T +import torch import torch.nn.functional as F +from datasets.dataset.jde import JointDataset from models.model import create_model, load_model -from datasets.dataset.jde import JointDataset, collate_fn from models.utils import _tranpose_and_gather_feat -from utils.utils import xywh2xyxy, ap_per_class, bbox_iou from opts import opts -from models.decode import mot_decode -from utils.post_process import ctdet_post_process +from scipy import interpolate +from sklearn import metrics +from torchvision.transforms import transforms as T def test_emb( @@ -104,6 +98,7 @@ def test_emb( print('TPR@FAR={:.7f}: {:.4f}'.format(fa, tar_at_far[f])) return tar_at_far + if __name__ == '__main__': os.environ['CUDA_VISIBLE_DEVICES'] = '1' opt = opts().init()