src/tools/benchmark_tool/benchmark_tool/benchmark_task/euclidean_cluster_node_task.py
def init(self):
        """
        Initialize the task structure.

        Uses the Kitti object detection benchmark dataset.
        The task computes two metrics:
            - speed
            - detection precision (Kitti measure)

        @return: True on success, False on failure
        """
        dataset_path = getParameter(self.node, "dataset_path")
        input_topic = getParameter(self.node, "input_topic")
        output_topic = getParameter(self.node, "output_topic")
        benchmarked_in_topic = getParameter(self.node, "benchmarked_input_topic")
        benchmarked_out_topic = getParameter(self.node, "benchmarked_output_topic")
        result_path = getParameter(self.node, "result_path")
        end_frame = getParameter(self.node, "force_end_at_frame_n")

        if end_frame is not None and end_frame >= 0:
            self._limit_frame = end_frame
        else:
            error(self.node,
                  "A positive limit frame number must be provided")
            return False

        # Load the Kitti 3D object detection benchmark dataset
        self._dataset = Kitti3DBenchmarkDataset(self.node, dataset_path)
        if not self._dataset.init():
            error(self.node,
                  "There is a problem initializing the dataset")
            return False

        if (self._limit_frame >= 0):
            self._dataset.set_frame_limit(end_frame)

        # Load TimeEstimator to get the speed metric
        self._time_estimator = TimeEstimatorHeader(self.node)

        # Load the lidar_euclidean_cluster_detect output formatter to get the
        # output of the lidar node and translate it to the kitti format
        self._output_formatter = EuclideanClusterNodeOutputFormatter(
            self.node,
            (result_path + self.OBJDET_METRIC_RESULT_PATH),
            dataset_path +
            Kitti3DBenchmarkDataset.KITTI_3D_BENCH_FOLDER_STRUCTURE[
                Kitti3DBenchmarkDataset.KITTI_3D_CALIB_PATH_IDX]
        )

        # Load the speed output formatter to get the output of the TimeEstimator
        # and save it to a file
        self._speed_formatter = GenericStreamFormatter(
            self.node,
            result_path + self.SPEED_METRIC_RESULT_PATH,
            self.SPEED_MEASURE_FILE_NAME
        )

        # Prepare the 3d object detection metric object
        self._kitti_3d_metric = Kitti3dObjectDetectionMetric(
            self.node,
            (result_path + self.OBJDET_METRIC_RESULT_PATH),
            self._dataset.get_ground_truth_path(),
            (result_path + self.OBJDET_METRIC_OUTPUT_PATH)
        )

        # Prepare the speed metric object
        self._speed_metric = AverageMetric(
            self.node,
            (result_path + self.SPEED_METRIC_RESULT_PATH),
            (result_path + self.SPEED_METRIC_OUTPUT_PATH),
            self.SPEED_MEASURE_FILE_NAME,
            self.SPEED_METRIC_OUTPUT_FILENAME
        )

        # Create the Player to play the data to the lidar node
        self._data_player = SyncedPlayer(self.node, self._dataset)
        if not self._data_player.add_track(
                self.POINT_CLOUD_DATASET_TRACK,
                input_topic,
                PointCloud2,
                output_topic,
                self.POINT_CLOUD_TRACK_MIN_SUBS,
                self.POINT_CLOUD_TRACK_RATE_HZ,
                self.POINT_CLOUD_TRACK_TIMEOUT_MS
        ):
            error(self.node,
                  "There is a problem initializing the player")
            return False

        # Create the relay player listening to the ray ground classifier
        # output topic, it is the preprocessing stage of this benchmarked node
        self._relay_player = RelayPlayer(
            self.node,
            benchmarked_in_topic,
            "/relay" + benchmarked_in_topic
        )

        if not self._time_estimator.start_listener(benchmarked_out_topic,
                                                   self.SPEED_METRIC_TOPIC):
            error(self.node,
                  "There is a problem initializing the TimeEstimator")
            return False

        # Listen to the speed metric
        if not self._speed_formatter.start_output_listener(
                self.SPEED_METRIC_TOPIC,
                Int64
        ):
            error(self.node,
                  "Problem initializing the speed metric listener")
            return False

        # Listen the lidar node output
        if not self._output_formatter.start_output_listener(output_topic):
            error(self.node,
                  "Problem initializing the speed metric listener")
            return False

        # Everything is fine
        return True

        Initialize the task structure.

        Uses the Kitti object detection benchmark dataset.
        The task computes two metrics:
            - speed
            - detection precision (Kitti measure)

        @return: True on success, False on failure
        
