Change directory structure

This commit is contained in:
Teoge 2018-10-02 17:16:16 +08:00
parent 97c1df51f7
commit b3d7c0b0f7
13 changed files with 27 additions and 28 deletions

6
data/__init__.py Normal file
View File

@ -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'])

View File

@ -1,11 +1,8 @@
from collections import namedtuple """Defines data structure and related function to process these data."""
import math import math
import torch import torch
import config import config
from . import MarkingPoint
MarkingPoint = namedtuple('MarkingPoint', ['x', 'y', 'direction', 'shape'])
Slot = namedtuple('Slot', ['x1', 'y1', 'x2', 'y2'])
def generate_objective(marking_points_batch, device): def generate_objective(marking_points_batch, device):

View File

@ -1,11 +1,11 @@
# -*- coding: utf-8 -*- """Defines the parking slot dataset for directional marking point detection."""
import json import json
import os import os
import os.path import os.path
import cv2 as cv import cv2 as cv
from torch.utils.data import Dataset from torch.utils.data import Dataset
from torchvision import transforms from torchvision import transforms
from data import MarkingPoint from . import MarkingPoint
class ParkingSlotDataset(Dataset): class ParkingSlotDataset(Dataset):

View File

@ -1,15 +1,12 @@
"""Evaluate directional marking point detector.""" """Evaluate directional marking point detector."""
import torch import torch
from torch.utils.data import DataLoader from torch.utils.data import DataLoader
from precision_recall import calc_average_precision
from precision_recall import calc_precision_recall
import config import config
from data import generate_objective from data.data_process import generate_objective, get_predicted_points, match_marking_points
from data import get_predicted_points from data.dataset import ParkingSlotDataset
from data import match_marking_points from model.detector import DirectionalPointDetector
from dataset import ParkingSlotDataset from util.log import Logger
from detector import DirectionalPointDetector from util.precision_recall import calc_average_precision, calc_precision_recall
from log import Logger
def evaluate_detector(args): def evaluate_detector(args):

View File

@ -5,9 +5,9 @@ import numpy as np
import torch import torch
from torchvision.transforms import ToTensor from torchvision.transforms import ToTensor
import config import config
from data import get_predicted_points from data.data_process import get_predicted_points
from detector import DirectionalPointDetector from model.detector import DirectionalPointDetector
from utils import Timer from util import Timer
def plot_marking_points(image, marking_points): def plot_marking_points(image, marking_points):

0
model/__init__.py Normal file
View File

View File

@ -1,7 +1,7 @@
# -*- coding: utf-8 -*- """Defines the detector network structure."""
import torch import torch
from torch import nn 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): class YetAnotherDarknet(nn.modules.Module):

View File

@ -1,4 +1,4 @@
"""Common network struture unit definition.""" """Universal network struture unit definition."""
from torch import nn from torch import nn

View File

@ -3,12 +3,11 @@ import random
import torch import torch
from torch.utils.data import DataLoader from torch.utils.data import DataLoader
import config import config
from data import get_predicted_points from data.data_process import get_predicted_points, generate_objective
from data import generate_objective from data.dataset import ParkingSlotDataset
from dataset import ParkingSlotDataset from model.detector import DirectionalPointDetector
from detector import DirectionalPointDetector from util.log import Logger
from log import Logger from util import tensor2im
from utils import tensor2im
def plot_prediction(logger, image, marking_points, prediction): def plot_prediction(logger, image, marking_points, prediction):

View File

View File

@ -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): def match_gt_with_preds(ground_truth, predictions, match_labels):