Skip to content

Commit

Permalink
Unified name of orig as ori (#7456)
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaAndroid authored Mar 19, 2022
1 parent e1bab6c commit d62e454
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions mmdet/datasets/pipelines/instaboost.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _parse_anns(self, results, anns, img):

def __call__(self, results):
img = results['img']
orig_type = img.dtype
ori_type = img.dtype
anns = self._load_anns(results)
if np.random.choice([0, 1], p=[1 - self.aug_ratio, self.aug_ratio]):
try:
Expand All @@ -109,7 +109,7 @@ def __call__(self, results):
anns, img = instaboost.get_new_data(
anns, img.astype(np.uint8), self.cfg, background=None)

results = self._parse_anns(results, anns, img.astype(orig_type))
results = self._parse_anns(results, anns, img.astype(ori_type))
return results

def __repr__(self):
Expand Down
6 changes: 3 additions & 3 deletions mmdet/datasets/pipelines/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,9 +520,9 @@ def __call__(self, results):
random_shift_y = random.randint(-self.max_shift_px,
self.max_shift_px)
new_x = max(0, random_shift_x)
orig_x = max(0, -random_shift_x)
ori_x = max(0, -random_shift_x)
new_y = max(0, random_shift_y)
orig_y = max(0, -random_shift_y)
ori_y = max(0, -random_shift_y)

# TODO: support mask and semantic segmentation maps.
for key in results.get('bbox_fields', []):
Expand Down Expand Up @@ -558,7 +558,7 @@ def __call__(self, results):
new_h = img_h - np.abs(random_shift_y)
new_w = img_w - np.abs(random_shift_x)
new_img[new_y:new_y + new_h, new_x:new_x + new_w] \
= img[orig_y:orig_y + new_h, orig_x:orig_x + new_w]
= img[ori_y:ori_y + new_h, ori_x:ori_x + new_w]
results[key] = new_img

return results
Expand Down
6 changes: 3 additions & 3 deletions tools/analysis_tools/get_flops.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def main():
h, w = args.shape
else:
raise ValueError('invalid input shape')
orig_shape = (3, h, w)
ori_shape = (3, h, w)
divisor = args.size_divisor
if divisor > 0:
h = int(np.ceil(h / divisor)) * divisor
Expand Down Expand Up @@ -83,9 +83,9 @@ def main():
split_line = '=' * 30

if divisor > 0 and \
input_shape != orig_shape:
input_shape != ori_shape:
print(f'{split_line}\nUse size divisor set input shape '
f'from {orig_shape} to {input_shape}\n')
f'from {ori_shape} to {input_shape}\n')
print(f'{split_line}\nInput shape: {input_shape}\n'
f'Flops: {flops}\nParams: {params}\n{split_line}')
print('!!!Please be cautious if you use the results in papers. '
Expand Down

0 comments on commit d62e454

Please sign in to comment.