Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Preprocessing for Training and Testing #3469

Closed
nseidl opened this issue Jun 21, 2019 · 4 comments
Closed

Image Preprocessing for Training and Testing #3469

nseidl opened this issue Jun 21, 2019 · 4 comments

Comments

@nseidl
Copy link

nseidl commented Jun 21, 2019

Where can I find in the source preprocessing for images in training?
Are images scaled to 416x416 maintaining aspect ratio then padded with gray 128 to make up missing space, in training?

What is the Python Pillow / opencv implementation of resize_image that is used in test_detector?

@nseidl nseidl changed the title Image Preprocessing for Training Image Preprocessing for Training and Testing Jun 21, 2019
@primepake
Copy link

you can see it in src/detector.c

@nseidl
Copy link
Author

nseidl commented Jun 22, 2019

First question:
I can see that when running detector test ..., images by default (without -letter_box) are preprocessed using the resize_image function.

if(letter_box) sized = letterbox_image(im, net.w, net.h);

image resize_image(image im, int w, int h)

What is a similar python (opencv or pillow) implementation of this resize_image methodology?

Second question:
During training, what preprocessing is applied? Is letterbox_image or resize_image used? Where in the source can I see how images are preprocessed during training? I've looked over train_detector several times but can't find where images are preprocessed during training.

@faybak
Copy link

faybak commented Jun 28, 2019

hello @nseidl did obtain an answer to your question please?

@nseidl
Copy link
Author

nseidl commented Jun 28, 2019

hello @nseidl did obtain an answer to your question please?

#3119 (comment)

By default in this repo, images are stretched in training and in inference.

Python (pillow) code:

from PIL import Image
image = Image.open(image_path)
image = image.resize((416, 416), Image.BICUBIC).convert('RGB)
return image

@nseidl nseidl closed this as completed Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants