diff --git a/services/camera/src/camera.py b/services/camera/src/camera.py index 2158f1435caa529469bc72b1e792614acd7063e3..c74b37194b797c417c3134085f9bfacdd233e6ce 100644 --- a/services/camera/src/camera.py +++ b/services/camera/src/camera.py @@ -1,4 +1,3 @@ -import argparse import random import socket import cv2 @@ -7,8 +6,7 @@ import struct import time import datetime import os # Import os for environment variables -from tracerprovider import tracer, meter -import pyshine as ps # pip install pyshine +from telemetry.tracerprovider import tracer, meter import imutils # pip install imutils import logging diff --git a/services/camera/src/telemetry/__init__.py b/services/camera/src/telemetry/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/camera/src/tracerprovider.py b/services/camera/src/telemetry/tracerprovider.py similarity index 100% rename from services/camera/src/tracerprovider.py rename to services/camera/src/telemetry/tracerprovider.py diff --git a/services/motion_detector/src/motion_detection.py b/services/motion_detector/src/motion_detection.py index 667d52afc2d199bd1a62455e3935fcac15f58a71..a6b74122f9b02855748d55d5ac178e110fcfc560 100644 --- a/services/motion_detector/src/motion_detection.py +++ b/services/motion_detector/src/motion_detection.py @@ -11,7 +11,7 @@ import queue import psutil import imutils import logging # Import the logging module -from tracerprovider import tracer, meter +from telemetry.tracerprovider import meter # Configure logging logging.basicConfig( diff --git a/services/motion_detector/src/telemetry/__init__.py b/services/motion_detector/src/telemetry/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/motion_detector/src/tracerprovider.py b/services/motion_detector/src/telemetry/tracerprovider.py similarity index 100% rename from services/motion_detector/src/tracerprovider.py rename to services/motion_detector/src/telemetry/tracerprovider.py diff --git a/services/object_recognizer/src/object_recognizer.py b/services/object_recognizer/src/object_recognizer.py index c906ddfc31ff879c43089430a93e807d7ba89449..e698fb0e1807c0af6149a2e9eca104ba5a24f712 100644 --- a/services/object_recognizer/src/object_recognizer.py +++ b/services/object_recognizer/src/object_recognizer.py @@ -1,17 +1,15 @@ import datetime import socket -import time import threading import queue import pickle import struct import cv2 -import numpy as np import logging from model.model import recognize from webserver import run_flask -from tracerprovider import tracer, meter +from telemetry.tracerprovider import meter # Configure logging logging.basicConfig( @@ -51,56 +49,6 @@ def draw_prediction(img, class_id, confidence, x, y, x_plus_w, y_plus_h, classes def process_frame(mddata): recognize(mddata['frame']) - # frame = mddata['frame'] - # Width = frame.shape[1] - # Height = frame.shape[0] - # scale = 0.00392 - # - # classes = None - # with open("src/yolov3.txt", 'r') as f: - # classes = [line.strip() for line in f.readlines()] - # - # COLORS = np.random.uniform(0, 255, size=(len(classes), 3)) - # net = cv2.dnn.readNet("src/yolov3.weights", "src/yolov3.cfg") - # blob = cv2.dnn.blobFromImage(frame, scale, (416, 416), (0, 0, 0), True, crop=False) - # net.setInput(blob) - # outs = net.forward(get_output_layers(net)) - # - # class_ids = [] - # confidences = [] - # boxes = [] - # conf_threshold = 0.5 - # nms_threshold = 0.4 - # - # for out in outs: - # for detection in out: - # scores = detection[5:] - # class_id = np.argmax(scores) - # confidence = scores[class_id] - # if confidence > 0.5: - # center_x = int(detection[0] * Width) - # center_y = int(detection[1] * Height) - # w = int(detection[2] * Width) - # h = int(detection[3] * Height) - # x = center_x - w / 2 - # y = center_y - h / 2 - # class_ids.append(class_id) - # confidences.append(float(confidence)) - # boxes.append([x, y, w, h]) - # - # indices = cv2.dnn.NMSBoxes(boxes, confidences, conf_threshold, nms_threshold) - # for i in indices: - # try: - # box = boxes[i] - # except: - # i = i[0] - # box = boxes[i] - # x = box[0] - # y = box[1] - # w = box[2] - # h = box[3] - # draw_prediction(frame, class_ids[i], confidences[i], round(x), round(y), round(x + w), round(y + h), classes, - # COLORS) def receive_frames(client_socket, frame_queue): data = b"" diff --git a/services/object_recognizer/src/telemetry/__init__.py b/services/object_recognizer/src/telemetry/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/services/object_recognizer/src/tracerprovider.py b/services/object_recognizer/src/telemetry/tracerprovider.py similarity index 100% rename from services/object_recognizer/src/tracerprovider.py rename to services/object_recognizer/src/telemetry/tracerprovider.py