File tree Expand file tree Collapse file tree 7 files changed +30
-0
lines changed
src/otx/algorithms/classification/adapters/mmcls
datumaro_h-label_class_decremental/annotations
datumaro_h-label/annotations Expand file tree Collapse file tree 7 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ All notable changes to this project will be documented in this file.
1717- Fix h-label loss normalization issue w/ exclusive label group of singe label (< https://github.com/openvinotoolkit/training_extensions/pull/2604 > )
1818- Fix division by zero in class incremental learning for classification (< https://github.com/openvinotoolkit/training_extensions/pull/2606 > )
1919- Fix saliency maps calculation issue for detection models (< https://github.com/openvinotoolkit/training_extensions/pull/2609 > )
20+ - Fix h-label bug of missing parent labels in output (< https://github.com/openvinotoolkit/training_extensions/pull/2626 > )
2021
2122## \[ v1.4.3\]
2223
Original file line number Diff line number Diff line change @@ -300,6 +300,7 @@ class OTXHierarchicalClsDataset(OTXMultilabelClsDataset):
300300
301301 def __init__ (self , ** kwargs ):
302302 self .hierarchical_info = kwargs .pop ("hierarchical_info" , None )
303+ self .label_schema = kwargs .pop ("label_schema" , None )
303304 super ().__init__ (** kwargs )
304305
305306 def load_annotations (self ):
@@ -308,6 +309,13 @@ def load_annotations(self):
308309 for i , _ in enumerate (self .otx_dataset ):
309310 class_indices = []
310311 item_labels = self .otx_dataset [i ].get_roi_labels (self .labels , include_empty = include_empty )
312+ if self .label_schema :
313+ # NOTE: Parent labels might be missing in annotations.
314+ # This code fills the gap just in case.
315+ full_item_labels = set ()
316+ for label in item_labels :
317+ full_item_labels .update (self .label_schema .get_ancestors (label ))
318+ item_labels = full_item_labels
311319 ignored_labels = self .otx_dataset [i ].ignored_labels
312320 if item_labels :
313321 num_cls_heads = self .hierarchical_info ["num_multiclass_heads" ]
Original file line number Diff line number Diff line change @@ -190,6 +190,7 @@ def configure(
190190 elif self ._hierarchical :
191191 options_for_patch_datasets ["type" ] = "OTXHierarchicalClsDataset"
192192 options_for_patch_datasets ["hierarchical_info" ] = self ._hierarchical_info
193+ options_for_patch_datasets ["label_schema" ] = self ._task_environment .label_schema
193194 options_for_patch_evaluation ["task" ] = "hierarchical"
194195 elif self ._selfsl :
195196 options_for_patch_datasets ["type" ] = "SelfSLDataset"
Original file line number Diff line number Diff line change 33 "categories" : {
44 "label" : {
55 "label_groups" : [
6+ {
7+ "name" : " shape" ,
8+ "group_type" : " exclusive" ,
9+ "labels" : [" blue" , " green" ]
10+ },
611 {
712 "name" : " blue" ,
813 "group_type" : " exclusive" ,
Original file line number Diff line number Diff line change 33 "categories" : {
44 "label" : {
55 "label_groups" : [
6+ {
7+ "name" : " shape" ,
8+ "group_type" : " exclusive" ,
9+ "labels" : [" blue" , " green" ]
10+ },
611 {
712 "name" : " blue" ,
813 "group_type" : " exclusive" ,
Original file line number Diff line number Diff line change 33 "categories" : {
44 "label" : {
55 "label_groups" : [
6+ {
7+ "name" : " shape" ,
8+ "group_type" : " exclusive" ,
9+ "labels" : [" blue" , " green" ]
10+ },
611 {
712 "name" : " blue" ,
813 "group_type" : " exclusive" ,
Original file line number Diff line number Diff line change 33 "categories" : {
44 "label" : {
55 "label_groups" : [
6+ {
7+ "name" : " shape" ,
8+ "group_type" : " exclusive" ,
9+ "labels" : [" blue" , " green" ]
10+ },
611 {
712 "name" : " blue" ,
813 "group_type" : " exclusive" ,
You can’t perform that action at this time.
0 commit comments