text
stringlengths 1
93.6k
|
|---|
def main():
|
"""
|
The main entry point for the Xeno project.
|
Initializes the following components:
|
- Logger: Handles logging for the application.
|
- WiFiManager: Manages Wi-Fi connections.
|
- HTMLLogger: Logs scan results in HTML format.
|
- EPaperDisplay: Manages the e-paper display updates.
|
- ImageStateManager: Tracks and manages workflow states and images.
|
Workflow:
|
1. Initializes display and loads required credentials.
|
2. Continuously performs scans and updates results.
|
3. Logs workflow progress and handles any exceptions.
|
Raises:
|
Exception: If a critical error occurs during initialization or execution.
|
"""
|
os.makedirs("logs", exist_ok=True)
|
logger = Logger(log_file="logs/scan.log")
|
wifi_manager = WiFiManager(logger=logger)
|
html_logger = HTMLLogger(output_dir="utils/html_logs", json_dir="utils/json_logs")
|
display = EPaperDisplay()
|
state_manager = ImageStateManager()
|
try:
|
display.initialize()
|
while True:
|
logger.log("[INFO] Starting new scanning cycle.")
|
run_scans(logger, wifi_manager, html_logger, display, state_manager)
|
logger.log("[INFO] Scanning cycle completed. Sleeping for 10 minutes.")
|
time.sleep(600) # Sleep for 10 minutes
|
except Exception as e:
|
logger.log(f"[ERROR] Fatal error occurred: {e}")
|
finally:
|
display.clear() # Display is cleared
|
print("[INFO] E-paper display cleared.")
|
if __name__ == "__main__":
|
main()
|
# <FILESEP>
|
# Copyright Niantic 2020. Patent Pending. All rights reserved.
|
#
|
# This software is licensed under the terms of the DepthHints licence
|
# which allows for non-commercial use only, the full terms of which are made
|
# available in the LICENSE file.
|
from __future__ import absolute_import, division, print_function
|
import json
|
import os
|
import time
|
import numpy as np
|
import torch
|
import torch.nn.functional as F
|
import torch.optim as optim
|
from tensorboardX import SummaryWriter
|
from torch.utils.data import DataLoader
|
import datasets
|
import networks
|
from layers import (SSIM, BackprojectDepth, Project3D, compute_depth_errors,
|
disp_to_depth, get_smooth_loss,
|
transformation_from_parameters)
|
from networks.RTMonoDepth.RTMonoDepth import DepthDecoder, DepthEncoder
|
from utils import normalize_image, readlines, sec_to_hm_str
|
torch.backends.cudnn.enabled = True
|
class Trainer:
|
def __init__(self, options):
|
self.opt = options
|
self.log_path = os.path.join(self.opt.log_dir, self.opt.model_name)
|
# checking height and width are multiples of 32
|
assert self.opt.height % 32 == 0, "'height' must be a multiple of 32"
|
assert self.opt.width % 32 == 0, "'width' must be a multiple of 32"
|
self.models = {}
|
self.parameters_to_train = []
|
self.device = torch.device("cpu" if self.opt.no_cuda else "cuda")
|
self.num_scales = len(self.opt.scales)
|
self.num_input_frames = len(self.opt.frame_ids)
|
self.num_pose_frames = 2 if self.opt.pose_model_input == "pairs" else self.num_input_frames
|
assert self.opt.frame_ids[0] == 0, "frame_ids must start with 0"
|
self.use_pose_net = not (self.opt.use_stereo and self.opt.frame_ids == [0])
|
if self.opt.use_stereo:
|
self.opt.frame_ids.append("s")
|
if self.opt.use_learnable_K:
|
focal_len = 807.1375
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.