guigzzz / Keras-Yolo-v2

Keras re-implementation of Yolo v2 Object Detection
29 stars 8 forks source link

Train TinyYOLOv2 from scratch #3

Open jefersonf opened 5 years ago

jefersonf commented 5 years ago

Hi, I am trying to train the TinyYOLOv2 model with VOC07 dataset. I've defined the function to fetch bounding boxes and labels for all the training images. But after fitting the model the output returns empty arrays when I make tiny.m.forward(image)[0] for a test image.

The training set is (318, 416, 416, 3) and the y_true is (318, 13, 13, 5, 25).

Am I doing something wrong? During fitting the loss information per epoch was always NaN.

guigzzz commented 5 years ago

Hey!

I would recommend you first check your code to make sure the data you're feeding to the model/loss function is what you expect (I.e. make sure you don't have NaNs in your training data!).

It's also very possible there's a bug in the implementation of the loss, which could explain why you get NaNs for the loss.

Beyond this I can't really help... I'll have a quick look later if I have time. If you do discover a bug and fix it then feel free to submit a PR.

guigzzz commented 5 years ago

Also as a starting point I would recommend you try to train the model on a single datapoint to make sure you can overfit it. It you can't even do that then the loss is broken. If you can overfit then you have a problem in your code/data.

On a side note, I should really add unit tests for all the models and the loss...