Initialize the task structure.
Uses the Kitti object detection benchmark dataset.
The task computes two metrics:
speed
detection precision (Kitti measure)
Initialize the task structure . Uses the Kitti object detection benchmark dataset . The task computes two metrics : speed detection precision ( Kitti measure )
def init(self):
        dataset_path = getParameter(self.node, "dataset_path")
        input_topic = getParameter(self.node, "input_topic")
        output_topic = getParameter(self.node, "output_topic")
        benchmarked_in_topic = getParameter(self.node, "benchmarked_input_topic")
        benchmarked_out_topic = getParameter(self.node, "benchmarked_output_topic")
        result_path = getParameter(self.node, "result_path")
        end_frame = getParameter(self.node, "force_end_at_frame_n")
        if end_frame is not None and end_frame >= 0:
            self._limit_frame = end_frame
        else:
            error(self.node,
                  "A positive limit frame number must be provided")
            return False
        self._dataset = Kitti3DBenchmarkDataset(self.node, dataset_path)
        if not self._dataset.init():
            error(self.node,
                  "There is a problem initializing the dataset")
            return False
        if (self._limit_frame >= 0):
            self._dataset.set_frame_limit(end_frame)
        self._time_estimator = TimeEstimatorHeader(self.node)
        self._output_formatter = EuclideanClusterNodeOutputFormatter(
            self.node,
            (result_path + self.OBJDET_METRIC_RESULT_PATH),
            dataset_path +
            Kitti3DBenchmarkDataset.KITTI_3D_BENCH_FOLDER_STRUCTURE[
                Kitti3DBenchmarkDataset.KITTI_3D_CALIB_PATH_IDX]
        )
        self._speed_formatter = GenericStreamFormatter(
            self.node,
            result_path + self.SPEED_METRIC_RESULT_PATH,
            self.SPEED_MEASURE_FILE_NAME
        )
        self._kitti_3d_metric = Kitti3dObjectDetectionMetric(
            self.node,
            (result_path + self.OBJDET_METRIC_RESULT_PATH),
            self._dataset.get_ground_truth_path(),
            (result_path + self.OBJDET_METRIC_OUTPUT_PATH)
        )
        self._speed_metric = AverageMetric(
            self.node,
            (result_path + self.SPEED_METRIC_RESULT_PATH),
            (result_path + self.SPEED_METRIC_OUTPUT_PATH),
            self.SPEED_MEASURE_FILE_NAME,
            self.SPEED_METRIC_OUTPUT_FILENAME
        )
        self._data_player = SyncedPlayer(self.node, self._dataset)
        if not self._data_player.add_track(
                self.POINT_CLOUD_DATASET_TRACK,
                input_topic,
                PointCloud2,
                output_topic,
                self.POINT_CLOUD_TRACK_MIN_SUBS,
                self.POINT_CLOUD_TRACK_RATE_HZ,
                self.POINT_CLOUD_TRACK_TIMEOUT_MS
        ):
            error(self.node,
                  "There is a problem initializing the player")
            return False
        self._relay_player = RelayPlayer(
            self.node,
            benchmarked_in_topic,
            "/relay" + benchmarked_in_topic
        )
        if not self._time_estimator.start_listener(benchmarked_out_topic,
                                                   self.SPEED_METRIC_TOPIC):
            error(self.node,
                  "There is a problem initializing the TimeEstimator")
            return False
        if not self._speed_formatter.start_output_listener(
                self.SPEED_METRIC_TOPIC,
                Int64
        ):
            error(self.node,
                  "Problem initializing the speed metric listener")
            return False
        if not self._output_formatter.start_output_listener(output_topic):
            error(self.node,
                  "Problem initializing the speed metric listener")
            return False
        return True
