diff --git a/src/_init_paths.py b/src/_init_paths.py deleted file mode 100644 index db11e08d..00000000 --- a/src/_init_paths.py +++ /dev/null @@ -1,12 +0,0 @@ -import os.path as osp -import sys - -def add_path(path): - if path not in sys.path: - sys.path.insert(0, path) - -this_dir = osp.dirname(__file__) - -# Add lib to PYTHONPATH -lib_path = osp.join(this_dir, 'lib') -add_path(lib_path) diff --git a/src/demo.py b/src/demo.py index a9bd4b38..c73642a4 100644 --- a/src/demo.py +++ b/src/demo.py @@ -2,15 +2,13 @@ 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 src.lib.opts import opts +from src.lib.tracking_utils.utils import mkdir_if_missing +from src.lib.tracking_utils.log import logger +import src.lib.datasets.dataset.jde as datasets from track import eval_seq diff --git a/src/detect.py b/src/detect.py index 21885841..09ddfe40 100755 --- a/src/detect.py +++ b/src/detect.py @@ -2,7 +2,6 @@ from __future__ import division from __future__ import print_function -import _init_paths import os import os.path as osp import cv2 @@ -11,18 +10,17 @@ import motmetrics as mm import numpy as np -from tracker.fusetracker import FuseTracker -from tracking_utils import visualization as vis -from tracking_utils.log import logger -from tracking_utils.timer import Timer -from tracking_utils.evaluation import Evaluator -import datasets.dataset.jde as datasets +from src.lib.tracking_utils import visualization as vis +from src.lib.tracking_utils.log import logger +from src.lib.tracking_utils.timer import Timer +from src.lib.tracking_utils.evaluation import Evaluator +import src.lib.datasets.dataset.jde as datasets import torch -from tracking_utils.utils import mkdir_if_missing, tlbr2tlwh -from opts import opts -from models.decode import mot_decode -from utils.post_process import ctdet_post_process -from models.model import create_model, load_model +from src.lib.tracking_utils.utils import mkdir_if_missing +from src.lib.opts import opts +from src.lib.models.decode import mot_decode +from src.lib.utils.post_process import ctdet_post_process +from src.lib.models.model import create_model, load_model def write_results_score(filename, results): diff --git a/src/detection_demo.py b/src/detection_demo.py index 0bc0541f..731ac02a 100644 --- a/src/detection_demo.py +++ b/src/detection_demo.py @@ -2,7 +2,6 @@ from __future__ import division from __future__ import print_function -import _init_paths import argparse import torch import json @@ -12,12 +11,12 @@ import numpy as np import torch.nn.functional as F -import datasets.dataset.jde as datasets +import src.lib.datasets.dataset.jde as datasets from torchvision.transforms import transforms as T -from models.model import create_model, load_model -from models.decode import mot_decode -from models.utils import _tranpose_and_gather_feat -from utils.post_process import ctdet_post_process +from src.lib.models.model import create_model, load_model +from src.lib.models.decode import mot_decode +from src.lib.models.utils import _tranpose_and_gather_feat +from src.lib.utils.post_process import ctdet_post_process max_per_image = 500 diff --git a/src/gen_data_path.py b/src/gen_data_path.py index 762fc1bd..24834e65 100644 --- a/src/gen_data_path.py +++ b/src/gen_data_path.py @@ -1,6 +1,5 @@ import os import glob -import _init_paths def gen_caltech_path(root_path): diff --git a/src/lib/datasets/dataset/jde.py b/src/lib/datasets/dataset/jde.py index 2659a838..87a12472 100644 --- a/src/lib/datasets/dataset/jde.py +++ b/src/lib/datasets/dataset/jde.py @@ -15,9 +15,9 @@ 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 src.lib.opts import opts +from src.lib.utils.image import gaussian_radius, draw_umich_gaussian, draw_msra_gaussian +from src.lib.utils.utils import xyxy2xywh, generate_anchors, xywh2xyxy, encode_delta class LoadImages: # for inference diff --git a/src/lib/datasets/dataset/jde_yolov5.py b/src/lib/datasets/dataset/jde_yolov5.py index 77554007..8344ae2a 100644 --- a/src/lib/datasets/dataset/jde_yolov5.py +++ b/src/lib/datasets/dataset/jde_yolov5.py @@ -15,9 +15,9 @@ 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 src.lib.opts import opts +from src.lib.utils.image import gaussian_radius, draw_umich_gaussian, draw_msra_gaussian +from src.lib.utils.utils import xyxy2xywh, generate_anchors, xywh2xyxy, encode_delta class LoadImages: # for inference diff --git a/src/lib/tracker/matching.py b/src/lib/tracker/matching.py index 22e958de..ac237632 100644 --- a/src/lib/tracker/matching.py +++ b/src/lib/tracker/matching.py @@ -5,7 +5,7 @@ from scipy.spatial.distance import cdist from cython_bbox import bbox_overlaps as bbox_ious -from tracking_utils import kalman_filter +from src.lib.tracking_utils import kalman_filter import time def merge_matches(m1, m2, shape): diff --git a/src/lib/tracker/multitracker.py b/src/lib/tracker/multitracker.py index 6dd8b53b..a0f704ec 100644 --- a/src/lib/tracker/multitracker.py +++ b/src/lib/tracker/multitracker.py @@ -8,17 +8,17 @@ import numpy as np import torch import torch.nn.functional as F -from models import * -from models.decode import mot_decode -from models.model import create_model, load_model -from models.utils import _tranpose_and_gather_feat -from tracking_utils.kalman_filter import KalmanFilter -from tracking_utils.log import logger -from tracking_utils.utils import * -from utils.image import get_affine_transform -from utils.post_process import ctdet_post_process - -from tracker import matching +from src.lib.models import * +from src.lib.models.decode import mot_decode +from src.lib.models.model import create_model, load_model +from src.lib.models.utils import _tranpose_and_gather_feat +from src.lib.tracking_utils.kalman_filter import KalmanFilter +from src.lib.tracking_utils.log import logger +from src.lib.tracking_utils.utils import * +from src.lib.utils.image import get_affine_transform +from src.lib.utils.post_process import ctdet_post_process + +from src.lib.tracker import matching from .basetrack import BaseTrack, TrackState diff --git a/src/lib/tracking_utils/evaluation.py b/src/lib/tracking_utils/evaluation.py index 50215a68..8e0b916f 100644 --- a/src/lib/tracking_utils/evaluation.py +++ b/src/lib/tracking_utils/evaluation.py @@ -4,7 +4,7 @@ import motmetrics as mm mm.lap.default_solver = 'lap' -from tracking_utils.io import read_results, unzip_objs +from src.lib.tracking_utils.io import read_results, unzip_objs class Evaluator(object): diff --git a/src/lib/tracking_utils/io.py b/src/lib/tracking_utils/io.py index a2a99d81..c664f225 100644 --- a/src/lib/tracking_utils/io.py +++ b/src/lib/tracking_utils/io.py @@ -2,7 +2,7 @@ from typing import Dict import numpy as np -from tracking_utils.log import logger +from src.lib.tracking_utils.log import logger def write_results(filename, results_dict: Dict, data_type: str): diff --git a/src/lib/tracking_utils/nms.py b/src/lib/tracking_utils/nms.py index 78321af4..899b6f5d 100644 --- a/src/lib/tracking_utils/nms.py +++ b/src/lib/tracking_utils/nms.py @@ -1,6 +1,6 @@ # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # from ._utils import _C -from tracking_utils import _C +from src.lib.tracking_utils import _C nms = _C.nms # nms.__doc__ = """ diff --git a/src/lib/trains/base_trainer.py b/src/lib/trains/base_trainer.py index 193ebec7..b5249fa3 100644 --- a/src/lib/trains/base_trainer.py +++ b/src/lib/trains/base_trainer.py @@ -5,8 +5,8 @@ import time import torch from progress.bar import Bar -from models.data_parallel import DataParallel -from utils.utils import AverageMeter +from src.lib.models.data_parallel import DataParallel +from src.lib.utils.utils import AverageMeter class ModleWithLoss(torch.nn.Module): diff --git a/src/lib/trains/mot.py b/src/lib/trains/mot.py index 3058e309..a3546417 100644 --- a/src/lib/trains/mot.py +++ b/src/lib/trains/mot.py @@ -11,11 +11,11 @@ from fvcore.nn import sigmoid_focal_loss_jit -from models.losses import FocalLoss, TripletLoss -from models.losses import RegL1Loss, RegLoss, NormRegL1Loss, RegWeightedL1Loss -from models.decode import mot_decode -from models.utils import _sigmoid, _tranpose_and_gather_feat -from utils.post_process import ctdet_post_process +from src.lib.models.losses import FocalLoss, TripletLoss +from src.lib.models.losses import RegL1Loss, RegLoss, NormRegL1Loss, RegWeightedL1Loss +from src.lib.models.decode import mot_decode +from src.lib.models.utils import _sigmoid, _tranpose_and_gather_feat +from src.lib.utils.post_process import ctdet_post_process from .base_trainer import BaseTrainer diff --git a/src/test_det.py b/src/test_det.py index d59cc9fd..c21c341e 100644 --- a/src/test_det.py +++ b/src/test_det.py @@ -2,7 +2,6 @@ from __future__ import division from __future__ import print_function -import _init_paths import argparse import torch import json @@ -14,12 +13,12 @@ from scipy import interpolate import numpy as np from torchvision.transforms import transforms as T -from models.model import create_model, load_model -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 utils.post_process import ctdet_post_process +from src.lib.models.model import create_model, load_model +from src.lib.datasets.dataset.jde import DetDataset, collate_fn +from src.lib.utils.utils import xywh2xyxy, ap_per_class, bbox_iou +from src.lib.opts import opts +from src.lib.models.decode import mot_decode +from src.lib.utils.post_process import ctdet_post_process def post_process(opt, dets, meta): diff --git a/src/test_emb.py b/src/test_emb.py index e4a7c86f..7a932361 100644 --- a/src/test_emb.py +++ b/src/test_emb.py @@ -2,7 +2,6 @@ from __future__ import division from __future__ import print_function -import _init_paths import argparse import torch import json @@ -16,13 +15,13 @@ import numpy as np from torchvision.transforms import transforms as T import torch.nn.functional as F -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 src.lib.models.model import create_model, load_model +from src.lib.datasets.dataset.jde import JointDataset, collate_fn +from src.lib.models.utils import _tranpose_and_gather_feat +from src.lib.utils.utils import xywh2xyxy, ap_per_class, bbox_iou +from src.lib.opts import opts +from src.lib.models.decode import mot_decode +from src.lib.utils.post_process import ctdet_post_process def test_emb( diff --git a/src/track.py b/src/track.py index a6f50c86..d2c67f31 100644 --- a/src/track.py +++ b/src/track.py @@ -2,7 +2,6 @@ from __future__ import division from __future__ import print_function -import _init_paths import os import os.path as osp import cv2 @@ -12,15 +11,15 @@ import numpy as np import torch -from tracker.multitracker import JDETracker -from tracking_utils import visualization as vis -from tracking_utils.log import logger -from tracking_utils.timer import Timer -from tracking_utils.evaluation import Evaluator -import datasets.dataset.jde as datasets +from src.lib.tracker.multitracker import JDETracker +from src.lib.tracking_utils import visualization as vis +from src.lib.tracking_utils.log import logger +from src.lib.tracking_utils.timer import Timer +from src.lib.tracking_utils.evaluation import Evaluator +import src.lib.datasets.dataset.jde as datasets -from tracking_utils.utils import mkdir_if_missing -from opts import opts +from src.lib.tracking_utils.utils import mkdir_if_missing +from src.lib.opts import opts def write_results(filename, results, data_type): diff --git a/src/track_half.py b/src/track_half.py index 37025478..50fa9257 100644 --- a/src/track_half.py +++ b/src/track_half.py @@ -2,7 +2,6 @@ from __future__ import division from __future__ import print_function -import _init_paths import os import os.path as osp import cv2 @@ -12,15 +11,15 @@ import numpy as np import torch -from tracker.multitracker import JDETracker -from tracking_utils import visualization as vis -from tracking_utils.log import logger -from tracking_utils.timer import Timer -from tracking_utils.evaluation import Evaluator -import datasets.dataset.jde as datasets +from src.lib.tracker.multitracker import JDETracker +from src.lib.tracking_utils import visualization as vis +from src.lib.tracking_utils.log import logger +from src.lib.tracking_utils.timer import Timer +from src.lib.tracking_utils.evaluation import Evaluator +import src.lib.datasets.dataset.jde as datasets -from tracking_utils.utils import mkdir_if_missing -from opts import opts +from src.lib.tracking_utils.utils import mkdir_if_missing +from src.lib.opts import opts def write_results(filename, results, data_type): diff --git a/src/train.py b/src/train.py index fe50cdbd..5a2bec51 100644 --- a/src/train.py +++ b/src/train.py @@ -2,20 +2,18 @@ from __future__ import division from __future__ import print_function -import _init_paths - import os import json import torch import torch.utils.data from torchvision.transforms import transforms as T -from opts import opts -from models.model import create_model, load_model, save_model -from models.data_parallel import DataParallel -from logger import Logger -from datasets.dataset_factory import get_dataset -from trains.train_factory import train_factory +from src.lib.opts import opts +from src.lib.models.model import create_model, load_model, save_model +from src.lib.models.data_parallel import DataParallel +from src.lib.logger import Logger +from src.lib.datasets.dataset_factory import get_dataset +from src.lib.trains.train_factory import train_factory def main(opt):