Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/test.workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,12 @@ jobs:
CONTAINER_REGISTRY: ${{ secrets.CONTAINER_REGISTRY }}
HIL_PAT_TOKEN: ${{ secrets.HIL_PAT_TOKEN }}

run_vanilla_mac_tests:
needs: [precheck]
if: needs.precheck.outputs.should_run == 'true'
uses: ./.github/workflows/test_child_mac.yml
with:
flavor: "asan-ubsan"
luxonis_os_versions_to_test: "['1.23.1']"
secrets:
HIL_PAT_TOKEN: ${{ secrets.HIL_PAT_TOKEN }}
52 changes: 52 additions & 0 deletions .github/workflows/test_child_mac.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Run hil tests for mac os
on:
workflow_call:
inputs:
flavor:
required: true
type: string
default: "vanilla"
luxonis_os_versions_to_test:
required: true
type: string
secrets:
HIL_PAT_TOKEN:
required: true

jobs:
# mac_rvc2_test:
# needs: [build_docker_container]
# runs-on: ['self-hosted', 'testbed-runner']
# steps:
# - uses: actions/checkout@v3

# - name: Run RVC2 tests
# run: |
# source scripts/hil/prepare_hil_framework.sh ${{ secrets.HIL_PAT_TOKEN }}
# export RESERVATION_NAME="https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID#rvc2-${{ inputs.flavor }}"
# exec hil_runner --capabilities depthai-core-hil --platforms 'rvc2 and rvc2' --reservation-name $RESERVATION_NAME --wait --docker-image ${{ secrets.CONTAINER_REGISTRY }}/depthai-core-hil:${{ needs.build_docker_container.outputs.tag }} --commands "./tests/run_tests_entrypoint.sh rvc2"

# Testing
mac_rvc4_test:
strategy:
matrix:
rvc4os: ${{ fromJson(inputs.luxonis_os_versions_to_test) }}
fail-fast: false
runs-on: ['self-hosted', 'testbed-runner']
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0

- name: Run RVC4 tests
run: |
BRANCH_NAME="${{ github.ref_name }}"
PULL_REQUEST="false"
if [[ -n "${{ github.head_ref }}" ]]; then
BRANCH_NAME="${{ github.ref }}"
PULL_REQUEST="true"
fi
source scripts/hil/prepare_hil_framework.sh ${{ secrets.HIL_PAT_TOKEN }}
export RESERVATION_NAME="https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID#rvc4-mac-${{ matrix.rvc4os }}-${{ inputs.flavor }}"
exec hil_runner --models "oak4_pro or oak4_d" -os mac --sync-workspace --rsync-args="--exclude=venv" --reservation-name $RESERVATION_NAME --wait --rvc4-os-version ${{ matrix.rvc4os }} --commands "cd /tmp/depthai-core && ./scripts/hil/run_hil_tests_mac.sh $PULL_REQUEST ${{ inputs.flavor }} --rvc4"
2 changes: 1 addition & 1 deletion .github/workflows/test_child_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:
pip install --upgrade pip
pip install numpy pytest pytest-html
$buildDir = 'C:/depthai-core/build'
$overlay = 'C:/depthai-core/cmake/triplets/release' # make it absolute
$overlay = 'C:/depthai-core/cmake/triplets/release'
$isPR = "${{ github.head_ref }}" -ne ""
$extraFlags = ""

