Skip to content
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

Add option to pick spatial calculation algorithm : average,min,max of… #56

Merged
merged 1 commit into from
Sep 18, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,28 @@ struct SpatialLocationCalculatorConfigThresholds {
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialLocationCalculatorConfigThresholds, lowerThreshold, upperThreshold);

enum class SpatialLocationCalculatorAlgorithm : uint32_t { AVERAGE = 0, MIN, MAX };

/// SpatialLocation configuration data structure
struct SpatialLocationCalculatorConfigData {
/**
* Region of interest for spatial location calculation.
*/
Rect roi;
/**
* Upper and lower thresholds for depth values to take into consideration.
*/
SpatialLocationCalculatorConfigThresholds depthThresholds;
/**
* Calculation method used to obtain spatial locations.
* Average: the average of ROI is used for calculation.
* Min: the minimum value inside ROI is used for calculation.
* Max: the maximum value inside ROI is used for calculation.
* Default: average.
*/
SpatialLocationCalculatorAlgorithm calculationAlgorithm = SpatialLocationCalculatorAlgorithm::AVERAGE;
};
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialLocationCalculatorConfigData, roi, depthThresholds);
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialLocationCalculatorConfigData, roi, depthThresholds, calculationAlgorithm);

/// RawSpatialLocation configuration structure
struct RawSpatialLocationCalculatorConfig : public RawBuffer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace dai {
struct SpatialDetectionNetworkProperties : DetectionNetworkProperties {
float detectedBBScaleFactor = 1.0;
SpatialLocationCalculatorConfigThresholds depthThresholds;
SpatialLocationCalculatorAlgorithm calculationAlgorithm = SpatialLocationCalculatorAlgorithm::AVERAGE;
};

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialDetectionNetworkProperties,
Expand All @@ -36,6 +37,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(SpatialDetectionNetworkProperties,
anchorMasks,
iouThreshold,
detectedBBScaleFactor,
depthThresholds)
depthThresholds,
calculationAlgorithm)

} // namespace dai