@@ -0,0 +1,6 @@ | |||
"""Defines data structure and related functions.""" | |||
from collections import namedtuple | |||
MarkingPoint = namedtuple('MarkingPoint', ['x', 'y', 'direction', 'shape']) | |||
Slot = namedtuple('Slot', ['x1', 'y1', 'x2', 'y2']) |
@@ -1,11 +1,8 @@ | |||
from collections import namedtuple | |||
"""Defines data structure and related function to process these data.""" | |||
import math | |||
import torch | |||
import config | |||
MarkingPoint = namedtuple('MarkingPoint', ['x', 'y', 'direction', 'shape']) | |||
Slot = namedtuple('Slot', ['x1', 'y1', 'x2', 'y2']) | |||
from . import MarkingPoint | |||
def generate_objective(marking_points_batch, device): |
@@ -1,11 +1,11 @@ | |||
# -*- coding: utf-8 -*- | |||
"""Defines the parking slot dataset for directional marking point detection.""" | |||
import json | |||
import os | |||
import os.path | |||
import cv2 as cv | |||
from torch.utils.data import Dataset | |||
from torchvision import transforms | |||
from data import MarkingPoint | |||
from . import MarkingPoint | |||
class ParkingSlotDataset(Dataset): |
@@ -1,15 +1,12 @@ | |||
"""Evaluate directional marking point detector.""" | |||
import torch | |||
from torch.utils.data import DataLoader | |||
from precision_recall import calc_average_precision | |||
from precision_recall import calc_precision_recall | |||
import config | |||
from data import generate_objective | |||
from data import get_predicted_points | |||
from data import match_marking_points | |||
from dataset import ParkingSlotDataset | |||
from detector import DirectionalPointDetector | |||
from log import Logger | |||
from data.data_process import generate_objective, get_predicted_points, match_marking_points | |||
from data.dataset import ParkingSlotDataset | |||
from model.detector import DirectionalPointDetector | |||
from util.log import Logger | |||
from util.precision_recall import calc_average_precision, calc_precision_recall | |||
def evaluate_detector(args): |
@@ -5,9 +5,9 @@ import numpy as np | |||
import torch | |||
from torchvision.transforms import ToTensor | |||
import config | |||
from data import get_predicted_points | |||
from detector import DirectionalPointDetector | |||
from utils import Timer | |||
from data.data_process import get_predicted_points | |||
from model.detector import DirectionalPointDetector | |||
from util import Timer | |||
def plot_marking_points(image, marking_points): |
@@ -1,7 +1,7 @@ | |||
# -*- coding: utf-8 -*- | |||
"""Defines the detector network structure.""" | |||
import torch | |||
from torch import nn | |||
from network import define_halve_unit, define_detector_block | |||
from model.network import define_halve_unit, define_detector_block | |||
class YetAnotherDarknet(nn.modules.Module): |
@@ -1,4 +1,4 @@ | |||
"""Common network struture unit definition.""" | |||
"""Universal network struture unit definition.""" | |||
from torch import nn | |||
@@ -3,12 +3,11 @@ import random | |||
import torch | |||
from torch.utils.data import DataLoader | |||
import config | |||
from data import get_predicted_points | |||
from data import generate_objective | |||
from dataset import ParkingSlotDataset | |||
from detector import DirectionalPointDetector | |||
from log import Logger | |||
from utils import tensor2im | |||
from data.data_process import get_predicted_points, generate_objective | |||
from data.dataset import ParkingSlotDataset | |||
from model.detector import DirectionalPointDetector | |||
from util.log import Logger | |||
from util import tensor2im | |||
def plot_prediction(logger, image, marking_points, prediction): |
@@ -1,4 +1,4 @@ | |||
"""Universal procedure of calculating average precision defined in VOC""" | |||
"""Universal procedure of calculating precision and recall.""" | |||
def match_gt_with_preds(ground_truth, predictions, match_labels): |