MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / _parse_split_info

Method _parse_split_info

PATH/core/augmentation.py:891–915  ·  view source on GitHub ↗
(self, correction=False)

Source from the content-addressed store, hash-verified

889 return head, neck, waist, foot
890
891 def _parse_split_info(self, correction=False):
892 print('parsing split_list_file:{}'.format(self.split_list_file))
893 if not os.path.exists(self.split_list_file):
894 self.split_list_file = self.split_list_file.replace('/mnt/lustre/share', '/mnt/lustre/share_data') # sh1986
895 assert os.path.exists(self.split_list_file), 'file not exist!! [{}]'.format(self.split_list_file)
896 f = open(self.split_list_file, 'r')
897 self.info = dict()
898 correc_cnt = 0
899 for line in f.readlines():
900 items = line.strip('\n').split(' ')
901 path = items[0]
902 key = os.path.join(self.prefix, path)
903 # head, neck, waist, foot
904 head, neck, waist, foot = float(items[-4]), float(items[-3]), float(items[-2]), float(items[-1])
905 if correction:
906 if not self._is_split_info_valid(head, neck, waist, foot):
907 correc_cnt += 1
908 ori_head, ori_neck, ori_waist, ori_foot = head, neck, waist, foot
909 head, neck, waist, foot = self._correct_split_info(ori_head, ori_neck, ori_waist, ori_foot)
910 # print('{}: need correction for split_info\n[{}, {}, {}, {}] => [{}, {}, {}, {}]'
911 # .format(path, ori_head, ori_neck, ori_waist, ori_foot, head, neck, waist, foot))
912 self.info[key] = (head, neck, waist, foot)
913 if correc_cnt > 0:
914 print("{} split_info items were made correction".format(correc_cnt))
915 f.close()
916
917 @staticmethod
918 def affine_image(img, src_points, dst_points, shape,

Callers 1

__init__Method · 0.95

Calls 3

_is_split_info_validMethod · 0.95
_correct_split_infoMethod · 0.95
closeMethod · 0.80

Tested by

no test coverage detected