Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove _init_paths - use module name directly instead #434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/_init_paths.py

This file was deleted.

10 changes: 4 additions & 6 deletions src/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
22 changes: 10 additions & 12 deletions src/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
11 changes: 5 additions & 6 deletions src/detection_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import division
from __future__ import print_function

import _init_paths
import argparse
import torch
import json
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/gen_data_path.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import os
import glob
import _init_paths


def gen_caltech_path(root_path):
Expand Down
6 changes: 3 additions & 3 deletions src/lib/datasets/dataset/jde.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/lib/datasets/dataset/jde_yolov5.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tracker/matching.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
22 changes: 11 additions & 11 deletions src/lib/tracker/multitracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/lib/tracking_utils/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tracking_utils/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/lib/tracking_utils/nms.py
Original file line number Diff line number Diff line change
@@ -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__ = """
Expand Down
4 changes: 2 additions & 2 deletions src/lib/trains/base_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
10 changes: 5 additions & 5 deletions src/lib/trains/mot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
13 changes: 6 additions & 7 deletions src/test_det.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import division
from __future__ import print_function

import _init_paths
import argparse
import torch
import json
Expand All @@ -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):
Expand Down
15 changes: 7 additions & 8 deletions src/test_emb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from __future__ import division
from __future__ import print_function

import _init_paths
import argparse
import torch
import json
Expand All @@ -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(
Expand Down
17 changes: 8 additions & 9 deletions src/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
17 changes: 8 additions & 9 deletions src/track_half.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
14 changes: 6 additions & 8 deletions src/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down