From ffee1c5cc21195c43b8eff214b799a60de2da0f2 Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Wed, 26 Apr 2023 22:51:28 -0700 Subject: [PATCH] predict: publish --- plugins/coreml/package-lock.json | 4 ++-- plugins/coreml/package.json | 3 +-- plugins/coreml/src/coreml/__init__.py | 5 +---- plugins/tensorflow-lite/package-lock.json | 4 ++-- plugins/tensorflow-lite/package.json | 3 +-- plugins/tensorflow-lite/src/predict/__init__.py | 7 +------ plugins/tensorflow-lite/src/tflite/__init__.py | 5 +---- plugins/tensorflow/package-lock.json | 4 ++-- plugins/tensorflow/package.json | 3 +-- plugins/tensorflow/src/tf/__init__.py | 5 +---- 10 files changed, 13 insertions(+), 30 deletions(-) diff --git a/plugins/coreml/package-lock.json b/plugins/coreml/package-lock.json index 287e04c018..82c35c8095 100644 --- a/plugins/coreml/package-lock.json +++ b/plugins/coreml/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/coreml", - "version": "0.1.12", + "version": "0.1.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/coreml", - "version": "0.1.12", + "version": "0.1.13", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/coreml/package.json b/plugins/coreml/package.json index 361b073b55..9735c4ab76 100644 --- a/plugins/coreml/package.json +++ b/plugins/coreml/package.json @@ -34,12 +34,11 @@ "type": "API", "interfaces": [ "Settings", - "BufferConverter", "ObjectDetection" ] }, "devDependencies": { "@scrypted/sdk": "file:../../sdk" }, - "version": "0.1.12" + "version": "0.1.13" } diff --git a/plugins/coreml/src/coreml/__init__.py b/plugins/coreml/src/coreml/__init__.py index 33bdf9f150..ab70444778 100644 --- a/plugins/coreml/src/coreml/__init__.py +++ b/plugins/coreml/src/coreml/__init__.py @@ -22,12 +22,9 @@ def parse_label_contents(contents: str): ret[row_number] = content.strip() return ret - -MIME_TYPE = 'x-scrypted-coreml/x-raw-image' - class CoreMLPlugin(PredictPlugin, scrypted_sdk.BufferConverter, scrypted_sdk.Settings): def __init__(self, nativeId: str | None = None): - super().__init__(MIME_TYPE, nativeId=nativeId) + super().__init__(nativeId=nativeId) labelsFile = self.downloadFile('https://raw.githubusercontent.com/koush/coreml-survival-guide/master/MobileNetV2%2BSSDLite/coco_labels.txt', 'coco_labels.txt') modelFile = self.downloadFile('https://github.com/koush/coreml-survival-guide/raw/master/MobileNetV2%2BSSDLite/ObjectDetection/ObjectDetection/MobileNetV2_SSDLite.mlmodel', 'MobileNetV2_SSDLite.mlmodel') diff --git a/plugins/tensorflow-lite/package-lock.json b/plugins/tensorflow-lite/package-lock.json index 7c289b92a4..20e400afa8 100644 --- a/plugins/tensorflow-lite/package-lock.json +++ b/plugins/tensorflow-lite/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/tensorflow-lite", - "version": "0.1.12", + "version": "0.1.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/tensorflow-lite", - "version": "0.1.12", + "version": "0.1.13", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/tensorflow-lite/package.json b/plugins/tensorflow-lite/package.json index 0459ba6ee4..654f890808 100644 --- a/plugins/tensorflow-lite/package.json +++ b/plugins/tensorflow-lite/package.json @@ -37,12 +37,11 @@ "type": "API", "interfaces": [ "Settings", - "BufferConverter", "ObjectDetection" ] }, "devDependencies": { "@scrypted/sdk": "file:../../sdk" }, - "version": "0.1.12" + "version": "0.1.13" } diff --git a/plugins/tensorflow-lite/src/predict/__init__.py b/plugins/tensorflow-lite/src/predict/__init__.py index 9882f3e09f..b67cdb72ee 100644 --- a/plugins/tensorflow-lite/src/predict/__init__.py +++ b/plugins/tensorflow-lite/src/predict/__init__.py @@ -110,14 +110,9 @@ def __init__(self, id: int, score: float, bbox: Tuple[float, float, float, float class PredictPlugin(DetectPlugin, scrypted_sdk.BufferConverter, scrypted_sdk.Settings): labels: dict - def __init__(self, PLUGIN_MIME_TYPE: str, nativeId: str | None = None): + def __init__(self, nativeId: str | None = None): super().__init__(nativeId=nativeId) - self.fromMimeType = PLUGIN_MIME_TYPE - self.toMimeType = scrypted_sdk.ScryptedMimeTypes.MediaObject.value - - self.crop = False - # periodic restart because there seems to be leaks in tflite or coral API. loop = asyncio.get_event_loop() loop.call_later(4 * 60 * 60, lambda: self.requestRestart()) diff --git a/plugins/tensorflow-lite/src/tflite/__init__.py b/plugins/tensorflow-lite/src/tflite/__init__.py index aff99f7c2a..39841b71b6 100644 --- a/plugins/tensorflow-lite/src/tflite/__init__.py +++ b/plugins/tensorflow-lite/src/tflite/__init__.py @@ -32,12 +32,9 @@ def parse_label_contents(contents: str): ret[row_number] = content.strip() return ret - -MIME_TYPE = 'x-scrypted-tensorflow-lite/x-raw-image' - class TensorFlowLitePlugin(PredictPlugin, scrypted_sdk.BufferConverter, scrypted_sdk.Settings): def __init__(self, nativeId: str | None = None): - super().__init__(MIME_TYPE, nativeId=nativeId) + super().__init__(nativeId=nativeId) tfliteFile = self.downloadFile('https://raw.githubusercontent.com/google-coral/test_data/master/ssd_mobilenet_v2_coco_quant_postprocess.tflite', 'ssd_mobilenet_v2_coco_quant_postprocess.tflite') edgetpuFile = self.downloadFile('https://raw.githubusercontent.com/google-coral/test_data/master/ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite', 'ssd_mobilenet_v2_coco_quant_postprocess_edgetpu.tflite') diff --git a/plugins/tensorflow/package-lock.json b/plugins/tensorflow/package-lock.json index 7c289b92a4..20e400afa8 100644 --- a/plugins/tensorflow/package-lock.json +++ b/plugins/tensorflow/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/tensorflow-lite", - "version": "0.1.12", + "version": "0.1.13", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/tensorflow-lite", - "version": "0.1.12", + "version": "0.1.13", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/tensorflow/package.json b/plugins/tensorflow/package.json index e17db5a6b9..57d86a4427 100644 --- a/plugins/tensorflow/package.json +++ b/plugins/tensorflow/package.json @@ -34,12 +34,11 @@ "type": "API", "interfaces": [ "Settings", - "BufferConverter", "ObjectDetection" ] }, "devDependencies": { "@scrypted/sdk": "file:../../sdk" }, - "version": "0.1.12" + "version": "0.1.13" } diff --git a/plugins/tensorflow/src/tf/__init__.py b/plugins/tensorflow/src/tf/__init__.py index e1f1ddb661..1dfd7553cc 100644 --- a/plugins/tensorflow/src/tf/__init__.py +++ b/plugins/tensorflow/src/tf/__init__.py @@ -21,12 +21,9 @@ def parse_label_contents(contents: str): ret[row_number] = content.strip() return ret - -MIME_TYPE = 'x-scrypted-tensorflow/x-raw-image' - class TensorFlowPlugin(PredictPlugin, scrypted_sdk.BufferConverter, scrypted_sdk.Settings): def __init__(self, nativeId: str | None = None): - super().__init__(MIME_TYPE, nativeId=nativeId) + super().__init__(nativeId=nativeId) modelPath = os.path.join(os.environ['SCRYPTED_PLUGIN_VOLUME'], 'zip', 'unzipped', 'fs') self.model = tf.saved_model.load(modelPath)