Skip to content

Commit

Permalink
fix(autoware_lidar_apollo_instance_segmentation): added existence pro…
Browse files Browse the repository at this point in the history
…bability (autowarefoundation#8862)

* added existence probability

Signed-off-by: Samrat Thapa <[email protected]>

* style(pre-commit): autofix

---------

Signed-off-by: Samrat Thapa <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
SamratThapa120 and pre-commit-ci[bot] authored Sep 18, 2024
1 parent edb4179 commit 3b147dd
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ geometry_msgs::msg::Quaternion getQuaternionFromRPY(const double r, const double
return tf2::toMsg(q);
}

double sigmoid(const double x)
{
return 1.0 / (1.0 + std::exp(-x));
}

Cluster2D::Cluster2D(const int rows, const int cols, const float range)
{
rows_ = rows;
Expand Down Expand Up @@ -220,7 +225,7 @@ void Cluster2D::filter(const float * inferred_data)
double vec_x = 0.0;
double vec_y = 0.0;
for (int grid : obs->grids) {
score += static_cast<double>(confidence_pt_data[grid]);
score += sigmoid(static_cast<double>(confidence_pt_data[grid]));
height += static_cast<double>(height_pt_data[grid]);
vec_x += heading_pt_x_data[grid];
vec_y += heading_pt_y_data[grid];
Expand Down Expand Up @@ -265,6 +270,8 @@ tier4_perception_msgs::msg::DetectedObjectWithFeature Cluster2D::obstacleToObjec
tier4_perception_msgs::msg::DetectedObjectWithFeature resulting_object;
// pcl::PointCloud<pcl::PointXYZI> in_cluster = *(in_obstacle.cloud_ptr);

resulting_object.object.existence_probability = in_obstacle.score;

resulting_object.object.classification.emplace_back(
autoware_perception_msgs::build<ObjectClassification>()
.label(ObjectClassification::UNKNOWN)
Expand Down

0 comments on commit 3b147dd

Please sign in to comment.