Spaces:
Configuration error
Configuration error
File size: 1,786 Bytes
3624d0b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | #pragma once
#include "tensorrt_runner.hpp"
#include <cstddef>
#include <string>
#include <unordered_map>
#include <vector>
namespace rclane {
struct LanePoint {
float x{};
float y{};
float score{};
};
struct Lane {
int width{};
int height{};
std::vector<LanePoint> points;
double score_sum{};
int lane_id{};
std::string role;
bool ego_boundary{};
int lateral_rank{};
double score() const;
};
struct DecoderConfig {
float step_length{10.0F};
float segmentation_threshold{0.5F};
float seed_threshold{0.5F};
int seed_min_distance{2};
float score_threshold{0.10F};
float iou_threshold{0.5F};
int max_seeds{1024};
int nms_max_lanes{128};
float nms_scale{0.25F};
int lane_width{15};
int max_output_lanes{4};
float ego_x{400.0F};
float ego_min_score_ratio{0.5F};
int threads{8};
};
struct DecodeStatistics {
std::size_t foreground_pixels{};
std::size_t seeds{};
std::size_t crawled_candidates{};
std::size_t nms_candidates{};
std::size_t nms_survivors{};
};
std::vector<float> softmax_foreground(const Tensor& segmentation_logits);
std::vector<Lane> decode(
const std::vector<float>& segmentation_probability,
const Tensor& up_arrow,
const Tensor& down_arrow,
const Tensor& up_bound,
const Tensor& down_bound,
const DecoderConfig& config = {},
DecodeStatistics* statistics = nullptr
);
std::vector<Lane> decode_outputs(
const std::unordered_map<std::string, Tensor>& outputs,
const DecoderConfig& config = {},
DecodeStatistics* statistics = nullptr
);
void write_lanes_json(
const std::string& path,
const std::vector<Lane>& lanes,
const DecodeStatistics* statistics = nullptr
);
} // namespace rclane
|