Skip to content

Commit 1ef2796

Browse files
benizBycob
authored andcommitted
fix: cutout and crops in data augmentation of torch models
1 parent c03aa9d commit 1ef2796

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/backends/torch/torchdataaug.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,11 @@ namespace dd
275275
_uniform_real_1(0.0, 1.0), _bernouilli(0.5),
276276
_uniform_int_rotate(0, 3)
277277
{
278+
if (_crop_params._crop_size > 0)
279+
{
280+
_cutout_params._img_width = _crop_params._crop_size;
281+
_cutout_params._img_height = _crop_params._crop_size;
282+
}
278283
}
279284

280285
~TorchImgRandAugCV()

tests/ut-torchapi.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ TEST(torchapi, service_train_object_detection_fasterrcnn)
17131713
"type\":\"ADAM\",\"test_interval\":200},\"net\":{\"batch_size\":2,"
17141714
"\"test_batch_size\":2},\"resume\":false,\"mirror\":true,\"rotate\":"
17151715
"true,\"crop_size\":224,"
1716-
"\"cutout\":0.1,\"geometry\":{\"prob\":0.1,\"persp_horizontal\":"
1716+
"\"cutout\":0.5,\"geometry\":{\"prob\":0.1,\"persp_horizontal\":"
17171717
"true,\"persp_vertical\":true,\"zoom_in\":true,\"zoom_out\":true,"
17181718
"\"pad_mode\":\"constant\"},\"noise\":{\"prob\":0.01},\"distort\":{"
17191719
"\"prob\":0."

0 commit comments

Comments
 (0)