summaryrefslogtreecommitdiff
path: root/megapixels/app/settings
diff options
context:
space:
mode:
Diffstat (limited to 'megapixels/app/settings')
-rw-r--r--megapixels/app/settings/__init__.py0
-rw-r--r--megapixels/app/settings/app_cfg.py90
-rw-r--r--megapixels/app/settings/types.py29
3 files changed, 119 insertions, 0 deletions
diff --git a/megapixels/app/settings/__init__.py b/megapixels/app/settings/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/megapixels/app/settings/__init__.py
diff --git a/megapixels/app/settings/app_cfg.py b/megapixels/app/settings/app_cfg.py
new file mode 100644
index 00000000..739ddce2
--- /dev/null
+++ b/megapixels/app/settings/app_cfg.py
@@ -0,0 +1,90 @@
+import os
+from os.path import join
+import logging
+import collections
+
+import cv2 as cv
+
+from app.settings import types
+from app.utils import click_utils
+
+
+# -----------------------------------------------------------------------------
+# Enun lists used for custom Click Params
+# -----------------------------------------------------------------------------
+
+FaceDetectNetVar = click_utils.ParamVar(types.FaceDetectNet)
+
+LogLevelVar = click_utils.ParamVar(types.LogLevel)
+
+# # data_store
+DATA_STORE = '/data_store_hdd/'
+DIR_DATASETS = join(DATA_STORE,'datasets')
+DIR_APPS = join(DATA_STORE,'apps')
+DIR_APP = join(DIR_APPS,'megapixels')
+DIR_MODELS = join(DIR_APP,'models')
+
+# # Frameworks
+DIR_MODELS_CAFFE = join(DIR_MODELS,'caffe')
+DIR_MODELS_DARKNET = join(DIR_MODELS,'darknet')
+DIR_MODELS_DARKNET_PJREDDIE = join(DIR_MODELS_DARKNET, 'pjreddie')
+DIR_MODELS_PYTORCH = join(DIR_MODELS,'pytorch')
+DIR_MODELS_TORCH = join(DIR_MODELS,'torch')
+DIR_MODELS_MXNET = join(DIR_MODELS,'mxnet')
+DIR_MODELS_TF = join(DIR_MODELS,'tensorflow')
+DIR_MODELS_DLIB = join(DIR_MODELS,'dlib')
+DIR_MODELS_DLIB_CNN = join(DIR_MODELS_DLIB, 'mmod_human_face_detector.dat')
+DIR_MODELS_DLIB_5PT = join(DIR_MODELS_DLIB, 'shape_predictor_5_face_landmarks.dat')
+DIR_MODELS_DLIB_68PT = join(DIR_MODELS_DLIB, 'shape_predictor_68_face_landmarks.dat')
+
+
+# Test images
+DIR_TEST_IMAGES = join(DIR_APP, 'test', 'images')
+
+# -----------------------------------------------------------------------------
+# Drawing, GUI settings
+# -----------------------------------------------------------------------------
+DIR_ASSETS = join(DIR_APP, 'assets')
+FP_FONT = join(DIR_ASSETS, 'font')
+
+
+# -----------------------------------------------------------------------------
+# click chair settings
+# -----------------------------------------------------------------------------
+DIR_COMMANDS_PROCESSOR_ADMIN = 'admin/commands'
+DIR_COMMANDS_PROCESSOR_DATASETS = 'datasets/commands'
+
+# -----------------------------------------------------------------------------
+# Filesystem settings
+# hash trees enforce a maximum number of directories per directory
+# -----------------------------------------------------------------------------
+ZERO_PADDING = 6 # padding for enumerated image filenames
+#FRAME_NAME_ZERO_PADDING = 6 # is this active??
+CKPT_ZERO_PADDING = 9
+HASH_TREE_DEPTH = 3
+HASH_BRANCH_SIZE = 3
+
+# -----------------------------------------------------------------------------
+# Logging options exposed for custom click Params
+# -----------------------------------------------------------------------------
+LOGGER_NAME = 'app'
+LOGLEVELS = {
+ types.LogLevel.DEBUG: logging.DEBUG,
+ types.LogLevel.INFO: logging.INFO,
+ types.LogLevel.WARN: logging.WARN,
+ types.LogLevel.ERROR: logging.ERROR,
+ types.LogLevel.CRITICAL: logging.CRITICAL
+}
+LOGLEVEL_OPT_DEFAULT = types.LogLevel.DEBUG.name
+#LOGFILE_FORMAT = "%(asctime)s: %(levelname)s: %(message)s"
+#LOGFILE_FORMAT = "%(levelname)s:%(name)s: %(message)s"
+#LOGFILE_FORMAT = "%(levelname)s: %(message)s"
+#LOGFILE_FORMAT = "%(filename)s:%(lineno)s %(funcName)s() %(message)s"
+# colored logs
+"""
+black, red, green, yellow, blue, purple, cyan and white.
+{color}, fg_{color}, bg_{color}: Foreground and background colors.
+bold, bold_{color}, fg_bold_{color}, bg_bold_{color}: Bold/bright colors.
+reset: Clear all formatting (both foreground and background colors).
+"""
+LOGFILE_FORMAT = "%(log_color)s%(levelname)-8s%(reset)s %(cyan)s%(filename)s:%(lineno)s:%(bold_cyan)s%(funcName)s() %(reset)s%(message)s" \ No newline at end of file
diff --git a/megapixels/app/settings/types.py b/megapixels/app/settings/types.py
new file mode 100644
index 00000000..0c3d7942
--- /dev/null
+++ b/megapixels/app/settings/types.py
@@ -0,0 +1,29 @@
+from enum import Enum
+
+def find_type(name, enum_type):
+ for enum_opt in enum_type:
+ if name == enum_opt.name.lower():
+ return enum_opt
+ return None
+
+
+
+class FaceDetectNet(Enum):
+ """Scene text detector networks"""
+ HAAR, DLIB_CNN, DLIB_HOG, CVDNN = range(4)
+
+class CVBackend(Enum):
+ """OpenCV 3.4.2+ DNN target type"""
+ DEFAULT, HALIDE, INFER_ENGINE, OPENCV = range(4)
+
+class CVTarget(Enum):
+ """OpenCV 3.4.2+ DNN backend processor type"""
+ CPU, OPENCL, OPENCL_FP16, MYRIAD = range(4)
+
+# ---------------------------------------------------------------------
+# Logger, monitoring
+# --------------------------------------------------------------------
+
+class LogLevel(Enum):
+ """Loger vebosity"""
+ DEBUG, INFO, WARN, ERROR, CRITICAL = range(5)