Commit daf3840a authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

FIX: astype on scalar value not allowed

parent 92b37087
No related merge requests found
Showing with 2 additions and 2 deletions
+2 -2
......@@ -377,14 +377,14 @@ class OBIABase:
self.populate_map(tn,obj_id,classes,output_file,compress)
def true_pred_bypixel(self, labels, predicted_classes, class_field='class'):
pred_c = np.zeros(np.max(self.ref_db['orig_label']).astype(int)+1)
pred_c = np.zeros(int(np.max(self.ref_db['orig_label']))+1)
pred_c[labels] = predicted_classes
support = []
for tn, t in self.tiled_objects(on_ref=True):
support.append(t[np.isin(t, labels)])
support = np.concatenate(support)
pred = pred_c[support]
true_c = np.zeros(np.max(self.ref_db['orig_label']).astype(int)+1)
true_c = np.zeros(int(np.max(self.ref_db['orig_label']))+1)
# ATTENTION: works if "labels" is sorted (as provided by get_reference_...)
true_c[labels] = self.ref_db.loc[self.ref_db['orig_label'].isin(labels),class_field].to_numpy(dtype=int)
true = true_c[support]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment