Skip to content

Commit

Permalink
Make all params availables from run (#144)
Browse files Browse the repository at this point in the history
* make all params available in run

* make params availables

* put back api

* style

* put back alert_relaxation to 2
  • Loading branch information
MateoLostanlen authored Jan 31, 2023
1 parent 5f5e787 commit 07af20b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyroengine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def __init__(
cache_size: int = 100,
cache_folder: str = "data/",
backup_size: int = 30,
jpeg_quality: int = 80,
**kwargs: Any,
) -> None:
"""Init engine"""
Expand All @@ -111,7 +112,7 @@ def __init__(
self.frame_saving_period = frame_saving_period
self.alert_relaxation = alert_relaxation
self.frame_size = frame_size
self.jpeg_quality = 50
self.jpeg_quality = jpeg_quality
self.cache_backup_period = cache_backup_period

# Local backup
Expand Down
22 changes: 22 additions & 0 deletions src/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ def main(args):
cache_folder=args.cache,
revision=args.revision,
backup_size=args.backup_size,
alert_relaxation=args.alert_relaxation,
frame_size=args.frame_size,
cache_backup_period=args.cache_backup_period,
cache_size=args.cache_size,
jpeg_quality=args.jpeg_quality,
)

sys_controller = SystemController(
Expand Down Expand Up @@ -92,6 +97,23 @@ def main(args):
# Camera & cache
parser.add_argument("--creds", type=str, default="data/credentials.json", help="Camera credentials")
parser.add_argument("--cache", type=str, default="./data", help="Cache folder")
parser.add_argument(
"--frame-size",
type=tuple,
default=(720, 1280),
help="Resize frame to frame_size before sending it to the api in order to save bandwidth (H, W)",
)
parser.add_argument("--jpeg_quality", type=int, default=80, help="Jpeg compression")
parser.add_argument("--cache-size", type=int, default=20, help="Maximum number of alerts to save in cache")
parser.add_argument(
"--alert_relaxation",
type=int,
default=2,
help="Number of consecutive positive detections required to send the first alert",
)
parser.add_argument(
"--cache_backup_period", type=int, default=60, help="Number of minutes between each cache backup to disk"
)
# Backup
parser.add_argument("--backup-size", type=int, default=10000, help="Local backup can't be bigger than 10Go")
# Time config
Expand Down

0 comments on commit 07af20b

Please sign in to comment.