Skip to content

Commit d91dc82

Browse files
Replace aspectRatioResizeMode with aspect_ratio_resize_mode, remove CallbackContext where it remained
1 parent 2e0dde3 commit d91dc82

File tree

8 files changed

+10
-16
lines changed

8 files changed

+10
-16
lines changed

gen2-emotion-recognition/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
det = oak.create_nn('face-detection-retail-0004', color)
1010
# Passthrough is enabled for debugging purposes
1111
# AspectRatioResizeMode has to be CROP for 2-stage pipelines at the moment
12-
det.config_nn(aspectRatioResizeMode=AspectRatioResizeMode.CROP)
12+
det.config_nn(aspect_ratio_resize_mode=AspectRatioResizeMode.CROP)
1313

1414
emotion_nn = oak.create_nn('emotions-recognition-retail-0003', input=det)
1515
# emotion_nn.config_multistage_nn(show_cropped_frames=True) # For debugging

gen2-full-fov-nn/cropping.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
with OakCamera() as oak:
44
color = oak.create_camera('color')
55
nn = oak.create_nn('mobilenet-ssd', color)
6-
nn.config_nn(aspectRatioResizeMode=AspectRatioResizeMode.CROP)
6+
nn.config_nn(aspect_ratio_resize_mode=AspectRatioResizeMode.CROP)
77
oak.visualize([nn, nn.out.passthrough], fps=True)
8-
oak.start(blocking=True)
8+
oak.start(blocking=True)

gen2-full-fov-nn/letterboxing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
with OakCamera() as oak:
44
color = oak.create_camera('color')
55
nn = oak.create_nn('mobilenet-ssd', color)
6-
nn.config_nn(aspectRatioResizeMode=AspectRatioResizeMode.LETTERBOX)
6+
nn.config_nn(aspect_ratio_resize_mode=AspectRatioResizeMode.LETTERBOX)
77
oak.visualize([nn, nn.out.passthrough], fps=True)
88
oak.start(blocking=True)

gen2-full-fov-nn/stretching.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
with OakCamera() as oak:
44
color = oak.create_camera('color')
55
nn = oak.create_nn('mobilenet-ssd', color)
6-
nn.config_nn(aspectRatioResizeMode=AspectRatioResizeMode.STRETCH)
6+
nn.config_nn(aspect_ratio_resize_mode=AspectRatioResizeMode.STRETCH)
77
oak.visualize([nn, nn.out.passthrough], fps=True)
88
oak.start(blocking=True)

gen2-head-posture-detection/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
det = oak.create_nn('face-detection-retail-0004', color)
1010
# Passthrough is enabled for debugging purposes
1111
# AspectRatioResizeMode has to be CROP for 2-stage pipelines at the moment
12-
det.config_nn(aspectRatioResizeMode=AspectRatioResizeMode.CROP)
12+
det.config_nn(aspect_ratio_resize_mode=AspectRatioResizeMode.CROP)
1313

1414
emotion_nn = oak.create_nn('head-pose-estimation-adas-0001', input=det)
1515
# emotion_nn.config_multistage_nn(show_cropped_frames=True) # For debugging

gen2-mask-detection/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def log_softmax(x):
1111

1212
det = oak.create_nn('face-detection-retail-0004', color)
1313
# AspectRatioResizeMode has to be CROP for 2-stage pipelines at the moment
14-
det.config_nn(aspectRatioResizeMode=AspectRatioResizeMode.CROP)
14+
det.config_nn(aspect_ratio_resize_mode=AspectRatioResizeMode.CROP)
1515

1616
mask = oak.create_nn('sbd_mask_classification_224x224', input=det)
1717
# mask.config_multistage_nn(show_cropped_frames=True) # For debugging

sdk_todo/sdk-efficient-det/main.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import cv2
2-
import depthai
32
import numpy as np
43
from depthai import NNData
54

65
from depthai_sdk import OakCamera, Detections
7-
from depthai_sdk.callback_context import CallbackContext
86

97
CONF_THRESHOLD = 0.4
108
SHAPE = 320
@@ -18,6 +16,7 @@
1816
"mouse", "remote", "keyboard", "cell phone", "microwave", "oven", "toaster", "sink", "refrigerator", "83",
1917
"book", "clock", "vase", "scissors", "teddy bear", "hair drier", "toothbrush"]
2018

19+
2120
def decode(nn_data: NNData):
2221
bb = np.array(nn_data.getLayerFp16('Identity')).reshape(25, 4)
2322
label = nn_data.getLayerInt32('Identity_1')
@@ -27,9 +26,7 @@ def decode(nn_data: NNData):
2726
# for det in bb:
2827

2928

30-
def callback(ctx: CallbackContext):
31-
packet = ctx.packet
32-
29+
def callback(packet, visualizer):
3330
frame = packet.frame
3431
nn_data = packet.img_detections
3532

sdk_todo/sdk-gaze-estimation/main.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22
import numpy as np
33

44
from depthai_sdk import OakCamera, AspectRatioResizeMode
5-
from depthai_sdk.callback_context import CallbackContext
65
from depthai_sdk.oak_outputs.normalize_bb import NormalizeBoundingBox
76

87
CONFIDENCE = 0.7
98

109

11-
def callback(ctx: CallbackContext):
12-
packet = ctx.packet
13-
10+
def callback(packet, visualizer):
1411
nn_data = packet.img_detections
1512
bboxes = np.array(nn_data.getFirstLayerFp16())
1613
bboxes = bboxes.reshape((bboxes.size // 7, 7))

0 commit comments

Comments
 (0)