fix letterbox_image in yolo example (#2911)

This commit is contained in:
Adrià Arrufat 2024-02-05 22:07:16 +09:00 committed by GitHub
parent 85aa29a4e8
commit 631c47c7fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -395,7 +395,6 @@ try
dlib::rand rnd(time(nullptr) + seed); dlib::rand rnd(time(nullptr) + seed);
matrix<rgb_pixel> image, rotated; matrix<rgb_pixel> image, rotated;
std::pair<matrix<rgb_pixel>, std::vector<yolo_rect>> temp; std::pair<matrix<rgb_pixel>, std::vector<yolo_rect>> temp;
temp.first.set_size(image_size, image_size);
random_cropper cropper; random_cropper cropper;
cropper.set_seed(time(nullptr) + seed); cropper.set_seed(time(nullptr) + seed);
cropper.set_chip_dims(image_size, image_size); cropper.set_chip_dims(image_size, image_size);
@ -424,6 +423,7 @@ try
for (auto& box : temp.second) for (auto& box : temp.second)
box.rect = tform(box.rect); box.rect = tform(box.rect);
temp.first.set_size(image_size, image_size);
tform = letterbox_image(rotated, temp.first); tform = letterbox_image(rotated, temp.first);
for (auto& box : temp.second) for (auto& box : temp.second)
box.rect = tform(box.rect); box.rect = tform(box.rect);