def run_mirror(coord, transmission_protocol, identifier, sender_ipc_focus, receiver_ipc_focus, receiver_ipc_light, senders_ipc_mirrors, receivers_ipc_mirrors): mirror = Mirror(identifier=identifier, coord=coord) mirror.sender_focus_ = Sender(sender_ipc_focus, transmission_protocol, verbose=False) mirror.receiver_focus_ = Receiver(receiver_ipc_focus, transmission_protocol, verbose=False) mirror.receiver_light_src_ = Receiver(receiver_ipc_light, transmission_protocol, verbose=False) for i, ipc in senders_ipc_mirrors.items(): mirror.senders_mirrors_[i] = Sender(ipc, transmission_protocol, verbose=False) for i, ipc in receivers_ipc_mirrors.items(): mirror.receivers_mirrors_[i] = Receiver(ipc, transmission_protocol, verbose=False) if identifier == 0: mirror.run(is_first_to_adjust=True) else: mirror.run()
from config import DEVICE, EMOTIONLOG, FACE_DIR, EMOTION_MODEL_PATH emotion_shard = EmotionShard(logfile=EMOTIONLOG, device=DEVICE, model_path=EMOTION_MODEL_PATH) shards = [CamShard(), FaceShard(FACE_DIR, device=DEVICE), emotion_shard] #shards = [CamShard(), FaceShard(FACE_DIR, device=DEVICE)] # Viewing live mirror = Mirror(shards=shards, lens=EmotionLens(), timestep=.1, logfile=MIRRORLOG) #mirror = Mirror(shards=shards, lens=LogLens(), timestep=.5, logfile=MIRRORLOG) #mirror = Mirror(shards=shards, lens=FaceswapLens(), timestep=.0, logfile=MIRRORLOG) mirror.run(memorize=False) # Logic to not remember everything in each step cam_block = CountdownBlock(blocking_shards=['webcam'], classes=emotion_shard.classes, frequencies={'neutral': 20}) face_block = CountdownBlock(blocking_shards=['faces'], classes=emotion_shard.classes, frequencies={'neutral': 20}) screenshot_block = CountdownBlock(blocking_shards=['screenshot'], classes=emotion_shard.classes, frequencies={'neutral': 50}, base_frequency=2) # Logging shards.append(WindowShard(logfile=WINDOWLOG))