-
Notifications
You must be signed in to change notification settings - Fork 135
ImageManipV2 optimization and refactor #1290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
asahtik
wants to merge
52
commits into
v3_develop
Choose a base branch
from
imagemanipv2_optimization
base: v3_develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
77a52da
Refactor imagemanipv2 transform, optimize crop
asahtik bf8d61b
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik fed4930
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 7a2863c
WIP: ImageManipV2 opt
asahtik 54088d5
Refactor ImageManipV2Impl + use shared data instead of span
asahtik ce48d48
Refactor ImageManipV2 again
asahtik dc6c491
Fix output size calculation for NV12
asahtik a9b57c3
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 966e74d
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik e373818
RVC4 FW: optimize common use cases in ImageManipV2 (crop, scale), fix…
asahtik 9c9ffc2
Bugfixes, add test, WIP: test fails becouse of DsImgDispatcher issues
asahtik ec8a5b5
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik cd7031c
Fixed test to check Eva downscaler
asahtik 2f06077
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 562d7e2
Add backend property to imagemanip [no ci]
asahtik 6eb0d07
RVC4 FW: Fix ImageManipV2 optimization, add backend property, TODO: b…
asahtik 6c8f3c7
Split test to RVC4 only part
asahtik cd6e306
Fix RVC2 ImageManipV2 rebuilding
asahtik ad2a88e
RVC2 FW: Fix ImageManipV2 rebuilding
asahtik a3e21af
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 34cc54f
Merge branch 'imagemanipv2_optimization' of github.com:luxonis/deptha…
asahtik 4c2a506
Fix image manip v2 rebuild test
asahtik b39d960
Fix failing tests
asahtik 125458d
RVC4 FW: Fix failing tests
asahtik d61851c
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 4cbb90b
Bump rvc4 fw
asahtik 0607a20
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 04566d9
RVC4 FW: Fix black frame when downscaling 8K frames
asahtik 4fe8900
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 810d4df
Fix test
asahtik 771ae62
Merge branch 'imagemanipv2_optimization' of github.com:luxonis/deptha…
asahtik bce823a
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 5e78ef4
Make test more reliable [no ci]
asahtik 13fbd2e
Bump rvc4 fw
asahtik 63dd08b
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 957b62c
RVC4 FW: Fix edge case manipv2 bug
asahtik 8a93c75
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 8ddca89
Fix april tags example [no ci]
asahtik 7423ef9
RVC4 FW: Fix ImageManipV2 crash
asahtik e310d6a
Add performance mode configuration option [no ci]
asahtik 86e3978
Bump rvc4 fw [no ci]
asahtik 60a4ef6
Bump rvc2 fw
asahtik 2c615c6
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik 55cace5
Add balanced option to manipv2 perf mode
asahtik 55d3c02
Bump rvc4 fw
asahtik 365ab0b
RVC4 FW: Added scale fallbacks
asahtik 2fdcfcb
Merge branch 'v3_develop' of github.com:luxonis/depthai-core into ima…
asahtik c9fff3d
Use performance mode manip by default [no ci]
asahtik afb9b20
Bump rvc4 fw [no ci]
asahtik f2dc49c
Bump rvc2 fw
asahtik ad6bc8a
Fix build [no ci]
asahtik 8bfe5f1
RVC4 FW: Fix build
asahtik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -25,6 +25,9 @@ class ImageManipV2 : public DeviceNodeCRTP<DeviceNode, ImageManipV2, ImageManipP | |
public: | ||
constexpr static const char* NAME = "ImageManipV2"; | ||
using DeviceNodeCRTP::DeviceNodeCRTP; | ||
using Backend = ImageManipPropertiesV2::Backend; | ||
using PerformanceMode = ImageManipPropertiesV2::PerformanceMode; | ||
|
||
ImageManipV2() = default; | ||
ImageManipV2(std::unique_ptr<Properties> props); | ||
|
||
|
@@ -70,6 +73,22 @@ class ImageManipV2 : public DeviceNodeCRTP<DeviceNode, ImageManipV2, ImageManipP | |
*/ | ||
ImageManipV2& setRunOnHost(bool runOnHost = true); | ||
|
||
/** | ||
* Set CPU as backend preference | ||
*/ | ||
ImageManipV2& setBackendCPU(); | ||
|
||
/** | ||
* Set HW as backend preference | ||
*/ | ||
ImageManipV2& setBackendHW(); | ||
|
||
Comment on lines
+76
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. setBackend(...) for consistency |
||
/** | ||
* Set performance mode | ||
* @param performanceMode Performance mode | ||
*/ | ||
ImageManipV2& setPerformanceMode(PerformanceMode performanceMode); | ||
|
||
/** | ||
* Check if the node is set to run on host | ||
*/ | ||
|
@@ -82,8 +101,8 @@ class ImageManipV2 : public DeviceNodeCRTP<DeviceNode, ImageManipV2, ImageManipP | |
const ImageManipConfigV2& initialConfig, | ||
std::shared_ptr<spdlog::async_logger> logger, | ||
std::function<size_t(const ImageManipConfigV2&, const ImgFrame&)> build, | ||
std::function<bool(std::shared_ptr<Memory>&, span<uint8_t>)> apply, | ||
std::function<void(const ImageManipConfigV2&, const ImgFrame&, ImgFrame&)> getFrame); | ||
std::function<bool(std::shared_ptr<Memory>&, std::shared_ptr<ImageManipData>)> apply, | ||
std::function<void(const ImgFrame&, ImgFrame&)> getFrame); | ||
}; | ||
|
||
} // namespace node | ||
|
@@ -97,8 +116,8 @@ void ImageManipV2::loop(N& node, | |
const ImageManipConfigV2& initialConfig, | ||
std::shared_ptr<spdlog::async_logger> logger, | ||
std::function<size_t(const ImageManipConfigV2&, const ImgFrame&)> build, | ||
std::function<bool(std::shared_ptr<Memory>&, span<uint8_t>)> apply, | ||
std::function<void(const ImageManipConfigV2&, const ImgFrame&, ImgFrame&)> getFrame) { | ||
std::function<bool(std::shared_ptr<Memory>&, std::shared_ptr<ImageManipData>)> apply, | ||
std::function<void(const ImgFrame&, ImgFrame&)> getFrame) { | ||
using namespace std::chrono; | ||
auto config = initialConfig; | ||
|
||
|
@@ -166,10 +185,10 @@ void ImageManipV2::loop(N& node, | |
bool success = true; | ||
{ | ||
auto t3 = steady_clock::now(); | ||
success = apply(inImage->data, outImageData->getData()); | ||
success = apply(inImage->data, outImageData); | ||
auto t4 = steady_clock::now(); | ||
|
||
getFrame(config, *inImage, *outImage); | ||
getFrame(*inImage, *outImage); | ||
|
||
logger->trace("Build time: {}us, Process time: {}us, Total time: {}us, image manip id: {}", | ||
duration_cast<microseconds>(t2 - t1).count(), | ||
|
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd go with just "setBackend()" and have an enum here.