"""
.. module:: Katna.config
:platform: Platfrom Independent
:synopsis: This module defines some helpful configuration variables
"""
import os
# # Configuration parameters for Image class
[docs]class Image:
# default value by which image size to be reduces for processing
down_sample_factor = 8
# Debug flag
DEBUG = False
# Crop_height_reduction_factor_in_each_iterationnot found crop height
# will be reduced by this multiplier/factor and search for candidate crops
# is resumed.
# Decreasing the height and width for crops while checking it don't get small by 1/(min_image_to_crop_factor) of image height/width
min_image_to_crop_factor = 4
crop_height_reduction_factor_in_each_iteration = 0.05
# # Configurations for Scoring crops for crop extractor
[docs]class CropScorer:
detail_weight = 0.2 # default weight value for detail parameter
edge_radius = 0.4 # default edge radius
edge_weight = -20 # default edge weight
outside_importance = (
-0.5
) # default value to set if the pixel is outside crop rectangle
rule_of_thirds = True # boolean to set rule of third condition check
saliency_bias = 0.2 # bias color value for saliency(+- error value)
saliency_weight = 1.3 # default edge radius
face_bias = 0.01 # bias color value for face(+- error value)
face_weight = 3.4 # default weight value for face parameter
rects_weight = 1 # default weight value for crop rectangles
# # Configurations for Text detection class
[docs]class TextDetector:
# Min Confidence Threshold for Text detection model
min_confidence = 0.9
# Threshold for merging text detection boxes
merge_threshold = 1
# Name of Model files to be used for text detection
frozen_weights = "frozen_east_text_detection.pb"
# Location where model file will be downloaded
cache_subdir = "models"
# Layers Name for text detection
layerNames = ["feature_fusion/Conv_7/Sigmoid", "feature_fusion/concat_3"]
# Download Link for Text detection model
model_download_link = "https://github.com/oyyd/frozen_east_text_detection.pb/raw/master/frozen_east_text_detection.pb"
# # Configurations for Edge Feature class
[docs]class EdgeFeature:
# min edge threshold value
min_val_threshold = 100
# Max edge threshold value
max_val_threshold = 200
# aperture_size/size of Sobel kernel for canny edge detector
ksize = 3
# # Configurations for Face detection Feature class
[docs]class FaceFeature:
# Model file name to be used for face detection
model_file = "res10_300x300_ssd_iter_140000_fp16.caffemodel"
# Model definition file name to be used for face detetion
prototxt_file = "deploy.prototxt"
# Location where model file will be downloaded
cache_subdir = "models"
# Min Confidence Threshold for face detection model
confidence = 0.5
# Download Link for face detection model defintion file
prototxt_download_link = "https://raw.githubusercontent.com/opencv/opencv/master/samples/dnn/face_detector/deploy.prototxt"
# Download Link for face detection model
modelfile_download_link = "https://raw.githubusercontent.com/opencv/opencv_3rdparty/dnn_samples_face_detector_20180205_fp16/res10_300x300_ssd_iter_140000_fp16.caffemodel"
# # Configuration parameters for Video class
[docs]class Video:
# Debug flag
DEBUG = False
min_video_duration = 5.0
# consume % of memory during video keyframe extraction
# 80% of available memory will be consumed
memory_consumption_threshold = 0.80
# assumed numbers of frames within which 1 candidate frames which might be available
# seconds to reach threshold if all frames are collected, but not all are candidate frames
# currently we assume 1 in 5 frame for that
assumed_no_of_frames_per_candidate_frame = 5
# if video duration greater than this number video will be treated as a large video
video_split_threshold_in_minutes = 20
# https://trac.ffmpeg.org/wiki/Encode/H.264
# Keep this between 20 to 30 value
video_compression_crf_parameter = 23
video_compression_codec = "libx264" # Currently "libx264 and is supported"
compression_output_file_extension = "mp4"
# Supported/valid video extensions supported by ffmpeg
# You can generate updated list by using following shell script on MacOSX or Linux
# $ ffmpeg -demuxers -hide_banner | tail -n +5 | cut -d' ' -f4 | xargs -I{} ffmpeg -hide_banner -h demuxer={} | grep 'Common extensions' | cut -d' ' -f7 | tr ',' $'\n' | tr -d '.'
video_extensions = [
".str",
".aa",
".aac",
".ac3",
".acm",
".adf",
".adp",
".dtk",
".ads",
".ss2",
".adx",
".aea",
".afc",
".aix",
".al",
".ape",
".apl",
".mac",
".aptx",
".aptxhd",
".aqt",
".ast",
".avi",
".avr",
".bfstm",
".bcstm",
".bit",
".bmv",
".brstm",
".cdg",
".cdxl",
".xl",
".c2",
".302",
".daud",
".str",
".dss",
".dts",
".dtshd",
".dv",
".dif",
".cdata",
".eac3",
".paf",
".fap",
".flm",
".flac",
".flv",
".fsb",
".g722",
".722",
".tco",
".rco",
".g723_1",
".g729",
".genh",
".gsm",
".h261",
".h26l",
".h264",
".264",
".avc",
".hevc",
".h265",
".265",
".idf",
".cgi",
".sf",
".ircam",
".ivr",
".flv",
".lvf",
".m4v",
".mkv",
".mk3d",
".mka",
".mks",
".mjpg",
".mjpeg",
".mpo",
".j2k",
".mlp",
".mov",
".mp4",
".m4a",
".3gp",
".3g2",
".mj2",
".mp2",
".mp3",
".m2a",
".mpa",
".mpc",
".mjpg",
".txt",
".mpl2",
".sub",
".msf",
".mtaf",
".ul",
".musx",
".mvi",
".mxg",
".v",
".nist",
".sph",
".nsp",
".nut",
".ogg",
".oma",
".omg",
".aa3",
".pjs",
".pvf",
".yuv",
".cif",
".qcif",
".rgb",
".rt",
".rsd",
".rsd",
".rso",
".sw",
".sb",
".smi",
".sami",
".sbc",
".msbc",
".sbg",
".scc",
".sdr2",
".sds",
".sdx",
".shn",
".vb",
".son",
".sln",
".mjpg",
".stl",
".sub",
".sub",
".sup",
".svag",
".tak",
".thd",
".tta",
".ans",
".art",
".asc",
".diz",
".ice",
".nfo",
".txt",
".vt",
".ty",
".ty+",
".uw",
".ub",
".v210",
".yuv10",
".vag",
".vc1",
".viv",
".idx",
".vpk",
".txt",
".vqf",
".vql",
".vqe",
".vtt",
".wsd",
".xmv",
".xvag",
".yop",
".y4m",
]
# Configuration parameters for mediapipe
[docs]class ImageSelector:
# Setting for optimum Brightness values
min_brightness_value = 10.0
max_brightness_value = 90.0
brightness_step = 2.0
# Setting for optimum Contrast/Entropy values
min_entropy_value = 1.0
max_entropy_value = 10.0
entropy_step = 0.5