Skip to content

Commit e9b645d

Browse files
author
SzabolcsGergely
committed
Fix tests
1 parent b8d942f commit e9b645d

File tree

9 files changed

+75
-196
lines changed

9 files changed

+75
-196
lines changed

depthai-core

examples/CMakeLists.txt

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -87,97 +87,97 @@ endif()
8787
# Add examples
8888

8989
## Bootloader
90-
add_python_example(bootloader_config bootloader_config.py)
91-
add_python_example(bootloader_version bootloader_version.py)
92-
add_python_example(flash_bootloader flash_bootloader.py)
90+
# add_python_example(bootloader_config bootloader/bootloader_config.py)
91+
add_python_example(bootloader_version bootloader/bootloader_version.py)
92+
# add_python_example(flash_bootloader bootloader/flash_bootloader.py)
9393

9494
## Calibration
95-
add_python_example(calibration_flash_v5 calibration_flash_v5.py)
96-
add_python_example(calibration_flash calibration_flash.py)
97-
add_python_example(calibration_load calibration_load.py)
98-
add_python_example(calibration_reader calibration_reader.py)
95+
# add_python_example(calibration_flash_v5 calibration/calibration_flash_v5.py)
96+
# add_python_example(calibration_flash calibration/calibration_flash.py)
97+
add_python_example(calibration_load calibration/calibration_load.py)
98+
add_python_example(calibration_reader calibration/calibration_reader.py)
9999

100100
## ColorCamera
101-
add_python_example(autoexposure_roi autoexposure_roi.py)
102-
add_python_example(rgb_camera_control rgb_camera_control.py)
103-
add_python_example(rgb_preview rgb_preview.py)
104-
add_python_example(rgb_scene rgb_scene.py)
105-
add_python_example(rgb_video rgb_video.py)
101+
add_python_example(autoexposure_roi ColorCamera/autoexposure_roi.py)
102+
add_python_example(rgb_camera_control ColorCamera/rgb_camera_control.py)
103+
add_python_example(rgb_preview ColorCamera/rgb_preview.py)
104+
add_python_example(rgb_scene ColorCamera/rgb_scene.py)
105+
add_python_example(rgb_video ColorCamera/rgb_video.py)
106106

107107
## EdgeDetector
108-
add_python_example(edge_detector edge_detector.py)
108+
add_python_example(edge_detector EdgeDetector/edge_detector.py)
109109

110110
## FeatureTracker
111-
add_python_example(feature_tracker feature_tracker.py)
112-
add_python_example(feature_detector feature_detector.py)
111+
add_python_example(feature_tracker FeatureTracker/feature_tracker.py)
112+
add_python_example(feature_detector FeatureTracker/feature_detector.py)
113113

114114
## HostSide
115-
add_python_example(device_queue_event device_queue_event.py)
116-
add_python_example(opencv_support opencv_support.py)
117-
add_python_example(queue_add_callback queue_add_callback.py)
115+
add_python_example(device_queue_event host_side/device_queue_event.py)
116+
add_python_example(opencv_support host_side/opencv_support.py)
117+
add_python_example(queue_add_callback host_side/queue_add_callback.py)
118118

119119
## ImageManip
120-
add_python_example(image_manip_rotate image_manip_rotate.py)
121-
add_python_example(image_manip_tiling image_manip_tiling.py)
122-
add_python_example(rgb_rotate_warp rgb_rotate_warp.py)
120+
add_python_example(image_manip_rotate ImageManip/image_manip_rotate.py)
121+
add_python_example(image_manip_tiling ImageManip/image_manip_tiling.py)
122+
add_python_example(rgb_rotate_warp ImageManip/rgb_rotate_warp.py)
123123

124124
## IMU
125-
add_python_example(imu_gyroscope_accelerometer imu_gyroscope_accelerometer.py)
126-
add_python_example(imu_rotation_vector imu_rotation_vector.py)
125+
add_python_example(imu_gyroscope_accelerometer IMU/imu_gyroscope_accelerometer.py)
126+
add_python_example(imu_rotation_vector IMU/imu_rotation_vector.py)
127127

128128
## Mixed
129-
add_python_example(mono_depth_mobilenetssd mono_depth_mobilenetssd.py)
130-
add_python_example(rgb_encoding_mobilenet rgb_encoding_mobilenet.py)
131-
add_python_example(rgb_encoding_mono_mobilenet rgb_encoding_mono_mobilenet.py)
132-
add_python_example(rgb_encoding_mono_mobilenet_depth rgb_encoding_mono_mobilenet_depth.py)
129+
add_python_example(mono_depth_mobilenetssd mixed/mono_depth_mobilenetssd.py)
130+
add_python_example(rgb_encoding_mobilenet mixed/rgb_encoding_mobilenet.py)
131+
add_python_example(rgb_encoding_mono_mobilenet mixed/rgb_encoding_mono_mobilenet.py)
132+
add_python_example(rgb_encoding_mono_mobilenet_depth mixed/rgb_encoding_mono_mobilenet_depth.py)
133133

