detection no-tflite ok
This commit is contained in:
parent
3c2d6f3775
commit
a0d1703e8f
@ -315,6 +315,7 @@ class Vision(Component):
|
|||||||
try:
|
try:
|
||||||
# create tensorflow model
|
# create tensorflow model
|
||||||
model = tf.saved_model.load(str(self.models_dir / model_name))
|
model = tf.saved_model.load(str(self.models_dir / model_name))
|
||||||
|
model = model.signatures['serving_default']
|
||||||
tf_mode = "normal"
|
tf_mode = "normal"
|
||||||
except Exception:
|
except Exception:
|
||||||
self.log.exception(traceback.format_exc())
|
self.log.exception(traceback.format_exc())
|
||||||
@ -386,7 +387,10 @@ class Vision(Component):
|
|||||||
"detection_classes": [map(lambda class_id: class_id + 1, class_ids)][0:1],
|
"detection_classes": [map(lambda class_id: class_id + 1, class_ids)][0:1],
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
detections = self.model(tensor)
|
input_tensor = tf.convert_to_tensor(np.asarray(tensor))
|
||||||
|
#input_tensor = input_tensor[tf.newaxis, ...]
|
||||||
|
|
||||||
|
detections = self.model(input_tensor)
|
||||||
if lock:
|
if lock:
|
||||||
self.lock.unlock()
|
self.lock.unlock()
|
||||||
# WARNING: results other than the ones related to tensor[-1] will be discarded
|
# WARNING: results other than the ones related to tensor[-1] will be discarded
|
||||||
|
|||||||
@ -270,6 +270,8 @@ class Test(Widget):
|
|||||||
|
|
||||||
def done(self, ok=True):
|
def done(self, ok=True):
|
||||||
self.log.info("cycle done")
|
self.log.info("cycle done")
|
||||||
|
self.data["vision"][0].pop("detections")
|
||||||
|
self.data["vision"][0].pop("results")
|
||||||
archived = Archive.archive(self.recipe, self.data, ok and self.data["ok"], overridden=self.data["overridden"])
|
archived = Archive.archive(self.recipe, self.data, ok and self.data["ok"], overridden=self.data["overridden"])
|
||||||
self.log.info(f"cycle archived locally: {archived!r}")
|
self.log.info(f"cycle archived locally: {archived!r}")
|
||||||
# COUNT OK
|
# COUNT OK
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user