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)
| 403 | |
| 404 | class BodySplit(object): |
| 405 | def __init__(self,extra_info=None,bg_type=0,aug_type=-1,split_prob=0.5): |
| 406 | """ |
| 407 | aug: for half augmentation |
| 408 | -1: no aug |
| 409 | 0:only return aug img wo padding |
| 410 | 1:add padding |
| 411 | """ |
| 412 | self.extra_info=extra_info |
| 413 | self.bg_type=bg_type |
| 414 | self.mean=[104,116,124] |
| 415 | self.aug_type=aug_type |
| 416 | self.debug=1 |
| 417 | self.split_prob=split_prob |
| 418 | if extra_info is not None: |
| 419 | print('read extra_info') |
| 420 | if not os.path.exists(extra_info): |
| 421 | extra_info = extra_info.replace('/mnt/lustre/share', '/mnt/lustre/share_data') # sh1986 |
| 422 | f = open(extra_info, 'r') |
| 423 | self.info = dict() |
| 424 | for line in f.readlines(): |
| 425 | items = line.strip('\n').split(' ') |
| 426 | key = items[0]#.split('/')[-1] |
| 427 | #print(key) |
| 428 | #import pdb;pdb.set_trace() |
| 429 | self.info[key] = (float(items[-4]), float(items[-3]), float(items[-2]), float(items[-1])) |
| 430 | f.close() |
| 431 | print('Done') |
| 432 | |
| 433 | def blind_split(self, raw_img): |
| 434 | w, h = raw_img.size |