src/tools/benchmark_tool/benchmark_tool/metric/kitti_3d_object_detection_metric.py
def _parse_result_file(self, result_class):
        """
        Parse the kitti sdk result file.

        Extract the 41 precision/recall scores and compute the final metric.

        @param result_class: The type of the object: car, pedestrian, cyclist
        @type  result_class: str
        @return: True on success, False on failure
        """
        filename = self._output_folder + "/" + \
            self.OUTPUT_FILES_KITTIOBJEVAL[result_class]

        if os.path.isfile(filename):
            # Compute metric precision for class EASY, MODERATE, HARD
            try:
                file = open(filename, "r")
                file_lines = file.readlines()
            except Exception as e:
                error(self.node, "%s" % str(e))
                return False
            finally:
                file.close()

            if len(file_lines) < 3:
                error(self.node,
                      "Malformed result file: %s." % filename)
                return False
            # Compute precision from result file
            precision = {}
            precision["EASY"] = self._compute_precision(file_lines[0])
            precision["MODERATE"] = self._compute_precision(file_lines[1])
            precision["HARD"] = self._compute_precision(file_lines[2])

            if (precision["EASY"] == -1) or (precision["MODERATE"] == -1) \
                    or (precision["HARD"] == -1):
                error(self.node,
                      "Malformed lines file: %s.", filename)
                return False

            # Print precision to the node output
            info(self.node, "Kitti 3D object evaluation for label: %s\n"
                 "Easy: %.2f \nModerate: %.2f \nHard: %.2f" %
                 (result_class,
                  round(precision["EASY"], 2),
                  round(precision["MODERATE"], 2),
                  round(precision["HARD"], 2))
                 )

            try:
                file = open(filename, "w")
                file.write(str(round(precision["EASY"], 2)) + "\n")
                file.write(str(round(precision["MODERATE"], 2)) + "\n")
                file.write(str(round(precision["HARD"], 2)) + "\n")
            except Exception as e:
                error(self.node, "%s" % str(e))
                return False
            finally:
                file.close()

        return True

        Parse the kitti sdk result file.

        Extract the 41 precision/recall scores and compute the final metric.

        @param result_class: The type of the object: car, pedestrian, cyclist
        @type  result_class: str
        @return: True on success, False on failure
        
Parse the kitti sdk result file.
Extract the 41 precision/recall scores and compute the final metric.
Parse the kitti sdk result file . Extract the 41 precision / recall scores and compute the final metric .
def _parse_result_file(self, result_class):
        filename = self._output_folder + "/" + \
            self.OUTPUT_FILES_KITTIOBJEVAL[result_class]
        if os.path.isfile(filename):
            try:
                file = open(filename, "r")
                file_lines = file.readlines()
            except Exception as e:
                error(self.node, "%s" % str(e))
                return False
            finally:
                file.close()
            if len(file_lines) < 3:
                error(self.node,
                      "Malformed result file: %s." % filename)
                return False
            precision = {}
            precision["EASY"] = self._compute_precision(file_lines[0])
            precision["MODERATE"] = self._compute_precision(file_lines[1])
            precision["HARD"] = self._compute_precision(file_lines[2])
            if (precision["EASY"] == -1) or (precision["MODERATE"] == -1) \
                    or (precision["HARD"] == -1):
                error(self.node,
                      "Malformed lines file: %s.", filename)
                return False
            info(self.node, "Kitti 3D object evaluation for label: %s\n"
                 "Easy: %.2f \nModerate: %.2f \nHard: %.2f" %
                 (result_class,
                  round(precision["EASY"], 2),
                  round(precision["MODERATE"], 2),
                  round(precision["HARD"], 2))
                 )
            try:
                file = open(filename, "w")
                file.write(str(round(precision["EASY"], 2)) + "\n")
                file.write(str(round(precision["MODERATE"], 2)) + "\n")
                file.write(str(round(precision["HARD"], 2)) + "\n")
            except Exception as e:
                error(self.node, "%s" % str(e))
                return False
            finally:
                file.close()
        return True
def _parse_result_file ( self , result_class ) : filename = self . _output_folder + "/" + self . OUTPUT_FILES_KITTIOBJEVAL [ result_class ] if os . path . isfile ( filename ) : try : file = open ( filename , "r" ) file_lines = file . readlines ( ) except Exception as e : error ( self . node , "%s" % str ( e ) ) return False finally : file . close ( ) if len ( file_lines ) < 3 : error ( self . node , "Malformed result file: %s." % filename ) return False precision = { } precision [ "EASY" ] = self . _compute_precision ( file_lines [ 0 ] ) precision [ "MODERATE" ] = self . _compute_precision ( file_lines [ 1 ] ) precision [ "HARD" ] = self . _compute_precision ( file_lines [ 2 ] ) if ( precision [ "EASY" ] == - 1 ) or ( precision [ "MODERATE" ] == - 1 ) or ( precision [ "HARD" ] == - 1 ) : error ( self . node , "Malformed lines file: %s." , filename ) return False info ( self . node , "Kitti 3D object evaluation for label: %s\n" "Easy: %.2f \nModerate: %.2f \nHard: %.2f" % ( result_class , round ( precision [ "EASY" ] , 2 ) , round ( precision [ "MODERATE" ] , 2 ) , round ( precision [ "HARD" ] , 2 ) ) ) try : file = open ( filename , "w" ) file . write ( str ( round ( precision [ "EASY" ] , 2 ) ) + "\n" ) file . write ( str ( round ( precision [ "MODERATE" ] , 2 ) ) + "\n" ) file . write ( str ( round ( precision [ "HARD" ] , 2 ) ) + "\n" ) except Exception as e : error ( self . node , "%s" % str ( e ) ) return False finally : file . close ( ) return True
Parse the kitti sdk result file.
Parse the kitti sdk result file .
"""
        Parse the kitti sdk result file.

        Extract the 41 precision/recall scores and compute the final metric.

        @param result_class: The type of the object: car, pedestrian, cyclist
        @type  result_class: str
        @return: True on success, False on failure
        """ # Compute metric precision for class EASY, MODERATE, HARD # Compute precision from result file # Print precision to the node output
True on success, False on failure
True on success False on failure
self
result_class
The type of the object: car, pedestrian, cyclist
The type of the object : car pedestrian cyclist