134134
## MobileNet
135-
add_python_example(mono_mobilenet mono_mobilenet.py)
136-
add_python_example(rgb_mobilenet_4k rgb_mobilenet_4k.py)
137-
add_python_example(rgb_mobilenet rgb_mobilenet.py)
138-
add_python_example(video_mobilenet video_mobilenet.py)
135+
add_python_example(mono_mobilenet MobileNet/mono_mobilenet.py)
136+
add_python_example(rgb_mobilenet_4k MobileNet/rgb_mobilenet_4k.py)
137+
add_python_example(rgb_mobilenet MobileNet/rgb_mobilenet.py)
138+
add_python_example(video_mobilenet MobileNet/video_mobilenet.py)
139139

140140
## MonoCamera
141-
add_python_example(mono_preview mono_preview.py)
142-
add_python_example(mono_full_resolution_saver mono_full_resolution_saver.py)
143-
add_python_example(mono_camera_control mono_camera_control.py)
141+
add_python_example(mono_preview MonoCamera/mono_preview.py)
142+
add_python_example(mono_full_resolution_saver MonoCamera/mono_full_resolution_saver.py)
143+
add_python_example(mono_camera_control MonoCamera/mono_camera_control.py)
144144

145145
## NeuralNetwork
146-
add_python_example(concat_multiple_input concat_multiple_input.py)
147-
add_python_example(normalization_multiple_input normalization_multiple_input.py)
146+
# add_python_example(concat_multiple_input NeuralNetwork/concat_multiple_input.py)
147+
# add_python_example(normalization_multiple_input NeuralNetwork/normalization_multiple_input.py)
148148

149149
## ObjectTracker
150-
add_python_example(object_tracker_video object_tracker_video.py)
151-
add_python_example(object_tracker object_tracker.py)
152-
add_python_example(spatial_object_tracker_mobilenet spatial_object_tracker_mobilenet.py)
153-
add_python_example(spatial_object_tracker_yolo spatial_object_tracker_yolo.py)
150+
add_python_example(object_tracker_video ObjectTracker/object_tracker_video.py)
151+
add_python_example(object_tracker ObjectTracker/object_tracker.py)
152+
add_python_example(spatial_object_tracker_mobilenet ObjectTracker/spatial_object_tracker_mobilenet.py)
153+
# add_python_example(spatial_object_tracker_yolo ObjectTracker/spatial_object_tracker_yolo.py)
154154

155155
## Script
156-
add_python_example(script_camera_control script_camera_control.py)
156+
add_python_example(script_camera_control Script/script_camera_control.py)
157157

158158
## SpatialDetection
159-
add_python_example(spatial_tiny_yolo_v3 spatial_tiny_yolo.py)
160-
add_python_example(spatial_tiny_yolo_v4 spatial_tiny_yolo.py)
161-
add_python_example(spatial_mobilenet spatial_mobilenet.py)
162-
add_python_example(spatial_mobilenet_mono spatial_mobilenet_mono.py)
163-
add_python_example(spatial_location_calculator spatial_location_calculator.py)
159+
add_python_example(spatial_tiny_yolo_v3 SpatialDetection/spatial_tiny_yolo.py yolo3)
160+
add_python_example(spatial_tiny_yolo_v4 SpatialDetection/spatial_tiny_yolo.py yolo4)
161+
add_python_example(spatial_mobilenet SpatialDetection/spatial_mobilenet.py)
162+
add_python_example(spatial_mobilenet_mono SpatialDetection/spatial_mobilenet_mono.py)
163+
add_python_example(spatial_location_calculator SpatialDetection/spatial_location_calculator.py)
164164

165165
## StereoDepth
166-
add_python_example(depth_crop_control depth_crop_control.py)
167-
add_python_example(depth_preview depth_preview.py)
168-
add_python_example(rgb_depth_aligned rgb_depth_aligned.py)
169-
add_python_example(stereo_depth_from_host stereo_depth_from_host.py)
170-
add_python_example(stereo_depth_video stereo_depth_video.py)
166+
add_python_example(depth_crop_control StereoDepth/depth_crop_control.py)
167+
add_python_example(depth_preview StereoDepth/depth_preview.py)
168+
add_python_example(rgb_depth_aligned StereoDepth/rgb_depth_aligned.py)
169+
add_python_example(stereo_depth_from_host StereoDepth/stereo_depth_from_host.py)
170+
add_python_example(stereo_depth_video StereoDepth/stereo_depth_video.py)
171171

172172
## SystemLogger
173-
add_python_example(system_information system_information.py)
173+
add_python_example(system_information SystemLogger/system_information.py)
174174

