Ejemplo n.º 1
0
    def __init__(self):
        self.queue_manager = QueueManager([
            self.__class__.__name__,
            "Interpreter",
            "ColourDetection",
            "PositionDetection",
        ])

        self.models = [{
            "name":
            "coco",
            "model_path":
            config.directory.data.joinpath("coco_resnet"),
            "category_index":
            coco_category_index
        }, {
            "name":
            "epic-kitchens",
            "model_path":
            config.directory.data.joinpath("epic_kitchens"),
            "category_index":
            epic_kitchens_category_index
        }]

        for model in self.models:
            tf_model = tf.saved_model.load(str(model["model_path"]))
            model["model"] = tf_model.signatures["serving_default"]

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 2
0
    def __init__(self):
        self.queue_manager = QueueManager(
            [self.__class__.__name__, "NaturalLanguageGenerator"]
        )
        self.memory = {}

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 3
0
    def __init__(self):
        self.queue_manager = QueueManager([
            self.__class__.__name__, "WebCam", "WebCamBis", "ObjectDetection",
            "OCR"
        ])
        self.camera_names = ["WebCam"]
        self.pictures = []
        self.waiting_cameras = 0
        self.save_body = None

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 4
0
    def __init__(self):
        self.queue_manager = QueueManager(
            [self.__class__.__name__, "ExternalInterface"])
        self.answers = {}
        self.description_types = [
            "DESCRIPTION_NOTHING", "DESCRIPTION_ANSWER_S",
            "DESCRIPTION_ANSWER_P", "DESCRIPTION_UNKNOWN"
        ]
        self.build_generator()

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 5
0
    def __init__(self):
        self.queue_manager = QueueManager([self.__class__.__name__, "Manager"])
        self.previous_query = None

        model_path = str(config.directory.data.joinpath("rasa", "nlu"))

        dirs = [f for f in listdir(model_path) if isdir(join(model_path, f))]
        dirs.sort(reverse=True)
        model = join(model_path, dirs[0])
        self.interpreter = Interpreter.load(model)

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 6
0
    def __init__(self):
        self.queue_manager = QueueManager([
            self.__class__.__name__,
            "Interpreter",
            "ColourDetection",
            "PositionDetection",
        ])
        self.category_index = coco_category_index

        self.model_path = config.directory.data.joinpath("resnet")
        model = tf.saved_model.load(str(self.model_path))
        self.model = model.signatures["serving_default"]

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 7
0
    def __init__(self):
        self.queue_manager = QueueManager(
            [self.__class__.__name__, "Interpreter"])

        data_file = config.directory.data.joinpath("colour", "lab.txt")

        colour_list = pd.read_csv(data_file,
                                  skiprows=28,
                                  header=None,
                                  names=["l", "a", "b", "name"])
        colour_list = colour_list.values.tolist()[1:]

        self.colour_list_names = [x[3] for x in colour_list]
        self.colour_list_values = np.asarray(
            [np.asarray(x[:3], dtype=np.float32) for x in colour_list])

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 8
0
    def __init__(self, mode=COLOR_MODE):
        self.kinect = PyKinectRuntime.PyKinectRuntime(mode)
        if mode & DEPTH_MODE:
            self.kinect_frame_size = (
                self.kinect.depth_frame_desc.Height,
                self.kinect.depth_frame_desc.Width,
            )
        if mode & COLOR_MODE:
            self.kinect_frame_size = (
                self.kinect.color_frame_desc.Height,
                self.kinect.color_frame_desc.Width,
                -1,
            )
        self.transform = mode & DEPTH_MODE and cv2.COLOR_GRAY2RGB or cv2.COLOR_RGBA2RGB
        self.queue_manager = QueueManager(
            [self.__class__.__name__, "CameraManager"])

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 9
0
    def __init__(self):
        self.queue_manager = QueueManager(
            [self.__class__.__name__, "CameraManager"])
        # TODO: Missing intent for lateral position
        self.intents_to_path = {
            "read_text": [["CameraManager", "OCR", "Interpreter"]],
            "detect_colour": [[
                "CameraManager", "ObjectDetection", "ColourDetection",
                "Interpreter"
            ]],
            "identify": [
                ["CameraManager", "OCR", "Interpreter"],
                ["CameraManager", "ObjectDetection", "Interpreter"],
            ],
            "recognise": [["CameraManager", "ObjectDetection", "Interpreter"]],
            "locate": [["CameraManager", "ObjectDetection", "Interpreter"]],
        }

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 10
0
def submit():
    service_if_audio = "AutomaticSpeechRecognition"
    service_if_text = "NaturalLanguageUnderstanding"

    # Parse user request
    user_request = UserRequest(
        service_if_audio=service_if_audio, service_if_text=service_if_text
    )

    # Create queue for Ayesaac and send it
    ayesaac_queue_manager = QueueManager([user_request.first_service])
    ayesaac_queue_manager.publish(user_request.first_service, user_request.body)

    status_url = url_for("submit_status", task_id=user_request.uid)

    return (
        status_url,
        202,
        {"Location": status_url},
    )
Ejemplo n.º 11
0
    def __init__(self):
        self.queue_manager = QueueManager(
            [self.__class__.__name__, "CameraManager"])

        logger.info(f"{self.__class__.__name__} ready")
Ejemplo n.º 12
0
 def __init__(self):
     self.queue_manager = QueueManager(
         [self.__class__.__name__, "Interpreter"])
Ejemplo n.º 13
0
 def __init__(self):
     self.queue_manager = QueueManager(
         [self.__class__.__name__, "Interpreter"])
     self.pipeline = keras_ocr.pipeline.Pipeline()