-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'v3_develop' into feature/get_env_refactor
- Loading branch information
Showing
21 changed files
with
389 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
examples/cpp/DetectionNetwork/detection_network_replay.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <csignal> | ||
#include <depthai/depthai.hpp> | ||
#include <depthai/remote_connection/RemoteConnection.hpp> | ||
#include <iostream> | ||
|
||
#include "depthai/modelzoo/NNModelDescription.hpp" | ||
|
||
// Signal handling for clean shutdown | ||
static bool isRunning = true; | ||
void signalHandler(int signum) { | ||
isRunning = false; | ||
} | ||
|
||
int main(int argc, char** argv) { | ||
// Default port values | ||
int webSocketPort = 8765; | ||
int httpPort = 8080; | ||
|
||
// Register signal handler | ||
std::signal(SIGINT, signalHandler); | ||
|
||
// Create RemoteConnection | ||
dai::RemoteConnection remoteConnector(dai::RemoteConnection::DEFAULT_ADDRESS, webSocketPort, true, httpPort); | ||
|
||
// Create Pipeline | ||
dai::Pipeline pipeline; | ||
auto replay = pipeline.create<dai::node::ReplayVideo>(); | ||
replay->setReplayVideoFile(VIDEO_PATH); | ||
|
||
// Create and configure Detection Network | ||
auto detectionNetwork = pipeline.create<dai::node::DetectionNetwork>()->build(replay, dai::NNModelDescription{"yolov6-nano"}); | ||
|
||
// Set up topics for remote connection | ||
remoteConnector.addTopic("detections", detectionNetwork->out); | ||
remoteConnector.addTopic("images", replay->out); | ||
pipeline.start(); | ||
|
||
remoteConnector.registerPipeline(pipeline); | ||
// Main loop | ||
while(isRunning && pipeline.isRunning()) { | ||
int key = remoteConnector.waitKey(1); | ||
if(key == 'q') { | ||
std::cout << "Got 'q' key from the remote connection!" << std::endl; | ||
break; | ||
} | ||
} | ||
|
||
std::cout << "Pipeline stopped." << std::endl; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
examples/python/DetectionNetwork/detection_network_replay.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
#!/usr/bin/env python3 | ||
import depthai as dai | ||
from pathlib import Path | ||
from argparse import ArgumentParser | ||
|
||
scriptDir = Path(__file__).resolve().parent | ||
examplesRoot = (scriptDir / Path('../')).resolve() # This resolves the parent directory correctly | ||
models = examplesRoot / 'models' | ||
videoPath = models / 'construction_vest.mp4' | ||
|
||
parser = ArgumentParser() | ||
parser.add_argument("--webSocketPort", type=int, default=8765) | ||
parser.add_argument("--httpPort", type=int, default=8080) | ||
parser.add_argument("-i", "--inputVideo", default=videoPath, help="Input video name") | ||
args = parser.parse_args() | ||
|
||
remoteConnector = dai.RemoteConnection(webSocketPort=args.webSocketPort, httpPort=args.httpPort) | ||
# Create pipeline | ||
with dai.Pipeline() as pipeline: | ||
replay = pipeline.create(dai.node.ReplayVideo) | ||
replay.setReplayVideoFile(Path(args.inputVideo)) | ||
detectionNetwork = pipeline.create(dai.node.DetectionNetwork).build( | ||
replay, dai.NNModelDescription("yolov6-nano") | ||
) | ||
|
||
remoteConnector.addTopic("detections", detectionNetwork.out, "img") | ||
remoteConnector.addTopic("images", replay.out, "img") | ||
|
||
pipeline.start() | ||
remoteConnector.registerPipeline(pipeline) | ||
|
||
while pipeline.isRunning(): | ||
key = remoteConnector.waitKey(1) | ||
if key == ord("q"): | ||
print("Got q key from the remote connection!") | ||
break |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.