From 0b6ffc2b87d782624ef697fd62176aecd60e803b Mon Sep 17 00:00:00 2001 From: Koushik Dutta Date: Sun, 16 Apr 2023 20:50:49 -0700 Subject: [PATCH] predict: strip out allow list --- plugins/coreml/package-lock.json | 4 ++-- plugins/coreml/package.json | 2 +- plugins/coreml/src/coreml/__init__.py | 3 +-- plugins/tensorflow-lite/package-lock.json | 4 ++-- plugins/tensorflow-lite/package.json | 2 +- plugins/tensorflow-lite/src/detect/__init__.py | 1 + plugins/tensorflow-lite/src/predict/__init__.py | 4 +--- plugins/tensorflow-lite/src/tflite/__init__.py | 3 +-- plugins/tensorflow/package-lock.json | 4 ++-- plugins/tensorflow/package.json | 2 +- plugins/tensorflow/src/tf/__init__.py | 3 +-- 11 files changed, 14 insertions(+), 18 deletions(-) diff --git a/plugins/coreml/package-lock.json b/plugins/coreml/package-lock.json index 5f63dc7f6..d863ad585 100644 --- a/plugins/coreml/package-lock.json +++ b/plugins/coreml/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/coreml", - "version": "0.1.10", + "version": "0.1.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/coreml", - "version": "0.1.10", + "version": "0.1.11", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/coreml/package.json b/plugins/coreml/package.json index 53d2a4813..a6684b0a0 100644 --- a/plugins/coreml/package.json +++ b/plugins/coreml/package.json @@ -41,5 +41,5 @@ "devDependencies": { "@scrypted/sdk": "file:../../sdk" }, - "version": "0.1.10" + "version": "0.1.11" } diff --git a/plugins/coreml/src/coreml/__init__.py b/plugins/coreml/src/coreml/__init__.py index caa0b471e..d8389e29f 100644 --- a/plugins/coreml/src/coreml/__init__.py +++ b/plugins/coreml/src/coreml/__init__.py @@ -91,6 +91,5 @@ class CoreMLPlugin(PredictPlugin, scrypted_sdk.BufferConverter, scrypted_sdk.Set )) objs.append(obj) - allowList = settings.get('allowList', None) if settings else None - ret = self.create_detection_result(objs, src_size, allowList, cvss) + ret = self.create_detection_result(objs, src_size, cvss) return ret diff --git a/plugins/tensorflow-lite/package-lock.json b/plugins/tensorflow-lite/package-lock.json index dcb242e73..be19531bc 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.10", + "version": "0.1.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/tensorflow-lite", - "version": "0.1.10", + "version": "0.1.11", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/tensorflow-lite/package.json b/plugins/tensorflow-lite/package.json index 77ae51bb1..9967134ab 100644 --- a/plugins/tensorflow-lite/package.json +++ b/plugins/tensorflow-lite/package.json @@ -44,5 +44,5 @@ "devDependencies": { "@scrypted/sdk": "file:../../sdk" }, - "version": "0.1.10" + "version": "0.1.11" } diff --git a/plugins/tensorflow-lite/src/detect/__init__.py b/plugins/tensorflow-lite/src/detect/__init__.py index 8cc565fec..49707778d 100644 --- a/plugins/tensorflow-lite/src/detect/__init__.py +++ b/plugins/tensorflow-lite/src/detect/__init__.py @@ -55,6 +55,7 @@ class DetectPlugin(scrypted_sdk.ScryptedDeviceBase, ObjectDetection): try: videoFrames = await scrypted_sdk.sdk.connectRPCObject(videoFrames) async for videoFrame in videoFrames: + videoFrame = await scrypted_sdk.sdk.connectRPCObject(videoFrame) detected = await self.run_detection_videoframe(videoFrame, session) yield { '__json_copy_serialize_children': True, diff --git a/plugins/tensorflow-lite/src/predict/__init__.py b/plugins/tensorflow-lite/src/predict/__init__.py index 7686d451b..9882f3e09 100644 --- a/plugins/tensorflow-lite/src/predict/__init__.py +++ b/plugins/tensorflow-lite/src/predict/__init__.py @@ -149,7 +149,7 @@ class PredictPlugin(DetectPlugin, scrypted_sdk.BufferConverter, scrypted_sdk.Set def getModelSettings(self, settings: Any = None) -> list[Setting]: return [] - def create_detection_result(self, objs: List[Prediction], size, allowList, convert_to_src_size=None) -> ObjectsDetected: + def create_detection_result(self, objs: List[Prediction], size, convert_to_src_size=None) -> ObjectsDetected: detections: List[ObjectDetectionResult] = [] detection_result: ObjectsDetected = {} detection_result['detections'] = detections @@ -157,8 +157,6 @@ class PredictPlugin(DetectPlugin, scrypted_sdk.BufferConverter, scrypted_sdk.Set for obj in objs: className = self.labels.get(obj.id, obj.id) - if allowList and len(allowList) and className not in allowList: - continue detection: ObjectDetectionResult = {} detection['boundingBox'] = ( obj.bbox.xmin, obj.bbox.ymin, obj.bbox.xmax - obj.bbox.xmin, obj.bbox.ymax - obj.bbox.ymin) diff --git a/plugins/tensorflow-lite/src/tflite/__init__.py b/plugins/tensorflow-lite/src/tflite/__init__.py index 91d755ca3..aff99f7c2 100644 --- a/plugins/tensorflow-lite/src/tflite/__init__.py +++ b/plugins/tensorflow-lite/src/tflite/__init__.py @@ -133,6 +133,5 @@ class TensorFlowLitePlugin(PredictPlugin, scrypted_sdk.BufferConverter, scrypted objs = await asyncio.get_event_loop().run_in_executor(self.executor, predict) - allowList = settings.get('allowList', None) if settings else None - ret = self.create_detection_result(objs, src_size, allowList, cvss) + ret = self.create_detection_result(objs, src_size, cvss) return ret diff --git a/plugins/tensorflow/package-lock.json b/plugins/tensorflow/package-lock.json index dcb242e73..be19531bc 100644 --- a/plugins/tensorflow/package-lock.json +++ b/plugins/tensorflow/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/tensorflow-lite", - "version": "0.1.10", + "version": "0.1.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/tensorflow-lite", - "version": "0.1.10", + "version": "0.1.11", "devDependencies": { "@scrypted/sdk": "file:../../sdk" } diff --git a/plugins/tensorflow/package.json b/plugins/tensorflow/package.json index 91867b07e..84a753314 100644 --- a/plugins/tensorflow/package.json +++ b/plugins/tensorflow/package.json @@ -41,5 +41,5 @@ "devDependencies": { "@scrypted/sdk": "file:../../sdk" }, - "version": "0.1.10" + "version": "0.1.11" } diff --git a/plugins/tensorflow/src/tf/__init__.py b/plugins/tensorflow/src/tf/__init__.py index 0534d966d..e1f1ddb66 100644 --- a/plugins/tensorflow/src/tf/__init__.py +++ b/plugins/tensorflow/src/tf/__init__.py @@ -86,6 +86,5 @@ class TensorFlowPlugin(PredictPlugin, scrypted_sdk.BufferConverter, scrypted_sdk )) objs.append(obj) - allowList = settings.get('allowList', None) if settings else None - ret = self.create_detection_result(objs, src_size, allowList, cvss) + ret = self.create_detection_result(objs, src_size, cvss) return ret