|
16 | 16 | from modules.common.modules.camera import camera_opencv |
17 | 17 | from modules.common.modules.camera import camera_picamera2 |
18 | 18 | from modules.communications import communications_worker |
| 19 | +from modules.detect_target import detect_target_brightspot |
19 | 20 | from modules.detect_target import detect_target_factory |
20 | 21 | from modules.detect_target import detect_target_worker |
| 22 | +from modules.detect_target import detect_target_ultralytics |
21 | 23 | from modules.flight_interface import flight_interface_worker |
22 | 24 | from modules.video_input import video_input_worker |
23 | 25 | from modules.data_merge import data_merge_worker |
@@ -109,13 +111,26 @@ def main() -> int: |
109 | 111 | DETECT_TARGET_OPTION = detect_target_factory.DetectTargetOption( |
110 | 112 | config["detect_target"]["option"] |
111 | 113 | ) |
112 | | - DETECT_TARGET_DEVICE = "cpu" if args.cpu else config["detect_target"]["device"] |
113 | | - DETECT_TARGET_MODEL_PATH = config["detect_target"]["model_path"] |
114 | | - DETECT_TARGET_OVERRIDE_FULL_PRECISION = args.full |
115 | 114 | DETECT_TARGET_SAVE_PREFIX = str( |
116 | 115 | pathlib.Path(logging_path, config["detect_target"]["save_prefix"]) |
117 | 116 | ) |
118 | 117 | DETECT_TARGET_SHOW_ANNOTATED = args.show_annotated |
| 118 | + match DETECT_TARGET_OPTION: |
| 119 | + case detect_target_factory.DetectTargetOption.ML_ULTRALYTICS: |
| 120 | + DETECT_TARGET_CONFIG = detect_target_ultralytics.DetectTargetUltralyticsConfig( |
| 121 | + config["detect_target"]["config"]["device"], |
| 122 | + config["detect_target"]["config"]["model_path"], |
| 123 | + args.full, |
| 124 | + ) |
| 125 | + case detect_target_factory.DetectTargetOption.CV_BRIGHTSPOT: |
| 126 | + DETECT_TARGET_CONFIG = detect_target_brightspot.DetectTargetBrightspotConfig( |
| 127 | + **config["detect_target"]["config"] |
| 128 | + ) |
| 129 | + case _: |
| 130 | + main.logger.error( |
| 131 | + f"Inputted an invalid detect target option: {DETECT_TARGET_OPTION}", True |
| 132 | + ) |
| 133 | + return -1 |
119 | 134 |
|
120 | 135 | FLIGHT_INTERFACE_ADDRESS = config["flight_interface"]["address"] |
121 | 136 | FLIGHT_INTERFACE_TIMEOUT = config["flight_interface"]["timeout"] |
@@ -244,12 +259,10 @@ def main() -> int: |
244 | 259 | count=DETECT_TARGET_WORKER_COUNT, |
245 | 260 | target=detect_target_worker.detect_target_worker, |
246 | 261 | work_arguments=( |
247 | | - DETECT_TARGET_OPTION, |
248 | | - DETECT_TARGET_DEVICE, |
249 | | - DETECT_TARGET_MODEL_PATH, |
250 | | - DETECT_TARGET_OVERRIDE_FULL_PRECISION, |
251 | | - DETECT_TARGET_SHOW_ANNOTATED, |
252 | 262 | DETECT_TARGET_SAVE_PREFIX, |
| 263 | + DETECT_TARGET_SHOW_ANNOTATED, |
| 264 | + DETECT_TARGET_OPTION, |
| 265 | + DETECT_TARGET_CONFIG, |
253 | 266 | ), |
254 | 267 | input_queues=[video_input_to_detect_target_queue], |
255 | 268 | output_queues=[detect_target_to_data_merge_queue], |
|
0 commit comments