175175
## VideoEncoder
176-
add_python_example(encoding_max_limit encoding_max_limit.py)
177-
add_python_example(rgb_encoding rgb_encoding.py)
178-
add_python_example(rgb_full_resolution_saver rgb_full_resolution_saver.py)
179-
add_python_example(rgb_mono_encoding rgb_mono_encoding.py)
176+
add_python_example(encoding_max_limit VideoEncoder/encoding_max_limit.py)
177+
add_python_example(rgb_encoding VideoEncoder/rgb_encoding.py)
178+
add_python_example(rgb_full_resolution_saver VideoEncoder/rgb_full_resolution_saver.py)
179+
add_python_example(rgb_mono_encoding VideoEncoder/rgb_mono_encoding.py)
180180

181181
## Yolo
182-
add_python_example(tiny_yolo_v3_device_side_decoding tiny_yolo_v3_device_side_decoding.py)
183-
add_python_example(tiny_yolo_v4_device_side_decoding tiny_yolo_v4_device_side_decoding.py)
182+
add_python_example(tiny_yolo_v3_device_side_decoding Yolo/tiny_yolo.py yolo3)
183+
add_python_example(tiny_yolo_v4_device_side_decoding Yolo/tiny_yolo.py yolo4)

examples/SpatialDetection/spatial_location_calculator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@
125125

126126
if newConfig:
127127
config.roi = dai.Rect(topLeft, bottomRight)
128+
config.calculationAlgorithm = dai.SpatialLocationCalculatorAlgorithm.AVERAGE
128129
cfg = dai.SpatialLocationCalculatorConfig()
129130
cfg.addROI(config)
130131
spatialCalcConfigInQueue.send(cfg)

examples/SpatialDetection/spatial_tiny_yolo.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,16 @@
1515

1616
# Get argument first
1717
nnBlobPath = str((Path(__file__).parent / Path('../models/yolo-v4-tiny-tf_openvino_2021.4_6shave.blob')).resolve().absolute())
18-
if len(sys.argv) > 1:
19-
nnBlobPath = sys.argv[1]
18+
if 1 < len(sys.argv):
19+
arg = sys.argv[1]
20+
if arg == "yolo3":
21+
nnBlobPath = str((Path(__file__).parent / Path('../models/yolo-v3-tiny-tf_openvino_2021.4_6shave.blob')).resolve().absolute())
22+
elif arg == "yolo4":
23+
nnBlobPath = str((Path(__file__).parent / Path('../models/yolo-v4-tiny-tf_openvino_2021.4_6shave.blob')).resolve().absolute())
24+
else:
25+
nnBlobPath = arg
26+
else:
27+
print("Using Tiny YoloV4 model. If you wish to use Tiny YOLOv3, call 'tiny_yolo.py yolo3'")
2028

2129
if not Path(nnBlobPath).exists():
2230
import sys

examples/StereoDepth/depth_preview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
inDepth = q.get() # blocking call, will wait until a new data has arrived
5252
frame = inDepth.getFrame()
5353
# Normalization for better visualization
54-
frame = (frame * (255 / depth.getMaxDisparity())).astype(np.uint8)
54+
frame = (frame * (255 / depth.initialConfig.getMaxDisparity())).astype(np.uint8)
5555

5656
cv2.imshow("disparity", frame)
5757

examples/Yolo/tiny_yolo.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
arg = sys.argv[1]
2020
if arg == "yolo3":
2121
nnPath = str((Path(__file__).parent / Path('../models/yolo-v3-tiny-tf_openvino_2021.4_6shave.blob')).resolve().absolute())
22+
elif arg == "yolo4":
23+
nnPath = str((Path(__file__).parent / Path('../models/yolo-v4-tiny-tf_openvino_2021.4_6shave.blob')).resolve().absolute())
2224
else:
2325
nnPath = arg
2426
else:

examples/calibration/calibration_reader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
calibData = device.readCalibration()
1515
calibData.eepromToJsonFile(calibFile)
1616

17-
M_rgb, width, height = np.array(calibData.getDefaultIntrinsics(dai.CameraBoardSocket.RGB))
17+
M_rgb, width, height = calibData.getDefaultIntrinsics(dai.CameraBoardSocket.RGB)
1818
print("RGB Camera Default intrinsics...")
1919
print(M_rgb)
2020
print(width)
2121
print(height)
2222

23-
M_rgb, width, height = np.array(calibData.getDefaultIntrinsics(dai.CameraBoardSocket.RGB))
23+
M_rgb, width, height = calibData.getDefaultIntrinsics(dai.CameraBoardSocket.RGB)
2424

2525
M_left = np.array(calibData.getCameraIntrinsics(dai.CameraBoardSocket.LEFT, 1280, 720))
2626
print("LEFT Camera resized intrinsics...")

examples/spatial_location_calculator.py

Lines changed: 0 additions & 132 deletions
This file was deleted.

0 commit comments

Comments
 (0)