def init ( self ) : dataset_path = getParameter ( self . node , "dataset_path" ) input_topic = getParameter ( self . node , "input_topic" ) output_topic = getParameter ( self . node , "output_topic" ) benchmarked_in_topic = getParameter ( self . node , "benchmarked_input_topic" ) benchmarked_out_topic = getParameter ( self . node , "benchmarked_output_topic" ) result_path = getParameter ( self . node , "result_path" ) end_frame = getParameter ( self . node , "force_end_at_frame_n" ) if end_frame is not None and end_frame >= 0 : self . _limit_frame = end_frame else : error ( self . node , "A positive limit frame number must be provided" ) return False self . _dataset = Kitti3DBenchmarkDataset ( self . node , dataset_path ) if not self . _dataset . init ( ) : error ( self . node , "There is a problem initializing the dataset" ) return False if ( self . _limit_frame >= 0 ) : self . _dataset . set_frame_limit ( end_frame ) self . _time_estimator = TimeEstimatorHeader ( self . node ) self . _output_formatter = EuclideanClusterNodeOutputFormatter ( self . node , ( result_path + self . OBJDET_METRIC_RESULT_PATH ) , dataset_path + Kitti3DBenchmarkDataset . KITTI_3D_BENCH_FOLDER_STRUCTURE [ Kitti3DBenchmarkDataset . KITTI_3D_CALIB_PATH_IDX ] ) self . _speed_formatter = GenericStreamFormatter ( self . node , result_path + self . SPEED_METRIC_RESULT_PATH , self . SPEED_MEASURE_FILE_NAME ) self . _kitti_3d_metric = Kitti3dObjectDetectionMetric ( self . node , ( result_path + self . OBJDET_METRIC_RESULT_PATH ) , self . _dataset . get_ground_truth_path ( ) , ( result_path + self . OBJDET_METRIC_OUTPUT_PATH ) ) self . _speed_metric = AverageMetric ( self . node , ( result_path + self . SPEED_METRIC_RESULT_PATH ) , ( result_path + self . SPEED_METRIC_OUTPUT_PATH ) , self . SPEED_MEASURE_FILE_NAME , self . SPEED_METRIC_OUTPUT_FILENAME ) self . _data_player = SyncedPlayer ( self . node , self . _dataset ) if not self . _data_player . add_track ( self . POINT_CLOUD_DATASET_TRACK , input_topic , PointCloud2 , output_topic , self . POINT_CLOUD_TRACK_MIN_SUBS , self . POINT_CLOUD_TRACK_RATE_HZ , self . POINT_CLOUD_TRACK_TIMEOUT_MS ) : error ( self . node , "There is a problem initializing the player" ) return False self . _relay_player = RelayPlayer ( self . node , benchmarked_in_topic , "/relay" + benchmarked_in_topic ) if not self . _time_estimator . start_listener ( benchmarked_out_topic , self . SPEED_METRIC_TOPIC ) : error ( self . node , "There is a problem initializing the TimeEstimator" ) return False if not self . _speed_formatter . start_output_listener ( self . SPEED_METRIC_TOPIC , Int64 ) : error ( self . node , "Problem initializing the speed metric listener" ) return False if not self . _output_formatter . start_output_listener ( output_topic ) : error ( self . node , "Problem initializing the speed metric listener" ) return False return True
Initialize the task structure.
Initialize the task structure .
"""
        Initialize the task structure.

        Uses the Kitti object detection benchmark dataset.
        The task computes two metrics:
            - speed
            - detection precision (Kitti measure)

        @return: True on success, False on failure
        """ # Load the Kitti 3D object detection benchmark dataset # Load TimeEstimator to get the speed metric # Load the lidar_euclidean_cluster_detect output formatter to get the # output of the lidar node and translate it to the kitti format # Load the speed output formatter to get the output of the TimeEstimator # and save it to a file # Prepare the 3d object detection metric object # Prepare the speed metric object # Create the Player to play the data to the lidar node # Create the relay player listening to the ray ground classifier # output topic, it is the preprocessing stage of this benchmarked node # Listen to the speed metric # Listen the lidar node output # Everything is fine
True on success, False on failure
True on success False on failure
self