2323import scipy .io as sio
2424
2525class Dataset (torch .utils .data .Dataset ):
26- def __init__ (self , transform , mode , annot_subset ):
26+ def __init__ (self , transform , mode ):
2727 self .mode = mode # train, test, val
28- self .annot_subset = annot_subset # all, human_annot, machine_annot
2928 self .img_path = '../data/InterHand2.6M/images'
3029 self .annot_path = '../data/InterHand2.6M/annotations'
31- if self .annot_subset == 'machine_annot' and self . mode == 'val' :
32- self .rootnet_output_path = '../data/InterHand2.6M/rootnet_output/rootnet_interhand2.6m_output_machine_annot_val .json'
30+ if self .mode == 'val' :
31+ self .rootnet_output_path = '../data/InterHand2.6M/rootnet_output/rootnet_interhand2.6m_output_val .json'
3332 else :
34- self .rootnet_output_path = '../data/InterHand2.6M/rootnet_output/rootnet_interhand2.6m_output_all_test .json'
33+ self .rootnet_output_path = '../data/InterHand2.6M/rootnet_output/rootnet_interhand2.6m_output_test .json'
3534 self .transform = transform
3635 self .joint_num = 21 # single hand
3736 self .root_joint_idx = {'right' : 20 , 'left' : 41 }
@@ -44,11 +43,11 @@ def __init__(self, transform, mode, annot_subset):
4443 self .sequence_names = []
4544
4645 # load annotation
47- print ("Load annotation from " + osp .join (self .annot_path , self .annot_subset ))
48- db = COCO (osp .join (self .annot_path , self .annot_subset , 'InterHand2.6M_' + self .mode + '_data.json' ))
49- with open (osp .join (self .annot_path , self .annot_subset , 'InterHand2.6M_' + self .mode + '_camera.json' )) as f :
46+ print ("Load annotation from " + osp .join (self .annot_path , self .mode ))
47+ db = COCO (osp .join (self .annot_path , self .mode , 'InterHand2.6M_' + self .mode + '_data.json' ))
48+ with open (osp .join (self .annot_path , self .mode , 'InterHand2.6M_' + self .mode + '_camera.json' )) as f :
5049 cameras = json .load (f )
51- with open (osp .join (self .annot_path , self .annot_subset , 'InterHand2.6M_' + self .mode + '_joint_3d.json' )) as f :
50+ with open (osp .join (self .annot_path , self .mode , 'InterHand2.6M_' + self .mode + '_joint_3d.json' )) as f :
5251 joints = json .load (f )
5352
5453 if (self .mode == 'val' or self .mode == 'test' ) and cfg .trans_test == 'rootnet' :
0 commit comments