Add noroc
Change-Id: I3e7e1c07fbbd3009e07a07627b7f32fab1888053
diff --git a/person_detection/app.py b/person_detection/app.py
index bc72e96..240c450 100644
--- a/person_detection/app.py
+++ b/person_detection/app.py
@@ -58,16 +58,16 @@
help = "Optional. Probability threshold for detections filtering",
default = 0.75,
type = float)
- args.add_argument("--idle",
- action = 'store_true',
- help = "Idle if no clients connected")
+ args.add_argument("--noroc",
+ action = 'store_false',
+ help = "No ROC")
args.add_argument("--key",
help = "ROC api key",
required = True,
type = str)
args.add_argument("--mbrlow",
help = "Low range of MBR",
- default = 5000000,
+ default = 7000000,
type = int)
args.add_argument("--mbrhigh",
help = "High range of MBR",
diff --git a/person_detection/base_camera.py b/person_detection/base_camera.py
index d7a7d29..f36120a 100644
--- a/person_detection/base_camera.py
+++ b/person_detection/base_camera.py
@@ -16,13 +16,14 @@
cameras = Array('i', [0, 0, 0, 0])
lock = Lock()
- def __init__(self, device, key, mbrlow, mbrhigh, devicegroup):
+ def __init__(self, device, key, mbrlow, mbrhigh, devicegroup, noroc):
self.mqttBroker = "localhost"
self.device = device
self.key = key
self.mbrlow = mbrlow
self.mbrhigh = mbrhigh
self.devicegroup = devicegroup
+ self.noroc = noroc
"""Start the background camera process if it isn't running yet."""
if BaseCamera.cameras[int(self.device)] == 0:
@@ -31,6 +32,7 @@
self.timer = None
self.detected = False
BaseCamera.frame[self.device] = Queue(100)
+ self.set_resolution(self.device, "low")
# start background frame process
BaseCamera.process[self.device] = Process(target=self._process, args=(self.device))
BaseCamera.process[self.device].start()
@@ -62,7 +64,8 @@
BaseCamera.activity_counter.value += 1
BaseCamera.lock.release()
self.set_resolution_high()
- roc.set_mbr(self.key, self.devicegroup, self.mbrhigh)
+ if self.noroc is True:
+ roc.set_mbr(self.key, self.devicegroup, self.mbrhigh)
self.detected = True
self.start_timer()
@@ -74,7 +77,8 @@
if BaseCamera.activity_counter.value <= 0:
BaseCamera.activity_counter.value = 0
self.set_resolution_low()
- roc.set_mbr(self.key, self.devicegroup, self.mbrlow)
+ if self.noroc is True:
+ roc.set_mbr(self.key, self.devicegroup, self.mbrlow)
BaseCamera.lock.release()
diff --git a/person_detection/config.py b/person_detection/config.py
index 4aa9d1e..f31b769 100644
--- a/person_detection/config.py
+++ b/person_detection/config.py
@@ -3,4 +3,4 @@
SPDX-License-Identifier: LicenseRef-ONF-Member-1.01
"""
-cameras = {"0": "Ain's desk", "1":"Large conference room", "2":"Shad's desk", "3":"Unknown"}
+cameras = {"0": "Ain's desk", "1":"HungWei's desk", "2":"Shad's desk", "3":"Unknown"}
diff --git a/person_detection/person_detection.py b/person_detection/person_detection.py
index 5d01794..f7984af 100644
--- a/person_detection/person_detection.py
+++ b/person_detection/person_detection.py
@@ -30,7 +30,7 @@
self.is_async_mode = True
self.device = device
- super(Camera, self).__init__(device, args.key, args.mbrlow, args.mbrhigh, args.devicegroup)
+ super(Camera, self).__init__(device, args.key, args.mbrlow, args.mbrhigh, args.devicegroup, args.noroc)
def __del__(self):
# stream.release()
diff --git a/person_detection/roc.py b/person_detection/roc.py
index a9477f1..7488af9 100644
--- a/person_detection/roc.py
+++ b/person_detection/roc.py
@@ -28,6 +28,7 @@
return mbr
def set_mbr(key, device_group, mbr):
+ print("Set {} mbr to {}".format(device_group, mbr))
m = {'uplink' : mbr}
url = URL + "vcs/vcs/vcs-{}/slice/mbr".format(device_group)
response = requests.post(url, headers=headers(key), json=m)