未验证 提交 e8dc77a5 编写于 作者: B Bubbliiiing 提交者: GitHub

Update utils.py

上级 7aa5c88c
...@@ -98,7 +98,7 @@ def merge_bboxes(bboxes, cutx, cuty): ...@@ -98,7 +98,7 @@ def merge_bboxes(bboxes, cutx, cuty):
merge_bbox.append(tmp_box) merge_bbox.append(tmp_box)
return merge_bbox return merge_bbox
def get_random_data_with_Mosaic(annotation_line, input_shape, max_boxes=50, hue=.1, sat=1.5, val=1.5): def get_random_data_with_Mosaic(annotation_line, input_shape, max_boxes=100, hue=.1, sat=1.5, val=1.5):
'''random preprocessing for real-time data augmentation''' '''random preprocessing for real-time data augmentation'''
h, w = input_shape h, w = input_shape
min_offset_x = 0.4 min_offset_x = 0.4
...@@ -206,7 +206,7 @@ def get_random_data_with_Mosaic(annotation_line, input_shape, max_boxes=50, hue= ...@@ -206,7 +206,7 @@ def get_random_data_with_Mosaic(annotation_line, input_shape, max_boxes=50, hue=
return new_image, box_data return new_image, box_data
def get_random_data(annotation_line, input_shape, max_boxes=50, jitter=.3, hue=.1, sat=1.5, val=1.5): def get_random_data(annotation_line, input_shape, max_boxes=100, jitter=.3, hue=.1, sat=1.5, val=1.5):
'''random preprocessing for real-time data augmentation''' '''random preprocessing for real-time data augmentation'''
line = annotation_line.split() line = annotation_line.split()
image = Image.open(line[0]) image = Image.open(line[0])
...@@ -216,7 +216,7 @@ def get_random_data(annotation_line, input_shape, max_boxes=50, jitter=.3, hue=. ...@@ -216,7 +216,7 @@ def get_random_data(annotation_line, input_shape, max_boxes=50, jitter=.3, hue=.
# 对图像进行缩放并且进行长和宽的扭曲 # 对图像进行缩放并且进行长和宽的扭曲
new_ar = w/h * rand(1-jitter,1+jitter)/rand(1-jitter,1+jitter) new_ar = w/h * rand(1-jitter,1+jitter)/rand(1-jitter,1+jitter)
scale = rand(.5, 1.5) scale = rand(.25, 2)
if new_ar < 1: if new_ar < 1:
nh = int(scale*h) nh = int(scale*h)
nw = int(nh*new_ar) nw = int(nh*new_ar)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册