aug: for half augmentation -1: no aug 0:only return aug img wo padding 1:add padding
(self,extra_info=None,bg_type=0,aug_type=-1,split_prob=0.5)
| 707 | |
| 708 | class BodySplit(object): |
| 709 | def __init__(self,extra_info=None,bg_type=0,aug_type=-1,split_prob=0.5): |
| 710 | """ |
| 711 | aug: for half augmentation |
| 712 | -1: no aug |
| 713 | 0:only return aug img wo padding |
| 714 | 1:add padding |
| 715 | """ |
| 716 | self.extra_info=extra_info |
| 717 | self.bg_type=bg_type |
| 718 | self.mean=[104,116,124] |
| 719 | self.aug_type=aug_type |
| 720 | self.debug=1 |
| 721 | self.split_prob=split_prob |
| 722 | if extra_info is not None: |
| 723 | print('read extra_info') |
| 724 | if not os.path.exists(extra_info): |
| 725 | extra_info = extra_info.replace('/mnt/lustre/share', '/mnt/lustre/share_data') # sh1986 |
| 726 | f = open(extra_info, 'r') |
| 727 | self.info = dict() |
| 728 | for line in f.readlines(): |
| 729 | items = line.strip('\n').split(' ') |
| 730 | key = items[0]#.split('/')[-1] |
| 731 | #print(key) |
| 732 | #import pdb;pdb.set_trace() |
| 733 | self.info[key] = (float(items[-4]), float(items[-3]), float(items[-2]), float(items[-1])) |
| 734 | f.close() |
| 735 | print('Done') |
| 736 | |
| 737 | def blind_split(self, raw_img): |
| 738 | w, h = raw_img.size |