File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
src/segmentation_skeleton_metrics Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -933,13 +933,20 @@ def avg_result(self, stats):
933933 Average value of metric computed across self.graphs".
934934
935935 """
936+ # Compute weights
936937 result = []
937938 wgts = []
938939 for key , wgt in self .wgts .items ():
939940 if self .omit_percent [key ] < 1 :
940941 result .append (stats [key ])
941942 wgts .append (wgt )
942- return np .average (result , weights = wgts )
943+
944+ # Average results
945+ try :
946+ return np .average (result , weights = wgts )
947+ except :
948+ print ("Error - Line 948 -" , wgts )
949+ return result
943950
944951 def compute_edge_accuracy (self ):
945952 """
@@ -984,11 +991,11 @@ def compute_erl(self):
984991 wgt = run_lengths / max (np .sum (run_lengths ), 1 )
985992
986993 self .erl [key ] = np .sum (wgt * run_lengths )
987- self .normalized_erl [key ] = self .erl [key ] / run_length
994+ self .normalized_erl [key ] = self .erl [key ] / max ( run_length , 1 )
988995 self .wgts [key ] = run_length
989996
990997 for key in self .graphs :
991- self .wgts [key ] = self .wgts [key ] / total_run_length
998+ self .wgts [key ] = self .wgts [key ] / max ( total_run_length , 1 )
992999
9931000 def count_total_splits (self ):
9941001 """
You can’t perform that action at this time.
0 commit comments