-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.py
66 lines (58 loc) · 2.26 KB
/
Config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
import os
'''
This class is used to set params of this project, including
general config, paths config, feature config.
'''
class Config(object):
def __init__(self, project_id=None):
'''
:param project_id: set project_id
'''
############### General Config ###############
# define the feature used
self.DES_TYPE = "HOG"
self.CLF_TYPE = "LIN_SVM"
# define the project_id
if project_id:
self.PROJECT_ID = project_id
else:
self.PROJECT_ID = "New_Vedio_New_Neg" + self.DES_TYPE + '_' + self.CLF_TYPE
# define image processing params
self.THRESHOLD = 0.3
self.DOWNSCALE = 1.25
################## Pathes ####################
# define the working dirnames
self.update_names()
self.mk_new_dirs()
################# Features #################
# Define HOG Features params
self.MIN_WDW_SIZE = [64, 64]
self.STEP_SIZE = [12, 12]
self.ORIENTATIONS = 9
self.PIXELS_PER_CELL = [3, 3]
self.CELLS_PER_BLOCK = [3, 3]
self.VISUALIZE = True
self.NORMALIZE = True
self.IF_PRINT = False
self.KEEP_FEAT = False
# Define LBP Features params
self.LBP_RADIUS = 3
self.LBP_POINTS = 8 * self.LBP_RADIUS
def mk_new_dirs(self):
for ph in self.DIR_PATHS.values():
if not os.path.exists(ph):
os.makedirs(ph)
print("==> Directory Tree", ph, "created")
def update_names(self):
# Pathes
self.DIR_PATHS = {
"POS_FEAT_PH": os.path.join("./source/features", self.PROJECT_ID, "pos"),
"NEG_FEAT_PH": os.path.join("./source/features", self.PROJECT_ID, "neg"),
"MODEL_DIR_PH": os.path.join("./source/models", self.PROJECT_ID),
"PRED_SAVE_PH": os.path.join("./source/predictions", self.PROJECT_ID),
"POS_IMG_PH": "./source/images/pos",
"NEG_IMG_PH": "./source/images/neg",
"TEST_IMG_DIR_PH": "./source/test_images"}
self.MODEL_PH = os.path.join(self.DIR_PATHS["MODEL_DIR_PH"], "svm.model")
self.TEST_IMG_PH = os.path.join(self.DIR_PATHS["TEST_IMG_DIR_PH"], "test.jpg")