-
카테고리
-
세부 분야
컴퓨터 비전
-
해결 여부
미해결
yolo augmentation 관련
21.02.18 12:58 작성 조회수 241
0
안녕하세요 선생님, yolo를 학습할 때, augmentation이 적용되는 건가요?
제가 train.py부분 yolo.py부분 등 찾아봐도 augmentation이 적용된 곳을 못찾았습니다.
혹시 augmentation하는 부분이 있다면 위치좀 알려주시면 감사하겠습니다!
답변을 작성해보세요.
0
권 철민
지식공유자2021.02.18
안녕하십니까,
keras yolo3 는 augmentation을 학습 시 적용하지 않았습니다. 아마도 공간 기반 augmentation을 하게되면 bbox 좌표값이 달라질 수 있기 때문인것으로 생각됩니다.
keras yolo3는 augmentation을 하지 않기 때문에 keras의 ImageDataGenerator 객체를 사용하지 않고 직접 Generator 함수를 생성해서 만듭니다.
https://github.com/qqwweee/keras-yolo3/blob/master/train.py의
165 line쯤에 해당 data generator가 있습니다.
'''data generator for fit_generator''' |
n = len(annotation_lines) |
i = 0 |
while True: |
image_data = [] |
box_data = [] |
for b in range(batch_size): |
if i==0: |
np.random.shuffle(annotation_lines) |
image, box = get_random_data(annotation_lines[i], input_shape, random=True) |
image_data.append(image) |
box_data.append(box) |
i = (i+1) % n |
image_data = np.array(image_data) |
box_data = np.array(box_data) |
y_true = preprocess_true_boxes(box_data, input_shape, anchors, num_classes) |
yield [image_data, *y_true], np.zeros(batch_size) |
def data_generator_wrapper(annotation_lines, batch_size, input_shape, anchors, num_classes): |
n = len(annotation_lines) |
if n==0 or batch_size<=0: return None |
return data_generator(annotation_lines, batch_size, input_shape, anchors, num_classes)
def data_generator(annotation_lines, batch_size, input_shape, anchors, num_classes): |
답변 1