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
2 changes: 1 addition & 1 deletion bindings/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ add_library(pyds SHARED src/pyds.cpp src/utils.cpp src/bindanalyticsmeta.cpp
src/bindnvdsmeta.cpp src/bindnvosd.cpp src/bindopticalflow.cpp
src/bindschema.cpp src/bindtrackermeta.cpp src/custom_binding/bindcustom.cpp
src/bind_reidembed_metadata.cpp src/bind_embed_metadata.cpp
src/bind_label.cpp src/bind_tracker_status_metadata.cpp)
src/bind_label.cpp src/bind_tracker_status_metadata.cpp src/bind_instance_segmentation.cpp)

set_target_properties(pyds PROPERTIES PREFIX "")
set_target_properties(pyds PROPERTIES OUTPUT_NAME "pyds")
Expand Down
5 changes: 5 additions & 0 deletions bindings/docstrings/functionsdoc.h
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,11 @@ constexpr const char *alloc_label_struct = R"pyds(

:returns: Allocated :class:`LabelsMetadata`)pyds";

constexpr const char *alloc_instance_segmentation_struct = R"pyds(
Allocate an :class:`InstanceSegmentationMetadata`.

:returns: Allocated :class:`InstanceSegmentationMetadata`)pyds";

constexpr const char *alloc_reidembedding_struct = R"pyds(
Allocate an :class:`ReIDEmbeddingMetadata`.

Expand Down
37 changes: 37 additions & 0 deletions bindings/docstrings/instance_segmentation_doc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION &
* AFFILIATES. All rights reserved. SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

namespace pydsdoc
{
namespace instancesegmentation
{
namespace InstanceSegmentationMetadata
{
constexpr const char *descr = R"pyds(
Holds polygon and area information of the instance segmentation.
Polygon is normalized values to the entier image.

:ivar polygon: *vector<int>*, normalized polygon values)pyds)
:ivar area: *vector<int>*, area values)pyds";

constexpr const char *cast
= R"pyds(cast given object/data to :class:`InstanceSegmentationMetadata`, call pyds.InstanceSegmentationMetadata.cast(data))pyds";
}
}
}
17 changes: 9 additions & 8 deletions bindings/docstrings/label_doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ namespace label
{
namespace LabelsMetadata
{
constexpr const char* descr = R"pyds(
Holds full label information for a specific category
constexpr const char *descr = R"pyds(
Holds full label information for a specific category

:ivar embedding: *vector<int>*, embeddings)pyds";

:ivar embedding: *vector<int>*, embeddings)pyds";

constexpr const char* cast=R"pyds(cast given object/data to :class:`EmbeddingMetadata`, call pyds.EmbeddingMetadata.cast(data))pyds";
}
}
}
constexpr const char *cast
= R"pyds(cast given object/data to :class:`EmbeddingMetadata`, call pyds.EmbeddingMetadata.cast(data))pyds";
}
}
}
12 changes: 12 additions & 0 deletions bindings/include/bind/bind_instance_segmentation.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "../../docstrings/functionsdoc.h"
#include "../../docstrings/instance_segmentation_doc.h"
#include "instance_segmentation.h" // Include the actual C++ header file for EmbeddingMetadata
#include "pyds.hpp"

namespace py = pybind11;

namespace pydeepstream
{
void bindinstancesegmentation (
py::module &m); // Declare the bindings function for this submodule
}
30 changes: 30 additions & 0 deletions bindings/src/bind_instance_segmentation.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include "bind_instance_segmentation.hpp"

namespace py = pybind11;

namespace pydeepstream
{

void
bindinstancesegmentation (py::module &m)
{
/* EmbeddingMetadata bindings to be used with NvDsUserMeta */
py::class_<InstanceSegmentationMetadata> (
m, "InstanceSegmentationMetadata",
pydsdoc::instancesegmentation::InstanceSegmentationMetadata::descr)
.def (py::init<> ())
// binding embedding int with InstanceSegmentationMetadata vector
.def_readwrite ("polygon", &InstanceSegmentationMetadata::polygon)
.def_readwrite ("area", &InstanceSegmentationMetadata::area)
// binding function to cast user_meta_data to
// InstanceSegmentationMetadata
.def (
"cast",
[] (void *data) { return (InstanceSegmentationMetadata *)data; },
py::return_value_policy::reference,
pydsdoc::instancesegmentation::InstanceSegmentationMetadata::cast);

m.attr ("NVDS_USER_META_INSTANCE_SEGMENTATION")
= py::cast (NVDS_USER_META_INSTANCE_SEGMENTATION);
}
}
2 changes: 2 additions & 0 deletions bindings/src/pyds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ AFFILIATES. All rights reserved.

#include "pyds.hpp"
#include "bind_embed_metadata.hpp"
#include "bind_instance_segmentation.hpp"
#include "bind_label.hpp"
#include "bind_reidembed_metadata.hpp"
#include "bind_tracker_status_metadata.hpp"
Expand Down Expand Up @@ -75,6 +76,7 @@ PYBIND11_MODULE (pyds, m)
bindembedding (m);
bindlabel (m);
bindtrackerstatus (m);
bindinstancesegmentation (m);

} // end PYBIND11_MODULE(pyds, m)
}