Expand Down
8 changes: 2 additions & 6 deletions examples/cpp/HostNodes/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class HostDisplay : public dai::node::CustomNode<HostDisplay> {
public:
HostDisplay() {
sendProcessingToPipeline(false);
sendProcessingToPipeline(true);
}

std::shared_ptr<dai::Buffer> processGroup(std::shared_ptr<dai::MessageGroup> message) override {
Expand Down Expand Up @@ -45,11 +45,7 @@ int main() {
output->link(display->inputs["frame"]);

// Start pipeline
pipeline.start();
std::cout << "Display window opened. Press 'q' to quit." << std::endl;

// Wait for pipeline to finish
pipeline.wait();
pipeline.run();

return 0;
}
4 changes: 2 additions & 2 deletions examples/cpp/HostNodes/host_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class Display : public dai::NodeCRTP<dai::node::HostNode, Display> {

std::shared_ptr<Display> build(Output& out) {
out.link(input);
sendProcessingToPipeline(true);
return std::static_pointer_cast<Display>(this->shared_from_this());
}
std::shared_ptr<dai::Buffer> processGroup(std::shared_ptr<dai::MessageGroup> in) override {
Expand Down Expand Up @@ -68,7 +69,6 @@ int main() {
pipeline.create<StreamMerger>()->build(*camRgb->requestOutput(std::make_pair(640, 480)), *camMono->requestOutput(std::make_pair(640, 480)));
auto display = pipeline.create<Display>()->build(streamMerger->out);

pipeline.start();
pipeline.wait();
pipeline.run();
return 0;
}
4 changes: 2 additions & 2 deletions examples/cpp/HostNodes/host_pipeline_synced_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ int main() {
auto camMono = pipeline.create<dai::node::Camera>()->build(dai::CameraBoardSocket::CAM_B);

auto syncedDisplay = pipeline.create<SyncedDisplay>();
syncedDisplay->sendProcessingToPipeline(true);
camRgb->requestOutput(std::make_pair(640, 480))->link(syncedDisplay->inputRgb);
camMono->requestOutput(std::make_pair(640, 480))->link(syncedDisplay->inputMono);

pipeline.start();
pipeline.wait();
pipeline.run();
return 0;
}
14 changes: 10 additions & 4 deletions examples/cpp/HostNodes/image_manip_host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ int main(int argc, char** argv) {
dai::Pipeline pipeline(false);

auto replay = pipeline.create<dai::node::ReplayVideo>();
auto display = pipeline.create<dai::node::Display>();
auto manip = pipeline.create<dai::node::ImageManip>();
manip->setRunOnHost();
// After doing the rest of the operations, resize the frame to 1270x710 and keep the aspect ratio by cropping from the center
Expand All @@ -36,9 +35,16 @@ int main(int argc, char** argv) {
replay->setSize(1280, 720);

replay->out.link(manip->inputImage);
manip->out.link(display->input);
auto outputQueue = manip->out.createOutputQueue();

pipeline.start();

pipeline.wait();
pipeline.start();
while(pipeline.isRunning()) {
auto imgFrame = outputQueue->get<dai::ImgFrame>();
cv::imshow("Manipulated Frame", imgFrame->getCvFrame());
int key = cv::waitKey(1);
if(key == 'q') {
break;
}
}
}
15 changes: 10 additions & 5 deletions examples/cpp/ImageManip/image_manip_multi_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ int main(int argc, char** argv) {
dai::Pipeline pipeline(device);

auto camRgb = pipeline.create<dai::node::Camera>()->build(dai::CameraBoardSocket::CAM_A);
auto display = pipeline.create<dai::node::Display>();
auto manip = pipeline.create<dai::node::ImageManip>();

manip->setMaxOutputFrameSize(4000000);
Expand All @@ -27,8 +26,14 @@ int main(int argc, char** argv) {

auto* rgbOut = camRgb->requestOutput({1920, 1080});
rgbOut->link(manip->inputImage);
manip->out.link(display->input);

auto outputQueue = manip->out.createOutputQueue();
pipeline.start();
pipeline.wait();
}
while(pipeline.isRunning()) {
auto imgFrame = outputQueue->get<dai::ImgFrame>();
cv::imshow("Manipulated Frame", imgFrame->getCvFrame());
int key = cv::waitKey(1);
if(key == 'q') {
break;
}
}
}
17 changes: 10 additions & 7 deletions examples/cpp/ImageManip/image_manip_resize.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#include <iostream>

#include "depthai/common/CameraBoardSocket.hpp"
#include "depthai/depthai.hpp"
#include "depthai/pipeline/datatype/ImgFrame.hpp"
#include "depthai/pipeline/node/Camera.hpp"
#include "depthai/pipeline/node/ImageManip.hpp"
#include "depthai/pipeline/node/host/Display.hpp"

int main(int argc, char** argv) {
std::shared_ptr<dai::Device> device = nullptr;
Expand All @@ -17,7 +13,6 @@ int main(int argc, char** argv) {
dai::Pipeline pipeline(device);

auto camRgb = pipeline.create<dai::node::Camera>()->build(dai::CameraBoardSocket::CAM_A);
auto display = pipeline.create<dai::node::Display>();
auto manip = pipeline.create<dai::node::ImageManip>();

// Resize to 400x400 and avoid stretching by cropping from the center
Expand All @@ -26,7 +21,15 @@ int main(int argc, char** argv) {
manip->initialConfig->setFrameType(dai::ImgFrame::Type::RGB888i);

camRgb->requestOutput((std::make_pair(1920, 1080)))->link(manip->inputImage);
manip->out.link(display->input);
auto outputQueue = manip->out.createOutputQueue();

pipeline.run();
pipeline.start();
while(pipeline.isRunning()) {
auto imgFrame = outputQueue->get<dai::ImgFrame>();
cv::imshow("Resized Frame", imgFrame->getCvFrame());
int key = cv::waitKey(1);
if(key == 'q') {
break;
}
}
}
4 changes: 2 additions & 2 deletions examples/cpp/SpatialDetectionNetwork/spatial_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class SpatialVisualizer : public dai::NodeCRTP<dai::node::HostNode, SpatialVisua
depth.link(depthInput);
detections.link(detectionsInput);
rgb.link(rgbInput);
sendProcessingToPipeline(true);
return std::static_pointer_cast<SpatialVisualizer>(this->shared_from_this());
}

Expand Down Expand Up @@ -229,8 +230,7 @@ int main(int argc, char** argv) {
std::cout << "Pipeline starting with depth source: " << depthSourceArg << '\n';

// Start pipeline
pipeline.start();
pipeline.wait();
pipeline.run();

} catch(const std::exception& e) {
std::cerr << "Error: " << e.what() << '\n';
Expand Down
5 changes: 4 additions & 1 deletion examples/python/install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ def hasWhitespace(string):
if args.install_rerun:
DEPENDENCIES.append('rerun-sdk')
if args.install_open3d_cpu:
DEPENDENCIES.append('open3d-cpu')
if platform.system() == "Darwin":
DEPENDENCIES.append("open3d")
else:
DEPENDENCIES.append("open3d-cpu")
# Constants
ARTIFACTORY_URL = 'https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local'

Expand Down
43 changes: 0 additions & 43 deletions scripts/hil/run_hil_tests.sh

This file was deleted.

61 changes: 61 additions & 0 deletions scripts/hil/run_hil_tests_mac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

# Check if the argument is provided
if [ $# -lt 1 ]; then
echo "Usage: $0 <pull_request> <test_type> [--rvc2 | --rvc4]"
echo " pull_request Specify are we doing short tests (pull request) or long tests (dispatch/merge)"
echo " test_type Specify test flavor: vanilla, asan-ubsan, or tsan."
echo " --rvc2 Optional: Run tests with RVC2 configuration."
echo " --rvc4 Optional: Run tests with RVC4 configuration."
exit 1
fi
# Get the test type from the argument
PULL_REQUEST=$1
TEST_FLAVOR=$2
TEST_ARGS=$3

# Set up a Python virtual environment
rm -rf venv
python3.12 -m venv venv
source venv/bin/activate
export LC_ALL=en_US.UTF-8
locale

if [ "$TEST_FLAVOR" == "vanilla" ]; then
echo $CMAKE_TOOLCHAIN_PATH
else
export CMAKE_TOOLCHAIN_PATH=$PWD/cmake/toolchain/${TEST_FLAVOR}.cmake
fi

pip install numpy pytest pytest-html > /dev/null 2>&1
export VCPKG_BINARY_SOURCES="files,/tmp/vcpkg_binaries,readwrite"
rm -rf build
CMAKE_ARGS=(
-S . -B build
-D CMAKE_BUILD_TYPE=Release
-D DEPTHAI_VCPKG_INTERNAL_ONLY=OFF
-D VCPKG_OVERLAY_TRIPLETS="$PWD/cmake/triplets/release"
-D DEPTHAI_BUILD_TESTS=ON
-D CMAKE_SHARED_LINKER_FLAGS="-Wl,-w"
)

if [ "$PULL_REQUEST" = "false" ]; then
CMAKE_ARGS+=(
-D DEPTHAI_BUILD_EXAMPLES=ON
-D DEPTHAI_TEST_EXAMPLES=ON
-D DEPTHAI_BUILD_PYTHON=ON
-D DEPTHAI_PYTHON_TEST_EXAMPLES=ON
-D DEPTHAI_PYTHON_ENABLE_EXAMPLES=ON
)
fi

echo "Running:"
printf 'cmake'; printf ' %q' "${CMAKE_ARGS[@]}"; echo

cmake "${CMAKE_ARGS[@]}"

cmake --build build --parallel 3 --config Release \
|| { echo "Build failed"; exit 3; }

cd tests
python3 run_tests.py $TEST_ARGS
6 changes: 6 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@
"host": true
}
],
"overrides": [
{
"name": "vcpkg-tool-meson",
"version": "1.9.0"
}
],
"features": {
"opencv-support": {
"description": "Enable OpenCV support",
Expand Down
Loading